public function actionHistoryOrdinance() { date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Searched Ordinance History'; $activity->act_datetime = date('Y-m-d G:i:s'); $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id; $activity->save(); $model = new Ordinance('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Ordinance'])) { $model->attributes = $_GET['Ordinance']; } $this->render('historyOrdinance', array('model' => $model)); }
public function actionViewArchive() { date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Viewed Archived Ordinance List'; $activity->act_datetime = date('Y-m-d G:i:s'); $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id; $activity->save(); $model = new Ordinance('viewArchive'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Ordinance'])) { $model->attributes = $_GET['Ordinance']; } if (!empty($model->author)) { $u = implode(',', $model->author); $model->author = $u; } else { $model->author = ''; } if (!empty($model->imp_agency)) { $x = implode(',', $model->imp_agency); $model->imp_agency = $x; } else { $model->imp_agency = ''; } $this->render('viewArchive', array('model' => $model)); }
public function actionIndex() { $reso = new Resolution('searchIndex'); $reso->unsetAttributes(); // clear any default values if (isset($_GET['Resolution'])) { $reso->attributes = $_GET['Resolution']; } $ordi = new Ordinance('search'); $ordi->unsetAttributes(); // clear any default values if (isset($_GET['Ordinance'])) { $ordi->attributes = $_GET['Ordinance']; } $fquestion = new ForumQuestion('searchPosted'); $fquestion->unsetAttributes(); // clear any default values if (isset($_GET['ForumQuestion'])) { $model->attributes = $_GET['ForumQuestion']; } // renders the view file 'protected/views/site/index.php' // using the default layout 'protected/views/layouts/main.php' $months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); $jan = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-01%"'))); $feb = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-02%"'))); $mar = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-03%"'))); $apr = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-04%"'))); $may = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-05%"'))); $jun = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-06%"'))); $jul = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-07%"'))); $aug = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-08%"'))); $sep = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-09%"'))); $oct = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-10%"'))); $nov = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-11%"'))); $dec = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-12%"'))); $months_data = array($jan, $feb, $mar, $apr, $may, $jun, $jul, $aug, $sep, $oct, $nov, $dec); $jan1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-01%"'))); $feb1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-02%"'))); $mar1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-03%"'))); $apr1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-04%"'))); $may1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-05%"'))); $jun1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-06%"'))); $jul1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-07%"'))); $aug1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-08%"'))); $sep1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-09%"'))); $oct1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-10%"'))); $nov1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-11%"'))); $dec1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-12%"'))); $months_dataOrd = array($jan1, $feb1, $mar1, $apr1, $may1, $jun1, $jul1, $aug1, $sep1, $oct1, $nov1, $dec1); $sql = 'select distinct substring(res_no,6,9) as reso from tbl_resolution order by date_passed asc'; $connection = Yii::app()->db; $command = $connection->createCommand($sql); $years = $command->queryAll(); $sql1 = 'select distinct substring(ord_no,6,9) as ordi from tbl_ordinance order by date_passed asc'; $connection1 = Yii::app()->db; $command1 = $connection->createCommand($sql1); $yearsOrd = $command1->queryAll(); $y = array(); foreach ($years as $value) { array_push($y, count(Resolution::model()->findAll(array('condition' => 'res_no like "%' . $value['reso'] . '"')))); } $yOrd = array(); foreach ($yearsOrd as $value) { array_push($yOrd, count(Ordinance::model()->findAll(array('condition' => 'ord_no like "%' . $value['ordi'] . '"')))); } if (!empty(User::model()->findByPK(Yii::app()->user->name)->emp_id)) { date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Return to Homepage'; $activity->act_datetime = date('Y-m-d G:i:s'); $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id; $activity->save(); } $this->render('index', array('months_dataOrd' => $months_dataOrd, 'months' => $months, 'months_data' => $months_data, 'years' => $years, 'yOrd' => $yOrd, 'years_data' => $y, 'reso' => $reso, 'ordi' => $ordi, 'fquestion' => $fquestion)); }