| Server IP : 188.114.97.2 / Your IP : 104.23.243.200 Web Server : Apache/2.4.59 (Debian) System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : edlftp ( 1002) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/git/sms.edl.codes.solutions/application/models/ |
Upload File : |
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Dash_model extends CI_Model {
function __construct() {
parent::__construct();
//$this->_ci =& get_instance();
$this->load->model('crud_model');
}
function clear_cache() {
$this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
$this->output->set_header('Pragma: no-cache');
}
function fetch_calendar($start,$end,$role,$filter){
if(isset($start) && isset($end)){
$this->db->select('*');
$this->db->from('course_scheduled_new');
$this->db->where('LessonDate <=',$end);
$this->db->where('LessonDate >=',$start);
$data = $this->db->get();
$courses = $data->result_array();
$jsonHours = "";
foreach ($courses as $key => $row) {
$array = $this->crud_model->get_lesson_teacher($row['ID']);
//var_dump($array);
$teachers = array();
//var_dump($array);
foreach ($array as $key2 => $row2) {
//echo $row2;
array_push($teachers,$this->crud_model->get_teacher_name($row2));
}
$teacherList = implode(",", $teachers);
$duration = (strtotime($row['LessonEnd']) - strtotime($row['LessonStart']))/3600;
if($role == "teacher" && $this->crud_model->check_teacher($row['CourseID'],$this->userInfo['user_id'])){
if($this->crud_model->get_course_local($row['CourseID']) == $filter || $filter == 'null'){
$jsonHours = $jsonHours . "{\"id\":\"".$row['CourseID']."\",\"groupId\":\"".$row['ID']."\",\"title\":\"".$this->crud_model->get_course_name($row['CourseID']);
$jsonHours = $jsonHours . "\",\"description\":\"[".$this->crud_model->get_course_name($row['CourseID'])."] \\nTeacher(s): $teacherList\\nClassroom: ".$this->crud_model->get_course_classroom($row['CourseID'])."\\nStudent nb: ".$this->crud_model->get_students_count($row['CourseID'])."\\n Duration: $duration H\\n [".$this->crud_model->get_course_language($row['CourseID'])."]\",\"courseId\":\"".$row['CourseID'];
$jsonHours = $jsonHours . "\",\"color\":\"".$this->color_course($this->crud_model->get_course_local($row['CourseID']))."\",\"teacher\":\"".$teacherList."\",\"start\":\"".$row['LessonDate']."T".$row['LessonStart']."\",\"end\":\"".$row['LessonDate']."T".$row['LessonEnd']."\",\"done\":\"".$row['LessonDone']."\",\"comment\":\"".$row['LessonComment']."\"},";
}
}
else if($role == "admin"){
if($this->crud_model->get_course_local($row['CourseID']) == $filter || $filter == 'null'){
$jsonHours = $jsonHours . "{\"id\":\"".$row['CourseID']."\",\"groupId\":\"".$row['ID']."\",\"title\":\"".$this->crud_model->get_course_name($row['CourseID']);
$jsonHours = $jsonHours . "\",\"description\":\"[".$this->crud_model->get_course_name($row['CourseID'])."] \\nTeacher(s): $teacherList\\nClassroom: ".$this->crud_model->get_course_classroom($row['CourseID'])."\\nStudent nb: ".$this->crud_model->get_students_count($row['CourseID'])."\\n Duration: $duration H\\n [".$this->crud_model->get_course_language($row['CourseID'])."]\",\"courseId\":\"".$row['CourseID'];
$jsonHours = $jsonHours . "\",\"color\":\"".$this->color_course($this->crud_model->get_course_local($row['CourseID']))."\",\"teacher\":\"".$teacherList."\",\"start\":\"".$row['LessonDate']."T".$row['LessonStart']."\",\"end\":\"".$row['LessonDate']."T".$row['LessonEnd']."\",\"done\":\"".$row['LessonDone']."\",\"comment\":\"".$row['LessonComment']."\"},";
}
}
else{
}
}
$jsonHours = "[".rtrim($jsonHours,',')."]";
}
return $jsonHours;
}
function color_course($id){
$color = $this->crud_model->get_bgColor($id);
//$bgColor
//$n = crc32($id);
//$n &= 0xffffffff;
//return("#".substr("000000".dechex($n),-6));
return $color;
}
function get_icon($id){
// $icon = $this->crud_model->get_bgIcon($id);
return $icon;
}
}
?>