Пример #1
0
 public function executeSearchByProgram(sfWebRequest $request)
 {
     $conn = Propel::getConnection();
     $today = getdate();
     $this->searchType = searchActions::SEARCH_BY_PROGRAM;
     $rawProgList = DisciplinePeer::doSelectAll($conn);
     $this->programList = array();
     foreach ($rawProgList as $obj) {
         $this->programList[$obj->getId()] = $obj->getDescr();
     }
     $this->yearList = array("0" => "All", "1" => "First Year", "2" => "Second Year", "3" => "Third Year", "4" => "Fourth Year");
     if ($request->hasParameter("year") && $request->hasParameter("program")) {
         $this->programId = $request->getParameter("program");
         if (helperFunctions::isMaliciousString($this->programId)) {
             $this->forward404();
         }
         $this->year = $request->getParameter("year");
         if (helperFunctions::isMaliciousString($this->year)) {
             $this->forward404();
         }
         // get result set
         $discipline = DisciplinePeer::retrieveByPK($this->programId, $conn);
         if (!is_object($discipline)) {
             $this->forward404();
         }
         $this->resultTitle = "Results for " . $discipline->getDescr();
         $this->results = CoursePeer::findCoursesByDisciplineIdAndYear($this->programId, $this->year, $conn);
     } else {
         $this->programId = $rawProgList[0]->getId();
         $this->year = 1;
     }
 }