public function series($noMonth) { $officials = Officials::model()->findAll(array('condition' => 'now() >= start_date and now() <= end_date', 'order' => 'off_id asc')); $resolutions = Resolution::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 ($resolutions as $reso) { $temp_reso = explode(',', $reso->author); foreach ($off as $val) { if (in_array($val, $temp_reso)) { $off2[$val]++; } } } foreach ($off2 as $values => $key) { $temp = array('name' => Officials::model()->findByPK($values)->Fullname, 'data' => array($key)); array_push($series, $temp); } return $series; }
/** * 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 Resolution the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Resolution::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php $box = $this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Choose Resolution No. :', 'headerIcon' => 'icon-th-list', 'htmlOptions' => array('class' => 'bootstrap-widget-table', 'style' => 'width:100%; margin-top:1%;'))); ?> <br> <div class="span8"> <div class="wide form"> <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get')); ?> <label>Resolution No.</label> <?php $this->widget('bootstrap.widgets.TbSelect2', array('model' => $model, 'attribute' => 'res_no', 'data' => CHtml::listData(Resolution::model()->findAll(), 'res_no', 'res_no'), 'options' => array('width' => '30%'))); ?> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => 'Search')); ?> </div> <?php $this->endWidget(); ?> </div> <?php $this->endWidget(); ?>
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'; } } }
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)); }
/* @var $this ResolutionController */ /* @var $model Resolution */ /* @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:98%;'))); ?> <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, 'res_no', CHtml::listData(Resolution::model()->findAll(), 'res_no', 'res_no'), array('class' => 'span3', 'empty' => 'Choose Resolution No.')); ?> <?php //echo $form->textFieldRow($model, 'res_no', array('class'=>'span4')); ?> <?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', 'data-placeholder' => ' ------------ Select Author ------------', 'options' => array('width' => '40%'))); ?> <?php