Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : Referral | ||
return | Referral | the static model class |
public function deactivate($contractor_id) { $criteria = new CDbCriteria(); $criteria->condition = "user_type='contractor' AND userid=" . $contractor_id; Affiliates::model()->deleteAll($criteria); Referral::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "owner_user_type='contractor' AND owner_id=" . $contractor_id; Answers::model()->deleteAll($criteria); Questions::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "user_type='contractor' AND deleted_by=" . $contractor_id; Messagedeleted::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "from_user_type='contractor' AND from_id=" . $contractor_id; Messages::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "to_user_type='contractor' AND to_id=" . $contractor_id; Messages::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "viewed_user_type='contractor' AND viewed_by=" . $contractor_id; QuestionViews::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "referred_by_type='contractor' AND referred_by=" . $contractor_id; Referral::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "invited_id=" . $contractor_id; ContractorTeam::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "contractor_id=" . $contractor_id; ContractorBond::model()->deleteAll($criteria); ContractorLicense::model()->deleteAll($criteria); ContractorPoints::model()->deleteAll($criteria); ContractorSocials::model()->deleteAll($criteria); ContractorTeam::model()->deleteAll($criteria); ContractorViews::model()->deleteAll($criteria); Contractorphotos::model()->deleteAll($criteria); Feedback::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "ContractorId=" . $contractor_id; self::model()->deleteAll($criteria); return true; }
/** * Return the open referral choices for the patient. * * @return Referral[] */ public function getReferralChoices($element = null) { $criteria = new CdbCriteria(); $criteria->addCondition('patient_id = :pid'); $criteria->addCondition('closed_date is null'); $criteria->params = array('pid' => $this->patient->id); // if the referral has been closed but is the selected referral for the event, needs to be part of the list if ($element && $element->referral_id) { $criteria->addCondition('id = :crid', 'OR'); $criteria->params[':crid'] = $element->referral_id; } $criteria->order = 'received_date DESC'; return Referral::model()->findAll($criteria); }
public function actionCommReportYearly() { date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Searched Yearly Committe Report per Committe'; $activity->act_datetime = date('Y-m-d G:i:s'); $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id; $activity->save(); $comm_name = ''; $ref_id = ''; $year = date('Y'); if (isset($_POST['searchButton'])) { $comm_name = $_POST['comm_name']; $year = $_POST['year']; $x = Committee::model()->findByPK($comm_name); $referrals = CHtml::listData(Referral::model()->findAll(array('condition' => 'lead_committee = :lcomm', 'params' => array(':lcomm' => $x->comm_id))), 'ref_id', 'ref_id'); $criteria = new CDbCriteria(); $criteria->condition = "action_taken <> 0 and comm_report like :comm_rep"; $criteria->params = array(':comm_rep' => $year . '%'); $criteria->addInCondition("ref_id", $referrals); $criteria->order = 'comm_report asc'; $dataProviderReso = new CActiveDataProvider('CommMeetingReso', array('criteria' => $criteria, 'pagination' => array('pageSize' => 20))); $dataProviderOrd = new CActiveDataProvider('CommMeetingOrdi', array('criteria' => $criteria, 'pagination' => array('pageSize' => 20))); date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Searched Yearly Committe Report of ' . $x->comm_name; $activity->act_datetime = date('Y-m-d G:i:s'); $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id; $activity->save(); } else { $dataProviderReso = new CActiveDataProvider('CommMeetingReso', array('criteria' => array('condition' => 'action_taken <> 0 or comm_report = null'), 'pagination' => array('pageSize' => 20))); $dataProviderOrd = new CActiveDataProvider('CommMeetingOrdi', array('criteria' => array('condition' => 'action_taken <> 0 or comm_report = null'), 'pagination' => array('pageSize' => 20))); } $this->render('commReportYearly', array('comm_name' => $comm_name, 'year' => $year, 'dataProviderReso' => $dataProviderReso, 'dataProviderOrd' => $dataProviderOrd)); }
public function getReferralDate($ctrl) { if ($ctrl) { $x = CommMeetingOrdi::model()->findByAttributes(array('meeting_ordi_id' => $ctrl))->ref_id; return Referral::model()->findByPK($x)->date_referred; } else { return 'No Referral Date'; } }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['CommMeetingReso'])) { $model->attributes = $_POST['CommMeetingReso']; $model->archive = 0; $ref_id = Referral::model()->findByAttributes(array('ctrl_no' => $model->ref_id))->ref_id; $model->ref_id = $ref_id; $model->remark = 0; if ($model->action_taken != 0) { //Status::model()->updateAll(array('referral_stat' => 1), 'ctrl_no = ' . $model->ref->ctrl_no); Referral::model()->updateByPK($model->ref_id, array('referral_stat' => 1)); $stat = Status::model()->findByAttributes(array('ctrl_no' => $model->ref->ctrl_no)); $stat->ctrl_no = $model->ref->ctrl_no; $stat->comm_meeting_stat = 1; $stat->remarks = 0; $stat->save(); //die('approve'); } else { $stat = Status::model()->findByAttributes(array('ctrl_no' => $model->ref->ctrl_no)); $stat->ctrl_no = $model->ref->ctrl_no; $stat->comm_meeting_stat = 0; $stat->remarks = 0; $stat->save(); //die('pending'); } $picture_name = ''; $picture_file = CUploadedFile::getInstance($model, 'comm_rep_file'); $model->comm_rep_file = $picture_file; $year = substr($model->ref->ctrl_no, 0, 4); if ($picture_file) { $picture_name = $picture_file->name; if (!is_dir(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year)) { mkdir(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year); mkdir(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year . '/' . $model->ref->ctrl_no); $picture_file->SaveAs(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year . '/' . $model->ref->ctrl_no . '/' . $picture_file->getName()); } else { if (!file_exists(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year . '/' . $model->ref->ctrl_no)) { //die('exists'); //mkdir(Yii::getPathOfAlias('webroot').'/protected/document/commMeetingReso/'.$year.'/'.$model->ref->ctrl_no); $picture_file->SaveAs(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year . '/' . $model->ref->ctrl_no . '/' . $picture_file->getName()); } else { //mkdir(Yii::getPathOfAlias('webroot').'/protected/document/commMeetingReso/'.$year.'/'.$model->ref->ctrl_no); $picture_file->SaveAs(Yii::getPathOfAlias('webroot') . '/protected/document/commMeetingReso/' . $year . '/' . $model->ref->ctrl_no . '/' . $picture_file->getName()); } } } if ($model->save() && $model->validate()) { date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Updated Committee Meeting ID: ' . $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(); $this->redirect(array('view', 'id' => $model->meeting_reso_id)); } } $this->render('update', array('model' => $model)); }
<td style="border-top-style: 1px solid black;">' . $origin . '</td>'; $tbl .= '</tr>'; if ($referral == '0000-00-00') { $tbl .= '<tr nobr="true"> <td style="border-top-style: 1px solid black; font-size:16px; font-weight:bold;">C) Referral Date</td> <td style="border-top-style: 1px solid black;">: N/A</td>'; } else { $tbl .= '<tr nobr="true"> <td style="border-top-style: 1px solid black; font-size:16px; font-weight:bold;">C) Referral Date</td> <td style="border-top-style: 1px solid black;">' . $refer1->format('M j, Y') . '</td>'; } $tbl .= '</tr>'; $tbl .= '<tr nobr="true"> <td style="border-top-style: 1px solid black; font-size:15px; font-weight:bold;">D) Date Meeting/s</td>'; $meetings = ''; $temp = Referral::model()->findByAttributes(array('ctrl_no' => $model->ctrl_no)); if (empty($temp)) { $meetings = '0000-00-00'; } else { $x = CommMeetingReso::model()->find(array('condition' => 'ref_id = "' . $temp->ref_id . '"')); if ($x == null) { $meetings = '0000-00-00'; } else { $IAs = CommMeetingReso::model()->findAll(array('condition' => 'ref_id = "' . $temp->ref_id . '"', 'order' => 'date_meeting desc')); $iaName = CHtml::listData($IAs, 'date_meeting', 'date_meeting'); foreach ($iaName as $val) { $meetings = $val . '' . $meetings; } } } $meetings1 = new DateTime($meetings, $timezone);
public function countCommMeetingOrdi() { $cat = Category::model()->findByAttributes(array('cat_name' => 'Provincial Ordinance'))->cat_id; $result = CHtml::listData(Communication::model()->findAll(array('condition' => 'cat_id = ' . $cat . ' and comm_stat=1')), 'ctrl_no', 'ctrl_no'); $criteria = new CDbCriteria(); $criteria->condition = 'archive=0 and referral_stat=0'; $criteria->addInCondition("ctrl_no", $result); $criteria->compare('ctrl_no', $this->ctrl_no, true); return Referral::model()->findAll($criteria); }
?> <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, 'meeting_ordi_id', CHtml::listData(CommMeetingOrdi::model()->findAll(), 'meeting_ordi_id', 'meeting_ordi_id'), array('class' => 'span3', 'prompt' => 'Committee Meeting ID')); ?> <?php echo $form->dropDownListRow($model, 'ref_id', CHtml::listData(Referral::model()->findAll(), 'ref_id', 'ctrl_no'), array('class' => 'span3', 'prompt' => 'Control Number')); ?> <?php echo $form->dropDownListRow($model, 'action_taken', array(0 => 'Pending', 1 => 'Approved', 2 => 'Return to Origin'), array('class' => 'span3', 'prompt' => 'Action Taken')); ?> <?php echo $form->datepickerRow($model, 'date_meeting', array('prepend' => '<i class="icon-calendar"></i>', 'options' => array('format' => 'yyyy-mm-dd'))); ?> <?php echo $form->datepickerRow($model, 'public_hearing', array('prepend' => '<i class="icon-calendar"></i>', 'options' => array('format' => 'yyyy-mm-dd'))); ?>
/** * 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 Referral the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Referral::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
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 actionCreate($id) { $model = new Ordinance(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); $count = count(Ordinance::model()->findAll()) + 1; if ($count <= 99) { if ($count <= 9) { $count = '00' . $count . ' - ' . date('Y'); } else { $count = '0' . $count . ' - ' . date('Y'); } } else { $count = $count . ' - ' . date('Y'); } if (isset($_POST['Ordinance'])) { $model->attributes = $_POST['Ordinance']; $x = CommMeetingOrdi::model()->find(array('condition' => 'comm_report IS NOT NULL and ref_id = ' . Referral::model()->findByAttributes(array('ctrl_no' => $model->meeting_ordi_id))->ref_id))->meeting_ordi_id; $model->meeting_ordi_id = $x; $model->archive = 0; $picture_name = ''; $picture_file = CUploadedFile::getInstance($model, 'ordi_file'); $model->ordi_file = $picture_file; if ($picture_file) { $picture_name = $picture_file->name; if (!is_dir(Yii::getPathOfAlias('webroot') . '/protected/document/ordinance/' . substr($model->ord_no, 6, 9))) { mkdir(Yii::getPathOfAlias('webroot') . '/protected/document/ordinance/' . substr($model->ord_no, 6, 9)); } if (!is_dir(Yii::getPathOfAlias('webroot') . '/protected/document/ordinance/' . substr($model->ord_no, 6, 9) . '/' . $model->ord_no)) { mkdir(Yii::getPathOfAlias('webroot') . '/protected/document/ordinance/' . substr($model->ord_no, 6, 9) . '/' . $model->ord_no); $picture_file->SaveAs(Yii::getPathOfAlias('webroot') . '/protected/document/ordinance/' . substr($model->ord_no, 6, 9) . '/' . $model->ord_no . '/' . $picture_file->getName()); } else { $picture_file->SaveAs(Yii::getPathOfAlias('webroot') . '/protected/document/ordinance/' . substr($model->ord_no, 6, 9) . '/' . $model->ord_no . '/' . $picture_file->getName()); } } $model->author = implode(',', $model->author); $model->imp_agency = implode(',', $model->imp_agency); $model->input_by = User::model()->findByPK(Yii::app()->user->name)->emp_id; //------------------------------------------------- $stat = Status::model()->findByAttributes(array('ctrl_no' => $model->meetingOrdi->ref->ctrl_no)); $stat->remarks = 1; $stat->save(); CommMeetingOrdi::model()->updateByPK($model->meeting_ordi_id, array('comm_meeting_stat' => 1, 'ord_remark' => 1)); if ($model->save() && $model->validate()) { date_default_timezone_set("Asia/Manila"); } $activity = new Activity(); $activity->act_desc = 'Added Another Ordinance'; $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->redirect(array('view', 'id' => $model->ord_no)); } $this->render('create', array('model' => $model, 'count' => $count, 'id' => $id)); }
/** * Ensure that referral assigned to the element is for the correct patient. * * @param $attribute * @param $params * * @throws Exception */ public function validateReferral($attribute, $params) { if (!$this->canChangeReferral() && $this->{$attribute} != $this->_original_referral_id) { $this->addError($attribute, 'Referral cannot be changed after an operation has been scheduled'); } elseif ($referral_id = $this->{$attribute}) { if (!($referral = Referral::model()->findByPk($referral_id))) { throw new Exception('Invalid referral id set on ' . get_class($this)); } if ($referral->patient_id != $this->getPatient()->id) { $this->addError($attribute, 'Referral must be for the patient of the event'); } } }
public function deactivate($homeowner_id) { $criteria = new CDbCriteria(); $criteria->condition = "user_type='homeowner' AND userid=" . $homeowner_id; Affiliates::model()->deleteAll($criteria); Referral::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "owner_user_type='homeowner' AND owner_id=" . $homeowner_id; Answers::model()->deleteAll($criteria); Questions::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "user_type='homeowner' AND deleted_by=" . $homeowner_id; Messagedeleted::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "from_user_type='homeowner' AND from_id=" . $homeowner_id; Messages::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "to_user_type='homeowner' AND to_id=" . $homeowner_id; Messages::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "project_id NOT IN (Select project_id from projects where homeowner_id = {$homeowner_id} )"; Projectphotos::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "viewed_user_type='homeowner' AND viewed_by=" . $homeowner_id; QuestionViews::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "referred_by_type='homeowner' AND referred_by=" . $homeowner_id; Referral::model()->deleteAll($criteria); $criteria = new CDbCriteria(); $criteria->condition = "homeowner_id=" . $homeowner_id; HomeownerPoints::model()->deleteAll($criteria); Feedback::model()->deleteAll($criteria); HomeownerViews::model()->deleteAll($criteria); Projects::model()->deleteAll($criteria); self::model()->deleteAll($criteria); return true; }
$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, 'meeting_reso_id', CHtml::listData(CommMeetingReso::model()->findAll(), 'meeting_reso_id', 'meeting_reso_id'), array('class' => 'span3', 'value' => '')); ?> <?php echo $form->dropDownListRow($model, 'ref_id', CHtml::listData(Referral::model()->findAll(array('condition' => 'referral_stat=0')), 'ref_id', 'ctrl_no'), array('class' => 'span3')); ?> <?php echo $form->dropDownListRow($model, 'action_taken', array(0 => 'Pending', 1 => 'Approved', 2 => 'Return to Origin'), array('class' => 'span3')); ?> <?php echo $form->datepickerRow($model, 'date_meeting', array('prepend' => '<i class="icon-calendar"></i>', 'options' => array('format' => 'yyyy-mm-dd'))); ?> <?php echo $form->datepickerRow($model, 'comm_report', array('prepend' => '<i class="icon-calendar"></i>', 'options' => array('format' => 'yyyy-mm-dd'))); ?>
<?php require Yii::getPathOfAlias('webroot') . '/protected/extensions/tcpdf/' . 'tcpdf.php'; // Data loading $pdf = new TCPDF('L', PDF_UNIT, 'Legal', true, 'UTF-8', false); // set document information $referralduedateCount = count(Referral::model()->findAll(array('condition' => 'referral_stat = 0 and now() > duedate'))); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor(User::model()->findByPK(Yii::app()->user->name)->emp->Fullname); $pdf->SetTitle($referralduedateCount . ' Pending Referrals - Referrals without Committee Reports as of today'); // set default header data $pdf->SetHeaderData('banner.jpg', PDF_HEADER_LOGO_WIDTH, 'Legislative Information System - Provincial Government of La Union v1.0'); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); //$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(15, $pdf->GetY() + 55, 15); $pdf->SetHeaderMargin(10); $pdf->SetFooterMargin(30); $pdf->SetAutoPageBreak(true, 65); // set auto page breaks //$pdf->SetAutoPageBreak(FALSE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) { require_once dirname(__FILE__) . '/lang/eng.php'; $pdf->setLanguageArray($l); }
public function getCommMeetings($d) { $temp = Referral::model()->findByAttributes(array('ctrl_no' => $d)); if (empty($temp)) { echo 'No Committee Meeting'; } else { $x = CommMeetingReso::model()->find(array('condition' => 'ref_id = "' . $temp->ref_id . '"')); if ($x == null) { echo '0000-00-00'; } else { $IAs = CommMeetingReso::model()->findAll(array('condition' => 'ref_id = "' . $temp->ref_id . '"', 'order' => 'date_meeting desc')); $iaName = CHtml::listData($IAs, 'date_meeting', 'date_meeting'); foreach ($iaName as $val) { echo $val . '<br/>'; } } } }
public function CommOrdi() { $cat = Category::model()->findByAttributes(array('cat_name' => 'Provincial Ordinance'))->cat_id; $result = CHtml::listData(Communication::model()->findAll(array('condition' => 'cat_id = ' . $cat . ' and comm_stat=1')), 'ctrl_no', 'ctrl_no'); $criteria = new CDbCriteria(); $criteria->condition = "referral_stat=0"; $criteria->addInCondition("ctrl_no", $result); $criteria2 = new CDbCriteria(); $criteria2->addInCondition("ctrl_no", $result); return $this->isNewRecord ? CHtml::listData(Referral::model()->findAll($criteria), 'ref_id', 'ctrl_no') : CHtml::listData(Referral::model()->findAll($criteria2), 'ref_id', 'ctrl_no'); }
public function actionCreate($id) { $model = new Resolution(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); $count = count(Resolution::model()->findAll(array('condition' => 'res_no like "%' . date('Y') . '"'))) + 1; if ($count <= 99) { if ($count <= 9) { $count = '00' . $count . ' - ' . date('Y'); } else { $count = '0' . $count . ' - ' . date('Y'); } } else { $count = $count . ' - ' . date('Y'); } if (isset($_POST['Resolution'])) { $model->attributes = $_POST['Resolution']; $model->archive = 0; $picture_name = ''; $picture_file = CUploadedFile::getInstance($model, 'reso_file'); $model->reso_file = $picture_file; if ($picture_file) { $picture_name = $picture_file->name; if (!is_dir(Yii::getPathOfAlias('webroot') . '/protected/document/resolution/' . substr($model->ctrl_no, 0, 4))) { mkdir(Yii::getPathOfAlias('webroot') . '/protected/document/resolution/' . substr($model->ctrl_no, 0, 4)); } if (!is_dir(Yii::getPathOfAlias('webroot') . '/protected/document/resolution/' . substr($model->ctrl_no, 0, 4) . '/' . $model->res_no)) { mkdir(Yii::getPathOfAlias('webroot') . '/protected/document/resolution/' . substr($model->ctrl_no, 0, 4) . '/' . $model->res_no); $picture_file->SaveAs(Yii::getPathOfAlias('webroot') . '/protected/document/resolution/' . substr($model->ctrl_no, 0, 4) . '/' . $model->res_no . '/' . $picture_file->getName()); } else { $picture_file->SaveAs(Yii::getPathOfAlias('webroot') . '/protected/document/resolution/' . substr($model->ctrl_no, 0, 4) . '/' . $model->res_no . '/' . $picture_file->getName()); } } $model->author = implode(',', $model->author); $model->input_by = User::model()->findByPK(Yii::app()->user->name)->emp_id; //------------------------------------------------- $stat = Status::model()->findByAttributes(array('ctrl_no' => $model->ctrl_no)); $stat->remarks = 1; $stat->save(); if (!empty(Referral::model()->findByAttributes(array('ctrl_no' => $model->ctrl_no))->ref_id)) { $temp = Referral::model()->findByAttributes(array('ctrl_no' => $model->ctrl_no))->ref_id; $meeting = CommMeetingReso::model()->find(array('condition' => 'ref_id = ' . $temp . ' and action_taken=1 or action_taken=2')); $meeting->comm_meeting_stat = 1; $meeting->remark = 1; $meeting->save(); } if ($model->save()) { date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Added Another Resolution'; $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->redirect(array('view', 'id' => $model->res_no)); } } $this->render('create', array('model' => $model, 'count' => $count, 'id' => $id)); }
</div><!-- header --> <div class="container" id="page" > <?php $countNotif = count(ForumQuestion::model()->findAll(array('condition' => 'confirmation=0'))); $notif = $this->widget('bootstrap.widgets.TbBadge', array('type' => $countNotif == 0 ? 'info' : 'important', 'label' => $countNotif), true); $receiving = count(Communication::model()->findAll(array('condition' => 'type_comm = 2 and now() >= date_agenda '))); $notifRC = $this->widget('bootstrap.widgets.TbBadge', array('type' => $receiving == 0 ? 'info' : 'important', 'label' => $receiving), true); $referralCount = count(Communication::model()->findAll(array('condition' => 'archive=0 and comm_stat=0 and type_comm<>2'))); $referralduedateCount = count(Referral::model()->findAll(array('condition' => 'referral_stat = 0 and now() > duedate'))); $meetingResoCount = count(Referral::model()->countCommMeetingReso()); $meetingOrdiCount = count(Referral::model()->countCommMeetingOrdi()); $rfTotal = 0; $rfTotal = $referralCount + $meetingOrdiCount + $meetingResoCount + $referralduedateCount; $notifRFTotal = $this->widget('bootstrap.widgets.TbBadge', array('type' => $rfTotal == 0 ? 'info' : 'important', 'label' => $rfTotal), true); $notifRFrefduedate = $this->widget('bootstrap.widgets.TbBadge', array('type' => $referralduedateCount == 0 ? 'info' : 'important', 'label' => $referralduedateCount), true); $notifRFref = $this->widget('bootstrap.widgets.TbBadge', array('type' => $referralCount == 0 ? 'info' : 'important', 'label' => $referralCount), true); $notifRFreso = $this->widget('bootstrap.widgets.TbBadge', array('type' => $meetingResoCount == 0 ? 'info' : 'important', 'label' => $meetingResoCount), true); $notifRFordi = $this->widget('bootstrap.widgets.TbBadge', array('type' => $meetingOrdiCount == 0 ? 'info' : 'important', 'label' => $meetingOrdiCount), true); $resoCount = count(Status::model()->countResolution()); $ordiCount = count(CommMeetingOrdi::model()->findAll(array('condition' => 'archive=0 and comm_meeting_stat=1 and ord_remark=0 and action_taken=1'))); $tTotal = 0; $tTotal = $resoCount + $ordiCount; $notifTtotal = $this->widget('bootstrap.widgets.TbBadge', array('type' => $tTotal == 0 ? 'info' : 'important', 'label' => $tTotal), true); $notifTreso = $this->widget('bootstrap.widgets.TbBadge', array('type' => $resoCount == 0 ? 'info' : 'important', 'label' => $resoCount), true); $notifTordi = $this->widget('bootstrap.widgets.TbBadge', array('type' => $ordiCount == 0 ? 'info' : 'important', 'label' => $ordiCount), true); $role = Yii::app()->user->getState("roles");
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['CommMeetingOrdi'])) { $model->attributes = $_POST['CommMeetingOrdi']; $x = Referral::model()->findByAttributes(array('ctrl_no' => $model->ref_id))->ref_id; $model->ref_id = $x; $model->archive = 0; $model->comm_meeting_stat = 0; $model->ord_remark = 0; if ($model->save()) { if ($model->action_taken != 0) { $stat = Status::model()->findByAttributes(array('ctrl_no' => $model->ref->ctrl_no)); $stat->referral_stat = 1; $stat->save(); Referral::model()->updateByPK($model->ref_id, array('referral_stat' => 1)); } else { $stat = Status::model()->findByAttributes(array('ctrl_no' => $model->ref->ctrl_no)); $stat->comm_meeting_stat = 0; $stat->referral_stat = 1; $stat->save(); Referral::model()->updateByPK($model->ref_id, array('referral_stat' => 1)); } } date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Updated Committee Meeting ID: ' . $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(); $this->redirect(array('view', 'id' => $model->meeting_ordi_id)); } $this->render('update', array('model' => $model)); }