コード例 #1
0
ファイル: miniheader.php プロジェクト: Jougito/DynWeb
 public static function showMiniHeader($userId)
 {
     CMiniHeader::load();
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     JFactory::getLanguage()->load('com_community');
     $option = $jinput->get('option', '', 'STRING');
     //JRequest::getVar('option', '' , 'REQUEST');
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     if (!empty($userId)) {
         $user = CFactory::getUser($userId);
         $params = $user->getParams();
         //links information
         $photoEnabled = $config->get('enablephotos') ? true : false;
         $eventEnabled = $config->get('enableevents') ? true : false;
         $groupEnabled = $config->get('enablegroups') ? true : false;
         $videoEnabled = $config->get('enablevideos') ? true : false;
         //likes
         CFactory::load('libraries', 'like');
         $like = new Clike();
         $isLikeEnabled = $like->enabled('profile') && $params->get('profileLikes', 1) ? 1 : 0;
         $isUserLiked = $like->userLiked('profile', $user->id, $my->id);
         /* likes count */
         $likes = $like->getLikeCount('profile', $user->id);
         //profile
         $profileModel = CFactory::getModel('profile');
         $profile = $profileModel->getViewableProfile($user->id, $user->getProfileType());
         $profile = JArrayHelper::toObject($profile);
         $profile->largeAvatar = $user->getAvatar();
         $profile->defaultAvatar = $user->isDefaultAvatar();
         $profile->status = $user->getStatus();
         $profile->defaultCover = $user->isDefaultCover();
         $profile->cover = $user->getCover();
         $profile->coverPostion = $params->get('coverPosition', '');
         if (strpos($profile->coverPostion, '%') === false) {
             $profile->coverPostion = 0;
         }
         $groupmodel = CFactory::getModel('groups');
         $profile->_groups = $groupmodel->getGroupsCount($profile->id);
         $eventmodel = CFactory::getModel('events');
         $profile->_events = $eventmodel->getEventsCount($profile->id);
         $profile->_friends = $user->_friendcount;
         $videoModel = CFactory::getModel('Videos');
         $profile->_videos = $videoModel->getVideosCount($profile->id);
         $photosModel = CFactory::getModel('photos');
         $profile->_photos = $photosModel->getPhotosCount($profile->id);
         /* is featured */
         $modelFeatured = CFactory::getModel('Featured');
         $profile->featured = $modelFeatured->isExists(FEATURED_USERS, $profile->id);
         $sendMsg = CMessaging::getPopup($user->id);
         $tmpl = new CTemplate();
         $tmpl->set('my', $my)->set('user', $user)->set('isBlocked', $user->isBlocked())->set('isMine', COwnerHelper::isMine($my->id, $user->id))->set('sendMsg', $sendMsg)->set('config', $config)->set('isWaitingApproval', CFriendsHelper::isWaitingApproval($my->id, $user->id))->set('isLikeEnabled', $isLikeEnabled)->set('photoEnabled', $photoEnabled)->set('eventEnabled', $eventEnabled)->set('groupEnabled', $groupEnabled)->set('videoEnabled', $videoEnabled)->set('profile', $profile)->set('isUserLiked', $isUserLiked)->set('likes', $likes)->set('isFriend', CFriendsHelper::isConnected($user->id, $my->id) && $user->id != $my->id);
         $showMiniHeader = $option == 'com_community' ? $tmpl->fetch('profile.miniheader') : '<div id="community-wrap" style="min-height:50px;">' . $tmpl->fetch('profile.miniheader') . '</div>';
         return $showMiniHeader;
     }
 }
コード例 #2
0
ファイル: hovercard.php プロジェクト: joshjim27/jobsglobal
$params = $user->getParams();
$config = CFactory::getConfig();
$my = CFactory::getUser();
$isMine = COwnerHelper::isMine($my->id, $user->id);
$isFriend = CFriendsHelper::isConnected($user->id, $my->id) && $user->id != $my->id;
$isWaitingApproval = CFriendsHelper::isWaitingApproval($my->id, $user->id);
$isWaitingResponse = CFriendsHelper::isWaitingApproval($user->id, $my->id);
$isBlocked = $user->isBlocked();
//links information
$photoEnabled = $config->get('enablephotos') ? true : false;
$eventEnabled = $config->get('enableevents') ? true : false;
$groupEnabled = $config->get('enablegroups') ? true : false;
$videoEnabled = $config->get('enablevideos') ? true : false;
//likes
CFactory::load('libraries', 'like');
$like = new Clike();
$isLikeEnabled = $like->enabled('profile') && $params->get('profileLikes', 1) ? 1 : 0;
$isUserLiked = $like->userLiked('profile', $user->id, $my->id);
/* likes count */
$likes = $like->getLikeCount('profile', $user->id);
$profileFields = '';
$themeModel = CFactory::getModel('theme');
$profileModel = CFactory::getModel('profile');
$settings = $themeModel->getSettings('profile');
$profile = $profileModel->getViewableProfile($user->id, $user->getProfileType());
$profile = JArrayHelper::toObject($profile);
$groupmodel = CFactory::getModel('groups');
$profile->_groups = $groupmodel->getGroupsCount($profile->id);
$eventmodel = CFactory::getModel('events');
$profile->_events = $eventmodel->getEventsCount($profile->id);
$profile->_friends = $user->_friendcount;
コード例 #3
0
ファイル: view.html.php プロジェクト: Jougito/DynWeb
 public function modProfileUserinfo()
 {
     jimport('joomla.utilities.arrayhelper');
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $my = CFactory::getUser();
     $userid = $jinput->get('userid', $my->id, 'INT');
     $user = CFactory::getUser($userid);
     $params = $user->getParams();
     $userModel = CFactory::getModel('user');
     $profileModel = CFactory::getModel('profile');
     //Reassign needed variable
     $data = new stdClass();
     $data->user = $user;
     $data->profile = $profileModel->getViewableProfile($userid, $user->getProfileType());
     $data->videoid = $params->get('profileVideo', 0);
     CFactory::load('libraries', 'messaging');
     $isMine = COwnerHelper::isMine($my->id, $user->id);
     // Get the admin controls HTML data
     $adminControlHTML = '';
     $tmpl = new CTemplate();
     // get how many unread message
     $filter = array();
     $inboxModel = CFactory::getModel('inbox');
     $filter['user_id'] = $my->id;
     $unread = $inboxModel->countUnRead($filter);
     // get how many pending connection
     $friendModel = CFactory::getModel('friends');
     $pending = $friendModel->countPending($my->id);
     $profile = JArrayHelper::toObject($data->profile);
     $profile->largeAvatar = $user->getAvatar();
     $profile->defaultAvatar = $user->isDefaultAvatar();
     $profile->status = $user->getStatus();
     $profile->defaultCover = $user->isDefaultCover();
     $profile->cover = $user->getCover();
     $profile->coverPostion = $params->get('coverPosition', '');
     if (strpos($profile->coverPostion, '%') === false) {
         $profile->coverPostion = 0;
     }
     $groupmodel = CFactory::getModel('groups');
     $profile->_groups = $groupmodel->getGroupsCount($profile->id);
     $eventmodel = CFactory::getModel('events');
     $profile->_events = $eventmodel->getEventsCount($profile->id);
     $profile->_friends = $user->_friendcount;
     $videoModel = CFactory::getModel('Videos');
     $profile->_videos = $videoModel->getVideosCount($profile->id);
     $photosModel = CFactory::getModel('photos');
     $profile->_photos = $photosModel->getPhotosCount($profile->id);
     if ($profile->status !== '') {
         $postedOn = new JDate($user->_posted_on);
         $postedOn = CActivityStream::_createdLapse($postedOn);
         $profile->posted_on = $user->_posted_on == '0000-00-00 00:00:00' ? '' : $postedOn;
     } else {
         $profile->posted_on = '';
     }
     /* is featured */
     $modelFeatured = CFactory::getModel('Featured');
     $profile->featured = $modelFeatured->isExists(FEATURED_USERS, $profile->id);
     // Assign videoId
     $profile->profilevideo = $data->videoid;
     $video = JTable::getInstance('Video', 'CTable');
     $video->load($profile->profilevideo);
     $profile->profilevideoTitle = $video->getTitle();
     $addbuddy = "joms.api.friendAdd('{$profile->id}')";
     $sendMsg = CMessaging::getPopup($profile->id);
     $config = CFactory::getConfig();
     $jConfig = JFactory::getConfig();
     $lastLogin = JText::_('COM_COMMUNITY_PROFILE_NEVER_LOGGED_IN');
     if ($user->lastvisitDate != '0000-00-00 00:00:00') {
         $userLastLogin = new JDate($user->lastvisitDate);
         $lastLogin = CActivityStream::_createdLapse($userLastLogin);
     }
     // @todo : beside checking the owner, maybe we want to check for a cookie,
     // say every few hours only the hit get increment by 1.
     if (!$isMine) {
         $user->viewHit();
     }
     // @rule: myblog integrations
     $showBlogLink = false;
     $myblog = CMyBlog::getInstance();
     if ($config->get('enablemyblogicon') && $myblog) {
         if ($myblog->userCanPost($user->id)) {
             $showBlogLink = true;
         }
         $tmpl->set('blogItemId', $myblog->getItemId());
     }
     $photoEnabled = $config->get('enablephotos') ? true : false;
     $eventEnabled = $config->get('enableevents') ? true : false;
     $groupEnabled = $config->get('enablegroups') ? true : false;
     $videoEnabled = $config->get('enablevideos') ? true : false;
     $isSEFEnabled = $jConfig->get('sef') ? true : false;
     $multiprofile = JTable::getInstance('MultiProfile', 'CTable');
     $multiprofile->load($user->getProfileType());
     CFactory::load('libraries', 'like');
     $like = new Clike();
     $isLikeEnabled = $like->enabled('profile') && $params->get('profileLikes', 1) ? 1 : 0;
     $isUserLiked = $like->userLiked('profile', $user->id, $my->id);
     /* likes count */
     $likes = $like->getLikeCount('profile', $user->id);
     /* User status */
     $status = new CUserStatus($user->id, 'profile');
     //respect wall setting
     if ($my->id && (!$config->get('lockprofilewalls') || $config->get('lockprofilewalls') && CFriendsHelper::isConnected($my->id, $profile->id)) || COwnerHelper::isCommunityAdmin()) {
         // Add default status box
         CUserHelper::addDefaultStatusCreator($status);
     }
     //$isblocked = $user->isBlocked();
     $isMine = COwnerHelper::isMine($my->id, $user->id);
     $isCommunityAdmin = COwnerHelper::isCommunityAdmin($user->id);
     // Check if user is blocked
     $getBlockStatus = new blockUser();
     $isblocked = $getBlockStatus->isUserBlocked($user->id, 'profile');
     // Get block user html
     //$blockUserHTML = $isMine || $isCommunityAdmin ? '' : CUserHelper::getBlockUserHTML($user->id, $isBlocked);
     $isMine = COwnerHelper::isMine($my->id, $user->id);
     $isCommunityAdmin = COwnerHelper::isCommunityAdmin($user->id);
     // Get reporting html
     $report = new CReportingLibrary();
     $reportsHTML = $isMine ? '' : $report->getReportingHTML(JText::_('COM_COMMUNITY_REPORT_USER'), 'profile,reportProfile', array($user->id));
     $tmpl = new CTemplate();
     echo $tmpl->set('karmaImgUrl', CUserPoints::getPointsImage($user))->set('reportsHTML', $reportsHTML)->set('isMine', $isMine)->set('lastLogin', $lastLogin)->set('addBuddy', $addbuddy)->set('sendMsg', $sendMsg)->set('config', $config)->set('multiprofile', $multiprofile)->set('showBlogLink', $showBlogLink)->set('isFriend', CFriendsHelper::isConnected($user->id, $my->id) && $user->id != $my->id)->set('isWaitingApproval', CFriendsHelper::isWaitingApproval($my->id, $user->id))->set('isWaitingResponse', CFriendsHelper::isWaitingApproval($user->id, $my->id))->set('isBlocked', $isblocked)->set('profile', $profile)->set('unread', $unread)->set('pending', $pending)->set('registerDate', $user->registerDate)->set('adminControlHTML', $adminControlHTML)->set('userstatus', $status)->set('user', $user)->set('isUserLiked', $isUserLiked)->set('likes', $likes)->set('isLikeEnabled', $isLikeEnabled)->set('photoEnabled', $photoEnabled)->set('eventEnabled', $eventEnabled)->set('groupEnabled', $groupEnabled)->set('videoEnabled', $videoEnabled)->set('about', $this->_getProfileHTML($data->profile))->set('isSEFEnabled', $isSEFEnabled)->set('blocked', $user->isBlocked())->fetch('profile/focus');
 }