Esempio n. 1
0
 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;
     }
 }