예제 #1
0
 function edit($id)
 {
     $gradeLevels = gradeLevels::find($id);
     $gradeLevels->gradeName = Input::get('gradeName');
     $gradeLevels->gradeDescription = Input::get('gradeDescription');
     $gradeLevels->gradePoints = Input::get('gradePoints');
     $gradeLevels->gradeFrom = Input::get('gradeFrom');
     $gradeLevels->gradeTo = Input::get('gradeTo');
     $gradeLevels->save();
     return $this->panelInit->apiOutput(true, $this->panelInit->language['editGrade'], $this->panelInit->language['gradeUpdated'], $gradeLevels->toArray());
 }
예제 #2
0
 function marksheet($id)
 {
     $marks = array();
     $examsList = examsList::get();
     $examMarks = examMarks::where('studentId', $id)->get();
     if (count($examMarks) == 0) {
         return json_encode(array("jsTitle" => $this->panelInit->language['Marksheet'], "jsStatus" => "0", "jsMessage" => $this->panelInit->language['studentHaveNoMarks']));
         exit;
     }
     $subject = subject::get();
     $gradeLevels = gradeLevels::get();
     $examArray = array();
     foreach ($examsList as $exam) {
         $marks[$exam->id] = array("title" => $exam->examTitle);
     }
     $subjectArray = array();
     foreach ($subject as $sub) {
         $subjectArray[$sub->id] = $sub->subjectTitle;
     }
     $gradeLevelsArray = array();
     foreach ($gradeLevels as $grade) {
         $gradeLevelsArray[$grade->gradeName] = array('from' => $grade->gradeFrom, "to" => $grade->gradeTo, "points" => $grade->gradePoints);
     }
     foreach ($examMarks as $mark) {
         if (!isset($marks[$mark->examId]['counter'])) {
             $marks[$mark->examId]['counter'] = 0;
             $marks[$mark->examId]['points'] = 0;
             $marks[$mark->examId]['totalMarks'] = 0;
         }
         $marks[$mark->examId]['counter']++;
         $marks[$mark->examId]['data'][$mark->id]['subjectName'] = $subjectArray[$mark->subjectId];
         $marks[$mark->examId]['data'][$mark->id]['subjectId'] = $mark->subjectId;
         $marks[$mark->examId]['data'][$mark->id]['examMark'] = $mark->examMark;
         $marks[$mark->examId]['data'][$mark->id]['attendanceMark'] = $mark->attendanceMark;
         $marks[$mark->examId]['data'][$mark->id]['markComments'] = $mark->markComments;
         while (list($key, $value) = each($gradeLevelsArray)) {
             if ($mark->examMark > $value['from'] and $mark->examMark < $value['to']) {
                 $marks[$mark->examId]['points'] += $value['points'];
                 $marks[$mark->examId]['data'][$mark->id]['grade'] = $key;
                 $marks[$mark->examId]['totalMarks'] += $mark->examMark;
                 break;
             }
         }
     }
     while (list($key, $value) = each($marks)) {
         if (isset($value['points']) and $value['counter']) {
             $marks[$key]['pointsAvg'] = $value['points'] / $value['counter'];
         }
     }
     return $marks;
     exit;
 }