예제 #1
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setAttrib('accept-charset', 'UTF-8');
     $this->setName('safcontrollers');
     $id = new Zend_Form_Element_Hidden('id');
     $hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $label = new Zend_Form_Element_Text('label');
     $label->setLabel('label');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('name');
     $image = new Zend_Form_Element_Textarea('image');
     $image->setLabel('image');
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel('description');
     $safmodulesId = new Zend_Form_Element_Select('safmodules_id');
     $options = new Safmodules();
     $safmodulesId->addMultiOption('', '----------');
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         $safmodulesId->addMultiOption($k, $v['mlabel']);
     }
     $safmodulesId->setLabel('safmodules_id');
     $this->addElements(array($id, $hash, $label, $name, $image, $description, $safmodulesId));
     $this->addElements(array($submit));
 }
예제 #2
0
 public function init()
 {
     $options = new Safmodules();
     foreach ($options->fetchAlltoFlatArray() as $k => $v) {
         if (isset($v['mlabel'])) {
             $this->addMultiOption($k, $v['mlabel']);
         }
     }
 }
예제 #3
0
 /**
  *
  */
 public function getmodulesForm()
 {
     $this->setName('safinstancesModules');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbuttonc');
     $safinstancesSafmodules = new Zend_Form_Element_MultiCheckbox('SafinstancesSafmodules');
     $safinstancesSafmodules->setLabel('SafinstancesSafmodules');
     $options = new Safmodules();
     // AND isalwaysactive != 1
     foreach ($options->fetchAll("istechnical != 1 AND name LIKE 'admin%' ", 'label') as $k) {
         $safinstancesSafmodules->addMultiOption($k->id, $k->label);
     }
     $this->addElements(array($this->idb, $this->hashb, $safinstancesSafmodules));
     $this->addElements(array($submit));
     return $this;
 }
예제 #4
0
 /**
  * Auto initialization of important params for sydney
  * @return void
  */
 public function init()
 {
     // add the general helper path for sydney
     $this->view->addHelperPath(Sydney_Tools_Paths::getCorePath() . '/library/Sydney/View/Helper', 'Sydney_View_Helper');
     $this->view->addHelperPath(Sydney_Tools_Paths::getCorePath() . '/application/modules/adminpages/views/helpers', 'Adminpages_View_Helper');
     $this->_initWebInstanceHelpers();
     $this->getResponse()->setHeader('Accept-encoding', 'gzip,deflate');
     // setup the basics
     $this->_registry = Zend_Registry::getInstance();
     $this->_config = $this->_registry->get('config');
     $this->_db = $this->_registry->get('db');
     $this->safinstancesId = $this->_config->db->safinstances_id;
     $this->view->safinstances_id = $this->_config->db->safinstances_id;
     $this->view->config = $this->_config;
     $this->_translate = $this->_registry->get('Zend_Translate');
     $this->_auth = Sydney_Auth::getInstance();
     $this->usersData = Sydney_Tools::getUserdata();
     if (isset($this->usersData['users_id'])) {
         $this->usersId = $this->usersData['users_id'];
         if (in_array(7, $this->usersData['member_of_groups'])) {
             $this->isDeveloper = true;
         }
     }
     $this->view->cdn = $this->_config->general->cdn;
     $this->view->isDeveloper = $this->isDeveloper;
     $this->view->moduleName = $this->_getParam('module');
     $this->view->controllerName = $this->_getParam('controller');
     $this->view->actionName = $this->_getParam('action');
     // On vérifie si on a un mapping entre le module courant et les tables qu'il utilise
     // ce mapping est utilisé pour charger ensuite automatiquement toutes les traductions de contenu de ce module
     if (!is_null($this->_config->general->modules->{$this->view->moduleName}) && !empty($this->_config->general->modules->{$this->view->moduleName}->tables)) {
         $translate = new Zend_Translate(array('adapter' => 'Sydney_Translate_Adapter_Db', 'tableName' => $this->_config->general->modules->{$this->view->moduleName}->tables, 'locale' => $this->config->general->locale));
         echo $translate->_('test');
         $this->_registry->set('Zend_Translate_Content', $translate);
     }
     // set up the log
     $this->logger = new Sydney_Log();
     $this->logger->setEventItem('className', get_class($this));
     $this->logger->addFilterDatabase();
     $safmodulesDB = new Safmodules();
     $this->availableModules = $safmodulesDB->getAvailableAvModules($this->safinstancesId, $this->usersData['member_of_groups'], true);
     if (!$this->_isService) {
         $this->setUpLayoutProps();
     }
     if (isset($this->getRequest()->sydneylayout) && $this->getRequest()->sydneylayout == 'no') {
         $this->_helper->layout->disableLayout();
         $this->view->sydneylayout = $this->getRequest()->sydneylayout;
     }
 }