Пример #1
0
 /**
  * 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 = new Certificate();
     $applicant = Applicant::model()->findByPk($id);
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model, $applicant);
     //$model=$this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Certificate'], $_POST['Applicant'])) {
         $model->attributes = $_POST['Certificate'];
         //$applicant->attributes=$_POST['Applicant'];
         //conhverting some of date into strtotime of type integer
         $applicant->dateofbirth = strtotime($applicant->dateofbirth);
         $model->residentcertdateissued = strtotime($model->residentcertdateissued);
         $valid = $model->validate();
         //$valid = $applicant->validate() && $valid;
         //autogenerate the certificate here
         //also assign the station in certificate-> station
         if ($valid) {
             // if($applicant->save()){
             $model->applicant_id = $applicant->id;
             if ($model->save()) {
                 $this->redirect(array('view', 'id' => $model->id));
             }
             //}
         }
     }
     $applicant->dateofbirth = date("Y-m-d", $applicant->dateofbirth);
     $model->residentcertdateissued = date("Y-m-d", $model->residentcertdateissued);
     $this->render('update', array('model' => $model, 'applicant' => $applicant));
 }
Пример #2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($app_id)
 {
     if (Yii::app()->user->checkAccess($this->id . '.' . $this->action->id)) {
         $model = new PaymentDetail();
         $applicant = Applicant::model()->findByPk($app_id);
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         $allotments = $applicant->getAllotments();
         if ($applicant !== null && !empty($allotments)) {
             $model->allotment_id = $allotments->data[0]->id;
             $model->applicant_id = $app_id;
         } else {
             throw new CHttpException('Please make allotment first. ' . CHtml::link('Click here to go Back', Yii::app()->user->returnUrl));
             exit;
         }
         $paymentTypeOptions = PaymentType::getPaymentTypes($allotments->data[0]->category_id);
         if (isset($_POST['PaymentDetail'])) {
             $model->attributes = $_POST['PaymentDetail'];
             if ($model->save()) {
                 $this->redirect(Yii::app()->user->returnUrl);
             }
         }
         $this->render('create', array('model' => $model, 'applicant' => $applicant, 'paymentTypeOptions' => $paymentTypeOptions));
     } else {
         $this->accessDenied();
     }
 }
Пример #3
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($app_id)
 {
     if (Yii::app()->user->checkAccess($this->id . '.' . $this->action->id)) {
         $model = new Allotment();
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         if (isset($_POST['Allotment'])) {
             $model->attributes = $_POST['Allotment'];
             $model->applicant_id = $app_id;
             if ($model->save()) {
                 $this->redirect(Yii::app()->user->returnUrl);
             }
         }
         $this->render('create', array('model' => $model, 'applicant' => Applicant::model()->findByPk($app_id)));
     } else {
         $this->accessDenied();
     }
 }
Пример #4
0
 public static function getApplicantOptions()
 {
     $result = array();
     //lists all applicants
     $_applicants = Applicant::model()->findAll();
     foreach ($_applicants as $applicant) {
         $result = $result + array($applicant['id'] => $applicant['name'] . ' S/D/o ' . $applicant['fname']);
     }
     return $result;
 }
Пример #5
0
 /**
  * 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)
 {
     $model = Applicant::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #6
0
 /**
  * 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, $app_id)
 {
     $model = $this->loadModel($id);
     if (Yii::app()->user->checkAccess($this->id . '.' . $this->action->id, array('owner' => $model->create_user))) {
         $applicant = Applicant::model()->findByPk($app_id);
         $allotment = $applicant->getAllotments();
         $paymentTypes = $allotment->data[0]->category->payment_types;
         $paymentTypesOption = array();
         foreach ($paymentTypes as $paymentType) {
             $paymentTypesOption = $paymentTypesOption + array($paymentType->id => $paymentType->payment_type);
         }
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         if (isset($_POST['DueDate'])) {
             $model->attributes = $_POST['DueDate'];
             if ($model->save()) {
                 $this->redirect(Yii::app()->user->returnUrl);
             }
         }
         $this->render('update', array('model' => $model, 'paymentTypesOption' => $paymentTypesOption));
     } else {
         $this->accessDenied();
     }
 }
Пример #7
0
$allData = $dp->getData();
if (empty($allData)) {
    $user = Yii::app()->getComponent('user');
    $user->setFlash('error', "<strong>Not Found!</strong> <a href=\"reminders\"> Click here to go back </a>");
}
$this->widget('booster.widgets.TbAlert', array('fade' => true, 'closeText' => '&times;', 'events' => array(), 'htmlOptions' => array(), 'userComponentId' => 'user', 'alerts' => array('success' => array('closeText' => '&times;'), 'info', 'warning' => array('closeText' => false), 'error' => array('closeText' => false))));
//     $this->widget('ext.mPrint.mPrint', array(
//          'title' => 'title',          //the title of the document. Defaults to the HTML title
//          'tooltip' => 'Print',        //tooltip message of the print icon. Defaults to 'print'
//          'text' => 'Print',   //text which will appear beside the print icon. Defaults to NULL
//          'element' => '.print_container',        //the element to be printed.
//          'exceptions' => array(       //the element/s which will be ignored
//              '.summary',
//              '.search-form'
//          ),
//          'publishCss' => false,       //publish the CSS for the whole page?
//          //'visible' => Yii::app()->user->checkAccess('print'),  //should this be visible to the current user?
//          'alt' => 'print',       //text which will appear if image can't be loaded
//          'debug' => false,            //enable the debugger to see what you will get
//          'id' => 'print-div',         //id of the print lin
//          'htmlOptions'=>array(
//              'class'=>'btn btn-primary',
//          )
//      ));
foreach ($allData as $data) {
    echo '<div class="print_container visible-print-block" >';
    $applicant = Applicant::model()->findByPk($data['aid']);
    $this->renderPartial('_reminder', array('data' => $data, 'allotment' => $applicant->getAllotment(), 'reminder' => $reminder));
    echo '</div>';
}