public function actionIndex()
 {
     $this->layout = "column2";
     $yearSelectRange = array();
     $yearSelectRange = YearRangeCollection::getCollection();
     $dateFrom = date("Y-m-d H:i:s", strtotime(sprintf("first day of October %s", date("Y"))));
     $dateTo = date("Y-m-d H:i:s", strtotime(sprintf("last day of September %s", intval(date("Y")) + 1)));
     if (Yii::app()->request->isPostRequest) {
         $searchRange = $_POST['searchRange'];
         $dateFrom = date("Y-m-d H:i:s", strtotime(sprintf("first day of October %s", $searchRange)));
         $dateTo = date("Y-m-d H:i:s", strtotime(sprintf("last day of September %s", intval($searchRange) + 1)));
     }
     $criteria = new CDbCriteria();
     $criteria->addCondition("DATE(term_from) between :dateFrom and :dateTo");
     $criteria->params = array(":dateFrom" => $dateFrom, ":dateTo" => $dateTo);
     $barangayOfficialsModels = BarangayOfficials::model()->findAll($criteria);
     $this->render('index', compact('yearSelectRange', 'dateFrom', 'dateTo', 'barangayOfficialsModels'));
 }
 /**
  * Test if collection returned is correct
  * @covers YearRangeCollection::getCollection()
  */
 public function testGetCollection()
 {
     $yearRangeCollection = YearRangeCollection::getCollection();
     $this->assertArrayHasKey('2015', $yearRangeCollection, 'Assert that there is 2015 in the array collection');
 }