Example #1
0
 public function __construct($options = null)
 {
     $baseDir = $options['baseDir'];
     parent::__construct($options);
     /****************************************/
     // PARAMETERS
     /****************************************/
     // Build the select to choose the associated form (Parameter #1)
     $blockForm = new Zend_Form_Element_Select('Param1');
     $blockForm->setLabel('Formulaire associé à ce bloc')->setAttrib('class', 'largeSelect');
     $forms = new Form();
     $select = $forms->getFormList();
     $formsArray = $forms->fetchAll($select);
     // Set the default value
     $blockForm->addMultiOption('0', 'Choisir un formulaire');
     //Fill the dropdown list
     foreach ($formsArray as $form) {
         $blockForm->addMultiOption($form['F_ID'], $form['FI_Title']);
     }
     // Test if a value has been chosen
     $at_least_one = new Zend_Validate_GreaterThan('0');
     $at_least_one->setMessage('Vous devez choisir un élément dans la liste.');
     $blockForm->addValidator($at_least_one);
     $this->addElements(array($blockForm));
     $this->removeDisplayGroup('parameters');
     $this->addDisplayGroup(array('Param999', 'Param1'), 'parameters');
     $parameters = $this->getDisplayGroup('parameters');
 }
 public function ajaxEditAction()
 {
     if (isset($this->_session->messages)) {
         $this->view->messages = $this->_session->messages;
     }
     $menuId = $this->_getParam('menuId');
     if ((int) $menuId === 0 && substr($menuId, 0, 11) != 'newMenuItem') {
         $msg = __("Root menu id cannot be modified.");
         throw new Exception($msg);
     }
     $objMenu = new MenuItem();
     $objMenu->menuId = $menuId;
     $objMenu->populate();
     $data = array();
     $data['menuId'] = $menuId;
     $data['type'] = $objMenu->type;
     $data['parentId'] = $objMenu->parentId;
     $data['active'] = $objMenu->active;
     $data['siteSection'] = $objMenu->siteSection;
     $objForm = new WebVista_Form(array('name' => 'menu-item'));
     $objForm->setAction(Zend_Registry::get('baseUrl') . "menu-manager.raw/edit-process");
     $objForm->loadORM($objMenu, "MenuItem");
     $objForm->setWindow('windowEditMenuId');
     $this->view->form = $objForm;
     if (!isset($data['siteSection'])) {
         $data['siteSection'] = 'default';
     }
     if (!isset($data['type'])) {
         $data['type'] = 'freeform';
     }
     $this->view->mainTabs = $this->getMainTabs();
     $this->view->types = array('freeform', 'report', 'form', 'submenu');
     $data['val'] = $objMenu->typeValue;
     $data['report'] = array();
     $objReport = new Report();
     $data['report'] = $objReport->getReportList();
     $data['form'] = array();
     $objForm = new Form();
     $data['form'] = $objForm->getFormList();
     $data['typeValue'] = $objMenu->action;
     switch ($objMenu->type) {
         case 'report':
             $x = explode('?', $objMenu->action);
             $requestUri = explode('&', $x[1]);
             foreach ($requestUri as $uri) {
                 $kvp = explode('=', $uri);
                 if ($kvp[0] == 'templateId') {
                     $data['typeValue'] = $kvp[1];
                     break;
                 }
             }
             break;
         case 'form':
             $x = explode('?', $objMenu->action);
             $requestUri = explode('&', $x[1]);
             foreach ($requestUri as $uri) {
                 $kvp = explode('=', $uri);
                 if ($kvp[0] == 'formId') {
                     $data['typeValue'] = $kvp[1];
                     break;
                 }
             }
             break;
     }
     $this->view->data = $data;
     $this->render('ajax-edit');
 }
Example #3
0
 /**
  * Get form title to reload for language switching
  *
  * @return void
  */
 public function reloadAction()
 {
     if ($this->_request->isGet()) {
         $tmp = 0;
         $id = $this->_request->getParam('FI_FormID');
         $lang = $this->_request->getParam('FI_LanguageID');
         $oForm = new Form();
         $form = $oForm->getFormList($id, $lang);
         $row = $oForm->fetchRow($form);
         if (count($row)) {
             $data = $row->toArray();
             $tmp = $data['FI_Title'];
         }
         echo json_encode($tmp);
     }
     exit;
 }