Exemplo n.º 1
0
 public function init()
 {
     //parent::init();
     $usersData = Sydney_Tools::getUserdata();
     $this->view->cdn = Sydney_Tools::getRootUrlCdn();
     $this->view->allowPermission = in_array(7, $usersData['member_of_groups']);
 }
Exemplo n.º 2
0
 /**
  * Redirects to the right action
  */
 public function indexAction()
 {
     $usersData = Sydney_Tools::getUserdata();
     $usersId = $usersData['users_id'];
     if (empty($usersId)) {
         //$this->_helper->redirector->gotoUrl($url, $options);
         //$this->_forward('login','login','default');
         $this->setJs();
         //$this->_helper->actionStack('editindex','index','adminpeople',array('id'=>$users_id));
         // Set a custom form user on publicms if exist for the current instance
         //if ($this->view->moduleName == 'publicms' && @class_exists('UsersPublicForm'.Sydney_Tools::getSafinstancesId())) {
         $this->view->form = Users::getForm(null, false, true);
     } else {
         $this->setJs();
         $oUser = new Users();
         //$this->_helper->actionStack('editindex','index','adminpeople',array('id'=>$users_id));
         // Set a custom form user on publicms if exist for the current instance
         //if ($this->view->moduleName == 'publicms' && @class_exists('UsersPublicForm'.Sydney_Tools::getSafinstancesId())) {
         $this->view->form = Users::getForm($usersData['member_of_groups'], true, true);
         $this->view->form->populate($oUser->get($usersId)->toArray());
     }
 }
Exemplo n.º 3
0
 /**
  * Update or Create user on table users
  *
  * @param array $data
  * @param boolean $isPublicModule
  * @param array $partialMailConfirm array('controller/action.phtml','module'[,subject])
  */
 public function save(array $data, $isPublicModule = false)
 {
     // Detect mode
     $modeEdit = $this->isEditMode($data);
     // Get datas of connected user
     $usersData = Sydney_Tools::getUserdata();
     // Set a custom form user on publicms if exist for the current instance
     $form = $this->getForm($usersData['member_of_groups'], $modeEdit, $isPublicModule);
     // add special validator for password / login
     $form = $this->addValidators($form, $data, $modeEdit);
     // Check validity
     if (!$form->isValid($data)) {
         Sydney_Messages::getInstance()->addMessage($form->getMessages());
         return false;
     } else {
         $this->saveRow($data, $modeEdit, $isPublicModule);
     }
     // END - IF VALID FORM
     return true;
 }
Exemplo n.º 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;
     }
 }