Beispiel #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>';
     }
 }