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; }
/** * * Enter description here ... * @param Acad_Model_Course_Subject $subject * @param Date $dateFrom * @param Date $dateUpto * @param string $status * @param string $group_id * @param string $subject_mode_id * @param int $maxAbsent Maximum limit of absentism (It means minimum present) * @param int $minAbsent Minimum limit of absentism (maximum present count) */ public function fetchStudentAttendance(Acad_Model_Course_Subject $subject, $dateFrom = NULL, $dateUpto = NULL, $status = NULL, $group_id = NULL, $maxAbsent = NULL, $minAbsent = NULL, $coditionalMode = NULL) { $subject_code = $subject->getSubject_code(); $department = $subject->getDepartment_id(); $groupByCols = array('department_id', 'programme_id', 'semester_id', 'group_id', 'subject_code', 'subject_mode_id', 'student_roll_no', 'status'); $orderByCols = array('programme_id ASC', 'semester_id ASC', 'subject_code ASC', 'subject_mode_id ASC', 'group_id ASC', 'student_roll_no ASC', 'status ASC'); $select = $this->getDbTable()->getAdapter()->select()->from('vw_student_attendance', array('subject_mode_id', 'student_roll_no', 'status', 'counts' => 'COUNT(student_roll_no)'))->where('subject_code = ?', $subject_code)->where('student_roll_no IS NOT NULL')->group($groupByCols)->order($orderByCols); if ($department) { $select->where('department_id = ?', $department); } if ($dateFrom) { $date = new Zend_Date($dateFrom); $select->where('period_date >= ?', $date->get(Zend_Date::ISO_8601)); } if ($dateUpto) { $date = new Zend_Date($dateUpto); $select->where('period_date <= ?', $date->get(Zend_Date::ISO_8601)); } if ($status) { $select->where('status = ?', $status); } if ($group_id) { $select->where('group_id = ?', $group_id); } else { $select->columns('group_id'); } if ($maxAbsent) { $select->having('counts <= ?', $maxAbsent); } if ($minAbsent) { $select->having('counts >= ?', $minAbsent); } if (is_string($coditionalMode) and $coditionalMode) { $select->where('subject_mode_id = ?', $coditionalMode); } else { $modeString = self::_subjectModeQuery($subject); $select->where($modeString); } return $select->query()->fetchAll(Zend_Db::FETCH_GROUP); }