-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfunctions.php
More file actions
335 lines (311 loc) · 6.54 KB
/
Copy pathfunctions.php
File metadata and controls
335 lines (311 loc) · 6.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
<?php
/**
* All the general functions of the website resides here.
* php version 8.1
*
* @category Functions
*
* @package Functions
*
* @author Waqas Ahmad <waqaskanju@gmail.com>
*
* @license http://www.abc.com MIT
*
* @link Adfas
**/
/**
* This function change -1 to absent.
*
* @param Integer $marks date of birth
*
* @return Marks of A for absent.
*/
function Show_absent($marks)
{
if ($marks == -1) {
$marks ="A";
}
return $marks;
}
/**
* This function change absent to zero for total marks calculation.
*
* @param Integer $marks_value date of birth
*
* @return Makrs of A for absent.
*/
function Change_Absent_tozero($marks_value)
{
if ($marks_value == -1) {
$marks_value=0;
}
return $marks_value;
}
/**
* This function change subject name to column name where
* marks of the subject will be added.
*
* @param string $subject Msg to be saved
*
* @return Void save message.
*/
function Change_Subject_To_Marks_col($subject)
{
switch ($subject) {
case "English":
return "English_Marks";
break;
case "Urdu":
return "Urdu_Marks";
break;
case "Maths":
return "Maths_Marks";
break;
case "Hpe":
return "Hpe_Marks";
break;
case "Nazira":
return "Nazira_Marks";
break;
case "General Science":
return "Science_Marks";
break;
case "Arabic":
return "Arabic_Marks";
break;
case "Islamyat":
return "Islamyat_Marks";
break;
case "History And Geography":
return "History_Marks";
break;
case "History":
return "History_Marks";
break;
case "Computer Science":
return "Computer_Marks";
break;
case "Mutalia Quran":
return "Mutalia_Marks";
break;
case "Drawing":
return "Drawing_Marks";
break;
case "Social Study":
return "Social_Marks";
break;
case "Pak Study":
return "Social_Marks";
break;
case "Pashto":
return "Pashto_Marks";
break;
case "Biology":
return "Biology_Marks";
break;
case "Chemistry":
return "Chemistry_Marks";
break;
case "Physics":
return "Physics_Marks";
break;
case "Civics":
return "Civics_Marks";
break;
case "Economics":
return "Economics_Marks";
break;
case "Islamic Study":
return "Islamic_Study_Marks";
break;
case "Islamic Education":
return "Islamic_Education_Marks";
break;
case "Statistics":
return "Statistics_Marks";
break;
case "Geography":
return "Geography_Marks";
break;
default:
echo "Unknown Subject";
}
}
/**
* Project Folder Name
*
* @return Void show project folder used in print.
*/
function Project_Folder_name()
{
// return folder of the project.
$path=getcwd();
//echo $main_dir=dirname($path, 1);
$chunks = explode('\\', $path);
$chunks_length=count($chunks);
return $my_directory=$chunks[$chunks_length-1];
}
/**
* Project Folder Name
*
* @param integer $status Name of class
*
* @return Void show project folder used in print.
*/
function Change_Status_To_word($status)
{
if ($status==0) {
return "Stuck off";
} else if ($status==1) {
return "Active";
} else if ($status==2) {
return "Graduate";
} else if ($status==3) {
return "SLC";
} else {
return "Something wrong";
}
}
/**
* Project Folder Name
*
* @param integer $status Name of class
*
* @return Void show project folder used in print.
*/
function Change_Student_Status_To_number($status)
{
if ($status=="Active") {
return 1;
} else if ($status=="Struck Off") {
return 0;
} else if ($status=="Graduate") {
return 2;
} else if ($status=="SLC") {
return 3;
} else {
// return 4 means so thing is wrong.
return 4;
}
}
/**
* Project Folder Name
*
* @param time $sec Time in Second
* @param string $url Url of the page
*
* @return Void show project folder used in print.
*/
function redirection($sec,$url)
{
header("refresh:$sec; url=$url");
}
/**
* Project Folder Name
*
* @param string $url Url of the page
*
* @return Void show project folder used in print.
*/
function Change_location($url)
{
header("Location: $url");
}
/**
* Show Alert Message
*
* @param string $message Time in Second
* @param string $alert_type Url of the page
*
* @return Void show project folder used in print.
*/
function Show_alert($message,$alert_type)
{
echo "<div class='alert alert-$alert_type alert-dismissible fade show'
role='alert'>
<strong> $message </strong>
<button type='button' class='btn-close' data-bs-dismiss='alert'
aria-label='Close'></button>
</div>";
}
/**
* Check Module Permission
*
* @param string $module_name Name of module
*
* @return css_class show project folder used in print.
*/
function Check_Module_permission($module_name)
{
if ($module_name!=1) {
return "d-none";
} else {
return "d-block";
}
}
/**
* Get Value of Permission
*
* @param Integer $value Value of premission either 0 or 1.
*
* @return $selected_class For example 6th 7th etc
*/
function Get_Permission_value($value)
{
$student_value=0;
if (isset($_POST[$value])) {
$student_value=$_POST[$value];
}
return $student_value;
}
/**
* Change date to Pakistani format
*
* @param String $date Date value.
*
* @return pakistani date format
*/
function Change_Date_To_Pak_format($date)
{
$date_from_string=strtotime($date);
$pkr_date = date('d-m-Y', $date_from_string);
return $pkr_date;
}
/**
* Change rank number to english position
* with 1 it will add 1st, 2 to 2nd
* 3 to 3rd and 4 to 4th and so on
*
* @param integer $rank as value.
*
* @return postion date format
*/
function Change_rank_to_position($rank)
{
if($rank==1){
return "1st";
}
else if($rank==2){
return "2nd";
}
else if($rank==3)
return "3rd";
else
return $rank."th";
}
/**
* Return admission no based on class
*
* @param integer $rank as value.
*
* @return postion date format
*/
function show_admission_no($numberic_class_name,$middle_admission_no,$high_admission_no)
{
if($numberic_class_name<=8){
return $middle_admission_no;
} else {
return $high_admission_no;
}
}
?>