1+ <?php
2+
3+ /*
4+ * This file is part of Schoost.
5+ *
6+ * (c) SmartClass, LLC
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+ namespace Schoost ;
13+
14+ class Admissions {
15+
16+ private $ admissions = array ();
17+ private $ interviews = array ();
18+ private $ admissionId = 0 ;
19+ private $ interviewtId = 0 ;
20+ private $ nofInterviews = 0 ;
21+ private $ settings = array ();
22+
23+ function __construct ()
24+ {
25+ global $ dbi , $ ySubeKodu ;
26+
27+ //set nof intervies
28+ $ dbi ->where ("subeKodu " , $ ySubeKodu );
29+ $ this ->nofInterviews = $ dbi ->getValue (_ADMISSION_INTERVIEWS_ , "count(id) " );
30+
31+ //set admission interview settings
32+ $ dbi ->where ("subeKodu " , $ ySubeKodu );
33+ $ this ->settings = $ dbi ->getOne (_ADMISSION_INTERVIEW_FORM_SETTINGS_ );
34+ }
35+
36+ /* function */
37+ function setAdmissionId ($ Id )
38+ {
39+ $ this ->admissionId = $ Id ;
40+ }
41+
42+ /* function */
43+ function setInterviewId ($ Id )
44+ {
45+ $ this ->interviewId = $ Id ;
46+ }
47+
48+ /* function */
49+ function getNofInterviews ()
50+ {
51+ return $ this ->nofInterviews ;
52+ }
53+
54+ /* function */
55+ function getSettings ()
56+ {
57+ return $ this ->settings ;
58+ }
59+
60+ /* function */
61+ function getInterviews ()
62+ {
63+ global $ dbi , $ ySubeKodu , $ aid , $ currentlang ;
64+
65+ //get interviews
66+ $ dbi ->where ("subeKodu " , $ ySubeKodu );
67+ $ dbi ->orderBy ("frmKayitTarihi " , "DESC " );
68+ $ rows = $ dbi ->get (_ADMISSION_INTERVIEWS_ );
69+
70+ if (!empty ($ rows ))
71+ {
72+ //handle admissions
73+ foreach ($ rows as $ k => $ v ) {
74+
75+ //order number
76+ $ rows [$ k ]["n " ] = $ k + 1 ;
77+
78+ //date
79+ $ rows [$ k ]["frmKayitTarihiFormatted " ] = FormatDateNumeric2Local ($ v ["frmKayitTarihi " ], 1 );
80+
81+ //source
82+ $ rows [$ k ]["frmKaynakFormatted " ] = $ v ["frmKaynak " ] == "tablet " ? _TABLET_FORM : YoneticiAdi ($ v ["frmKaynak " ]);
83+
84+ //get students for the interview
85+ $ dbi ->where ("interviewID " , $ v ['id ' ]);
86+ $ students = $ dbi ->get (_ADMISSION_INTERVIEWS_STUDENTS_ );
87+
88+ foreach ($ students as $ s => $ student )
89+ {
90+ if (!empty ($ student ["ogrSinifGrubu " ]))
91+ {
92+ $ dbi ->where ("subeKodu " , $ ySubeKodu );
93+ $ dbi ->where ("kursID " , $ student ["ogrSinifGrubu " ]);
94+ $ courseTitle = $ dbi ->getValue (_OGRENCI_UCRETLERI_ , "kursAdi " );
95+
96+ //set student course title
97+ $ students [$ s ]["courseTitle " ] = $ courseTitle ;
98+ $ students [$ s ]["courseCount " ] = "1 " ;
99+ }
100+ else
101+ {
102+ $ students [$ s ]["courseTitle " ] = _NOT_SELECTED ;
103+ $ students [$ s ]["courseCount " ] = "0 " ;
104+ }
105+
106+ //get last note for the student related to the interview
107+ $ dbi ->join (_ADMISSION_INTERVIEW_NEGATIVE_REASONS_ . " r " , "r.Id = n.negativeReasonId " , "LEFT " );
108+ $ dbi ->where ("n.interviewID " , $ v ['id ' ]);
109+ $ dbi ->where ("n.studentId " , $ student ["id " ]);
110+ $ dbi ->where ("n.subeKodu " , $ ySubeKodu );
111+ $ dbi ->where ("n.status " , NULL , "IS NOT " );
112+ $ dbi ->orderBy ("n.id " , "DESC " );
113+ $ noteDetails = $ dbi ->getOne (_ADMISSION_INTERVIEWS_NOTES_ . " n " , "n.status, n.recallDate, r.neden " );
114+
115+ //recall date
116+ $ students [$ s ]["recallDate " ] = ($ noteDetails ["status " ] == "_PREADD_RECALL " && $ noteDetails ["recallDate " ] != "0000-00-00 " ) ? FormatDateNumeric2Local ($ noteDetails ["recallDate " ]) : "- " ;
117+
118+ //recognition work
119+ $ students [$ s ]["recognitionWork " ] = ($ noteDetails ["status " ] == "_RECOGNITION_WORK " && $ noteDetails ["recallDate " ] != "0000-00-00 " ) ? FormatDateNumeric2Local ($ noteDetails ["recallDate " ]) : "- " ;
120+
121+ //get reason title
122+ $ students [$ s ]["negativeTooltipText " ] = $ noteDetails ["neden " ];
123+
124+ //status formatted
125+ if ($ noteDetails ["status " ] == "_PREADD_POSITIVE " ) $ students [$ s ]["statusFormatted " ] = "<button class='btn btn-success' style='width:75px; margin-bottom:5px'><i class='fa fa-thumbs-up'></i> " ._PREADD_POSITIVE ."</button> " ;
126+ else if ($ noteDetails ["status " ] == "_PREADD_NEGATIVE " ) $ students [$ s ]["statusFormatted " ] = "<button class='btn btn-danger' style='width:75px; margin-bottom:5px' data-toggle='tooltip' data-placement='right' title=' " .$ negativeTooltipText ."'><i class='fa fa-thumbs-down'></i> " ._PREADD_NEGATIVE ."</button> " ;
127+ else if ($ noteDetails ["status " ] == "_PREADD_RECALL " ) $ students [$ s ]["statusFormatted " ] = "<button class='btn btn-warning' style='margin-bottom:5px'><i class='fa fa-phone'></i> " ._PREADD_RECALL ." [ " .$ recallDate ."]</button> " ;
128+ else if ($ noteDetails ["status " ] == "_WILL_BE_FOLLOWED " ) $ students [$ s ]["statusFormatted " ] = "<button class='btn btn-primary' style='margin-bottom:5px'><i class='fa fa-clock-o'></i> " ._WILL_BE_FOLLOWED ."</button> " ;
129+ else if ($ noteDetails ["status " ] == "_RECOGNITION_WORK " ) $ students [$ s ]["statusFormatted " ] = "<button class='btn btn-default' style='margin-bottom:5px'><i class='fa fa-address-card-o'></i> " ._RECOGNITION_WORK ."</button> " ;
130+
131+ //add status to the student
132+ $ students [$ s ]["status " ] = $ noteDetails ["status " ];
133+ }
134+
135+ //add students to the interview
136+ $ rows [$ k ]["students " ] = $ students ;
137+
138+ //add settings
139+ $ rows [$ k ]["settings " ] = $ this ->settings ;
140+ }
141+
142+ $ this ->interviews = $ rows ;
143+ }
144+
145+ return $ this ->interviews ;
146+ }
147+
148+ }
149+ ?>
0 commit comments