public function indexAction()
 {
     try {
         $this->view->heads = $this->_indexGetHeads();
         $this->view->content = Application_Model_Encyclopedie_Article_Multilang::fetchAll(true);
         $this->view->resources = Application_Model_Resources::get(array("modifButton" => "img_button_modif_png", "deleteButton" => "img_button_delete_png", "activateButton" => "img_button_activate_png", "desactivateButton" => "img_button_desactivate_png", "addButton" => "img_button_add_png", "returnButton" => "img_button_return_png"));
     } catch (Zend_Exception $e) {
         throw new Zend_Controller_Action_Exception("Error in Action : unlog-backend | encyclopedie | index", null, $e);
     }
 }
Пример #2
0
 public function addCgvAction()
 {
     $params = $this->_getParams();
     /**
      * Savoir si on crée un set neuf ou si l'on souhaite partir du set actuel
      */
     if (empty($params['scratch'])) {
         $params['scratch'] = false;
     }
     try {
         $form = new Form_Unlog_Backend_About_Cgv_Add();
         $formName = "Form_Unlog_Backend_About_Cgv_Add_";
         $locales = new Application_Model_DbTable_Locale_Language();
         if (!$params['scratch'] && empty($params[$formName . 'Submit'])) {
             $latest = Application_Model_About_Cgv_Multilang::getLatest();
             $params[$formName . 'Date'] = $latest->getDate()->toString("dd/MM/yyyy hh:mm");
             $params[$formName . 'Active'] = $latest->getActive();
             foreach ($locales->getList() as $locale) {
                 $params[$formName . 'Text_' . $locale] = $latest->getText($locale);
             }
             $form->populate($params);
         } elseif (!empty($params[$formName . 'Submit']) && !$form->isValid($params)) {
             $form->populate($params);
         } elseif (!empty($params[$formName . 'Submit']) && $form->isValid($params)) {
             $data = new Application_Model_About_Cgv_Writer_Data($params[$formName . 'Date'], $params[$formName . 'Active']);
             foreach ($params as $key => $param) {
                 if (preg_match("#^{$formName}Text_#", $key)) {
                     $localeCode = substr($key, strlen($formName . "Text_"));
                     $data->addLocale($localeCode, $params[$formName . 'Text_' . $localeCode]);
                 }
             }
             $writer = new Application_Model_About_Cgv_Writer();
             $writer->insert($data);
             $this->_forward("cgv", "about", "unlog-backend");
         }
         $this->view->form = $form;
         $this->view->resources = Application_Model_Resources::get(array("returnButton" => "img_button_return_png"));
     } catch (Zend_Exception $e) {
         throw new Zend_Controller_Action_Exception("Error in Action : unlog-backend | about | cgv", null, $e);
     }
 }