Ejemplo n.º 1
0
 public function __get($strName)
 {
     switch ($strName) {
         case 'DisplayForForums':
             $strToReturn = sprintf('<a href="%s" title="View Profile">%s</a>', $this->ViewProfileUrl, QApplication::HtmlEntities($this->DisplayName));
             if ($this->strLocation) {
                 $strToReturn .= ' (' . QApplication::HtmlEntities($this->strLocation, ENT_COMPAT, QApplication::$EncodingType) . ')';
             }
             // Display the Flag (if applicable)
             if ($this->Country) {
                 $strCode = strtolower($this->Country->Code);
                 $strImageFile = sprintf('/images/flags/%s.png', $strCode);
                 if (file_exists(QApplication::$DocumentRoot . $strImageFile)) {
                     $strToReturn .= sprintf(' <img src="%s" title="%s" alt="%s" width="16" height="11"/>', $strImageFile, $this->Country->Name, $this->Country->Name);
                 }
             }
             // Display the Star (if applicable)
             $strStarIcon = ' <img src="/images/star_icon.png" style="vertical-align: bottom;" title="%s" alt="%s" width="16" height="16"/>';
             if ($this->intPersonTypeId == PersonType::Administrator) {
                 $strToReturn .= sprintf($strStarIcon, 'Qcodo Administrator', 'Qcodo Administrator');
             } else {
                 if ($this->intPersonTypeId == PersonType::Contributor) {
                     $strToReturn .= sprintf($strStarIcon, 'Qcodo Core Contributor', 'Qcodo Core Contributor');
                 } else {
                     if ($this->blnDonatedFlag) {
                         $strToReturn .= sprintf($strStarIcon, 'Financial Contributor', 'Financial Contributor');
                     }
                 }
             }
             return $strToReturn;
         case 'ViewProfileUrl':
             return '/profile/view.php/' . $this->strUsername;
         case 'DisplayNameWithLink':
             return sprintf('<a href="%s" title="View Profile">%s</a>', $this->ViewProfileUrl, QApplication::HtmlEntities($this->DisplayName));
         case 'SmtpEmailAddress':
             return $this->strFirstName . ' ' . $this->strLastName . ' <' . $this->strEmail . '>';
         case 'Type':
             return PersonType::$NameArray[$this->intPersonTypeId];
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
Ejemplo n.º 2
0
 public function __get($strName)
 {
     switch ($strName) {
         case 'Name':
             return $this->strFirstName . ' ' . $this->strLastName;
         case 'FullName':
             $strToReturn = null;
             $strToReturn .= $this->strFirstName . ' ';
             if ($this->strMiddleName) {
                 if (strlen($this->strMiddleName) == 1) {
                     $strToReturn .= $this->strMiddleName . '. ';
                 } else {
                     $strToReturn .= $this->strMiddleName . ' ';
                 }
             }
             $strToReturn .= $this->strLastName;
             if ($this->strSuffix) {
                 $strToReturn .= ', ' . $this->strSuffix;
             }
             return $strToReturn;
         case 'NameWithNickname':
             if ($this->strNickname) {
                 return sprintf('%s "%s" %s', $this->strFirstName, $this->strNickname, $this->strLastName);
             } else {
                 return $this->strFirstName . ' ' . $this->strLastName;
             }
         case 'FormalName':
             $strToReturn = null;
             if ($this->strTitle) {
                 $strToReturn .= $this->strTitle . ' ';
             }
             $strToReturn .= $this->strFirstName . ' ';
             if ($this->strMiddleName) {
                 if (strlen($this->strMiddleName) == 1) {
                     $strToReturn .= $this->strMiddleName . '. ';
                 } else {
                     $strToReturn .= $this->strMiddleName . ' ';
                 }
             }
             $strToReturn .= $this->strLastName;
             if ($this->strSuffix) {
                 $strToReturn .= ', ' . $this->strSuffix;
             }
             return $strToReturn;
         case 'ActiveMailingLabel':
             if ($this->strMailingLabel) {
                 return $this->strMailingLabel;
             } else {
                 return $this->Name;
             }
         case 'MembershipStatus':
             return MembershipStatusType::$NameArray[$this->intMembershipStatusTypeId];
         case 'CurrentMembershipInfo':
             $objMembership = Membership::QuerySingle(QQ::Equal(QQN::Membership()->PersonId, $this->intId), QQ::OrderBy(QQN::Membership()->DateStart, false));
             if (!$objMembership) {
                 return null;
             }
             if ($objMembership->DateEnd) {
                 return null;
             }
             $intYears = QDateTime::Now()->Difference($objMembership->DateStart)->Years;
             return sprintf('since %s (%s year%s)', $objMembership->DateStart->__toString('MMMM D, YYYY'), $intYears, $intYears == 1 ? '' : 's');
         case 'MaritalStatus':
             return MaritalStatusType::$NameArray[$this->intMaritalStatusTypeId];
         case 'PronounSubject':
             switch ($this->strGender) {
                 case 'M':
                     return 'he';
                 case 'F':
                     return 'she';
                 default:
                     return 'he/she';
             }
         case 'PronounIndirectObject':
             switch ($this->strGender) {
                 case 'M':
                     return 'him';
                 case 'F':
                     return 'her';
                 default:
                     return 'him/her';
             }
         case 'PronounAdjective':
             switch ($this->strGender) {
                 case 'M':
                     return 'his';
                 case 'F':
                     return 'her';
                 default:
                     return 'his/her';
             }
         case 'GenderLabel':
             switch ($this->strGender) {
                 case 'M':
                     return 'Male';
                 case 'F':
                     return 'Female';
                 default:
                     return 'Not Specified';
             }
         case 'Birthdate':
             if (!$this->dttDateOfBirth) {
                 return null;
             }
             switch (true) {
                 case !$this->blnDobGuessedFlag && !$this->blnDobYearApproximateFlag:
                     $strToReturn = $this->dttDateOfBirth->__toString('MMMM D, YYYY');
                     $intAge = $this->Age;
                     $strToReturn .= sprintf('<br/>%s year%s old', $intAge, $intAge != 1 ? 's' : '');
                     return $strToReturn;
                 case $this->blnDobGuessedFlag && !$this->blnDobYearApproximateFlag:
                     $strToReturn = 'Birthday Not Available';
                     $intAge = $this->Age;
                     $strToReturn .= sprintf('<br/>%s year%s old', $intAge, $intAge != 1 ? 's' : '');
                     return $strToReturn;
                 case !$this->blnDobGuessedFlag && $this->blnDobYearApproximateFlag:
                     $strToReturn = $this->dttDateOfBirth->__toString('MMMM D');
                     $intAge = $this->Age;
                     $strToReturn .= sprintf('<br/>Approximately %s year%s old', $intAge, $intAge != 1 ? 's' : '');
                     return $strToReturn;
                 case $this->blnDobGuessedFlag && $this->blnDobYearApproximateFlag:
                     $strToReturn = 'Birthday Not Available';
                     $intAge = $this->Age;
                     $strToReturn .= sprintf('<br/>Approximately %s year%s old', $intAge, $intAge != 1 ? 's' : '');
                     return $strToReturn;
                 default:
                     throw new Exception('Invalid BirthDate Switch');
             }
         case 'LinkUrl':
             return sprintf('/individuals/view.php/%s#general', $this->intId);
         case 'ContactInfoLinkUrl':
             return sprintf('/individuals/view.php/%s#contact', $this->intId);
         case 'RefreshLinkUrl':
             return sprintf('/individuals/refresh_view.php/%s', $this->intId);
         case 'LinkHtml':
             return sprintf('<a href="%s" title="View %s\'s Information">%s</a>', $this->LinkUrl, QApplication::HtmlEntities($this->FormalName), QApplication::HtmlEntities($this->FormalName));
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }