function select_tag_departments($name = 'departments', $selected = 2, $options = array()) { $c = new Criteria(); $c->addAscendingOrderByColumn(DepartmentPeer::NAME); $departments = DepartmentPeer::doSelect($c); return select_tag($name, objects_for_select($departments, 'getUuid', 'getName', $selected, array()), $options); }
public function executeList() { $c = new Criteria(); $c->add(DepartmentPeer::STATUS, Constant::RECORD_STATUS_DELETED, Criteria::NOT_EQUAL); $c->addAscendingOrderByColumn(DepartmentPeer::TITLE); $this->departments = DepartmentPeer::doSelect($c); }
public function departmentAvailable($id) { $return = array(); $current = DepartmentPeer::retrieveByPK($id); if ($current) { $return[] = $id; } else { return null; } $childCriteria = new Criteria(); $childCriteria->add(DepartmentPeer::PARENT, $id, Criteria::EQUAL); $child = DepartmentPeer::doSelect($childCriteria); if (!$child) { return $return; } $childArray = array(); foreach ($child as $c) { $return[] = $c->getId(); $childArray[] = $c->getId(); } $moreChildCriteria = new Criteria(); $moreChildCriteria->add(DepartmentPeer::PARENT, $childArray, Criteria::IN); $moreChild = DepartmentPeer::doSelect($moreChildCriteria); if (!$moreChild) { return $return; } foreach ($moreChild as $c) { $return[] = $c->getId(); } return $return; //$moreChildCriteria = new Criteria() }
public static function doSelectByStudent(Criteria $criteria, $con = null) { $usertype = sfContext::getInstance()->getUser()->getAttribute('usertype', 'common', 'bo'); $student = null; $student_id = null; if ($usertype == 'student') { $student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $student = StudentPeer::retrieveByPK($student_id); } if ($student == null) { $student_id = sfContext::getInstance()->getRequest()->getParameter('student_id'); $student = StudentPeer::retrieveByPK($student_id); } $criteria->add(StudentPeer::CURRICULUM_ID, $student->getCurriculumId()); $criteria->addJoin(StudentPeer::CURRICULUM_ID, CurriculumPeer::ID); $criteria->addJoin(CurriculumPeer::DEPARTMENT_ID, DepartmentPeer::ID); $tmp_depts = DepartmentPeer::doSelect($criteria); $depts = array(); foreach ($tmp_depts as $key => $val) { $pi = $val->getParentalIndex(); $prefix = ''; for ($i = 0; $i < $val->level - 1; $i++) { $prefix .= ParamsPeer::retrieveByCode('tree_node_mark')->getValue(); } $val->setdescription($prefix . $val->getDescription()); $val->setCode($prefix . $val->getCode()); $depts[$pi] = $val; } ksort($depts); $result = array(); foreach ($depts as $r) { $result[] = $r; } return $result; }
public static function GetDepartment() { $c = new Criteria(); $c->add(DepartmentPeer::STATUS, Constant::RECORD_STATUS_ACTIVE); $departments = DepartmentPeer::doSelect($c); return $departments; }
/** * Executes index action * */ public function executeIndex() { if ($this->getUser()->isAuthenticated()) { $this->redirect('@show_user_personal'); return sfView::SUCCESS; } $this->departments = DepartmentPeer::doSelect(new Criteria()); //$this->forward('default', 'module'); }
public function smsAvailable($departmentId) { return true; $departmentAvailable = array('TK'); $dc = new Criteria(); $dc->add(DepartmentPeer::CODE, $departmentAvailable, Criteria::IN); $dc->add(DepartmentPeer::ID, $departmentId, Criteria::EQUAL); $department = DepartmentPeer::doSelect($dc); if ($department) { return true; } else { return false; } }
public function getlist($param) { $department_id = $param['department_id']; $departmentAvailable = $this->tools->departmentAvailable($department_id); $this->criteria->add(DepartmentPeer::ID, $departmentAvailable, Criteria::IN); $this->criteria->addAscendingOrderByColumn(DepartmentPeer::NAME); $sectionTemp = DepartmentPeer::doSelect($this->criteria); $sections = array(); foreach ($sectionTemp as $section) { $sections[] = $section->toArray(); } $output = array('success' => 1, 'data' => $sections); $this->jsonwrapper->print_json($output); }
public function executeEnquiry() { $this->getEnquirer(); $this->getLayoutParam(); $this->step = 'enquiry'; /* Get Department */ $c = new Criteria(); $c->addAscendingOrderByColumn(DepartmentPeer::ID); //$c->addAscendingOrderByColumn(DepartmentPeer::ID); $department = DepartmentPeer::doSelect($c); $this->departments = array(); foreach ($department as $d) { if (!array_key_exists($d->getParent(), $this->departments)) { $this->departments[$d->getParent()] = array(); } $this->departments[$d->getParent()][] = $d->toArray(); } $this->departments = $this->jsonwrapper->json_encode($this->departments); }
public function getDepartments($DepParent) { try { $result = array(); $criteria = new Criteria('workflow'); $criteria->add(DepartmentPeer::DEP_PARENT, $DepParent, Criteria::EQUAL); $con = Propel::getConnection(DepartmentPeer::DATABASE_NAME); $objects = DepartmentPeer::doSelect($criteria, $con); $oUsers = new Users(); foreach ($objects as $oDepartment) { $node = array(); $node['DEP_UID'] = $oDepartment->getDepUid(); $node['DEP_PARENT'] = $oDepartment->getDepParent(); $node['DEP_TITLE'] = $oDepartment->getDepTitle(); $node['DEP_STATUS'] = $oDepartment->getDepStatus(); $node['DEP_MANAGER'] = $oDepartment->getDepManager(); $node['DEP_LDAP_DN'] = $oDepartment->getDepLdapDn(); $node['DEP_LAST'] = 0; $manager = $oDepartment->getDepManager(); if ($manager != '') { $UserUID = $oUsers->load($manager); $node['DEP_MANAGER_USERNAME'] = isset($UserUID['USR_USERNAME']) ? $UserUID['USR_USERNAME'] : ''; $node['DEP_MANAGER_FIRSTNAME'] = isset($UserUID['USR_FIRSTNAME']) ? $UserUID['USR_FIRSTNAME'] : ''; $node['DEP_MANAGER_LASTNAME'] = isset($UserUID['USR_LASTNAME']) ? $UserUID['USR_LASTNAME'] : ''; } else { $node['DEP_MANAGER_USERNAME'] = ''; $node['DEP_MANAGER_FIRSTNAME'] = ''; $node['DEP_MANAGER_LASTNAME'] = ''; } $criteria = new \Criteria(); $criteria->add(UsersPeer::DEP_UID, $node['DEP_UID'], \Criteria::EQUAL); $node['DEP_MEMBERS'] = UsersPeer::doCount($criteria); $criteriaCount = new Criteria('workflow'); $criteriaCount->clearSelectColumns(); $criteriaCount->addSelectColumn('COUNT(*)'); $criteriaCount->add(DepartmentPeer::DEP_PARENT, $oDepartment->getDepUid(), Criteria::EQUAL); $rs = DepartmentPeer::doSelectRS($criteriaCount); $rs->next(); $row = $rs->getRow(); $node['HAS_CHILDREN'] = $row[0]; $result[] = $node; } if (count($result) >= 1) { $result[count($result) - 1]['DEP_LAST'] = 1; } return $result; } catch (exception $e) { throw $e; } }
public function handleErrorUpdateProfile() { $this->forward404Unless($this->getUser()->isAuthenticated(), 'not logged in, cannot edit profile, obviously'); $this->tab = "editprofile"; $this->profile = $this->getUser()->getProfile(); $this->campuses = CampusPeer::doSelect(new Criteria()); $this->departments = DepartmentPeer::doSelect(new Criteria()); $this->subdepartments = SubdepartmentPeer::doSelect(new Criteria()); $this->setTemplate("editProfile"); return sfView::SUCCESS; }
public static function getAll(PropelPDO $propelConnection) { $c = new Criteria(); $c->addAscendingOrderByColumn(DepartmentPeer::ID); return DepartmentPeer::doSelect($c, $propelConnection); }
public function handleErrorSaveNew() { //$this->project = ProjectPeer::retrieveBySlug($this->getRequestParameter('project')); //$this->forward404Unless($this->project, 'Project not found using slug ['.$this->getRequestParameter('project').']'); $this->project = new Project(); $this->campuses = CampusPeer::doSelect(new Criteria()); $this->departments = DepartmentPeer::doSelect(new Criteria()); $this->setTemplate('create'); return sfView::SUCCESS; }
public function executeListFilter() { $this->campuses = CampusPeer::doSelect(new Criteria()); $this->departments = DepartmentPeer::doSelect(new Criteria()); }
public function getDepartmentsRelatedByParent($criteria = null, $con = null) { include_once 'lib/model/om/BaseDepartmentPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collDepartmentsRelatedByParent === null) { if ($this->isNew()) { $this->collDepartmentsRelatedByParent = array(); } else { $criteria->add(DepartmentPeer::PARENT, $this->getId()); DepartmentPeer::addSelectColumns($criteria); $this->collDepartmentsRelatedByParent = DepartmentPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(DepartmentPeer::PARENT, $this->getId()); DepartmentPeer::addSelectColumns($criteria); if (!isset($this->lastDepartmentRelatedByParentCriteria) || !$this->lastDepartmentRelatedByParentCriteria->equals($criteria)) { $this->collDepartmentsRelatedByParent = DepartmentPeer::doSelect($criteria, $con); } } } $this->lastDepartmentRelatedByParentCriteria = $criteria; return $this->collDepartmentsRelatedByParent; }
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(DepartmentPeer::ID, $pks, Criteria::IN); $objs = DepartmentPeer::doSelect($criteria, $con); } return $objs; }
public function getDepartmentChild($parent_id, $departmentAvailable) { $criteria = new Criteria(); $criteria->add(DepartmentPeer::PARENT, $parent_id, Criteria::IN); $criteria->add(DepartmentPeer::ID, $departmentAvailable, Criteria::IN); $criteria->addAscendingOrderByColumn(DepartmentPeer::NAME); $result = DepartmentPeer::doSelect($criteria); if (!$result) { return false; } else { return $result; } }