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; } }
/** * Save a sessional datesheet * * @param array|Acad_Model_Test_Sessional * @return void */ public function save($sessional) { if ($sessional instanceof Acad_Model_Test_Sessional) { $id = $sessional->getTest_info_id(); if ((string) $id === (string) (int) $id) { $data['date_of_conduct'] = $sessional->getDate_of_conduct(); $data['time'] = $sessional->getTime(); $data['max_marks'] = $sessional->getMax_marks(); $data['pass_marks'] = $sessional->getPass_marks(); return $this->getDbTable()->update($data, "test_info_id = {$id}"); } else { $data['date_of_conduct'] = $sessional->getDate_of_conduct(); $data['time'] = $sessional->getTime(); $data['max_marks'] = $sessional->getMax_marks(); $data['pass_marks'] = $sessional->getPass_marks(); $data['department_id'] = $sessional->getDepartment_id(); $data['degree_id'] = $sessional->getDegree_id(); $data['semester_id'] = $sessional->getSemester_id(); $data['subject_code'] = $sessional->getSubject_code(); $data['test_id'] = $sessional->getTest_id(); $data['test_type_id'] = $sessional->getTest_type_id(); $today = new Zend_Date(); $data['date_of_announcemnet'] = $today->toString('YYYY-MM-dd'); $class = new Acad_Model_Class(); $class->setDepartment($sessional->getDepartment_id())->setDegree($sessional->getDegree_id())->setSemester($sessional->getSemester_id()); $studentInfo = $class->getStudents(); $candidates = array(); $cols = array('test_info_id', 'student_roll_no'); $this->getDbTable()->getAdapter()->beginTransaction(); $this->getDbTable()->insert($data); $id = $this->getDbTable()->getAdapter()->lastInsertId('test_info', 'test_info_id'); foreach ($studentInfo as $key => $student) { $candidates[] = "({$id}, " . $student['student_roll_no'] . ")"; } // build the statement $sql = "INSERT INTO " . $this->getDbTable()->getAdapter()->quoteIdentifier('test_marks', true) . ' (' . implode(', ', $cols) . ') ' . 'VALUES ' . implode(', ', $candidates); try { $this->getDbTable()->getAdapter()->query($sql); } catch (Zend_Exception $e) { $this->getDbTable()->getAdapter()->rollBack(); throw new Zend_Exception('Can not get students\' list. Error Msg :' . $e->getMessage(), Zend_Log::ERR); } $this->getDbTable()->getAdapter()->commit(); return $id; } } }
public function getsubjectAction() { $request = $this->getRequest(); //$faculty_id = $request->getParam('faculty_id'); $department = $request->getParam('department_id'); $degree = $request->getParam('degree_id'); $semester = $request->getParam('semester_id'); $showModes = $request->getParam('modes'); $format = $this->getRequest()->getParam('format', 'json'); $faculty = new Acad_Model_Member_Faculty(); $class = null; if (isset($department) and isset($degree) and isset($semester)) { $class = new Acad_Model_Class(); $class->setDepartment($department)->setDegree($degree)->setSemester($semester); } $result = $faculty->getSubjects($class, $showModes); 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 id="facultySubject">'; echo '<option value="">Select one</option>'; foreach ($result as $subjectCode => $subjectInfo) { foreach ($subjectInfo as $key => $subject) { $mode = isset($subject['subject_mode_id']) ? $subject['subject_mode_id'] : null; $modeValStr = isset($mode) ? '_' . $mode : null; $modeTxtStr = isset($mode) ? ' - ' . $mode : null; echo '<option value="' . $subjectCode . $modeValStr . '">' . ucwords(strtolower($subject['subject_name'])) . $modeTxtStr . '</option>'; } } echo '</select>'; return; } header("HTTP/1.1 400 Bad Request"); }
public function tempAction() { $class = new Acad_Model_Class(); $class->setDepartment('CSE')->setDegree('BTECH')->setSemester('4'); $faculty = new Acad_Model_Member_Faculty(); $result = $faculty->getSubjects($class); echo '<pre>'; print_r($result); //$this->_helper->logger($result); }
/** * Get students in this period. * @return array $groups */ public function getStudents($periodDate, $faculty = null) { $class = new Acad_Model_Class(); $class->setDepartment($this->getDepartment())->setDegree($this->getDegree())->setSemester($this->getSemester()); $groupWiseStudents = array(); $groups = self::getGroups($periodDate, $faculty); foreach ($groups as $key => $group) { $groupWiseStudents[$group['group_id']] = $class->getStudents($group['group_id']); } }
public function getclassunmarkedattAction() { $request = $this->getRequest(); $department = $request->getParam('department_id'); $programme_id = $request->getParam('degree_id'); $semester = $request->getParam('semester_id'); $class = new Acad_Model_Class(); $class->setDepartment($department)->setProgramme_id($programme_id)->setSemester($semester); $result = $class->getUnmarkedAttendance(); $response = new stdClass(); $response->page = 1; $response->total = 1; $response->records = count($result); $response->rows = $result; echo $this->_helper->json($response, false); //$this->_helper->logger($result); }
public function getstudentsAction() { $request = $this->getRequest(); $department_id = $request->getParam('department_id'); $degree_id = $request->getParam('degree_id'); $semester_id = $request->getParam('semester_id'); $group_id = $request->getParam('group_id'); if ('ALL' == strtoupper($group_id) or !isset($group_id)) { $groups = Acad_Model_DbTable_Groups::getClassGroups($department_id, $degree_id); } else { $groups = array($group_id); } $studentList = array(); $resultSet = array(); $resultSet['totalgroups'] = count($groups); $resultSet['group_id'] = $groups; $totalrows = 0; $totalstudents = 0; foreach ($groups as $key => $group_id) { $group_number = substr($group_id, strlen($group_id) - 1); $class = new Acad_Model_Class(); $class->setDepartment($department_id)->setDegree($degree_id)->setSemester($semester_id); $studentList = Acad_Model_ClassMapper::fetchSemesterStudents($class, $group_id); $totalstudents = $totalstudents + count($studentList); if ($totalrows < count($studentList)) { $totalrows = count($studentList); } $resultSet[$group_id] = array("group_number" => $group_number, "students" => $studentList); } $resultSet['totalrows'] = $totalrows; $resultSet['totalstudents'] = $totalstudents; echo $this->_helper->json($resultSet, false); }