Esempio n. 1
0
 /**
  * @param string $name
  *
  * @return string
  */
 public function profileIcon($name)
 {
     switch ($name) {
         case 'gender':
             switch ($this->gender) {
                 case 1:
                     $gender = 'male';
                     break;
                 case 2:
                     $gender = 'female';
                     break;
                 default:
                     $gender = 'unknown';
             }
             $title = JText::_('COM_KUNENA_MYPROFILE_GENDER') . ': ' . JText::_('COM_KUNENA_MYPROFILE_GENDER_' . $gender);
             return '<span class="kicon-profile kicon-profile-gender-' . $gender . '" title="' . $title . '"></span>';
             break;
         case 'birthdate':
             if ($this->birthdate) {
                 $date = new KunenaDate($this->birthdate);
                 if ($date->format('%Y') < 1902) {
                     break;
                 }
                 return '<span class="kicon-profile kicon-profile-birthdate" title="' . JText::_('COM_KUNENA_MYPROFILE_BIRTHDATE') . ': ' . $this->birthdate->toKunena('date', 'GMT') . '"></span>';
             }
             break;
         case 'location':
             if ($this->location) {
                 return '<span class="kicon-profile kicon-profile-location" title="' . JText::_('COM_KUNENA_MYPROFILE_LOCATION') . ': ' . $this->escape($this->location) . '"></span>';
             }
             break;
         case 'website':
             $url = $this->websiteurl;
             if (!preg_match("~^(?:f|ht)tps?://~i", $this->websiteurl)) {
                 $url = 'http://' . $this->websiteurl;
             }
             if (!$this->websitename) {
                 $websitename = $this->websiteurl;
             } else {
                 $websitename = $this->websitename;
             }
             if ($this->websiteurl) {
                 return '<a href="' . $this->escape($url) . '" target="_blank"><span class="kicon-profile kicon-profile-website" title="' . JText::_('COM_KUNENA_MYPROFILE_WEBSITE') . ': ' . $this->escape($websitename) . '"></span></a>';
             }
             break;
         case 'private':
             $pms = KunenaFactory::getPrivateMessaging();
             return $pms->showIcon($this->userid);
             break;
         case 'email':
             // TODO: show email
             return;
             // '<span class="email" title="'. JText::_('COM_KUNENA_MYPROFILE_EMAIL').'"></span>';
             break;
         case 'profile':
             if (!$this->userid) {
                 return;
             }
             return $this->getLink('<span class="profile" title="' . JText::_('COM_KUNENA_VIEW_PROFILE') . '"></span>');
             break;
     }
 }