public function canRevertCalificate(PropelPDO $con = null) { $course_subject = CourseSubjectPeer::retrieveByCourseId($this->getId()); if (!is_null($course_subject)) { $c = new Criteria(); $c->add(CourseSubjectStudentPeer::COURSE_SUBJECT_ID, $course_subject->getId()); $c->add(CourseSubjectStudentPeer::IS_NOT_AVERAGEABLE, true); return CourseSubjectStudentPeer::doCount($c) > 0; } return true; }
public function executeAttendanceSheet(sfWebRequest $request) { if ($request->isMethod('POST')) { $this->user_course_subject = true; $attendance_sheet = $request->getParameter("attendance_sheet"); $this->course_id = $attendance_sheet['division_or_course_id']; $this->form = new AttendanceSheetForm(); $this->form->bind($request->getParameter($this->form->getName())); if ($this->form->isValid()) { $date_range = $attendance_sheet['date_range']; $this->from_date = $date_range['from']; $this->to_date = $date_range['to']; list($day, $month, $year) = explode("/", $this->from_date); $start_date = mktime(date('H'), date('i'), date('s'), $month, $day, $year); list($day, $month, $year) = explode("/", $this->to_date); $end_date = mktime(date('H'), date('i'), date('s'), $month, $day, $year); $total_days = ($end_date - $start_date) / (60 * 60 * 24); $this->days = $this->getDays($start_date, $total_days); $this->course_subject = CourseSubjectPeer::retrieveByCourseId($this->course_id); $this->course_subject_id = $this->course_subject->getId(); $this->students = $this->course_subject->getStudents(); $this->setTemplate('attendanceSheet', 'division'); $this->setLayout('cleanLayout'); } else { $this->getUser()->setFlash('error', 'Por favor, complete los campos de fecha correctamente.'); $this->redirect('commission/attendanceSheetByCourseSubject?id=' . $this->course_id); } } }