OphCoTherapyapplication_Processor::processEvent PHP Method

processEvent() public method

processes the application for the event with id $event_id returns a boolean to indicate whether this was successful or not.
public processEvent ( CController $controller, User $notify_user = null ) : boolean
$controller CController
$notify_user User
return boolean
    public function processEvent(CController $controller, User $notify_user = null)
    {
        if ($this->getApplicationStatus() == self::STATUS_SENT || $this->getProcessWarnings()) {
            return false;
        }
        $success = true;
        $template_data = $this->getTemplateData();
        $diag = $this->getElement('Element_OphCoTherapyapplication_Therapydiagnosis');
        if ($diag->hasLeft() && !$this->processEventForEye($controller, $template_data, Eye::LEFT, $notify_user)) {
            $success = false;
        }
        if ($diag->hasRight() && !$this->processEventForEye($controller, $template_data, Eye::RIGHT, $notify_user)) {
            $success = false;
        }
        return $success;
    }

Usage Example

コード例 #1
0
 /**
  * actually generates and submits the therapy application.
  *
  * @throws CHttpException
  */
 public function actionProcessApplication()
 {
     $service = new OphCoTherapyapplication_Processor($this->event);
     $user = null;
     if (@Yii::app()->params['OphCoTherapyapplication_cc_applicant']) {
         $user = User::model()->findByPk(Yii::app()->user->id);
     }
     if ($service->processEvent($this, $user)) {
         Yii::app()->user->setFlash('success', 'Application processed.');
     } else {
         Yii::app()->user->setFlash('error', 'Unable to process the application at this time.');
     }
     $this->redirect(array($this->successUri . $this->event->id));
 }