コード例 #1
0
ファイル: CrudAction.php プロジェクト: kostya1017/our
 /**
  * Logic for both create and update actions.
  */
 protected function createUpdateCommon()
 {
     $this->_action = get_class($this);
     // Recursively processing all forms.
     if (!isset($this->formSettings['forms']['id'])) {
         foreach ($this->formSettings['forms'] as $key => $value) {
             $this->formSettings['forms'][$key] = $this->processFormSettingsForm($this->formSettings['forms'][$key]);
         }
     } else {
         $this->formSettings['forms'] = $this->processFormSettingsForm($this->formSettings['forms']);
     }
     $formManager = new FormManager($this->formSettings);
     $formManager->process();
     // Render with form variables. Blocs type forms have a variable that is an array containing its sub-forms as well.
     $renderArray = array();
     foreach ($this->_formIds as $varName => $formIdArr) {
         if ($formIdArr[1] !== null) {
             $blocsForm = $formManager->getForm($formIdArr[0]);
             $renderArray[$varName] = array($formManager->getModels($formIdArr[0]));
             foreach ($blocsForm->forms as $blocsSubForm) {
                 $renderArray[$varName][substr($blocsSubForm->id, 18, -4)] = $blocsSubForm->models;
             }
         } else {
             $renderArray[$varName] = $formManager->getModels($formIdArr[0]);
         }
     }
     $this->controller->render(lcfirst($this->_action), $renderArray);
 }
コード例 #2
0
ファイル: SettingsController.php プロジェクト: kostya1017/our
 public function actionIndex()
 {
     $flickrUsers = FlickrUser::model()->findAll('', array('index' => 'id'));
     $formManager = new FormManager(array('checkIfPosted' => false, 'redirect' => $this->createUrl('index'), 'forms' => array('id' => 'flickrUsersForm', 'models' => $flickrUsers)));
     if (isset($_POST['sent'])) {
         $formManager->process();
     }
     $this->render('index', array('flickrUsers' => $formManager->getModels('flickrUsersForm')));
 }