public function executeSearchByDepartment(sfWebRequest $request) { $conn = Propel::getConnection(); $this->searchType = searchActions::SEARCH_BY_DEPARTMENT; $rawDeptList = DepartmentPeer::getAll($conn); $deptList = array(); foreach ($rawDeptList as $obj) { $deptList[$obj->getId()] = $obj->getId(); } $this->deptList = $deptList; if ($request->hasParameter("deptId")) { $deptId = $request->getParameter("deptId"); if (helperFunctions::isMaliciousString($deptId)) { $this->forward404(); } $this->deptId = $deptId; $deptObj = DepartmentPeer::retrieveByPK($deptId, $conn); $this->resultTitle = "Results for " . $deptObj->getId() . " (" . $deptObj->getDescr() . ")"; $this->results = $deptObj->getCourses(null, $conn); } else { $this->deptId = $rawDeptList[0]->getId(); } }