Пример #1
0
 /**
  * Fill title with date if available
  *
  * This will normally be overwriten by extended classes to provide
  * an appropriate title title string
  * @param array mInfo type hash of data to be used to provide base data
  * @return string Descriptive title for the object
  */
 public static function getTitleFromHash(&$pHash, $pDefault = TRUE)
 {
     global $gBitSmarty;
     $ret = NULL;
     if (!empty($pHash['title'])) {
         $ret = $pHash['title'];
     } elseif (!empty($pHash['created'])) {
         $gBitSmarty->loadPlugin('smarty_modifier_bit_short_date');
         $ret = smarty_modifier_bit_short_date($pHash['created']);
     } elseif (!empty($pHash['content_name'])) {
         $ret = $pHash['content_name'];
     }
     return $ret;
 }
Пример #2
0
 /**
  * Pure virtual function that returns link to display a piece of content
  *
  * @param string $pLinkText Text for the link unless overriden by object title
  * @param array $pMixed different possibilities depending on derived class
  * @param string $pAnchor anchor string e.g.: #comment_123
  * @return string Formated html the link to display the page.
  */
 function getDisplayLink($pLinkText = NULL, $pMixed = NULL, $pAnchor = NULL)
 {
     global $gBitSmarty;
     $ret = '';
     if (empty($pMixed) && !empty($this->mInfo)) {
         $pMixed =& $this->mInfo;
     }
     if (empty($pLinkText)) {
         if (!empty($pMixed['title'])) {
             $pLinkText = $pMixed['title'];
         } elseif (!empty($pMixed['content_name'])) {
             $pLinkText = "[ " . $pMixed['content_name'] . " ]";
         }
     }
     if (empty($pLinkText)) {
         $pLinkText = "[ " . tra("No Title") . " ]";
     }
     // we add some more info to the title of the link
     if (!empty($pMixed['created'])) {
         $gBitSmarty->loadPlugin('smarty_modifier_bit_short_date');
         $linkTitle = tra('Created') . ': ' . smarty_modifier_bit_short_date($pMixed['created']);
     } else {
         $linkTitle = $pLinkText;
     }
     // finally we are ready to create the full link
     if (!empty($pMixed['content_id'])) {
         $ret = '<a title="' . htmlspecialchars($linkTitle) . '" href="' . LibertyContent::getDisplayUrlFromHash($pMixed) . $pAnchor . '">' . htmlspecialchars($pLinkText) . '</a>';
     }
     return $ret;
 }