コード例 #1
0
ファイル: CommunityBuilder.php プロジェクト: pashakiz/crowdf
 /**
  * Get a link to user profile.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  * $userId = 1;
  *
  * $profiles = new Prism\Integration\Profiles\CommunityBuilder(\JFactory::getDbo());
  * $profiles->load($ids);
  *
  * $link = $profiles->getLink($userId);
  * </code>
  * 
  * @param int $userId
  * @param bool $route Route or not the link.
  *
  * @return string
  */
 public function getLink($userId, $route = true)
 {
     $link = "";
     if (isset($this->profiles[$userId])) {
         $needles = array("userprofile" => array(0));
         $menuItemId = Helper::getItemId("com_comprofiler", $needles);
         $link = 'index.php?option=com_comprofiler&view=userprofile&user=' . $userId;
         if (!empty($menuItemId)) {
             $link .= "&Itemid=" . (int) $menuItemId;
         }
         // Route the link.
         if ($route) {
             $link = \JRoute::_($link);
         }
     }
     return $link;
 }
コード例 #2
0
 /**
  * Provide a link to social profile.
  *
  * <code>
  * $userId = 1;
  *
  * $profile = new Prism\Integration\Profile\CommunityBuilder(\JFactory::getDbo());
  * $profile->load($userId);
  *
  * $link = $profile->getLink();
  * </code>
  *
  * @param bool $route Route or not the link.
  *
  * @return string
  */
 public function getLink($route = true)
 {
     $link = '';
     if ($this->user_id !== null and $this->user_id > 0) {
         $needles = array('userprofile' => array(0));
         $menuItemId = Helper::getItemId('com_comprofiler', $needles);
         $link = 'index.php?option=com_comprofiler&view=userprofile&user='******'&Itemid=' . (int) $menuItemId;
         }
         if (!$route) {
             $link = \JRoute::_($link);
         }
     }
     return $link;
 }
コード例 #3
0
 /**
  * Get a link to user profile.
  *
  * <code>
  * $ids = array(1, 2, 3, 4);
  * $userId = 1;
  *
  * $profiles = new Prism\Integration\Profiles\CommunityBuilder(\JFactory::getDbo());
  * $profiles->load($ids);
  *
  * $link = $profiles->getLink($userId);
  * </code>
  * 
  * @param int $userId
  * @param bool $route Route or not the link.
  *
  * @return string
  */
 public function getLink($userId, $route = true)
 {
     $link = '';
     if (array_key_exists($userId, $this->profiles)) {
         $needles = array('userprofile' => array(0));
         $menuItemId = Helper::getItemId('com_comprofiler', $needles);
         $link = 'index.php?option=com_comprofiler&view=userprofile&user='******'&Itemid=' . (int) $menuItemId;
         }
         // Route the link.
         if ($route) {
             $link = \JRoute::_($link);
         }
     }
     return $link;
 }