当前位置: 首页>>代码示例>>PHP>>正文


PHP CActivityStream::_createdLapse方法代码示例

本文整理汇总了PHP中CActivityStream::_createdLapse方法的典型用法代码示例。如果您正苦于以下问题:PHP CActivityStream::_createdLapse方法的具体用法?PHP CActivityStream::_createdLapse怎么用?PHP CActivityStream::_createdLapse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CActivityStream的用法示例。


在下文中一共展示了CActivityStream::_createdLapse方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: album


//.........这里部分代码省略.........
         $album->thumbnail = $photo->getThumbURI();
     } else {
         $album->thumbnail = $photo->getImageURI();
     }
     // Increment album's hit each time this page is loaded.
     $album->hit();
     if ($groupId > 0) {
         $otherAlbums = $model->getGroupAlbums($groupId);
     } else {
         $otherAlbums = $model->getAlbums($user->id);
     }
     $totalAlbums = count($otherAlbums);
     $showOtherAlbum = 6;
     $randomAlbum = array();
     if (count($otherAlbums) > 0) {
         $randomId = $totalAlbums < $showOtherAlbum ? array_rand($otherAlbums, $totalAlbums) : array_rand($otherAlbums, $showOtherAlbum);
         $count = 0;
         for ($i = 0; $i < $totalAlbums; $i++) {
             $num = is_array($randomId) ? $randomId[$i] : $randomId;
             if ($otherAlbums[$num]->id != $album->id) {
                 $count++;
                 $randomAlbum[] = $otherAlbums[$num];
             }
             if (count($randomAlbum) == $showOtherAlbum - 1) {
                 break;
             }
         }
     }
     /* set head meta */
     if (strtolower(trim(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()))) == strtolower(trim($album->name))) {
         /**
          * Opengraph
          */
         CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()), CStringHelper::escape($album->getDescription()));
     } else {
         /**
          * Opengraph
          */
         CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()) . ' - ' . $album->name, CStringHelper::escape($album->getDescription()));
     }
     $this->setTitle($album->name);
     $handler->setAlbumPathway(CStringHelper::escape($album->name));
     $handler->setRSSHeader($albumId);
     // Set album thumbnail and description for social bookmarking sites linking
     $document->addHeadLink($album->getCoverThumbURI(), 'image_src', 'rel');
     //$document->setDescription( CStringHelper::escape($album->getDescription()) );
     //CFactory::load( 'libraries' , 'phototagging' );
     $getTaggingUsers = new CPhotoTagging();
     $people = array();
     // @TODO temporary fix for undefined link
     $list = array();
     foreach ($photos as $photo) {
         $photo->link = $handler->getPhotoURI($photo->id, $photo->albumid);
         CHeadHelper::addOpengraph('og:image', JUri::root(true) . '/' . $photo->image, true);
         $list[] = $photo;
     }
     $photos = $list;
     $albumParam = new Cparameter($album->params);
     $tagged = $albumParam->get('tagged');
     if (!empty($tagged)) {
         $people = explode(',', $albumParam->get('tagged'));
     }
     //Update lastUpdated
     $lastUpdated = new JDate($album->lastupdated);
     $album->lastUpdated = CActivityStream::_createdLapse($lastUpdated, false);
     $people = array_unique($people);
     CFactory::loadUsers($people);
     foreach ($people as &$person) {
         $person = CFactory::getUser($person);
     }
     //CFactory::load( 'libraries' , 'bookmarks' );
     $bookmarks = new CBookmarks($handler->getAlbumExternalURI($album->id));
     // Get wall data.
     $wallCount = CWallLibrary::getWallCount('albums', $album->id);
     $viewAllLink = false;
     if ($jinput->request->get('task', '') != 'app') {
         $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls');
     }
     $wallContent = CWallLibrary::getWallContents('albums', $album->id, COwnerHelper::isCommunityAdmin() || $my->id == $album->creator && $my->id != 0, $config->get('stream_default_comments'), 0, 'wall/content', 'photos,album');
     $wallForm = CWallLibrary::getWallInputForm($album->id, 'photos,ajaxAlbumSaveWall', 'photos,ajaxAlbumRemoveWall', $viewAllLink);
     $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls');
     $wallViewAll = '';
     if ($wallCount > $config->get('stream_default_comments')) {
         $wallViewAll = CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     }
     $redirectUrl = CRoute::getURI(false);
     $tmpl = new CTemplate();
     if ($album->location != "") {
         $zoomableMap = CMapping::drawZoomableMap($album->location, 220, 150);
     } else {
         $zoomableMap = "";
     }
     // Get the likes / dislikes item
     //CFactory::load( 'libraries' , 'like' );
     $like = new CLike();
     $likeCount = $like->getLikeCount('album', $album->id);
     $likeLiked = $like->userLiked('album', $album->id, $my->id) === COMMUNITY_LIKE;
     $owner = CFactory::getUser($album->creator);
     echo $tmpl->set('photosmapdefault', $photoMapsDefault)->set('my', $my)->set('bookmarksHTML', $bookmarks->getHTML())->set('isOwner', $handler->isAlbumOwner($album->id))->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('owner', $owner)->set('photos', $photos)->set('people', $people)->set('album', $album)->set('groupId', $groupId)->set('otherAlbums', $randomAlbum)->set('likeCount', $likeCount)->set('likeLiked', $likeLiked)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('wallCount', $wallCount)->set('wallViewAll', $wallViewAll)->set('zoomableMap', $zoomableMap)->set('pagination', $pagination)->set('photoId', $defaultId)->set('submenu', $this->showSubmenu(false))->fetch('photos/list');
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:101,代码来源:view.html.php

示例2: getLastUpdated

 public function getLastUpdated($raw = false)
 {
     $query = ' SELECT MAX(created) AS lastupdated' . ' FROM ' . $this->_db->nameQuote('#__community_videos') . ' WHERE ' . $this->_db->nameQuote('id') . ' = ' . $this->_db->quote($this->getId());
     $this->_db->setQuery($query);
     $this->_lastupdated = $this->_db->loadResult();
     if ($raw) {
         return $this->_lastupdated;
     }
     CFactory::load('libraries', 'activities');
     if ($this->_lastupdated == '0000-00-00 00:00:00' || $this->_lastupdated == '') {
         $this->_lastupdated = $this->created;
         if ($this->_lastupdated == '' || $this->_lastupdated == '0000-00-00 00:00:00') {
             $this->_lastupdated = JText::_('CC NO LAST ACTIVITY');
         } else {
             $lastUpdated = new JDate($this->_lastupdated);
             $this->_lastupdated = CActivityStream::_createdLapse($lastUpdated);
         }
     } else {
         $lastUpdated = new JDate($this->_lastupdated);
         $this->_lastupdated = CActivityStream::_createdLapse($lastUpdated);
     }
     return $this->_lastupdated;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:23,代码来源:video.php

示例3: _getAlbumsHTML

 function _getAlbumsHTML($albums, $type = PHOTOS_USER_TYPE)
 {
     $my = CFactory::getUser();
     $groupId = JRequest::getInt('groupid', '', 'REQUEST');
     $tmpl = new CTemplate();
     CFactory::load('libraries', 'activities');
     CFactory::load('models', 'groups');
     CFactory::load('helpers', 'owner');
     for ($i = 0; $i < count($albums); $i++) {
         $albums[$i]->user = CFactory::getUser($albums[$i]->creator);
         $albums[$i]->link = CRoute::_("index.php?option=com_community&view=photos&task=album&albumid={$albums[$i]->id}&userid={$albums[$i]->creator}");
         $albums[$i]->editLink = CRoute::_("index.php?option=com_community&view=photos&task=editAlbum&albumid={$albums[$i]->id}&userid={$albums[$i]->creator}");
         $albums[$i]->uploadLink = CRoute::_("index.php?option=com_community&view=photos&task=uploader&albumid={$albums[$i]->id}&userid={$albums[$i]->creator}");
         $albums[$i]->isOwner = $my->id == $albums[$i]->creator;
         if ($type == PHOTOS_GROUP_TYPE) {
             $group =& JTable::getInstance('Group', 'CTable');
             $group->load($groupId);
             $albums[$i]->link = CRoute::_("index.php?option=com_community&view=photos&task=album&albumid={$albums[$i]->id}&groupid={$albums[$i]->groupid}");
             $albums[$i]->editLink = CRoute::_("index.php?option=com_community&view=photos&task=editAlbum&albumid={$albums[$i]->id}&groupid={$albums[$i]->groupid}");
             $albums[$i]->uploadLink = CRoute::_("index.php?option=com_community&view=photos&task=uploader&albumid={$albums[$i]->id}&groupid={$albums[$i]->groupid}");
             $params = $group->getParams();
             $photopermission = $params->get('photopermission', GROUP_PHOTO_PERMISSION_ADMINS);
             if ($photopermission == GROUP_PHOTO_PERMISSION_MEMBERS && $group->isMember($my->id)) {
                 $albums[$i]->isOwner = $my->id == $albums[$i]->creator;
             } else {
                 if ($photopermission == GROUP_PHOTO_PERMISSION_ADMINS && $group->isAdmin($my->id) || COwnerHelper::isCommunityAdmin()) {
                     $albums[$i]->isOwner = true;
                 } else {
                     $albums[$i]->isOwner = false;
                 }
             }
         }
         // If new albums that has just been created and
         // does not contain any images, the lastupdated will always be 0000-00-00 00:00:00:00
         // Try to use the albums creation date instead.
         if ($albums[$i]->lastupdated == '0000-00-00 00:00:00' || $albums[$i]->lastupdated == '') {
             $albums[$i]->lastupdated = $albums[$i]->created;
             if ($albums[$i]->lastupdated == '' || $albums[$i]->lastupdated == '0000-00-00 00:00:00') {
                 $albums[$i]->lastupdated = JText::_('CC NO LAST ACTIVITY');
             } else {
                 $lastUpdated = new JDate($albums[$i]->lastupdated);
                 $albums[$i]->lastupdated = CActivityStream::_createdLapse($lastUpdated);
             }
         } else {
             $lastUpdated = new JDate($albums[$i]->lastupdated);
             $albums[$i]->lastupdated = CActivityStream::_createdLapse($lastUpdated);
         }
     }
     CFactory::load('helpers', 'owner');
     CFactory::load('libraries', 'featured');
     $featured = new CFeatured(FEATURED_ALBUMS);
     $featuredList = $featured->getItemIds();
     $task = JRequest::getVar('task', '', 'GET');
     $showFeatured = empty($task) ? true : false;
     $createLink = CRoute::_('index.php?option=com_community&view=photos&task=newalbum&userid=' . $my->id);
     if ($type == PHOTOS_GROUP_TYPE) {
         $createLink = CRoute::_('index.php?option=com_community&view=photos&task=newalbum&groupid=' . $groupId);
         CFactory::load('helpers', 'group');
         $isOwner = CGroupHelper::allowManagePhoto($groupId);
     } else {
         $userId = JRequest::getInt('userid', '', 'REQUEST');
         $user = CFactory::getUser($userId);
         $isOwner = $my->id == $user->id ? true : false;
     }
     $task = JRequest::getCmd('task', '');
     $tmpl->set('isOwner', $isOwner);
     $tmpl->set('type', $type);
     $tmpl->set('createLink', $createLink);
     $tmpl->set('currentTask', $task);
     $tmpl->set('showFeatured', $showFeatured);
     $tmpl->set('featuredList', $featuredList);
     $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin());
     $tmpl->set('my', $my);
     $tmpl->set('albums', $albums);
     $tmpl->set('isSuperAdmin', COwnerHelper::isCommunityAdmin());
     return $tmpl->fetch('albums.list');
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:77,代码来源:view.feed.php

示例4: album


//.........这里部分代码省略.........
     $pagination = $model->getPagination();
     $photo =& JTable::getInstance('Photo', 'CTable');
     $photo->load($album->photoid);
     if ($album->photoid == '0') {
         $album->thumbnail = $photo->getThumbURI();
     } else {
         $album->thumbnail = $photo->getImageURI();
     }
     // Increment album's hit each time this page is loaded.
     $album->hit();
     $otherAlbums = $model->_getOnlyAlbums($user->id, PHOTOS_USER_TYPE, 0, 20);
     $totalAlbums = count($otherAlbums);
     $showOtherAlbum = 6;
     $randomAlbum = array();
     if (count($otherAlbums) > 0) {
         $randomId = $totalAlbums < $showOtherAlbum ? array_rand($otherAlbums, $totalAlbums) : array_rand($otherAlbums, $showOtherAlbum);
         $count = 0;
         for ($i = 0; $i < $totalAlbums; $i++) {
             $num = is_array($randomId) ? $randomId[$i] : $randomId;
             if ($otherAlbums[$num]->id != $album->id) {
                 $count++;
                 $randomAlbum[] = $otherAlbums[$num];
             }
             if (count($randomAlbum) == $showOtherAlbum - 1) {
                 break;
             }
         }
     }
     $js = 'assets/gallery';
     $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
     CAssets::attach($js, 'js');
     CFactory::load('helpers', 'string');
     $document->setTitle(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()) . ' - ' . $album->name);
     $this->setTitle($album->name);
     $handler->setAlbumPathway(CStringHelper::escape($album->name));
     $handler->setRSSHeader($albumId);
     // Set album thumbnail and description for social bookmarking sites linking
     $document->addHeadLink($album->getCoverThumbURI(), 'image_src', 'rel');
     $document->setDescription(CStringHelper::escape($album->getDescription()));
     CFactory::load('libraries', 'phototagging');
     $tagging = new CPhotoTagging();
     $people = array();
     $maxTime = $album->created;
     // Need to append the absolute path for the captions
     for ($i = 0; $i < count($photos); $i++) {
         $item =& JTable::getInstance('Photo', 'CTable');
         $item->bind($photos[$i]);
         $photos[$i] = $item;
         $photo =& $photos[$i];
         $photo->link = $handler->getPhotoURI($photo->id, $photo->albumid);
         $tags = $tagging->getTaggedList($photo->id);
         //Get last update
         $maxTime = $photo->created > $maxTime ? $photo->created : $maxTime;
         // Get the people in the tags
         foreach ($tags as $tag) {
             $people[] = $tag->userid;
         }
     }
     //Update lastUpdated
     $maxTime = new JDate($maxTime);
     $album->lastUpdated = CActivityStream::_createdLapse($maxTime, false);
     $people = array_unique($people);
     foreach ($people as &$person) {
         $person = CFactory::getUser($person);
     }
     CFactory::load('libraries', 'bookmarks');
     $bookmarks = new CBookmarks($handler->getAlbumExternalURI($album->id));
     // Get the walls
     CFactory::load('libraries', 'wall');
     $wallContent = CWallLibrary::getWallContents('albums', $album->id, COwnerHelper::isCommunityAdmin() || $my->id == $album->creator && $my->id != 0, 10, 0);
     $wallCount = CWallLibrary::getWallCount('albums', $album->id);
     $viewAllLink = false;
     if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
         $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls');
     }
     $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     $wallForm = CWallLibrary::getWallInputForm($album->id, 'photos,ajaxAlbumSaveWall', 'photos,ajaxAlbumRemoveWall', $viewAllLink);
     $redirectUrl = CRoute::getURI(false);
     // Add tagging code
     //		$tagsHTML = '';
     //		if($config->get('tags_photos')){
     //			CFactory::load('libraries', 'tags');
     //			$tags = new CTags();
     //			$tagsHTML = $tags->getHTML('albums', $album->id, $handler->isAlbumOwner( $album->id ) );
     //		}
     $this->showSubmenu();
     $tmpl = new CTemplate();
     if ($album->location != "") {
         CFactory::load('libraries', 'mapping');
         $zoomableMap = CMapping::drawZoomableMap($album->location, 220, 150);
     } else {
         $zoomableMap = "";
     }
     // Get the likes / dislikes item
     CFactory::load('libraries', 'like');
     $like = new CLike();
     $likesHTML = $like->getHTML('album', $album->id, $my->id);
     $owner = CFactory::getUser($album->creator);
     echo $tmpl->set('likesHTML', $likesHTML)->set('photosmapdefault', $photoMapsDefault)->set('my', $my)->set('bookmarksHTML', $bookmarks->getHTML())->set('isOwner', $handler->isAlbumOwner($album->id))->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('owner', $owner)->set('photos', $photos)->set('people', $people)->set('album', $album)->set('otherAlbums', $randomAlbum)->set('likesHTML', $likesHTML)->set('wallForm', $wallForm)->set('wallContent', $wallContent)->set('zoomableMap', $zoomableMap)->set('pagination', $pagination)->fetch('photos.album');
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:101,代码来源:view.html.php

示例5: getLastUpdated

 public function getLastUpdated($raw = false)
 {
     $this->_lastupdated = $this->created;
     if ($raw) {
         return $this->_lastupdated;
     }
     if ($this->_lastupdated == '0000-00-00 00:00:00' || $this->_lastupdated == '') {
         $this->_lastupdated = $this->created;
         if ($this->_lastupdated == '' || $this->_lastupdated == '0000-00-00 00:00:00') {
             $this->_lastupdated = JText::_('COM_COMMUNITY_NO_LAST_ACTIVITY');
         } else {
             $lastUpdated = new JDate($this->_lastupdated);
             $this->_lastupdated = CActivityStream::_createdLapse($lastUpdated, false);
         }
     } else {
         $lastUpdated = new JDate($this->_lastupdated);
         $this->_lastupdated = CActivityStream::_createdLapse($lastUpdated, false);
     }
     return $this->_lastupdated;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:20,代码来源:video.php

示例6: _showHeader

 /**
  * Show the main profile header
  */
 function _showHeader(&$data)
 {
     jimport('joomla.utilities.arrayhelper');
     $my =& JFactory::getUser();
     $userid = JRequest::getVar('userid', $my->id);
     $user = CFactory::getUser($userid);
     $userModel = CFactory::getModel('user');
     CFactory::load('libraries', 'messaging');
     CFactory::load('helpers', 'owner');
     // Get the admin controls HTML data
     $adminControlHTML = '';
     $tmpl = new CTemplate();
     $editStatus = '';
     $editLink = '';
     if (COwnerHelper::isMine($my->id, $user->id)) {
         $editStatus = '<input id="new-status" style="border:1px solid #cccccc;" type="text" value="" size="38" onkeyup="if(event.keyCode == 13) {cStatusAct()}"/>';
         $editLink = '<span id="profile-status-edit" onclick="cStatusAct()">[' . JText::_('CC EDIT') . ']</span>';
     }
     // 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);
     $tmpl->set('karmaImgUrl', CUserPoints::getPointsImage($user));
     $tmpl->set('editStatus', $editStatus);
     $tmpl->set('editLink', $editLink);
     $tmpl->set('isMine', COwnerHelper::isMine($my->id, $user->id));
     $profile = JArrayHelper::toObject($data->profile);
     $profile->largeAvatar = $user->getAvatar();
     $profile->status = $user->getStatus();
     CFactory::load('libraries', 'activities');
     $postedOn = new JDate($user->_posted_on);
     $postedOn = CActivityStream::_createdLapse($postedOn);
     $profile->posted_on = $user->_posted_on == '0000-00-00 00:00:00' ? '' : $postedOn;
     // Assign videoId
     $profile->profilevideo = $data->videoid;
     $addbuddy = "joms.friends.connect('{$profile->id}')";
     $sendMsg = CMessaging::getPopup($profile->id);
     $config = CFactory::getConfig();
     $lastLogin = JText::_('CC NEVER LOGGED IN');
     if ($user->lastvisitDate != '0000-00-00 00:00:00') {
         //$now =& JFactory::getDate();
         $userLastLogin = new JDate($user->lastvisitDate);
         CFactory::load('libraries', 'activities');
         $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 (!COwnerHelper::isMine($my->id, $user->id)) {
         $user->viewHit();
     }
     $tmpl->set('lastLogin', $lastLogin);
     $tmpl->setRef('user', $user);
     $tmpl->set('addBuddy', $addbuddy);
     $tmpl->set('sendMsg', $sendMsg);
     $tmpl->set('config', $config);
     // @rule: myblog integrations
     $showBlogLink = false;
     CFactory::load('libraries', 'myblog');
     $myblog =& CMyBlog::getInstance();
     if ($config->get('enablemyblogicon') && $myblog) {
         if ($myblog->userCanPost($user->id)) {
             $showBlogLink = true;
         }
         $tmpl->set('blogItemId', $myblog->getItemId());
     }
     $multiprofile =& JTable::getInstance('MultiProfile', 'CTable');
     $multiprofile->load($user->getProfileType());
     // Get like
     $likesHTML = '';
     if ($user->getParams()->get('profileLikes', true)) {
         CFactory::load('libraries', 'like');
         $likes = new CLike();
         $likesHTML = $my->id == 0 ? $likes->getHtmlPublic('profile', $user->id) : $likes->getHTML('profile', $user->id, $my->id);
     }
     $tmpl->set('multiprofile', $multiprofile);
     $tmpl->set('showBlogLink', $showBlogLink);
     $tmpl->set('isFriend', CFriendsHelper::isConnected($user->id, $my->id) && $user->id != $my->id);
     $tmpl->set('profile', $profile);
     $tmpl->set('unread', $unread);
     $tmpl->set('pending', $pending);
     $tmpl->set('registerDate', $user->registerDate);
     $tmpl->set('adminControlHTML', $adminControlHTML);
     $tmpl->set('likesHTML', $likesHTML);
     $html = $tmpl->fetch('profile.header');
     return $html;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:93,代码来源:view.html.php

示例7: modProfileUserinfo

 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 */
//.........这里部分代码省略.........
开发者ID:Jougito,项目名称:DynWeb,代码行数:101,代码来源:view.html.php

示例8: _showHeader

 /**
  * Show the main profile header
  */
 public function _showHeader(&$data)
 {
     jimport('joomla.utilities.arrayhelper');
     $my =& JFactory::getUser();
     $userid = JRequest::getVar('userid', $my->id);
     $user = CFactory::getUser($userid);
     $params = $user->getParams();
     $userModel = CFactory::getModel('user');
     CFactory::load('libraries', 'messaging');
     CFactory::load('helpers', 'owner');
     $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();
     CFactory::load('libraries', 'activities');
     $profile->status = $user->getStatus();
     if ($profile->status !== '') {
         CFactory::load('libraries', 'activities');
         $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 = '';
     }
     // Assign videoId
     $profile->profilevideo = $data->videoid;
     $video = JTable::getInstance('Video', 'CTable');
     $video->load($profile->profilevideo);
     $profile->profilevideoTitle = $video->getTitle();
     $addbuddy = "joms.friends.connect('{$profile->id}')";
     $sendMsg = CMessaging::getPopup($profile->id);
     $config = CFactory::getConfig();
     $lastLogin = JText::_('COM_COMMUNITY_PROFILE_NEVER_LOGGED_IN');
     if ($user->lastvisitDate != '0000-00-00 00:00:00') {
         //$now =& JFactory::getDate();
         $userLastLogin = new JDate($user->lastvisitDate);
         CFactory::load('libraries', 'activities');
         $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;
     CFactory::load('libraries', 'myblog');
     $myblog =& CMyBlog::getInstance();
     if ($config->get('enablemyblogicon') && $myblog) {
         if ($myblog->userCanPost($user->id)) {
             $showBlogLink = true;
         }
         $tmpl->set('blogItemId', $myblog->getItemId());
     }
     $multiprofile =& JTable::getInstance('MultiProfile', 'CTable');
     $multiprofile->load($user->getProfileType());
     // Get like
     $likesHTML = '';
     if ($user->getParams()->get('profileLikes', true)) {
         CFactory::load('libraries', 'like');
         $likes = new CLike();
         $likesHTML = $my->id == 0 ? $likes->getHtmlPublic('profile', $user->id) : $likes->getHTML('profile', $user->id, $my->id);
     }
     /* User status */
     CFactory::load('libraries', 'userstatus');
     $status = new CUserStatus($user->id, 'profile');
     //respect wall setting
     CFactory::load('helpers', 'friends');
     CFactory::load('helper', 'owner');
     if ($my->id && (!$config->get('lockprofilewalls') || $config->get('lockprofilewalls') && CFriendsHelper::isConnected($my->id, $profile->id)) || COwnerHelper::isCommunityAdmin()) {
         // Add default status box
         CFactory::load('helpers', 'user');
         CUserHelper::addDefaultStatusCreator($status);
     }
     $isblocked = $user->isBlocked();
     return $tmpl->set('karmaImgUrl', CUserPoints::getPointsImage($user))->set('isMine', $isMine)->set('lastLogin', $lastLogin)->setRef('user', $user)->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('isBlocked', $isblocked)->set('profile', $profile)->set('unread', $unread)->set('pending', $pending)->set('registerDate', $user->registerDate)->set('adminControlHTML', $adminControlHTML)->set('likesHTML', $likesHTML)->set('userstatus', $status)->fetch('profile.header');
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:90,代码来源:view.html.php


注:本文中的CActivityStream::_createdLapse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。