public function filltestgridAction() { $request = $this->getRequest(); $valid = $request->getParam('nd'); $SubjectCode = $request->getParam('subject_code'); if ($request->isXmlHttpRequest() and $valid) { $this->gridparam['page'] = $request->getParam('page', 1); // get the requested page $this->gridparam['limit'] = $request->getParam('rows', 20); // rows limit in Grid $this->gridparam['sidx'] = $request->getParam('sidx', 1); // get index column - i.e. user click to sort $this->gridparam['sord'] = $request->getParam('sord', 'asc'); // sort direction $params = array('department_id' => $this->_department_id, 'staff_id' => $this->_staff_id, 'subject_code' => $SubjectCode); $model = new Acad_Model_Course_Subject($params); $marks = $model->fetchTest(); $this->_count = count($marks); $this->total_pages = 1; $this->offset = 0; $response = new stdClass(); $response->page = $this->gridparam['page']; $response->total = $this->total_pages; $response->records = $this->_count; foreach ($marks as $key => $row) { $response->rows[$key]['id'] = $row->getTest_info_id(); $response->rows[$key]['cell'] = array($row->getTest_Id(), $row->getTest_Type_Id(), $row->getMax_marks(), $row->getPass_Marks(), $row->getRemarks(), $row->getIsOptional()); } //$this->_helper->json($response); $this->_helper->logger($response); } }
public function attendanceAction() { $department_id = $this->_getParam('department_id'); $programme_id = $this->_getParam('programme_id'); $semester_id = $this->_getParam('semester_id'); $faculty_id = $this->_getParam('faculty_id'); $dateFrom = $this->_getParam('date_from'); $dateUpto = $this->_getParam('date_upto'); $format = $this->_getParam('format', 'html'); $faculty = new Acad_Model_Member_Faculty(); if (true) { $faculty->setFacultyId($faculty_id); } $faculty->setDepartment($department_id); $objLevel = null; if ($department_id) { $objLevel = new Acad_Model_Department(); $objLevel->setDepartment($department_id); } if ($department_id and $programme_id and $semester_id) { $objLevel = new Acad_Model_Class(); $objLevel->setDepartment($department_id)->setProgramme_id($programme_id)->setSemester($semester_id); } $subjects = $faculty->getInHandSubjects($objLevel, TRUE); foreach ($subjects as $subject_code => $subjectClasses) { $subject = new Acad_Model_Course_Subject(array('subject_code' => $subject_code)); $subjectName = $subject->getSubject_name(); foreach ($subjectClasses as $key => $subjectClass) { $subjects[$subject_code][$key]['subject_name'] = $subjectName; } } switch (strtolower($format)) { case 'test': $this->_helper->logger($subjects); return; case 'html': $this->_helper->logger($subjects); $this->_helper->viewRenderer->setNoRender(false); $this->_helper->layout()->enableLayout(); $this->view->assign('department_id', $this->view->escape($department_id)); $urlSubjectDetail = $this->_helper->url('attendance', 'subject'); $this->view->assign('urlSubjetDetail', $this->view->escape($urlSubjectDetail)); $this->view->assign('subjects', $subjects); $this->view->assign('date_from', $this->view->escape($dateFrom)); $this->view->assign('date_upto', $this->view->escape($dateUpto)); $this->view->assign('faculty', $faculty); $this->view->assign('viewLevel', $objLevel); return; case 'json': echo $this->_helper->json($subjects, false); return; case 'jsonp': $callback = $this->_getParam('callback'); echo $callback . '(' . $this->_helper->json($subjects, false) . ')'; return; } }
public function fetchLocked(Acad_Model_Course_Subject $subject) { $sql = 'SELECT `test_info`.`test_info_id`, `test_info`.`degree_id`, `test_info`.`semester_id`, `test_info`.`test_id`, `test_type`.`test_type_id`, `test_type`.`test_type_name` FROM `test_info` INNER JOIN `test_type` ON (`test_info`.`test_type_id` = `test_type`.`test_type_id`) WHERE (`test_info`.`department_id` = ? AND `test_info`.`subject_code` = ? ) AND `test_info`.`is_locked` = 1'; $data = array($subject->getDepartment(), $subject->getSubject_code()); $result = Zend_Db_Table::getDefaultAdapter()->query($sql, $data)->fetchAll(); return $result; }
/** * Just an shortcut to insert available modes in where query. * As it is being used multiple times. * @param Acad_Model_Course_Subject $subject * @return string */ protected function _subjectModeQuery(Acad_Model_Course_Subject $subject) { $subject_modes = $subject->getSubject_mode_id(); $orArray = NULL; foreach ($subject_modes as $key => $subject_mode) { $orArray[] = "(subject_mode_id = '{$subject_mode}')"; } return implode(' OR ', $orArray); }
public function attendanceAction() { $department_id = $this->_getParam('department_id'); $subject_code = $this->_getParam('subject_code'); $subject_mode_id = $this->_getParam('subject_mode_id'); $lowerThreshold = $this->_getParam('lower', 65); $upperThreshold = $this->_getParam('upper', 75); $filterBelow = $this->_getParam('filter_below'); $filterAbove = $this->_getParam('filter_above'); $dateFrom = $this->_getParam('date_from'); $dateUpto = $this->_getParam('date_upto'); $status = $this->_getParam('status'); $group = $this->_getParam('group'); $subject_mode_id = $this->_getParam('subject_mode_id'); $format = $this->_getParam('format', 'html'); if (!((string) $lowerThreshold === (string) (int) $lowerThreshold) or !((string) $upperThreshold === (string) (int) $upperThreshold) or !($upperThreshold > $lowerThreshold)) { throw new Exception('Check lower and upper threshold parameters, Hint: "Upper"(i.e. ' . $upperThreshold . ') must be greater then "lower"(i.e. ' . $lowerThreshold . ')', Zend_Log::ERR); } if ($subject_code and $department_id) { $subject = new Acad_Model_Course_Subject(); $subject->setSubject_code($subject_code)->setDepartment_id($department_id)->setSubject_mode_id($subject_mode_id); $attendanceSet = $subject->getStudentAttendance($dateFrom, $dateUpto, $status, $group, $filterBelow, $filterAbove); $attendanceTotal = $subject->getAttendanceTotal(); $facultySet = $subject->getFaculty($dateFrom, $dateUpto); $stat = $subject->getStudentAttendanceStat(); $summary = $subject->attendanceSummary($lowerThreshold, $upperThreshold); $stuModeWiseAtt = $subject->attendanceStuModeWise(); $subject_name = $subject->getSubject_name(); } /* ELSE part is mentioned in view section. * else { throw new Exception('<b>Department Id</b>(department_id) as well as <b>Subject code</b>(subject_code) are <b>required</b>.', Zend_Log::INFO); }*/ switch (strtolower($format)) { case 'test': $this->_helper->logger($summary); $this->_helper->logger($attendanceSet); return; case 'html': $this->_helper->viewRenderer->setNoRender(false); $this->_helper->layout()->enableLayout(); $this->view->assign('department_id', $this->view->escape($department_id)); $this->view->assign('subject_code', $this->view->escape($subject_code)); $this->view->assign('subject_mode_id', $this->view->escape($subject_mode_id)); $this->view->assign('lowerThreshold', $lowerThreshold); $this->view->assign('upperThreshold', $upperThreshold); $this->view->assign('filterBelow', $filterBelow); $this->view->assign('filterAbove', $filterAbove); $this->view->assign('date_from', $dateFrom); $this->view->assign('date_upto', $dateUpto); $this->view->assign('stat', $stat); $this->view->assign('attendanceSet', $attendanceSet); $this->view->assign('subjectModes', array_keys($attendanceSet)); $this->view->assign('subject_name', $subject_name); $this->view->assign('summary', $summary); $this->view->assign('stuModeWiseAtt', $stuModeWiseAtt); $session_startdate = Acad_Model_DbTable_AcademicSession::getSessionStartDate(); $this->view->assign('session_startdate', $session_startdate); return; case 'json': echo $this->_helper->json($this->summary, false); return; } }
public function gettestAction() { $request = $this->getRequest(); $department = $request->getParam('department_id'); $subject_code = $request->getParam('subject_code'); $locked = $request->getParam('locked'); $format = $this->getRequest()->getParam('format', 'json'); $subject = new Acad_Model_Course_Subject(); $subject->setSubject_code($subject_code)->setDepartment($department); $result = $subject->getTest($locked); switch (strtolower($format)) { case 'json': echo $this->_helper->json($result, false); return; case 'jsonp': $callback = $request->getParam('callback'); echo $callback . '(' . $this->_helper->json($result, false) . ')'; return; case 'select': echo '<select>'; echo '<option>Select one</option>'; foreach ($result as $key => $row) { echo '<option value="' . $row['department_id'] . '">' . $row['department_id'] . '</option>'; } echo '</select>'; return; break; } header("HTTP/1.1 400 Bad Request"); }