OEModule\OphCoCvi\controllers\DefaultController::actionCreate PHP 메소드

actionCreate() 공개 메소드

Create Form with check for the cvi existing events count
public actionCreate ( )
    public function actionCreate()
    {
        $create_new_cvi = $this->request->getParam('createnewcvi', null);
        if ($create_new_cvi !== null) {
            $cancel_url = $this->episode ? '/patient/episode/' . $this->episode->id : '/patient/episodes/' . $this->patient->id;
            if ($create_new_cvi == 1) {
                if (!$this->getManager()->canCreateEventForPatient($this->patient)) {
                    $this->getApp()->user->setFlash('warning.cvi_create', 'You cannot create another CVI whilst one exists that has not been issued.');
                    $this->redirect(array($cancel_url));
                } else {
                    parent::actionCreate();
                }
            } else {
                $this->redirect(array($cancel_url));
            }
        } else {
            $cvi_events = $this->getApp()->moduleAPI->get('OphCoCvi');
            $current_cvis = $cvi_events->getEvents($this->patient);
            if (count($current_cvis) >= $this->cvi_limit) {
                $this->render('select_event', array('current_cvis' => $current_cvis, 'can_create' => $this->getManager()->canCreateEventForPatient($this->patient)), false);
            } else {
                parent::actionCreate();
            }
        }
    }