/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionDownloadOrdinance($id) { date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Downloaded Ordinance No. ' . $id; $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 = Ordinance::model()->findByPK($id); $year = substr($model->ord_no, strlen($model->ord_no) - 4); $file = $model->ordi_file; if (file_exists(Yii::getPathOfAlias('webroot') . '/protected/document/Ordinance/' . $year . '/' . $model->ord_no . '/' . $file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . basename(Yii::getPathOfAlias('webroot') . '/protected/document/Ordinance/' . $year . '/' . $model->ord_no . '/' . $file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize(Yii::getPathOfAlias('webroot') . '/protected/document/Ordinance/' . $year . '/' . $model->ord_no . '/' . $file)); ob_clean(); flush(); readfile(Yii::getPathOfAlias('webroot') . '/protected/document/Ordinance/' . $year . '/' . $model->ord_no . '/' . $file); exit; } else { } }
$box = $this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Choose Ordinance No. :', 'headerIcon' => 'icon-th-list', 'htmlOptions' => array('class' => 'bootstrap-widget-table', 'style' => 'width:100%;'))); ?> <br> <div class="span8"> <div class="well form-inline"> <?php echo CHtml::beginForm(); ?> <div style="alignment-baseline:5px; "> <label>Ordinance No.</label> <?php $this->widget('bootstrap.widgets.TbSelect2', array('model' => $model, 'attribute' => 'ord_no', 'data' => CHtml::listData(Ordinance::model()->findAll(), 'ord_no', 'ord_no'), 'asDropDownList' => array(''))); ?> <?php echo CHtml::htmlButton('<i class="icon-search icon-white"></i> Search', array('class' => 'btn btn-success', 'type' => 'submit', 'name' => 'searchButton')); ?> </div> <?php echo CHtml::endForm(); ?> </div><!-- form --> <?php $this->endWidget(); ?> </div><!-- form --> </div><!-- search-form -->
/* @var $this OrdinanceController */ /* @var $model Ordinance */ /* @var $form CActiveForm */ $box = $this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Advanced Search', 'headerIcon' => 'icon-th-list', 'htmlOptions' => array('class' => 'bootstrap-widget-table', 'style' => 'width:100%;'))); ?> <br> <div class="span8"> <div class="wide form"> <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get')); CHtml::$afterRequiredLabel = ''; ?> <?php echo $form->dropDownListRow($model, 'ord_no', CHtml::listData(Ordinance::model()->findAll(), 'ord_no', 'ord_no'), array('class' => 'span3', 'empty' => 'Choose Ordinance Number')); ?> <?php echo $form->dropDownListRow($model, 'meeting_ordi_id', $model->isNewRecord ? CHtml::listData(CommMeetingOrdi::model()->findAll(array('condition' => 'comm_meeting_stat=1 and ord_remark=0')), 'meeting_ordi_id', 'ControlNumber') : CHtml::listData(CommMeetingOrdi::model()->findAll(), 'meeting_ordi_id', 'ControlNumber'), array('class' => 'span3', 'empty' => $model->isNewRecord ? '------ Select Control No. ------' : $model->meetingOrdi->ControlNumber)); ?> <?php echo $form->textFieldRow($model, 'subj_matter', array('class' => 'span4')); ?> <?php echo $form->select2Row($model, 'author', array('asDropDownList' => true, 'data' => CHtml::listData(Officials::model()->findAll(''), 'off_id', 'Fullname'), 'multiple' => 'multiple', 'options' => array('width' => '40%', 'placeholder' => ' ------------ Choose Author ------------', 'tokenSeparators' => array(',', ' '))));
<?php $box = $this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Advanced Search', 'headerIcon' => 'icon-th-list', 'htmlOptions' => array('class' => 'bootstrap-widget-table', 'style' => 'width:100%;'))); ?> <br> <div class="span8"> <div class="wide form"> <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get')); CHtml::$afterRequiredLabel = ''; ?> <?php echo $form->dropDownListRow($model, 'monitor_id', CHtml::listData(MonitorOrd::model()->findAll(), 'monitor_id', 'monitor_id'), array('empty' => '--- Choose ID. ---')); ?> <?php echo $form->dropDownListRow($model, 'ord_no', CHtml::listData(Ordinance::model()->findAll(), 'ord_no', 'ord_no'), array('empty' => '----- Choose Ordinance -----')); ?> <?php echo $form->textFieldRow($model, 'subj_matter', array('class' => 'span4')); ?> <?php echo $form->select2Row($model, 'agency_id', array('asDropDownList' => true, 'data' => CHtml::listData(Agency::model()->findAll(), 'agency_id', 'agency_name'), 'multiple' => 'multiple', 'data-placeholder' => ' ------------ Select Agency ------------', 'options' => array('maximumSelectionSize' => 1, 'class' => 'span4'))); ?> <?php echo $form->datepickerRow($model, 'date_furnished', array('prepend' => '<i class="icon-calendar"></i>', 'options' => array('format' => 'yyyy-mm-dd'))); ?> <?php echo $form->dropDownListRow($model, 'status', array(0 => 'Implemented', 1 => 'Partially Implemented', 2 => 'Not Implemented'), array('empty' => '----- Choose Status -----'));
public function getTitle($d) { $x = Referral::model()->findByAttributes(array('ctrl_no' => $d)); if (!empty($x->ref_id)) { if ($this->cat->cat_name == 'Provincial Ordinance') { $ord = CommMeetingOrdi::model()->findAll(array('condition' => 'ref_id=' . $x->ref_id, 'order' => 'date_meeting desc', 'limit' => 1)); $y = ''; foreach ($ord as $key) { $y = $key->meeting_ordi_id; } if (!empty(Ordinance::model()->findByAttributes(array('meeting_ordi_id' => $y))->ord_no)) { echo 'Ord No. ' . Ordinance::model()->findByAttributes(array('meeting_ordi_id' => $y))->ord_no; } else { echo 'None'; } } else { $reso = CommMeetingReso::model()->findAll(array('condition' => 'ref_id=' . $x->ref_id, 'order' => 'date_meeting desc', 'limit' => 1)); foreach ($reso as $key) { if (!empty($key->comm_report)) { if (!empty(Resolution::model()->findByAttributes(array('ctrl_no' => $d))->res_no)) { echo 'Res No. ' . Resolution::model()->findByAttributes(array('ctrl_no' => $d))->res_no; } else { echo 'None'; } } else { echo 'None'; } } } } else { if (!empty(Resolution::model()->findByAttributes(array('ctrl_no' => $d))->res_no)) { echo 'Res No. ' . Resolution::model()->findByAttributes(array('ctrl_no' => $d))->res_no; } else { echo 'None'; } } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Ordinance the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Ordinance::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function seriesOrd($noMonth) { $officials = Officials::model()->findAll(array('condition' => 'now() >= start_date and now() <= end_date', 'order' => 'off_id asc')); $ordinance = Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-' . $noMonth . '%"')); $series = array(); $off = array(); $off2 = array(); $x = 0; foreach ($officials as $v) { $off2[$v->off_id] = 0; $x++; } foreach ($officials as $val) { array_push($off, $val->off_id); } foreach ($ordinance as $ord) { $temp_ord = explode(',', $ord->author); foreach ($off as $val) { if (in_array($val, $temp_ord)) { $off2[$val]++; } } } foreach ($off2 as $values => $key) { $temp = array('name' => Officials::model()->findByPK($values)->Fullname, 'data' => array($key)); array_push($series, $temp); } return $series; }
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)); }