public function saveNewYearRecord()
 {
     $year = new Years();
     $year['description'] = Input::get('txtYear');
     if ($year->save()) {
         return 1;
     } else {
         return 0;
     }
 }
예제 #2
0
 public function sectionByYear()
 {
     $response = array();
     $infos = Years::find(Input::get('drpYearLvl'))['listBySection'];
     if (!empty($infos)) {
         foreach ($infos as $info) {
             $response[] = array("info_id" => $info['id'], "year" => $this->yearInfo($info['year_id'])['description'], "year_id" => $info['year_id'], "data_description" => $info['description']);
         }
     }
     return $response;
 }
예제 #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Years::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'year', $this->year]);
     return $dataProvider;
 }
예제 #4
0
 public function search($input)
 {
     $query = Years::query();
     $columns = Schema::getColumnListing('years');
     $attributes = array();
     foreach ($columns as $attribute) {
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     return [$query->get(), $attributes];
 }
예제 #5
0
 /**
  * Finds the Years model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Years the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Years::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }