Ejemplo n.º 1
0
 /**
  * Set a bunch of placeholders to be used within Smarty templates
  *
  * @return void
  */
 public function setPlaceholders()
 {
     $username = '';
     if ($this->modx->getOption('manager_use_fullname') == true) {
         $userProfile = $this->modx->user->getOne('Profile');
         $username = $userProfile->get('fullname');
     }
     if (empty($username)) {
         $username = $this->modx->getLoginUserName();
     }
     $placeholders = array('username' => $username, 'userImage' => $this->getUserImage());
     $this->controller->setPlaceholders($placeholders);
 }
Ejemplo n.º 2
0
 /**
  * Retrieve/compute the user picture profile
  *
  * @return string The HTML output
  */
 public function getUserImage()
 {
     /** @var modUserProfile $userProfile */
     $userProfile = $this->modx->user->getOne('Profile');
     // Default to FontAwesome
     $userImage = '<i class="icon icon-user icon-large"></i>&nbsp;';
     if ($userProfile->photo) {
         // First, handle user defined image
         $src = $this->modx->getOption('connectors_url', MODX_CONNECTORS_URL) . 'system/phpthumb.php?zc=1&h=128&w=128&src=' . $userProfile->photo;
         $userImage = '<img src="' . $src . '" />';
     } elseif ($this->modx->getOption('enable_gravatar')) {
         // Gravatar
         $gravemail = md5(strtolower(trim($userProfile->email)));
         $gravsrc = $this->modx->getOption('url_scheme', null, 'http://') . 'www.gravatar.com/avatar/' . $gravemail . '?s=128&d=mm';
         $userImage = '<img src="' . $gravsrc . '" alt="' . $this->modx->getLoginUserName() . '" />';
     }
     return $userImage;
 }
Ejemplo n.º 3
0
 /**
  * Set a bunch of placeholders to be used within Smarty templates
  *
  * @return void
  */
 public function setPlaceholders()
 {
     $placeholders = array('username' => $this->modx->getLoginUserName(), 'userImage' => $this->getUserImage());
     $this->controller->setPlaceholders($placeholders);
 }