public function listAll()
 {
     $toReturn['exams'] = examsList::where('examAcYear', $this->panelInit->selectAcYear)->get()->toArray();
     if ($this->data['users']->role == "teacher") {
         $toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->where('classTeacher', 'LIKE', '%"' . $this->data['users']->id . '"%')->get()->toArray();
     } else {
         $toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->get()->toArray();
     }
     $toReturn['userRole'] = $this->data['users']->role;
     $newrole = $this->data['users']->newrole;
     $newrole_array = json_decode($newrole);
     $params = permissions::where('moduleId', 1)->where('permission', 1)->get();
     $uniparam = array(5, 6, 7, 8, 15);
     if ($toReturn['userRole'] == "teacher") {
         if (array_intersect($newrole_array, $uniparam)) {
             $toReturn['access'] = 1;
         } else {
             $toReturn['access'] = 0;
         }
     } elseif ($toReturn['userRole'] == "admin") {
         $toReturn['access'] = 1;
     } else {
         $toReturn['access'] = 0;
     }
     $toReturn['newuserRole'] = $this->data['users']->newrole;
     return $toReturn;
 }
 public function preAttendaceStats()
 {
     $toReturn = array();
     $classes = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->get();
     $toReturn['classes'] = array();
     $subjList = array();
     foreach ($classes as $class) {
         $class['classSubjects'] = json_decode($class['classSubjects'], true);
         if (is_array($class['classSubjects'])) {
             foreach ($class['classSubjects'] as $subject) {
                 $subjList[] = $subject;
             }
         }
         $toReturn['classes'][$class->id] = $class->className;
     }
     $subjList = array_unique($subjList);
     if ($this->data['panelInit']->settingsArray['attendanceModel'] == "subject") {
         $toReturn['subjects'] = array();
         if (count($subjList) > 0) {
             $subjects = subject::whereIN('id', $subjList)->get();
             foreach ($subjects as $subject) {
                 $toReturn['subjects'][$subject->id] = $subject->subjectTitle;
             }
         }
     }
     $toReturn['role'] = $this->data['users']->role;
     $toReturn['attendanceModel'] = $this->data['panelInit']->settingsArray['attendanceModel'];
     return $toReturn;
 }
 public function listAll()
 {
     $toReturn = array();
     $toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->get()->toArray();
     $toReturn['subject'] = subject::get()->toArray();
     $toReturn['days'] = $arrayOfDays = array(0 => $this->panelInit->language['Sunday'], 1 => $this->panelInit->language['Monday'], 2 => $this->panelInit->language['Tuesday'], 3 => $this->panelInit->language['Wednesday'], 4 => $this->panelInit->language['Thurusday'], 5 => $this->panelInit->language['Friday'], 6 => $this->panelInit->language['Saturday']);
     $toReturn['userRole'] = $this->data['users']->role;
     return $toReturn;
 }
Beispiel #4
0
 static function InsertNewClassFromFranchise($data)
 {
     $insert = new classes();
     $insert->class_name = $data['className'];
     $getSlug = ClassesMaster::select('slug', 'id')->where('class_name', '=', $data['className'])->get();
     //return $getSlug[0]['slug'];
     $insert->slug = $getSlug[0]['slug'];
     $insert->base_price_no = $data['basePriceNo'];
     $insert->course_id = $data['Course_id'];
     $insert->franchisee_id = Session::get('franchiseId');
     $insert->class_master_id = $getSlug[0]['id'];
     $insert->created_by = Session::get('userId');
     $insert->updated_by = Session::get('userId');
     $insert->save();
     return $insert;
 }
 public function listAll()
 {
     $toReturn = array();
     $toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->get()->toArray();
     $classesArray = array();
     while (list(, $class) = each($toReturn['classes'])) {
         $classesArray[$class['id']] = $class['className'];
     }
     $toReturn['subject'] = subject::get()->toArray();
     $subjectArray = array();
     while (list(, $subject) = each($toReturn['subject'])) {
         $subjectArray[$subject['id']] = $subject['subjectTitle'];
     }
     $toReturn['materials'] = array();
     $studyMaterial = new studyMaterial();
     if ($this->data['users']->role == "student") {
         $studyMaterial = $studyMaterial->where('class_id', 'LIKE', '%"' . $this->data['users']->studentClass . '"%');
     }
     if ($this->data['users']->role == "teacher") {
         $studyMaterial = $studyMaterial->where('teacher_id', $this->data['users']->id);
     }
     $studyMaterial = $studyMaterial->get();
     foreach ($studyMaterial as $key => $material) {
         $classId = json_decode($material->class_id);
         if ($this->data['users']->role == "student" and !in_array($this->data['users']->studentClass, $classId)) {
             continue;
         }
         $toReturn['materials'][$key]['id'] = $material->id;
         $toReturn['materials'][$key]['subjectId'] = $material->subject_id;
         $toReturn['materials'][$key]['subject'] = $subjectArray[$material->subject_id];
         $toReturn['materials'][$key]['material_title'] = $material->material_title;
         $toReturn['materials'][$key]['material_description'] = $material->material_description;
         $toReturn['materials'][$key]['material_file'] = $material->material_file;
         $toReturn['materials'][$key]['classes'] = "";
         if (is_array($classId)) {
             while (list(, $value) = each($classId)) {
                 if (isset($classesArray[$value])) {
                     $toReturn['materials'][$key]['classes'] .= $classesArray[$value] . ", ";
                 }
             }
         }
     }
     $toReturn['userRole'] = $this->data['users']->role;
     return $toReturn;
     exit;
 }
Beispiel #6
0
<?php

/**
 * Create a quiz
 */
if ($_SESSION['username'] != "") {
    require_once 'web/core/navigation.php';
    if ($_SESSION['utype'] >= '5') {
        // get and initiate the course class to access the functions
        require_once 'src/core/controller/classes.php';
        $ObjClass = new classes();
        require_once 'src/core/controller/quiz.php';
        $ObjQuiz = new quiz();
        // set class id for form and links
        if ($_POST['classid'] != "") {
            $classid = $_POST['classid'];
        } else {
            $classid = $d;
        }
        if ($_POST['y'] == 'quiz' && $_POST['z'] == 'create' && $_POST['action'] == "save") {
            $createContent = $ObjQuiz->createQuiz($_POST['quizTitle'], $_POST['quizState'], $_POST['quizDescription'], $ObjClass->convertUUIDToClassID($_POST['classid']));
            if ($createContent !== false) {
                $responseMsg = "Your quiz has been created successfully";
            } else {
                $responseMsg = "Could not create your quiz at this time - something went wrong, sorry";
            }
        }
        // create the view for coursek information
        require_once 'web/core/quiz/create.php';
    } else {
        require_once 'web/core/security/insufficientrights.php';
 function export($id, $type)
 {
     if ($this->data['users']->role != "admin") {
         exit;
     }
     if ($type == "excel") {
         $classArray = array();
         $classes = classes::get();
         foreach ($classes as $class) {
             $classArray[$class->id] = $class->className;
         }
         $data = array(1 => array('Student Roll', 'Full Name', 'Date took', 'Exam Grade'));
         $grades = \DB::table('onlineExamsGrades')->where('examId', $id)->leftJoin('users', 'users.id', '=', 'onlineExamsGrades.studentId')->select('onlineExamsGrades.id as id', 'onlineExamsGrades.examGrade as examGrade', 'onlineExamsGrades.examDate as examDate', 'users.fullName as fullName', 'users.id as studentId', 'users.studentRollId as studentRollId')->get();
         foreach ($grades as $value) {
             $data[] = array($value->studentRollId, $value->fullName, date("m/d/y", $value->examDate), $value->examGrade);
         }
         $xls = new Excel_XML('UTF-8', false, 'Exam grades Sheet');
         $xls->addArray($data);
         $xls->generateXML('Exam grades Sheet');
     } elseif ($type == "pdf") {
         $classArray = array();
         $classes = classes::get();
         foreach ($classes as $class) {
             $classArray[$class->id] = $class->className;
         }
         $header = array('Student Roll', 'Full Name', 'Date took', 'Exam Grade');
         $data = array();
         $grades = \DB::table('onlineExamsGrades')->where('examId', $id)->leftJoin('users', 'users.id', '=', 'onlineExamsGrades.studentId')->select('onlineExamsGrades.id as id', 'onlineExamsGrades.examGrade as examGrade', 'onlineExamsGrades.examDate as examDate', 'users.fullName as fullName', 'users.id as studentId', 'users.studentRollId as studentRollId')->get();
         foreach ($grades as $value) {
             $data[] = array($value->studentRollId, $value->fullName, date("m/d/y", $value->examDate), $value->examGrade);
         }
         $pdf = new FPDF();
         $pdf->SetFont('Arial', '', 10);
         $pdf->AddPage();
         // Header
         foreach ($header as $col) {
             $pdf->Cell(60, 7, $col, 1);
         }
         $pdf->Ln();
         // Data
         foreach ($data as $row) {
             foreach ($row as $col) {
                 $pdf->Cell(60, 6, $col, 1);
             }
             $pdf->Ln();
         }
         $pdf->Output();
     }
     exit;
 }
 private function rewrite_tree_node($node_html, $new_classes)
 {
     $opening_tag = strstr($node_html, ' ', true);
     $pattern = '/class=\\"([^"]+)/';
     if (preg_match($pattern, $node_html, $matches)) {
         $existing_classes = $matches[1];
         $new_classes = classes::add_to($new_classes, $existing_classes);
     }
     $node_html = substr($node_html, strlen($opening_tag));
     $node_html = substr($node_html, 0, -1 * strlen($opening_tag));
     return '<a class="' . implode(' ', $new_classes) . '"' . $node_html . 'a>';
 }
 function export($type)
 {
     if ($this->data['users']->role != "admin") {
         exit;
     }
     if ($type == "excel") {
         $classArray = array();
         $classes = classes::get();
         foreach ($classes as $class) {
             $classArray[$class->id] = $class->className;
         }
         $data = array(1 => array('Title', 'Description', 'Student', 'Amount', 'Date', 'Status'));
         $payments = \DB::table('payments')->leftJoin('users', 'users.id', '=', 'payments.paymentStudent')->select('payments.id as id', 'payments.paymentTitle as paymentTitle', 'payments.paymentDescription as paymentDescription', 'payments.paymentAmount as paymentAmount', 'payments.paymentStatus as paymentStatus', 'payments.paymentDate as paymentDate', 'payments.paymentStudent as studentId', 'users.fullName as fullName')->get();
         foreach ($payments as $value) {
             if ($value->paymentStatus == 1) {
                 $paymentStatus = "PAID";
             } else {
                 $paymentStatus = "UNPAID";
             }
             $data[] = array($value->paymentTitle, $value->paymentDescription, $value->fullName, $value->paymentAmount, $value->paymentDate, $paymentStatus);
         }
         $xls = new Excel_XML('UTF-8', false, 'Students Sheet');
         $xls->addArray($data);
         $xls->generateXML('Students-Sheet');
     } elseif ($type == "pdf") {
         $classArray = array();
         $classes = classes::get();
         foreach ($classes as $class) {
             $classArray[$class->id] = $class->className;
         }
         $header = array('Title', 'Description', 'Student', 'Amount', 'Date', 'Status');
         $data = array();
         $payments = \DB::table('payments')->leftJoin('users', 'users.id', '=', 'payments.paymentStudent')->select('payments.id as id', 'payments.paymentTitle as paymentTitle', 'payments.paymentDescription as paymentDescription', 'payments.paymentAmount as paymentAmount', 'payments.paymentStatus as paymentStatus', 'payments.paymentDate as paymentDate', 'payments.paymentStudent as studentId', 'users.fullName as fullName')->get();
         foreach ($payments as $value) {
             if ($value->paymentStatus == 1) {
                 $paymentStatus = "PAID";
             } else {
                 $paymentStatus = "UNPAID";
             }
             $data[] = array($value->paymentTitle, $value->paymentDescription, $value->fullName, $value->paymentAmount, $value->paymentDate, $paymentStatus);
         }
         $pdf = new FPDF();
         $pdf->SetFont('Arial', '', 10);
         $pdf->AddPage();
         // Header
         foreach ($header as $col) {
             $pdf->Cell(40, 7, $col, 1);
         }
         $pdf->Ln();
         // Data
         foreach ($data as $row) {
             foreach ($row as $col) {
                 $pdf->Cell(40, 6, $col, 1);
             }
             $pdf->Ln();
         }
         $pdf->Output();
     }
     exit;
 }
   $out['CONTROLPANEL']=1;
  }
  $qry="1";
  // search filters
  if (IsSet($this->object_id)) {
   $object_id=$this->object_id;
   $qry.=" AND OBJECT_ID='".$this->object_id."'";
  } else {
   global $object_id;
  }
  if (IsSet($this->class_id)) {
   $class_id=$this->class_id;
   $qry.=" AND CLASS_ID='".$this->class_id."'";

   include_once(DIR_MODULES.'classes/classes.class.php');
   $cl=new classes();
   $out['PARENT_METHODS']=$cl->getParentMethods($this->class_id);
   if (!$out['PARENT_METHODS'][0]['ID']) {
    unset($out['PARENT_METHODS']);
   }


  } else {
   global $class_id;
  }
  // QUERY READY
  global $save_qry;
  if ($save_qry) {
   $qry=$session->data['methods_qry'];
  } else {
   $session->data['methods_qry']=$qry;
Beispiel #11
0
                    $my_meth['ID'] = SQLInsert('methods', $my_meth);
                }
                $out['OK'] = 1;
            }
        }
        if (!$my_meth['ID']) {
            $out['CALL_PARENT'] = 1;
        } else {
            $out['CODE'] = htmlspecialchars($my_meth['CODE']);
            $out['SCRIPT_ID'] = $my_meth['SCRIPT_ID'];
            $out['CALL_PARENT'] = (int) $my_meth['CALL_PARENT'];
        }
        $out['OVERWRITE'] = 1;
    }
    include_once DIR_MODULES . 'classes/classes.class.php';
    $cl = new classes();
    $methods = $cl->getParentMethods($rec['CLASS_ID'], '', 1);
    $total = count($methods);
    for ($i = 0; $i < $total; $i++) {
        $my_meth = SQLSelectOne("SELECT ID FROM methods WHERE OBJECT_ID='" . $rec['ID'] . "' AND TITLE LIKE '" . DBSafe($methods[$i]['TITLE']) . "'");
        if ($my_meth['ID']) {
            $methods[$i]['CUSTOMIZED'] = 1;
        }
    }
    $out['METHODS'] = $methods;
}
// step: history
if ($this->tab == 'history') {
}
if (is_array($rec)) {
    foreach ($rec as $k => $v) {
Beispiel #12
0
<?php

/**
 * Delete a class
 */
if ($_SESSION['username'] != "") {
    require_once 'web/core/navigation.php';
    // get and initiate the course class to access the functions
    require_once 'src/core/controller/classes.php';
    $ObjClass = new classes();
    // Set what we are loading up for editing
    if ($d) {
        $classid = $d;
    } elseif ($_POST['classid'] != "") {
        $classid = $_POST['classid'];
    } else {
        $classid = "";
    }
    // If a valid id comes forth then utilise that to load data or save
    if ($classid) {
        $classid = $ObjClass->convertUUIDToClassID($classid);
        // Update information if it has ben requested
        if ($_POST['action'] == "remove" && $classid != "") {
            $deleteClass = $ObjClass->deleteClass($classid);
            if ($createClass !== false) {
                $responseMsg = "Your class has been removed successfully";
            } else {
                $responseMsg = "Could not remove your class at this time - something went wrong, sorry";
            }
        }
        // else display the information
Beispiel #13
0
 public function proceed()
 {
     if (Input::get('nextStep') == "1") {
         if (filter_var(Input::get('email'), FILTER_VALIDATE_EMAIL)) {
             if (!Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password'), 'activated' => 1, 'role' => 'admin'))) {
                 $loginError = false;
                 $this->data['loginError'] = "loginError";
             }
         } else {
             if (!Auth::attempt(array('username' => Input::get('email'), 'password' => Input::get('password'), 'activated' => 1, 'role' => 'admin'))) {
                 $loginError = false;
                 $this->data['loginError'] = "loginError";
             }
         }
         if (!isset($loginError)) {
             file_put_contents('app/storage/meta/lc', Input::get('cpc'));
             if ($this->sbApi() == "err") {
                 @unlink('app/storage/meta/lc');
                 $this->data['installErrors'][] = "Purchase code is missing";
                 $loginError = false;
                 $this->data['loginError'] = "loginError";
             }
         }
         $this->data['currStep'] = "welcome";
         if (!isset($loginError)) {
             $this->data['currStep'] = "1";
             $this->data['nextStep'] = "2";
             $testData = uniqid();
             @file_put_contents("uploads/assignments/test", $testData);
             @file_put_contents("uploads/books/test", $testData);
             @file_put_contents("uploads/cache/test", $testData);
             @file_put_contents("uploads/media/test", $testData);
             @file_put_contents("uploads/profile/test", $testData);
             @file_put_contents("uploads/studyMaterial/test", $testData);
             @file_put_contents("uploads/assignmentsAnswers/test", $testData);
             @file_put_contents("app/storage/cache/test", $testData);
             @file_put_contents("app/storage/logs/test", $testData);
             @file_put_contents("app/storage/meta/test", $testData);
             @file_put_contents("app/storage/sessions/test", $testData);
             @file_put_contents("app/storage/views/test", $testData);
             if (@file_get_contents("uploads/assignments/test") != $testData) {
                 $this->data['perrors'][] = "uploads/assignments";
                 $this->data['nextStep'] = "1";
             } else {
                 $this->data['success'][] = "uploads/assignments";
             }
             if (@file_get_contents("uploads/books/test") != $testData) {
                 $this->data['perrors'][] = "uploads/books";
                 $this->data['nextStep'] = "1";
             } else {
                 $this->data['success'][] = "uploads/books";
             }
             if (@file_get_contents("uploads/cache/test") != $testData) {
                 $this->data['perrors'][] = "uploads/cache";
                 $this->data['nextStep'] = "1";
             } else {
                 $this->data['success'][] = "uploads/cache";
             }
             if (@file_get_contents("uploads/media/test") != $testData) {
                 $this->data['perrors'][] = "uploads/media";
                 $this->data['nextStep'] = "1";
             } else {
                 $this->data['success'][] = "uploads/media";
             }
             if (@file_get_contents("uploads/profile/test") != $testData) {
                 $this->data['perrors'][] = "uploads/profile";
                 $this->data['nextStep'] = "1";
             } else {
                 $this->data['success'][] = "uploads/profile";
             }
             if (@file_get_contents("uploads/studyMaterial/test") != $testData) {
                 $this->data['perrors'][] = "uploads/studyMaterial";
                 $this->data['nextStep'] = "1";
             } else {
                 $this->data['success'][] = "uploads/studyMaterial";
             }
             if (@file_get_contents("uploads/assignmentsAnswers/test") != $testData) {
                 $this->data['perrors'][] = "uploads/assignmentsAnswers";
                 $this->data['nextStep'] = "1";
             } else {
                 $this->data['success'][] = "uploads/assignmentsAnswers";
             }
             if (@file_get_contents("app/storage/cache/test") != $testData) {
                 $this->data['perrors'][] = "app/storage/cache";
                 $this->data['nextStep'] = "1";
             } else {
                 $this->data['success'][] = "app/storage/cache";
             }
             if (@file_get_contents("app/storage/logs/test") != $testData) {
                 $this->data['perrors'][] = "app/storage/logs";
                 $this->data['nextStep'] = "1";
             } else {
                 $this->data['success'][] = "app/storage/logs";
             }
             if (@file_get_contents("app/storage/meta/test") != $testData) {
                 $this->data['perrors'][] = "app/storage/meta";
                 $this->data['nextStep'] = "1";
             } else {
                 $this->data['success'][] = "app/storage/meta";
             }
             if (@file_get_contents("app/storage/sessions/test") != $testData) {
                 $this->data['perrors'][] = "app/storage/sessions";
                 $this->data['nextStep'] = "1";
             } else {
                 $this->data['success'][] = "app/storage/sessions";
             }
             if (@file_get_contents("app/storage/views/test") != $testData) {
                 $this->data['perrors'][] = "app/storage/views";
                 $this->data['nextStep'] = "1";
             } else {
                 $this->data['success'][] = "app/storage/views";
             }
         }
     }
     if (Input::get('nextStep') == "2") {
         $this->data['currStep'] = "2";
         $this->data['nextStep'] = "3";
         $testInstalled = settings::where('fieldName', 'thisVersion')->first();
         if ($testInstalled->fieldValue == "1.2" || $testInstalled->fieldValue == "1.3") {
             //Upgrade from first version to 1.4
             DB::unprepared(file_get_contents('app/storage/dbsqlUp14'));
             $settings = settings::where('fieldName', 'thisVersion')->first();
             $settings->fieldValue = '1.4';
             $settings->save();
             $testInstalled->fieldValue = "1.4";
         }
         if ($testInstalled->fieldValue == "1.4") {
             //Upgrade from first version to 1.4
             DB::unprepared(file_get_contents('app/storage/dbsqlUp20'));
             //Classes and relation with subjects
             $classes = classes::get();
             foreach ($classes as $class) {
                 $classesUpdateArray = array();
                 $subjects = subject::where('classId', $class->id)->get();
                 foreach ($subjects as $subject) {
                     $classesUpdateArray[] = $subject->id;
                 }
                 $classesUpdateArray = json_encode($classesUpdateArray);
                 classes::where('id', $class->id)->update(array('classSubjects' => $classesUpdateArray));
                 unset($classesUpdateArray);
             }
             //create academic years
             $users = User::where('role', 'student')->get();
             foreach ($users as $user) {
                 $studentAcademicYears = new studentAcademicYears();
                 $studentAcademicYears->studentId = $user->id;
                 $studentAcademicYears->academicYearId = 1;
                 $studentAcademicYears->classId = $user->studentClass;
                 $studentAcademicYears->save();
             }
             DB::unprepared('ALTER TABLE `subject` CHANGE `teacherId` `teacherId` int(250)   NOT NULL after `subjectTitle` ,DROP COLUMN `classId` ;');
             $settings = settings::where('fieldName', 'thisVersion')->first();
             $settings->fieldValue = '2.0';
             $settings->save();
         }
     }
     if (Input::get('nextStep') == "3") {
         $this->data['currStep'] = "3";
         $settings = settings::where('fieldName', 'thisVersion')->first();
         $settings->fieldValue = '1.4';
         $settings->save();
     }
     return View::make('upgrade', $this->data);
 }
 protected function disabled_navigation_node(navigation_node $node, $wrap = true)
 {
     $items = $node->children;
     if ($items->count() == 0) {
         return '';
     }
     foreach ($items as $item) {
         if (!$item->display) {
             continue;
         }
         $isbranch = $item->children->count() > 0 || $item->nodetype == navigation_node::NODETYPE_BRANCH;
         if ($isbranch) {
             $item->hideicon = true;
         }
         $content = $this->output->render($item);
         $classes = 'tree_item';
         $expanded = 'true';
         if (!$item->forceopen || !$item->forceopen && $item->collapse || $item->children->count() == 0 && $item->nodetype == navigation_node::NODETYPE_BRANCH) {
             $classes = classes::add_to($classes, 'collapsed');
             if ($isbranch) {
                 $expanded = "false";
                 $classes = classes::add_to($classes, 'branch');
             }
         }
         if ($item->isactive === true) {
             $classes = classes::add_to($classes, 'active');
         }
         $attributes = array('class' => $classes, 'aria-expanded' => $expanded);
         $content .= $this->navigation_node($item);
         $lis[] = html::li($attributes, $content);
     }
     $output = implode($lis);
     if ($wrap) {
         return html::ul('nav nav-list block_tree', $output);
     }
     return $output;
 }
Beispiel #15
0
<?php

/**
 * View a course
 */
if ($_SESSION['username'] != "") {
    if ($_SESSION['utype'] >= '5') {
        require_once 'web/core/navigation.php';
        // get and initiate the course class to access the functions
        require_once 'src/core/controller/classes.php';
        $ObjClass = new classes();
        if ($_POST['y'] == 'class' && $_POST['z'] == 'create' && $_POST['action'] == "save") {
            $createClass = $ObjClass->createClass($_POST['className'], $_POST['classTutor'], $_POST['classDescription'], $_POST['classState'], $_POST['classSubject'], $_POST['classSet']);
            if ($createClass !== false) {
                $responseMsg = "Your class has been created successfully";
            } else {
                $responseMsg = "Could not create your class at this time - something went wrong, sorry";
            }
        }
        // create the view for course information
        require_once 'web/core/class/create.php';
    } else {
        require_once 'web/core/security/insufficientrights.php';
    }
} else {
    require_once 'web/core/login/index.php';
}
 /**
  * @dataProvider replace
  * @depends test_replace
  */
 public function test_replace_in_array($existing, $replacements, $expected)
 {
     $attributes['class'] = $existing;
     $actual = classes::replace($attributes, $replacements);
     $this->assertArrayHasKey('class', $actual);
     $this->assertSame($expected, $actual['class']);
     $attributes = array();
     $actual = classes::replace($attributes, $replacements);
     $this->assertArrayHasKey('class', $actual);
     $this->assertSame('', $actual['class']);
 }
Beispiel #17
0
 public function registerClasses()
 {
     return classes::where('classAcademicYear', $this->panelInit->selectAcYear)->get();
 }
 function profile($id)
 {
     $data = User::where('role', 'student')->where('id', $id)->first()->toArray();
     $data['birthday'] = date('m/d/Y', $data['birthday']);
     if ($data['studentClass'] != "" and $data['studentClass'] != "0") {
         $class = classes::where('id', $data['studentClass'])->first();
     }
     $return = array();
     $return['title'] = $data['fullName'] . " " . $this->panelInit->language['Profile'];
     $return['content'] = "<div class='text-center'>";
     $return['content'] .= "<img alt='" . $data['fullName'] . "' class='user-image img-circle' style='width:70px; height:70px;' src='dashboard/profileImage/" . $data['id'] . "'>";
     $return['content'] .= "</div>";
     $return['content'] .= "<h4>" . $this->panelInit->language['studentInfo'] . "</h4>";
     $return['content'] .= "<table class='table table-bordered'><tbody>\n                          <tr>\n                              <td>" . $this->panelInit->language['FullName'] . "</td>\n                              <td>" . $data['fullName'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['rollid'] . "</td>\n                              <td>" . $data['studentRollId'] . "</td>\n                          </tr>";
     if (isset($class)) {
         $return['content'] .= "<tr>\n\t                              <td>" . $this->panelInit->language['class'] . "</td>\n\t                              <td>" . $class->className . "</td>\n\t                          </tr>";
     }
     $return['content'] .= "<tr>\n                              <td>" . $this->panelInit->language['username'] . "</td>\n                              <td>" . $data['username'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['email'] . "</td>\n                              <td>" . $data['email'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['Birthday'] . "</td>\n                              <td>" . $data['birthday'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['Gender'] . "</td>\n                              <td>" . $data['gender'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['Address'] . "</td>\n                              <td>" . $data['address'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['phoneNo'] . "</td>\n                              <td>" . $data['phoneNo'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['mobileNo'] . "</td>\n                              <td>" . $data['mobileNo'] . "</td>\n                          </tr>\n\n                          </tbody></table>";
     return $return;
 }
 public function getStats($date = "")
 {
     if ($date == "") {
         $date = date('m/Y');
     }
     $date = explode("/", $date);
     $toReturn = array();
     $classes = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->get();
     $toReturn['classes'] = array();
     $subjList = array();
     foreach ($classes as $class) {
         $class['classSubjects'] = json_decode($class['classSubjects'], true);
         if (is_array($class['classSubjects'])) {
             foreach ($class['classSubjects'] as $subject) {
                 $subjList[] = $subject;
             }
         }
         $toReturn['classes'][$class->id] = $class->className;
     }
     $subjList = array_unique($subjList);
     if ($this->data['panelInit']->settingsArray['attendanceModel'] == "subject") {
         $toReturn['subjects'] = array();
         if (count($subjList) > 0) {
             $subjects = subject::whereIN('id', $subjList)->get();
             foreach ($subjects as $subject) {
                 $toReturn['subjects'][$subject->id] = $subject->subjectTitle;
             }
         }
     }
     $toReturn['role'] = $this->data['users']->role;
     $toReturn['attendanceModel'] = $this->data['panelInit']->settingsArray['attendanceModel'];
     if ($this->data['users']->role == "admin" || $this->data['users']->role == "teacher") {
         $attendanceArray = attendance::where('date', 'like', $date[0] . "%")->where('date', 'like', "%" . $date[1])->orderBy('date')->get();
         foreach ($attendanceArray as $value) {
             $dateHere = str_replace("/" . $date[1], "", $value->date);
             $dateHere = str_replace($date[0] . "/", "", $dateHere);
             $dateHere = preg_replace('/^0/', "", $dateHere);
             if (!isset($toReturn['attendance'][$dateHere][0])) {
                 $toReturn['attendance'][$dateHere][0] = 0;
                 $toReturn['attendance'][$dateHere][1] = 0;
                 $toReturn['attendance'][$dateHere][2] = 0;
                 $toReturn['attendance'][$dateHere][3] = 0;
                 $toReturn['attendance'][$dateHere][4] = 0;
             }
             $toReturn['attendance'][$dateHere][$value->status]++;
         }
         $attendanceArrayToday = attendance::where('date', date('m/d/Y'))->get();
         if ($this->data['panelInit']->settingsArray['attendanceModel'] == "subject") {
             foreach ($attendanceArrayToday as $value) {
                 if (isset($toReturn['subjects'][$value->subjectId])) {
                     if (!isset($toReturn['attendanceDay'][$toReturn['subjects'][$value->subjectId]])) {
                         $toReturn['attendanceDay'][$toReturn['subjects'][$value->subjectId]] = 0;
                     }
                     $toReturn['attendanceDay'][$toReturn['subjects'][$value->subjectId]]++;
                 }
             }
         } else {
             foreach ($attendanceArrayToday as $value) {
                 if (isset($toReturn['classes'][$value->classId])) {
                     if (!isset($toReturn['attendanceDay'][$toReturn['classes'][$value->classId]])) {
                         $toReturn['attendanceDay'][$toReturn['classes'][$value->classId]] = 0;
                     }
                     $toReturn['attendanceDay'][$toReturn['classes'][$value->classId]]++;
                 }
             }
         }
     } elseif ($this->data['users']->role == "student") {
         $attendanceArray = attendance::where('studentId', $this->data['users']->id)->where('date', 'like', $date[0] . "%")->where('date', 'like', "%" . $date[1])->get();
         foreach ($attendanceArray as $value) {
             $toReturn['studentAttendance'][] = array("date" => $value->date, "status" => $value->status, "subject" => isset($toReturn['subjects'][$value->subjectId]) ? $toReturn['subjects'][$value->subjectId] : "");
         }
     } elseif ($this->data['users']->role == "parent") {
         if ($this->data['users']->parentOf != "") {
             $parentOf = json_decode($this->data['users']->parentOf, true);
             $ids = array();
             while (list(, $value) = each($parentOf)) {
                 $ids[] = $value['id'];
             }
             $studentArray = User::where('role', 'student')->whereIn('id', $ids)->get();
             foreach ($studentArray as $stOne) {
                 $students[$stOne->id] = array('name' => $stOne->fullName, 'studentRollId' => $stOne->studentRollId);
             }
             if (count($ids) > 0) {
                 $attendanceArray = attendance::whereIn('studentId', $ids)->where('date', 'like', $date[0] . "%")->where('date', 'like', "%" . $date[1])->get();
                 foreach ($attendanceArray as $value) {
                     if (!isset($toReturn['studentAttendance'][$value->studentId])) {
                         $toReturn['studentAttendance'][$value->studentId]['n'] = $students[$value->studentId];
                         $toReturn['studentAttendance'][$value->studentId]['d'] = array();
                     }
                     $toReturn['studentAttendance'][$value->studentId]['d'][] = array("date" => $value->date, "status" => $value->status, "subject" => $value->subjectId);
                 }
             }
         }
     }
     return $toReturn;
 }
Beispiel #20
0
<?php

/*
* Remove stored content from the system
*/
if ($_SESSION['username'] != "") {
    require_once 'web/core/navigation.php';
    if ($_SESSION['utype'] >= 3) {
        // get and initiate the course class to access the functions
        require_once 'src/core/controller/classes.php';
        $ObjClass = new classes();
        require_once 'src/core/controller/content.php';
        $ObjContent = new content();
        if ($d) {
            $documentID = $d;
        } elseif ($_POST['docid']) {
            $documentID = $_POST['docid'];
        } else {
            $documentID = "";
        }
        if ($documentID) {
            if ($_POST['action'] == "confirm") {
                // Remove the document
                $deleteDoc = $ObjContent->deleteDoc($documentID);
                if ($deleteDoc) {
                    $responseMsg = "Your document has been marked for removal";
                } else {
                    $responseMsg = "I couldn't mark this for removal right now, please try again.";
                }
            }
            $document = $ObjContent->getSingleDocument($ObjContent->convertUUIDToDocumentID($documentID));
Beispiel #21
0
<?php

/**
 * Create a register - build the view and form to create a register
 */
if ($_SESSION['username'] != "") {
    if ($_SESSION['utype'] >= '5') {
        require_once 'web/core/navigation.php';
        // get and initiate the course class to access the functions
        require_once 'src/core/controller/classes.php';
        $ObjClass = new classes();
        require_once 'src/core/controller/register.php';
        $ObjRegister = new register();
        if ($_POST['y'] == 'register' && $_POST['z'] == 'create' && $_POST['action'] == "save") {
            $saveRegister = $ObjRegister->storeRegister($ObjClass->convertUUIDToClassID($_POST['classid']), $ObjAkonga->usernametoid($_SESSION['username']), $_POST['pupil'], $_POST['mark']);
            if ($saveRegister === false) {
                $responseMsg = "Could not create your register at this time - something went wrong, sorry";
            } else {
                $responseMsg = "Register saved";
            }
            // return to class view
            $classid = $ObjClass->convertUUIDToClassID($_POST['classid']);
            $className = $ObjClass->getClassName($classid);
            require_once 'web/core/register/create.php';
        } else {
            // create the view for course information
            $classid = $ObjClass->convertUUIDToClassID($d);
            $className = $ObjClass->getClassName($classid);
            $myRegister = $ObjRegister->createRegister($classid);
            require_once 'web/core/register/create.php';
        }
 public function listAll()
 {
     $toReturn = array();
     $toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->get()->toArray();
     $classesArray = array();
     while (list(, $class) = each($toReturn['classes'])) {
         $classesArray[$class['id']] = $class['className'];
     }
     $toReturn['assignments'] = array();
     if (count($classesArray) > 0) {
         $assignments = new assignments();
         if ($this->data['users']->role == "student") {
             $assignments = $assignments->where('classId', 'LIKE', '%"' . $this->data['users']->studentClass . '"%');
         } else {
             while (list($key, ) = each($classesArray)) {
                 $assignments = $assignments->orWhere('classId', 'LIKE', '%"' . $key . '"%');
             }
         }
         if ($this->data['users']->role == "teacher") {
             $assignments = $assignments->where('teacherId', $this->data['users']->id);
         }
         $assignments = $assignments->get();
         foreach ($assignments as $key => $assignment) {
             $classId = json_decode($assignment->classId);
             if ($this->data['users']->role == "student" and !in_array($this->data['users']->studentClass, $classId)) {
                 continue;
             }
             $toReturn['assignments'][$key]['id'] = $assignment->id;
             $toReturn['assignments'][$key]['subjectId'] = $assignment->subjectId;
             $toReturn['assignments'][$key]['AssignTitle'] = $assignment->AssignTitle;
             $toReturn['assignments'][$key]['AssignDescription'] = $assignment->AssignDescription;
             $toReturn['assignments'][$key]['AssignFile'] = $assignment->AssignFile;
             $toReturn['assignments'][$key]['AssignDeadLine'] = $assignment->AssignDeadLine;
             $toReturn['assignments'][$key]['classes'] = "";
             while (list(, $value) = each($classId)) {
                 if (isset($classesArray[$value])) {
                     $toReturn['assignments'][$key]['classes'] .= $classesArray[$value] . ", ";
                 }
             }
         }
     }
     $toReturn['userRole'] = $this->data['users']->role;
     $newrole = $this->data['users']->newrole;
     $newrole_array = json_decode($newrole);
     $params = permissions::where('moduleId', 1)->where('permission', 1)->get();
     foreach ($params as $param) {
         $uniparam[] = $param->roleId;
     }
     if ($toReturn['userRole'] == "teacher") {
         if (array_intersect($newrole_array, $uniparam)) {
             $toReturn['access'] = 1;
         } else {
             $toReturn['access'] = 0;
         }
     } elseif ($toReturn['userRole'] == "admin") {
         $toReturn['access'] = 1;
     } else {
         $toReturn['access'] = 0;
     }
     $toReturn['newuserRole'] = $this->data['users']->newrole;
     return $toReturn;
 }
/*
* @version 0.1 (auto-set)
*/

 global $session;
  if ($this->owner->name=='panel') {
   $out['CONTROLPANEL']=1;
  }
  $qry="1";
  // search filters
  if (IsSet($this->class_id)) {
   $class_id=$this->class_id;
   $qry.=" AND CLASS_ID='".$this->class_id."'";

   include_once(DIR_MODULES.'classes/classes.class.php');
   $cl=new classes();
   $out['PARENT_PROPERTIES']=$cl->getParentProperties($this->class_id);
   if (!$out['PARENT_PROPERTIES'][0]['ID']) {
    unset($out['PARENT_PROPERTIES']);
   }

  } else {
   global $class_id;
  }
  // QUERY READY
  global $save_qry;
  if ($save_qry) {
   $qry=$session->data['properties_qry'];
  } else {
   $session->data['properties_qry']=$qry;
  }
Beispiel #24
0
<?php

/**
 * View a register on the system
 */
if ($_SESSION['username'] != "") {
    if ($_SESSION['utype'] >= '5') {
        require_once 'web/core/navigation.php';
        // get and initiate the course class to access the functions
        require_once 'src/core/controller/classes.php';
        $ObjClass = new classes();
        require_once 'src/core/controller/register.php';
        $ObjRegister = new register();
        // create the view for register
        $classid = $ObjClass->convertUUIDToClassID($d);
        $className = $ObjClass->getClassName($classid);
        if ($_POST['action'] == "load") {
            $myRegister = $ObjRegister->createRegister($classid);
        } else {
            $availableRegisters = $ObjRegister->listRegisters($classid);
        }
        require_once 'web/core/register/view.php';
    } else {
        require_once 'web/core/security/insufficientrights.php';
    }
} else {
    require_once 'web/core/login/index.php';
}
Beispiel #25
0
 function profile($id)
 {
     $data = User::where('role', 'student')->where('id', $id)->first()->toArray();
     $data['birthday'] = date('m/d/Y', $data['birthday']);
     if ($data['studentClass'] != "" and $data['studentClass'] != "0") {
         $class = classes::where('id', $data['studentClass'])->first();
     }
     $return = array();
     $return['title'] = $data['fullName'] . " " . $this->panelInit->language['Profile'];
     $return['content'] = "<div class='text-center'>";
     if ($data['photo'] == "") {
         $return['content'] .= "<img src='uploads/profile/user.png'/>";
     } else {
         $return['content'] .= "<img width='200' src='uploads/profile/" . $data['photo'] . "'/><br/>" . "<h3>" . $data['fullName'] . "</h3>";
     }
     $return['content'] .= "</div>";
     $return['content'] .= "<h4>" . $this->panelInit->language['studentInfo'] . "</h4>";
     $return['content'] .= "<table class='table table-bordered'><tbody>\n                          <tr>\n                              <td>" . $this->panelInit->language['FullName'] . "</td>\n                              <td>" . $data['fullName'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['rollid'] . "</td>\n                              <td>" . $data['studentRollId'] . "</td>\n                          </tr>";
     if (isset($class)) {
         $return['content'] .= "<tr>\n\t                              <td>" . $this->panelInit->language['class'] . "</td>\n\t                              <td>" . $class->className . "</td>\n\t                          </tr>";
     }
     $return['content'] .= "<tr>\n                              <td>" . $this->panelInit->language['username'] . "</td>\n                              <td>" . $data['username'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['email'] . "</td>\n                              <td>" . $data['email'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['Birthday'] . "</td>\n                              <td>" . $data['birthday'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['Gender'] . "</td>\n                              <td>" . $data['gender'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['Address'] . "</td>\n                              <td>" . $data['address'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['phoneNo'] . "</td>\n                              <td>" . $data['phoneNo'] . "</td>\n                          </tr>\n                          <tr>\n                              <td>" . $this->panelInit->language['mobileNo'] . "</td>\n                              <td>" . $data['mobileNo'] . "</td>\n                          </tr>\n\n                          </tbody></table>";
     return $return;
 }
Beispiel #26
0
<?php

/**
 * Toggle a course visibility
 */
if ($_SESSION['username'] != "") {
    require_once 'web/core/navigation.php';
    // get and initiate the course class to access the functions
    require_once 'src/core/controller/classes.php';
    $ObjClass = new classes();
    require_once 'src/core/controller/quiz.php';
    $ObjQuiz = new quiz();
    if ($d) {
        $classid = $ObjClass->convertUUIDToClassID($d);
        $classes = $ObjClass->getClassInformation($classid);
        $documents = $ObjClass->getClassDocuments($classid);
        $classActivity = $ObjClass->getClassActivity($classid);
        $today = date('Y-m-d');
        $classDiary = $ObjClass->getClassDiary($classid, $today, $today);
        // Check if an administrator or owner of the class to b eable to toggle visibility
        if ($_SESSION['utype'] >= 8 || $ObjAkonga->usernametoid($_SESSION['username']) == $classes['teacherid']) {
            if ($e == "1") {
                $visibility = 1;
            } else {
                $visibility = 0;
            }
            $toggleClass = $ObjClass->toggleClass($classid, $visibility);
            if ($toggleClass != false) {
                $responseMsg = "Your class visibility has been changed.";
                $classes = $ObjClass->getClassInformation($classid);
                // Reload class information to stop it pulling in the wrong data now it's changed
 protected function render_single_button(single_button $button)
 {
     // Just because it says "single_botton" doesn't mean it's going to be rendered on its own
     // but it does mean it gets its own unique form and a div round it.
     $attributes = array('title' => $button->tooltip, 'class' => classes::add_to($button->class, 'btn btn-primary'), 'value' => $button->label, 'disabled' => $button->disabled ? 'disabled' : null);
     if ($button->actions) {
         $id = html_writer::random_id('single_button');
         $attributes['id'] = $id;
         foreach ($button->actions as $action) {
             $this->add_action_handler($action, $id);
         }
     }
     $output = html::submit($attributes);
     if ($button->method === 'post') {
         $params['sesskey'] = sesskey();
     }
     $output .= html::hidden_inputs($button->url->params());
     if ($button->method === 'get') {
         $url = $button->url->out_omit_querystring(true);
     } else {
         $url = $button->url->out_omit_querystring();
     }
     if ($url === '') {
         $url = '#';
     }
     $attributes = array('method' => $button->method, 'action' => $url, 'id' => $button->formid);
     return html::form($attributes, $output);
 }
Beispiel #28
0
<?php

/**
 * Create course content
 */
if ($_SESSION['username'] != "") {
    require_once 'web/core/navigation.php';
    if ($_SESSION['utype'] >= '5') {
        // get and initiate the course class to access the functions
        require_once 'src/core/controller/content.php';
        $ObjContent = new content();
        require_once 'src/core/controller/classes.php';
        $ObjClass = new classes();
        // Sort out the class ID
        if ($d) {
            $classid = $d;
        } elseif ($_POST['classid'] != "") {
            $classid = $_POST['classid'];
        } else {
            $classid = "";
        }
        if ($_POST['y'] == 'content' && $_POST['z'] == 'create' && $_POST['action'] == "save") {
            // $contentTitle, $classid, $userid, $contentType, $contentDescription='', $contentLink='', $contentFile='', $contentFileExtension='', $documentContent=''
            $createContent = $ObjContent->createContent($_POST['contentTitle'], $ObjClass->convertUUIDToClassID($_POST['classid']), $ObjAkonga->usernametoid($_SESSION['username']), $_POST['contentType'], $_POST['contentDescription'], $_POST['contentLink'], $_FILES['contentFile']['name'], $_FILES['contentFile']['tmp_name'], $_POST['documentContent'], $_POST['contentState']);
            if ($createContent !== false) {
                $responseMsg = "Your content has been created successfully";
            } else {
                $responseMsg = "Could not create your content at this time - something went wrong, sorry";
            }
        }
        // create the view for course information
function LoadClass()
{
    $db = new DB_Connect();
    $major_id = (string) $_POST['major_id'];
    $statement = 'select * from class where state = 1 and major_id=:major_id';
    $result = $db->prepare($statement);
    $result->execute(array(':major_id' => $major_id));
    $index = 0;
    $ret = "";
    while ($row = $result->fetch()) {
        $element = new classes();
        $element->setVal($row['class_id'], $row['class_name']);
        $ret[$index++] = $element;
    }
    echo json_encode($ret);
}
 public function subjectList($classes = "")
 {
     $subjectList = array();
     $classesCount = 1;
     if ($classes == "") {
         $classes = Input::get('classes');
         if (!Input::has('classes')) {
             return $subjectList;
         }
     }
     if (is_array($classes)) {
         $classes = classes::whereIn('id', $classes)->get()->toArray();
         $classesCount = count($classes);
     } else {
         $classes = classes::where('id', $classes)->get()->toArray();
     }
     while (list(, $value) = each($classes)) {
         $value['classSubjects'] = json_decode($value['classSubjects'], true);
         if (is_array($value['classSubjects'])) {
             while (list(, $value2) = each($value['classSubjects'])) {
                 $subjectList[] = $value2;
             }
         }
     }
     if ($classesCount == 1) {
         $finalClasses = $subjectList;
     } else {
         $subjectList = array_count_values($subjectList);
         $finalClasses = array();
         while (list($key, $value) = each($subjectList)) {
             if ($value == $classesCount) {
                 $finalClasses[] = $key;
             }
         }
     }
     if (count($finalClasses) > 0) {
         return subject::whereIn('id', $finalClasses)->get()->toArray();
     }
     return array();
 }