Skip to content

Commit 2946d6c

Browse files
authored
Add files via upload
1 parent 66e411d commit 2946d6c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+23625
-0
lines changed

Controller/Admissions.php

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
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+
?>

Controller/Announcements.php

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
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+
use \Twig\Loader;
15+
16+
class Announcements {
17+
18+
private $announcements = array();
19+
private $announcementId = 0;
20+
private $nofUnread = 0;
21+
22+
/* function */
23+
function setAnnouncementId($Id)
24+
{
25+
$this->announcementId = $Id;
26+
}
27+
28+
/* function */
29+
function getAnnouncements($page = 0, $limit = 8)
30+
{
31+
global $dbi, $ySubeKodu, $aid, $userType, $currentlang, $dashboard, $userStudentInfo, $simsDateTime;
32+
33+
//get announcements
34+
if($globalUserManagerType == "parent" || $globalUserManagerType == "student")
35+
{
36+
$batchId = $userStudentInfo["SinifKodu"];
37+
38+
//if batchid is empty then return empty announcements
39+
if(empty($batchId)) $dbi->where("Id", "0"); //just show nothing
40+
41+
//otherwise get announcements
42+
else $dbi->where("IF(HangiSiniflarGorebilir IS NULL OR HangiSiniflarGorebilir = '', FIND_IN_SET(". $userType. ", CAST(`KimGorebilir` AS CHAR)) > 0, FIND_IN_SET(". $userType. ", CAST(`KimGorebilir` AS CHAR)) > 0 AND FIND_IN_SET(". $batchId. ", CAST(`HangiSiniflarGorebilir` AS CHAR)) > 0)");
43+
44+
}
45+
else
46+
{
47+
$dbi->where("FIND_IN_SET(". $userType. ", CAST(`KimGorebilir` AS CHAR))", "0", ">");
48+
}
49+
50+
$dbi->where("SubeKodu", $ySubeKodu);
51+
$dbi->where("Aktif", "1");
52+
$dbi->orderBy("OnayTarihi", "DESC");
53+
54+
if(empty($page))
55+
{
56+
$announcements = $dbi->get(_ANNOUNCEMENTS_);
57+
}
58+
else
59+
{
60+
$dbi->pageLimit = $limit;
61+
$announcements = $dbi->paginate(_ANNOUNCEMENTS_, $page);
62+
}
63+
64+
if(!empty($announcements))
65+
{
66+
//handle posts for template
67+
foreach($announcements as $k => $p) {
68+
69+
//check if read or not
70+
$dbi->where("aidKodu", $aid);
71+
$dbi->where("mKodu", $p["Id"]);
72+
$readDate = $dbi->getValue(_ANNOUNCEMENTS_READ_, "rDate");
73+
74+
if($dashboard && !empty($readDate)) continue;
75+
76+
//add other parameters
77+
$announcements[$k]["KisaDetay"] = substr($p["Detay"], 0, 120);
78+
$announcements[$k]["OnayTarihi"] = FormatDateNumeric2Local($p["OnayTarihi"]);
79+
$announcements[$k]["OkunmaTarihi"] = FormatDateNumeric2Local($readDate, true, true);
80+
$announcements[$k]["sentTime"] = DateDifferenceWStrings($simsDateTime, $p["OnayTarihi"], "none");
81+
$announcements[$k]["Read"] = empty($readDate) ? "0" : "1";
82+
83+
//get total number of announcement messages
84+
$dbi->where("subject", $p["Baslik"]);
85+
$dbi->where("sentTime", $p["OnayTarihi"]);
86+
$announcements[$k]["nofAnnouncements"] = $dbi->getValue(_MESSAGES_, "COUNT(id)");
87+
88+
//get total number of read announcement
89+
$dbi->where("mKodu", $p["Id"]);
90+
$announcements[$k]["nofReadAnnouncements"] = $dbi->getValue(_ANNOUNCEMENTS_READ_, "COUNT(Id)");
91+
92+
//get stats
93+
$announcements[$k]["readPercentage"] = $announcements[$k]["nofAnnouncements"] == 0 ? 0 : ($announcements[$k]["nofReadAnnouncements"]/$announcements[$k]["nofAnnouncements"]) * 100;
94+
$announcements[$k]["unreadPercentage"] = 100 - $announcements[$k]["readPercentage"];
95+
96+
$announcements[$k]["readPercentageFormatted"] = number_format($announcements[$k]["readPercentage"], 2) . "%";
97+
$announcements[$k]["unreadPercentageFormatted"] = number_format($announcements[$k]["unreadPercentage"], 2) . "%";
98+
99+
//set nof unread messages for the user
100+
$this->nofUnread++;
101+
}
102+
103+
$this->announcements = $announcements;
104+
}
105+
106+
return $this->announcements;
107+
}
108+
109+
/* function */
110+
function nofUnread()
111+
{
112+
return $this->nofUnread;
113+
}
114+
115+
/* function */
116+
function deleteAnnouncement()
117+
{
118+
global $dbi;
119+
120+
// delete comment with the id
121+
//$dbi->where("Id", $this->postId);
122+
//$result = $dbi->delete(_SOCIAL_POSTS_);
123+
124+
return $result;
125+
}
126+
127+
}

0 commit comments

Comments
 (0)