Beispiel #1
0
 public function __call($attrName, $arguments)
 {
     if (preg_match('/^_render/', $attrName)) {
         $attrName = mb_strtolower(mb_strcut($attrName, 7));
         if (!empty($this->_options)) {
             $attrName = array_merge(array($attrName), $this->_options);
             $attrName = implode('_', $attrName);
         }
         $attrName = preg_replace('/[^\\w\\d-_]/ui', '', $attrName);
         // check if we have a getter for this property
         $getter = 'get' . ucfirst($attrName);
         if (method_exists($this->_user, $getter)) {
             $value = $this->_user->{$getter}();
         } else {
             // or try to get attribute value
             $value = $this->_user->getAttribute($attrName);
         }
         if ($this->_editableMode) {
             $this->_view->attribute = $attrName;
             $this->_view->value = $value;
             $this->_view->userId = $this->_user->getId();
             return $this->_view->render('user-attribute.phtml');
         }
         return $value;
     }
 }