public static function doSelectOrdered() { $criteria = new Criteria(); $criteria->addAscendingOrderByColumn(EmployeePeer::EMP_NO); $criteria->addAscendingOrderByColumn(EmployeePeer::NAME); return EmployeePeer::doSelect($criteria); }
public function executeList(sfWebRequest $request) { $c = new Criteria(); $c->add(EmployeePeer::STATUS, Constant::RECORD_STATUS_DELETED, Criteria::NOT_EQUAL); $c->add(EmployeePeer::ROLE_ID, 1, Criteria::NOT_EQUAL); $c->addAscendingOrderByColumn(EmployeePeer::DEPARTMENT_ID); $this->employees = EmployeePeer::doSelect($c); }
public static function GetStaff() { $c = new Criteria(); $c->add(EmployeePeer::STATUS, Constant::RECORD_STATUS_ACTIVE); $c->add(EmployeePeer::EMP_CATEGORY, 'staff'); $employees = EmployeePeer::doSelect($c); if ($employees) { return $employees; } else { return false; } }
public function executeEmployeeExpiration(sfWebRequest $request) { $this->form = new ReportExpirationForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); if ($this->form->isValid()) { $date = $this->form->getValue('date'); $date = mktime(0, 0, 0, $date['month'], $date['day'], $date['year']); $this->columns = $this->form->getValue('columns') ? $this->form->getValue('columns') : array(); $c = new Criteria(); $cton = $c->getNewCriterion(EmployeePeer::ID, null, Criteria::ISNULL); foreach ($this->columns as $column) { $ex = $c->getNewCriterion('employee.' . $column, $date, Criteria::LESS_EQUAL); $cton->addOr($ex); } $c->add($cton); $c->addAscendingOrderByColumn(EmployeePeer::LAST_NAME); $this->employees = EmployeePeer::doSelect($c); $this->date = $date; $this->setTemplate('employeeExpirationReport'); } } }
public function executeGetCounselorByAccal() { $accal_id = $this->getRequestParameter('academic_calendar_id'); $accal = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($accal); $c = new Criteria(); $c->add(EmployeePeer::DEPARTMENT_ID, $accal->getDepartment()->getIdRecursArray(), Criteria::IN); $c->add(EmployeePeer::IS_COUNSELOR, 1); $objs = EmployeePeer::doSelect($c); $counselors = array(); foreach ($objs as $o) { $counselors[$o->getId()] = $o->toString(); } $this->content = $counselors; $this->setTemplate('buildOptions'); }
public function getEmployees($criteria = null, $con = null) { include_once 'lib/model/om/BaseEmployeePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collEmployees === null) { if ($this->isNew()) { $this->collEmployees = array(); } else { $criteria->add(EmployeePeer::DEPARTMENT_ID, $this->getId()); EmployeePeer::addSelectColumns($criteria); $this->collEmployees = EmployeePeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(EmployeePeer::DEPARTMENT_ID, $this->getId()); EmployeePeer::addSelectColumns($criteria); if (!isset($this->lastEmployeeCriteria) || !$this->lastEmployeeCriteria->equals($criteria)) { $this->collEmployees = EmployeePeer::doSelect($criteria, $con); } } } $this->lastEmployeeCriteria = $criteria; return $this->collEmployees; }
public function executeListEmployee() { $course_id = $this->getRequestParameter('course_id'); $c = new Criteria(); $c->add(CourseScheduleTutorPeer::COURSE_SCHEDULE_ID, $course_id); $c->addJoin(CourseScheduleTutorPeer::EMPLOYEE_ID, TeachingCompetencyPeer::EMPLOYEE_ID); $c->addJoin(TeachingCompetencyPeer::EMPLOYEE_ID, EmployeePeer::ID); $objs = EmployeePeer::doSelect($c); $employee_ids = array(); foreach ($objs as $o) { $employee_ids[] = $o->getId(); } $subject_id = $this->getRequestParameter('subject_id'); $c = new Criteria(); $c->add(TeachingCompetencyPeer::SUBJECT_ID, $subject_id, Criteria::IN); $c->add(TeachingCompetencyPeer::EMPLOYEE_ID, $employee_ids, Criteria::NOT_IN); $c->addJoin(TeachingCompetencyPeer::EMPLOYEE_ID, EmployeePeer::ID); $c->addAscendingOrderByColumn(EmployeePeer::NAME); $this->sort($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filter($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'employee')); $this->getUser()->setAttribute('max_per_page', $rpp, 'employee'); $pager = new sfPropelPager('Employee', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'employee')); $this->getUser()->setAttribute('page', $page, 'employee'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions2 = array(array('name' => 'filter', 'color' => 'white')); $this->actions2 = $actions2; $this->subject_id = $subject_id; $this->course_id = $course_id; }
public function executeGetList() { if ($this->hasRequestParameter('employee_name') && $this->getRequestParameter('employee_name') != '') { $name = $this->getRequestParameter('employee_name'); $c = new Criteria(); $c->add(EmployeePeer::NAME, "%{$name}%", Criteria::LIKE); $this->rows = EmployeePeer::doSelect($c); } }
/** * Gets an array of Employee objects which contain a foreign key that references this object. * * If this collection has already been initialized with an identical Criteria, it returns the collection. * Otherwise if this Role has previously been saved, it will retrieve * related Employees from storage. If this Role is new, it will return * an empty collection or the current collection, the criteria is ignored on a new object. * * @param PropelPDO $con * @param Criteria $criteria * @return array Employee[] * @throws PropelException */ public function getEmployees($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(RolePeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collEmployees === null) { if ($this->isNew()) { $this->collEmployees = array(); } else { $criteria->add(EmployeePeer::ROLE_ID, $this->id); EmployeePeer::addSelectColumns($criteria); $this->collEmployees = EmployeePeer::doSelect($criteria, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(EmployeePeer::ROLE_ID, $this->id); EmployeePeer::addSelectColumns($criteria); if (!isset($this->lastEmployeeCriteria) || !$this->lastEmployeeCriteria->equals($criteria)) { $this->collEmployees = EmployeePeer::doSelect($criteria, $con); } } } $this->lastEmployeeCriteria = $criteria; return $this->collEmployees; }
public static function UpdateCompanyGrades($company_id) { $c = new Criteria(); $c->add(EmployeePeer::COMPANY_ID, $company_id); $employees = EmployeePeer::doSelect($c); foreach ($employees as $employee) { //calculate the employee grade /*$c = new Criteria(); $c->add(EmployeeGradePeer::COMPANY_ID,$company_id); $c->add(EmployeeGradePeer::STATUS,Constant::RECORD_STATUS_ACTIVE); $c->add(EmployeeGradePeer::MIN_VALUE, round ($employee->getRating(),Constant::ROUND_RATING),Criteria::LESS_EQUAL); $c->add(EmployeeGradePeer::MAX_VALUE, round ($employee->getRating(),Constant::ROUND_RATING),Criteria::GREATER_EQUAL); $grade = EmployeeGradePeer::doSelectOne($c); if($grade) $grade_id = $grade->getId(); else $grade_id = NULL; */ $connection = Propel::getConnection(); $rating = round($employee->getRating(), Constant::ROUND_RATING); $query = 'SELECT * FROM %s where company_id = %s and status = %s and ' . $rating . ' >= %s and ' . $rating . ' <= %s'; $query = sprintf($query, EmployeeGradePeer::TABLE_NAME, $employee->getCompanyId(), Constant::RECORD_STATUS_ACTIVE, EmployeeGradePeer::MIN_VALUE, EmployeeGradePeer::MAX_VALUE); $statement = $connection->prepare($query); $statement->execute(); $grade = $statement->fetch(PDO::FETCH_OBJ); if ($grade) { $grade_id = $grade->id; } else { $grade_id = NULL; } //now save employee object wicth calculated grade and rating $employee->setGradeId($grade_id); $employee->save(); } }
public function executeEditPicket() { $course_schedule = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_id')); $this->forward404Unless($course_schedule); $course_schedule_id = $course_schedule->getId(); $grade_options = array(); $c = new Criteria(); $c->add(SubjectGradingPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId(), Criteria::IN); $c->addAscendingOrderByColumn(SubjectGradingPeer::ID); $grades = SubjectGradingPeer::doSelect($c); foreach ($grades as $grade) { $grade_options[$grade->getId()] = $grade->getGradeComponent()->toString(); } $this->grade_options = $grade_options; $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo'); $employee_options = array(); $c = new Criteria(); $c->add(EmployeePeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN); $c->addAscendingOrderByColumn(EmployeePeer::NAME); $employees = EmployeePeer::doSelect($c); foreach ($employees as $employee) { $employee_options[$employee->getId()] = $employee->getName(); } $this->employee_options = $employee_options; $class_agenda = ClassAgendaPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($class_agenda); $this->setTemplate('edit'); $this->actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")), array('name' => 'cancel', 'url' => 'course_agenda/listPicket?course_id=' . $course_schedule->getId(), 'color' => 'black')); $this->subtitle = $course_schedule->getSubjectCurr()->getSubject()->getName() . ' - ' . $course_schedule->getClassGroup()->toString(); $this->type = 'edit'; $actions2 = array(array('name' => '<span>Agenda Kelas</span>', 'url' => 'course_agenda/listPicket?course_id=' . $course_schedule->getId(), 'color' => 'sun', 'type' => 'direct')); array_unshift($actions2, array('name' => '<span>Daftar Mata Pelajaran</span>', 'url' => 'course_subtitute/list', 'color' => 'sun')); array_push($actions2, array('name' => '<span>Absensi Kelas</span>', 'url' => 'course_absence/listShow?course_id=' . $course_schedule->getId(), 'color' => 'sun')); $this->actions2 = $actions2; $this->course_schedule_id = $course_schedule_id; $this->course_schedule = $course_schedule; $this->class_agenda = $class_agenda; }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(EmployeePeer::ID, $pks, Criteria::IN); $objs = EmployeePeer::doSelect($criteria, $con); } return $objs; }
public function executeGetLectors() { $subject_id = $this->getRequestParameter('subject_id'); $accal_id = $this->getRequestParameter('accal_id'); $accal = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($accal); $subject = SubjectPeer::retrieveByPK($subject_id); $subject_academic = null; if (!$subject) { $subject_academic_id = $this->getRequestParameter('subject_academic_id'); $subject_academic = SubjectAccalPeer::retrieveByPK($subject_academic_id); $subject = $subject_academic->getSubject(); } $this->forward404Unless($subject); $subject_id = $subject->getId(); if ($subject_academic == null) { $c = new Criteria(); $c->add(SubjectAccalPeer::ACADEMIC_CALENDAR_ID, $accal_id); $c->add(SubjectAccalPeer::SUBJECT_ID, $subject_id); $subject_academic = SubjectAccalPeer::doSelectOne($c); } $c = new Criteria(); $c->add(TeachingCompetencyPeer::SUBJECT_ID, $subject_id); $c->addJoin(TeachingCompetencyPeer::EMPLOYEE_ID, EmployeePeer::ID); $c->addAscendingOrderByColumn(EmployeePeer::EMP_NO); $objs = EmployeePeer::doSelect($c); $lectors = array(); $disabled = array(); $cs_counts = array(); foreach ($objs as $o) { $lectors[$o->getId()] = $o->toString(); if ($subject_academic) { $c = new Criteria(); $c->add(CourseSchedulePeer::EMPLOYEE_ID, $o->getId()); $c->add(CourseSchedulePeer::SUBJECT_ACCAL_ID, $subject_academic->getId()); $cs_count = CourseSchedulePeer::doCount($c); $cs_counts[$o->getId()] = $cs_count; } } $this->selected_lectors = array(); if ($subject_academic) { $sals = $subject_academic->getSubjectAccalLectors(); foreach ($sals as $sal) { $this->selected_lectors[$sal->getEmployeeId()] = 1; } } $this->cs_counts = $cs_counts; $this->lectors = $lectors; $this->forward404Unless($subject); $this->setTemplate('buildCheckBoxes'); $this->disabled = $disabled; $this->accal = $accal; $this->subject_academic = $subject_academic; }
public static function doSelectCoordinator() { $criteria = new Criteria(); $depts = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo'); $criteria->add(EmployeePeer::DEPARTMENT_ID, $depts->getChildRecurs(), Criteria::IN); $criteria->add(EmployeePeer::IS_THESIS_ADVISOR, true, Criteria::IN); return EmployeePeer::doSelect($criteria); }
public function executeBatchClassroomTimesheet(sfWebRequest $request) { // using the filters and the selected ID's get the set of provider ID's $ids = $request->getParameter('ids'); // apply filter $this->filters = new ClientFormFilter($this->getUser()->getAttribute('client.filters', array(), 'admin_module')); $c = $this->filters->buildCriteria($this->getFilters(), true); // limit to only the selected clients (save for later use in loop) $filter_crit = $c->add(ClientServicePeer::CLIENT_ID, $ids, Criteria::IN); // only get the set of employees $c->addGroupByColumn(ClientServicePeer::EMPLOYEE_ID); // get employees for all services $c->addJoin(ClientServicePeer::EMPLOYEE_ID, EmployeePeer::ID); $employees = EmployeePeer::doSelect($c); // for each provider, use the filter criteria to get just their timesheets $this->filters = new ClientFormFilter($this->getUser()->getAttribute('client.filters', array(), 'admin_module')); $filter_crit = $this->filters->buildCriteria($this->getFilters()); $filter_crit->add(ClientPeer::ID, $ids, Criteria::IN); $timesheet = array(); $i = 0; foreach ($employees as $employee) { $temp = clone $filter_crit; $timesheet[$i]['employee'] = $employee->getFullName(); $temp->add(ClientServicePeer::EMPLOYEE_ID, $employee->getId()); $client_servs = ClientServicePeer::doSelect($temp); $timesheet[$i]['clients_right'] = ''; $timesheet[$i]['clients_left'] = ''; $num = 0; foreach ($client_servs as $acs) { if ($num++ % 2) { $timesheet[$i]['clients_right'] .= $acs->getClient()->getFullName() . " - " . $acs->getFrequency() . "\n"; } else { $timesheet[$i]['clients_left'] .= $acs->getClient()->getFullName() . " - " . $acs->getFrequency() . "\n"; } } $timesheet[$i]['office'] = $acs->getOffice(); $timesheet[$i]['service'] = $acs->getService(); $timesheet[$i]['date'] = $acs->getStartDate('Y') . ' - ' . $acs->getEndDate('Y'); $i++; } /* foreach($timesheet as $asheet){ echo $asheet['employee'].'<br />'; foreach($asheet['clients'] as $kid){ echo $kid->getClient().'<br />'; } echo '<br />'; } die(); */ // create the document $doc = new sfTinyDoc(); $doc->createFrom(array('basename' => 'batchClassroomTimesheet')); $doc->loadXml('content.xml'); $doc->mergeXmlBlock('timesheet', $timesheet); $doc->saveXml(); $doc->close(); // send and remove the document $doc->sendResponse(); $doc->remove(); throw new sfStopException(); }
public function executePrintAbsenceXLS() { $academic_calendar_id = $this->getRequestParameter('academic_calendar_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id); $this->forward404Unless($academic_calendar); $department_id = $this->getRequestParameter('department_id'); $department = DepartmentPeer::retrieveByPK($department_id); $this->forward404Unless($department); $month_id = $this->getRequestParameter('month_id'); $month = MonthPeer::retrieveByPK($month_id); $this->forward404Unless($month); $tgl_absen1 = $this->getRequestParameter('tgl_absen1'); $tgl_absen2 = $this->getRequestParameter('tgl_absen2'); $time = $this->getRequestParameter('time'); $time2 = $this->getRequestParameter('time2'); $tgl_cetak = $this->getRequestParameter('tgl_cetak'); $cr = new Criteria(); $cr->add(TempTablePeer::COUNSELING_ID, $academic_calendar->getId()); $cr->add(TempTablePeer::STUDENT_ID, $department->getId()); $cr->add(TempTablePeer::TIME, $time); $cr->addJoin(EmployeePeer::ID, TempTablePeer::EMPLOYEE_ID); $cr->addAscendingOrderByColumn(EmployeePeer::ID); $employees = EmployeePeer::doSelect($cr); $this->academic_calendar = $academic_calendar; $this->department = $department; $this->time = $time; $this->time2 = $time2; $this->tgl_cetak = $tgl_cetak; $this->tgl_absen1 = $tgl_absen1; $this->tgl_absen2 = $tgl_absen2; $this->employees = $employees; $this->month = $month; $cli = new Criteria(); $cli->add(EmployeeRegulationPeer::REGULATION_TYPE, EmployeeRegulation::ABSENCE); $employ_regulations = EmployeeRegulationPeer::doSelect($cli); $groups = array(); $types = array(); $alls = array(); foreach ($employ_regulations as $emp_reg) { $groups[$emp_reg->getAcademicCalendarId() . '#' . $emp_reg->getGroups()] = $emp_reg->getId(); $types[$emp_reg->getAcademicCalendarId() . '#' . $emp_reg->getStaffTypeId()] = $emp_reg->getId(); $alls[$emp_reg->getAcademicCalendarId() . '#' . $emp_reg->getStaffTypeId() . '#' . $emp_reg->getGroups()] = $emp_reg->getId(); } $this->employ_regulations = $employ_regulations; $this->alls = $alls; $this->groups = $groups; $this->types = $types; $this->setLayout(false); $this->getResponse()->setHttpHeader('Content-Type', 'application/vnd-ms-excel'); $this->getResponse()->setHttpHeader('Content-Disposition', 'attachment; filename="' . $this->getModuleName() . '.xls"'); }
public function executeEditSched() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, 'schedule/listSched'); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $schedule = SchedulePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($schedule); $this->setTemplate('editSched'); $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); if ($acl->getRemovePriv()) { array_push($actions, array('name' => 'delete', 'url' => 'schedule/deleteSched?id=' . $schedule->getId(), 'color' => 'red')); } array_push($actions, array('name' => 'cancel', 'url' => 'schedule/listSched', 'color' => 'black')); $this->subtitle = $schedule->toString() . ' - id:' . $schedule->getId(); $this->type = 'edit'; $this->schedule = $schedule; $this->actions = $actions; $c = new Criteria(); $c->add(TeachingCompetencyPeer::SUBJECT_ID, $schedule->getSubjectCurr()->getSubjectId()); $c->addJoin(TeachingCompetencyPeer::EMPLOYEE_ID, EmployeePeer::ID); $objs = EmployeePeer::doSelect($c); $lectors = array(); foreach ($objs as $o) { $lectors[$o->getId()] = $o->getName(); } $this->coordinators = $lectors; $this->lectors = $lectors; $this->selected_lector = $schedule->getEmployeeId(); $subject_currs_options = array(); $c = new Criteria(); $c->add(SubjectCurrPeer::CURRICULUM_ID, $schedule->getSubjectCurr()->getCurriculumId()); $subject_currs = SubjectCurrPeer::doSelect($c); foreach ($subject_currs as $sa) { $subject_currs_options[$sa->getId()] = $sa->getSubject()->getName(); } $this->subject_currs = $subject_currs_options; $this->selected_subject_curr = $schedule->getSubjectCurrId(); }
public function executeAddLector() { $course_schedule = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($course_schedule); $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); array_push($actions, array('name' => 'cancel', 'url' => 'course_sched/preview?class_group_id=' . $course_schedule->getClassGroupId() . '&accal_id=' . $course_schedule->getAcademicCalendarId(), 'color' => 'black')); $this->subtitle = $course_schedule->getSubjectCurr()->getSubject()->getName() . ' - id:' . $course_schedule->getId(); $this->type = 'edit'; $this->course_schedule = $course_schedule; $this->actions = $actions; $c = new Criteria(); $c->add(TeachingCompetencyPeer::SUBJECT_ID, $course_schedule->getSubjectCurr()->getSubjectId()); $c->addJoin(TeachingCompetencyPeer::EMPLOYEE_ID, EmployeePeer::ID); $objs = EmployeePeer::doSelect($c); $lectors = array(); foreach ($objs as $o) { $lectors[$o->getId()] = $o->toString(); } $this->coordinators = $lectors; $this->lectors = $lectors; $c = new Criteria(); $c->add(CourseScheduleTutorPeer::COURSE_SCHEDULE_ID, $course_schedule->getId()); $c->addJoin(CourseScheduleTutorPeer::EMPLOYEE_ID, TeachingCompetencyPeer::EMPLOYEE_ID); $c->addJoin(TeachingCompetencyPeer::EMPLOYEE_ID, EmployeePeer::ID); $objs = EmployeePeer::doSelect($c); $employee_ids = array(); foreach ($objs as $o) { $employee_ids[] = $o->getId(); } $c = new Criteria(); $c->add(TeachingCompetencyPeer::SUBJECT_ID, $course_schedule->getSubjectCurr()->getSubjectId(), Criteria::IN); $c->add(TeachingCompetencyPeer::EMPLOYEE_ID, $employee_ids, Criteria::NOT_IN); $c->addJoin(TeachingCompetencyPeer::EMPLOYEE_ID, EmployeePeer::ID); $c->add(EmployeePeer::DEPARTMENT_ID, $course_schedule->getAcademicCalendar()->getDepartmentId(), Criteria::IN); $c->addAscendingOrderByColumn(EmployeePeer::NAME); $this->sortEmployee($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filterEmployee($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'employee')); $this->getUser()->setAttribute('max_per_page', $rpp, 'employee'); $pager = new sfPropelPager('Employee', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'employee')); $this->getUser()->setAttribute('page', $page, 'employee'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions2 = array(array('name' => 'filter', 'color' => 'white')); $this->actions2 = $actions2; }
private function getEmployeeByName($keyword) { $departmentAvailable = $this->cmsTools->departmentAvailable($this->department->getId()); $criteria = new Criteria(); $criteria->add(EmployeePeer::NAME, '%' . $keyword . '%', Criteria::LIKE); $criteria->add(EmployeePeer::DEPARTMENT_ID, $departmentAvailable, Criteria::IN); $employee = EmployeePeer::doSelect($criteria); $employeeId = array(); foreach ($employee as $e) { $employeeId[] = $e->getId(); } return $employeeId; }
public function executeGetLectors() { $subject_id = $this->getRequestParameter('subject_id'); $subject = SubjectPeer::retrieveByPK($subject_id); if (!$subject) { $subject_accal_id = $this->getRequestParameter('subject_accal_l_id'); $subject_accal = SubjectAccalPeer::retrieveByPK($subject_accal_id); $subject = $subject_accal->getSubject(); } $this->forward404Unless($subject); $subject_id = $subject->getId(); $c = new Criteria(); $c->add(TeachingCompetencyPeer::SUBJECT_ID, $subject_id); $c->addJoin(TeachingCompetencyPeer::EMPLOYEE_ID, EmployeePeer::ID); $objs = EmployeePeer::doSelect($c); $lectors = array(); foreach ($objs as $o) { $lectors[$o->getId()] = $o->toString(); } $this->content = $lectors; $this->forward404Unless($subject); $this->setTemplate('buildOptions'); }