/**
  * Add/Edit a panel
  * @return void
  */
 public function formAction()
 {
     if ($this->panel) {
         $panel = $this->panel;
     } else {
         $factory = new Flex_Panel_Factory();
         $panel = $factory->createRow();
     }
     $form = new Flex_Form_Panel($panel);
     if ($this->getRequest()->isPost() && $form->isValid($_REQUEST)) {
         $values = $form->getValues();
         $panel->parent_id = $values['parent_id'];
         $panel->name = $values['name'];
         $panel->title = $values['title'];
         $panel->layout = $values['layout'];
         //$panel->settings = $values['settings'];
         $panel->category = $values['category'];
         $panel->save();
         Zoo::getService('cache')->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('panel_' . $panel->id));
         $this->_redirect(Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => "flex", 'controller' => 'panel', 'action' => 'index'), 'default', true));
     }
     $this->view->form = $form;
     $this->view->form->populate($_REQUEST);
     $this->render('form');
 }
Exemple #2
0
 /**
  * Fetch current panel
  *
  */
 public function dispatchLoopStartup()
 {
     if (!Zend_Layout::getMvcInstance()->isEnabled()) {
         // No layout, no panel content
         return;
     }
     $factory = new Flex_Panel_Factory();
     $this->panel = $factory->getCurrentPanel();
     if ($this->panel && $this->panel->theme) {
         // No panel to display
         Zend_Layout::getMvcInstance()->setLayout($theme)->setLayoutPath(ZfApplication::$_doc_root . '/themes/');
     }
 }