예제 #1
0
 protected function _load()
 {
     if (empty($this->_options)) {
         throw new Exceptions_SeotoasterWidgetException('No options provided');
     }
     if (is_numeric(reset($this->_options))) {
         $userId = array_shift($this->_options);
         $this->_user = Application_Model_Mappers_UserMapper::getInstance()->find($userId);
         if (is_null($this->_user)) {
             return '';
         }
     } elseif ($this->_sessionHelper->getCurrentUser()->getRoleId() === Tools_Security_Acl::ROLE_GUEST) {
         return '';
     } else {
         $this->_user = $this->_sessionHelper->getCurrentUser();
     }
     $this->_user->loadAttributes();
     if (Tools_Security_Acl::isAllowed(Tools_Security_Acl::RESOURCE_USERS) || $this->_user->getId() === $this->_sessionHelper->getCurrentUser()->getId()) {
         $this->_editableMode = true;
         Zend_Layout::getMvcInstance()->getView()->headScript()->appendFile($this->_websiteHelper->getUrl() . 'system/js/internal/user-attributes.js');
     }
     $method = strtolower(array_shift($this->_options));
     try {
         return $this->{'_render' . ucfirst($method)}();
     } catch (Exception $e) {
         return '<b>Method ' . $method . ' doesn\'t exist</b>';
     }
 }
예제 #2
0
 public function __construct($options, $seotoasterData)
 {
     // setting up Seotoaster data and plugin options
     $this->_options = $options;
     $this->_seotoasterData = $seotoasterData;
     // setting up helpers
     $this->_sessionHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('session');
     $this->_websiteHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('website');
     $this->_responseHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('response');
     $this->_redirector = new Zend_Controller_Action_Helper_Redirector();
     // setting up request and response objects
     $front = Zend_Controller_Front::getInstance();
     $this->_request = $front->getRequest();
     $this->_response = $front->getResponse();
     unset($front);
     // setting up view
     $this->_view = new Zend_View();
     $this->_websiteUrl = $this->_websiteHelper->getUrl();
     $this->_pluginName = strtolower(__CLASS__);
     $this->_view->websiteUrl = $this->_websiteUrl;
     $this->_view->pluginName = $this->_pluginName;
     // setting up view helpers (standart and ZendX)
     $this->_view->setHelperPath(APPLICATION_PATH . '/views/helpers/');
     $this->_view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
     // runing init routines
     $this->_initAcl();
     $this->_initTranslator();
     $this->_init();
 }