Exemple #1
0
 protected function buildCriteria()
 {
     if (is_null($this->filters)) {
         $this->filters = $this->configuration->getFilterForm($this->getFilters());
     }
     $criteria = $this->filters->buildCriteria($this->getFilters());
     $event = $this->dispatcher->filter(new sfEvent($this, 'admin.build_criteria'), $criteria);
     $criteria = $event->getReturnValue();
     $deserter_students = StudentPeer::getDeserterStudents();
     $ids = array();
     foreach ($deserter_students as $student) {
         $ids[] = $student->getId();
     }
     $criteria->add(StudentPeer::ID, $ids, Criteria::IN);
     $total_criteria_desertores = count(StudentPeer::doSelect($criteria));
     $total_alumnos = count(StudentPeer::doSelect(new Criteria()));
     $this->getUser()->setAttribute('students_count', $total_criteria_desertores);
     $this->getUser()->setAttribute('students_percentaje', $total_criteria_desertores * 100 / $total_alumnos);
     return $criteria;
 }