Example #1
0
                     }
                 }
             }
         }
         $this->render('member/upload', array('model' => $model));
     } catch (Exception $exc) {
         throw new CHttpException(404, $exc->getMessage());
     }
 }
 /**
  * <Jason>
  * <To added a report into gridview in tenancy details page>
  */
 public function actionAddReport()
 {
     try {
         $aRoleRestrict = array(ROLE_LANDLORD);
         if (in_array(Yii::app()->user->role_id, $aRoleRestrict)) {
             die;
         }
         $model = new ProReportDefect('create');
         if (isset($_POST['ProReportDefect'])) {
             $model->attributes = $_POST['ProReportDefect'];
             $model->transaction_id = $_GET['transaction_id'];
             $model->created_date = date('Y-m-d H:i:s');
             $model->photo = CUploadedFile::getInstance($model, 'photo');
             $model->status = 0;
             $model->user_id = Yii::app()->user->id;
             if ($model->validate()) {
                 if (!$model->getErrors()) {
                     if ($model->save()) {
                         ProReportDefect::save_photo($model);
Example #2
0
 public function actionDelete()
 {
     try {
         if (isset($_GET['report_id'])) {
             $report = ProReportDefect::model()->findByPk($_GET['report_id']);
             if ($report && $report->user_id == Yii::app()->user->id) {
                 $report->delete();
             }
         } elseif (isset($_GET['document_id'])) {
             $document = ProTransactionsPropertyDocument::model()->findByPk($_GET['document_id']);
             if ($document) {
                 $document->delete();
             }
         }
     } catch (Exception $exc) {
         throw new CHttpException('404', $exc->getMessage());
     }
 }
 /**
  * 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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     try {
         $model = ProReportDefect::model()->findByPk($id);
         if ($model === null) {
             Yii::log("The requested page does not exist.");
             throw new CHttpException(404, 'The requested page does not exist.');
         }
         return $model;
     } catch (Exception $e) {
         Yii::log("Exception " . print_r($e, true), 'error');
         throw new CHttpException("Exception " . print_r($e, true));
     }
 }
Example #4
0
 public function actionUpdateDefectStatus($id)
 {
     try {
         $model = ProReportDefect::model()->findByPk($id);
         if (is_null($model)) {
             throw new Exception('id not valid');
         }
         $model->scenario = 'UpdateDefectStatus';
         $this->layout = 'application.views.layouts.ajax';
         $cmsFormater = new CmsFormatter();
         $model->approved_date = $cmsFormater->formatDatePickerInput($model->approved_date);
         if (isset($_POST['ProReportDefect'])) {
             $attUpdate = array('status');
             $model->attributes = $_POST['ProReportDefect'];
             if ($model->status == CmsFormatter::COMPLETE_REPORT) {
                 $model->approved_by_complete = Yii::app()->user->id;
                 $model->scenario = 'UpdateDefectStatusComplete';
                 $attUpdate[] = 'approved_by_complete';
                 $attUpdate[] = 'approved_date';
                 $attUpdate[] = 'remark';
             } elseif ($model->status == CmsFormatter::PROGESS_REPORT) {
                 $model->approved_by_progess = Yii::app()->user->id;
                 $attUpdate[] = 'approved_by_progess';
             }
             $model->validate();
             if (!$model->hasErrors()) {
                 $model->update($attUpdate);
                 die('<script type="text/javascript">parent.$.fancybox.close(); parent.fnUpdateGridView("#defect-grid");</script>');
             }
         }
         $this->render('UpdateDefectStatus', array('model' => $model, 'actions' => $this->listActionsCanAccess));
     } catch (Exception $e) {
         Yii::log("Exception " . print_r($e, true), 'error');
         throw new CHttpException("Exception " . print_r($e, true));
     }
 }
Example #5
0
 public function actionReportDefect($transaction_id)
 {
     $this->pageTitle = "Report Defects - " . Yii::app()->params['title'];
     $this->layout = "application.views.layouts.layout_callslog";
     try {
         $model = new ProReportDefect();
         $model->unsetAttributes();
         // clear any default values
         if (isset($_GET['ProReportDefect'])) {
             $model->attributes = $_GET['ProReportDefect'];
         }
         $model->transaction_id = $transaction_id;
         $this->render('report/list', array('model' => $model, 'actions' => $this->listActionsCanAccess));
     } catch (Exception $e) {
         Yii::log("Exception " . print_r($e, true), 'error');
         throw new CHttpException("Exception " . print_r($e, true));
     }
 }