/**
  * Add a new help topic action
  */
 public function actionCreate()
 {
     // Check Access
     checkAccessThrowException('op_helptopics_add');
     $model = new HelpTopic();
     if (isset($_POST['HelpTopic'])) {
         $model->attributes = $_POST['HelpTopic'];
         if (isset($_POST['submit'])) {
             if ($model->save()) {
                 fok(at('Help Topic Created.'));
                 alog(at("Created Help Topic '{name}'.", array('{name}' => $model->name)));
                 $this->redirect(array('helptopics/index'));
             }
         } else {
             if (isset($_POST['preview'])) {
                 $model->attributes = $_POST['HelpTopic'];
             }
         }
     }
     // Add Breadcrumb
     $this->addBreadCrumb(at('Creating New Help Topic'));
     $this->title[] = at('Creating New Help Topic');
     // Display form
     $this->render('form', array('model' => $model));
 }
Пример #2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     Acl::hasPrivilege($this->privileges, $this->resource, Acl::ACTION_CREATE);
     $this->pageTitle = 'Add ' . $this->homeTitle;
     $model = new HelpTopic(ActiveRecord::SCENARIO_CREATE);
     $class_name = $model->getClassName();
     if (isset($_POST[$class_name])) {
         $model->attributes = $_POST[$class_name];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', Lang::t('SUCCESS_MESSAGE'));
             $this->refresh();
         }
     }
     $this->render('create', array('model' => $model));
 }