/** * addAction * @author Daniel Rotter <*****@*****.**> * @version 1.0 */ public function addAction() { $this->core->logger->debug('cms->controllers->WidgetController->addAction()'); try { $this->getForm($this->core->sysConfig->generic->actions->add); $this->addWidgetSpecificFormElements(); if ($this->objRequest->isPost() && $this->objRequest->isXmlHttpRequest()) { $arrFormData = $this->objRequest->getPost(); $this->objForm->Setup()->setFieldValues($arrFormData); $this->objForm->prepareForm(); if ($this->objForm->isValid($arrFormData)) { $this->objForm->setAction('/zoolu/cms/widget/edit'); $intWidgetId = $this->objForm->saveFormData(); $this->objForm->Setup()->setElementId($intWidgetId); $this->objForm->Setup()->setActionType($this->core->sysConfig->generic->actions->edit); $this->objForm->getElement('id')->setValue($intWidgetId); $this->view->assign('blnShowFormAlert', true); } else { $this->objForm->setAction('zoolu/cms/widget/add'); $this->view->assign('blnShowFormAlert', false); } } else { $this->objForm->prepareForm(); } $this->objForm->updateSpecialFieldValues(); $this->view->formtitle = $this->objForm->Setup()->getFormTitle(); $this->setViewMetaInfos(); $this->view->form = $this->objForm; $this->renderScript('page/form.phtml'); } catch (Exception $exc) { $this->core->logger->err($exc); } }
/** * editAction * @author Cornelius Hansjakob <*****@*****.**> * @version 1.0 */ public function editAction() { $this->core->logger->debug('cms->controllers->PageController->editAction()'); try { $this->getForm($this->core->sysConfig->generic->actions->edit); $this->addPageSpecificFormElements(); /** * get form title */ $this->view->formtitle = $this->objForm->Setup()->getFormTitle(); if ($this->objRequest->isPost() && $this->objRequest->isXmlHttpRequest()) { $arrFormData = $this->objRequest->getPost(); $this->objForm->Setup()->setFieldValues($arrFormData); /** * prepare form (add fields and region to the Zend_Form) */ $this->objForm->prepareForm(); if ($this->objForm->isValid($arrFormData)) { $this->objForm->saveFormData(); $this->view->assign('blnShowFormAlert', true); } else { $this->view->assign('blnShowFormAlert', false); } } else { /** * prepare form (add fields and region to the Zend_Form) */ $this->objForm->prepareForm(); } /** * update special field values */ $this->objForm->updateSpecialFieldValues(); /** * set action */ $this->objForm->setAction('/zoolu/cms/page/edit'); /** * output of metainformation to hidden div */ $this->setViewMetaInfos(); $this->view->form = $this->objForm; $this->renderScript('page/form.phtml'); } catch (Exception $exc) { $this->core->logger->err($exc); exit; } }
/** * editsubwidgetAction * @author Daniel Rotter <*****@*****.**> * @version 1.0 */ public function editsubwidgetAction() { $this->core->logger->debug('widgets->blog->FormController->editsubwidgetAction()'); try { $this->getFormArticle($this->core->sysConfig->generic->actions->edit); $this->getBlogSpecificElements(); $this->view->formtitle = $this->objForm->Setup()->getFormTitle(); if ($this->objRequest->isPost() && $this->objRequest->isXmlHttpRequest()) { $arrFormData = $this->objRequest->getPost(); $this->objForm->Setup()->setFieldValues($arrFormData); $this->objForm->Setup()->setElementId($arrFormData['elementId']); $arrOldData = $this->getModelBlogEntry()->getBlogEntry($arrFormData['elementId']); $this->objForm->Setup()->setSubwidgetId($arrOldData['subwidgetId']); /** * Get the data for the updated entry */ $arrData = array('title' => $arrFormData['title'], 'text' => $arrFormData['text']); $this->getModelBlogEntry()->editBlogEntry($arrData, $arrFormData['elementId']); /** * prepare form (add fields and region to the Zend_Form) */ $this->objForm->prepareForm(); if ($this->objForm->isValid($arrFormData)) { $this->objForm->saveFormData(); $this->view->assign('blnShowFormAlert', true); } else { $this->view->assign('blnShowFormAlert', false); } } else { /** * prepare form (add fields and region to the Zend_Form) */ $this->objForm->prepareForm(); } $this->objForm->updateSpecialFieldValues(); $this->objForm->setAction('/widget/blog/form/editsubwidget'); $this->setViewMetaInfos(); $this->view->form = $this->objForm; $this->renderScript('blog/form.phtml'); } catch (Exception $exc) { $this->core->logger->err($exc); } }