本文整理汇总了PHP中CUserHelper::addDefaultStatusCreator方法的典型用法代码示例。如果您正苦于以下问题:PHP CUserHelper::addDefaultStatusCreator方法的具体用法?PHP CUserHelper::addDefaultStatusCreator怎么用?PHP CUserHelper::addDefaultStatusCreator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUserHelper
的用法示例。
在下文中一共展示了CUserHelper::addDefaultStatusCreator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Frontpage display
* @param type $tpl
*/
public function display($tpl = null)
{
/**
* Init variables
*/
$config = CFactory::getConfig();
$document = JFactory::getDocument();
$usersConfig = JComponentHelper::getParams('com_users');
$my = CFactory::getUser();
$model = CFactory::getModel('user');
/**
* Opengraph
*/
CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_FRONTPAGE_TITLE', $config->get('sitename')));
/**
* Init document
*/
$feedLink = CRoute::_('index.php?option=com_community&view=frontpage&format=feed');
$feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_RECENT_ACTIVITIES_FEED') . '" href="' . $feedLink . '"/>';
$document->addCustomTag($feed);
// Process headers HTML output
$headerHTML = '';
$tmpl = new CTemplate();
$alreadyLogin = 0;
/* User is logged */
if ($my->id != 0) {
$headerHTML = $tmpl->fetch('frontpage.members');
$alreadyLogin = 1;
} else {
/* User is not logged */
$uri = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_login'), false);
$uri = base64_encode($uri);
$fbHtml = '';
/* Facebook login */
if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) {
$facebook = new CFacebook();
$fbHtml = $facebook->getLoginHTML();
}
/* Joomla! Facebook Connect */
if ($config->get('usejfbc')) {
if (class_exists('JFBCFactory')) {
$providers = JFBCFactory::getAllProviders();
foreach ($providers as $p) {
$fbHtml .= $p->loginButton();
}
}
}
//hero image
$heroImage = JURI::root() . 'components/com_community/assets/frontpage-image-default.jpg';
if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.jpg')) {
$heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.jpg';
} else {
if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.png')) {
$heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.png';
}
}
//add the hero image as the image metatdata
$imgMeta = '<meta property="og:image" content="' . $heroImage . '"/>';
$document->addCustomTag($imgMeta);
$themeModel = CFactory::getModel('theme');
$settings = $themeModel->getSettings();
/* Generate header HTML for guest */
if ($settings['general']['enable-frontpage-login']) {
$headerHTML = $tmpl->set('allowUserRegister', $usersConfig->get('allowUserRegistration'))->set('heroImage', $heroImage)->set('fbHtml', $fbHtml)->set('useractivation', $usersConfig->get('useractivation'))->set('return', $uri)->set('settings', $settings)->fetch('frontpage/guest');
} else {
$headerHTML = '';
}
}
/* Get site members count */
$totalMembers = $model->getMembersCount();
$latestActivitiesData = $this->showLatestActivities();
$latestActivitiesHTML = $latestActivitiesData['HTML'];
$tmpl = new CTemplate();
$tmpl->set('totalMembers', $totalMembers)->set('my', $my)->set('alreadyLogin', $alreadyLogin)->set('header', $headerHTML)->set('userActivities', $latestActivitiesHTML)->set('config', $config)->set('customActivityHTML', $this->getCustomActivityHTML());
$status = new CUserStatus();
if ($my->authorise('community.view', 'frontpage.statusbox')) {
// Add default status box
CUserHelper::addDefaultStatusCreator($status);
if (COwnerHelper::isCommunityAdmin() && $config->get('custom_activity')) {
$template = new CTemplate();
$template->set('customActivities', CActivityStream::getCustomActivities());
$creator = new CUserStatusCreator('custom');
$creator->title = JText::_('COM_COMMUNITY_CUSTOM');
$creator->html = $template->fetch('status.custom');
$status->addCreator($creator);
}
}
/**
* Misc variables
* @since 3.3
* Move out variable init in side template into view
*/
$moduleCount = count(JModuleHelper::getModules('js_side_frontpage')) + count(JModuleHelper::getModules('js_side_top')) + count(JModuleHelper::getModules('js_side_bottom')) + count(JModuleHelper::getModules('js_side_frontpage_top')) + count(JModuleHelper::getModules('js_side_frontpage_bottom')) + count(JModuleHelper::getModules('js_side_frontpage_stacked')) + count(JModuleHelper::getModules('js_side_top_stacked')) + count(JModuleHelper::getModules('js_side_bottom_stacked')) + count(JModuleHelper::getModules('js_side_frontpage_top_stacked')) + count(JModuleHelper::getModules('js_side_frontpage_bottom_stacked'));
$jinput = JFactory::getApplication()->input;
/**
* @todo 3.3
//.........这里部分代码省略.........
示例2: modProfileUserstatus
public function modProfileUserstatus()
{
$my = CFactory::getUser();
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$userid = $jinput->get('userid', $my->id, 'INT');
//JRequest::getVar('userid', $my->id);
$user = CFactory::getUser($userid);
$config = CFactory::getConfig();
//respect wall setting
$status = new CUserStatus($user->id, 'profile');
if ($my->id && (!$config->get('lockprofilewalls') || $config->get('lockprofilewalls') && CFriendsHelper::isConnected($my->id, $user->id)) || COwnerHelper::isCommunityAdmin()) {
// Add default status box
CUserHelper::addDefaultStatusCreator($status);
}
#echo $status->render();
}
示例3: display
public function display()
{
$mainframe = JFactory::getApplication();
$config = CFactory::getConfig();
$document = JFactory::getDocument();
$usersConfig =& JComponentHelper::getParams('com_users');
$useractivation = $usersConfig->get('useractivation');
$document->setTitle(JText::sprintf('COM_COMMUNITY_FRONTPAGE_TITLE', $config->get('sitename')));
$my = CFactory::getUser();
$model = CFactory::getModel('user');
$avatarModel = CFactory::getModel('avatar');
$status = CFactory::getModel('status');
$frontpageUsers = intval($config->get('frontpageusers'));
$document->addScriptDeclaration("var frontpageUsers\t= " . $frontpageUsers . ";");
$frontpageVideos = intval($config->get('frontpagevideos'));
$document->addScriptDeclaration("var frontpageVideos\t= " . $frontpageVideos . ";");
$status = $status->get($my->id);
$feedLink = CRoute::_('index.php?option=com_community&view=frontpage&format=feed');
$feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_RECENT_ACTIVITIES_FEED') . '" href="' . $feedLink . '"/>';
$document->addCustomTag($feed);
CFactory::load('libraries', 'tooltip');
CFactory::load('libraries', 'activities');
// Process headers HTML output
$headerHTML = '';
$tmpl = new CTemplate();
$alreadyLogin = 0;
if ($my->id != 0) {
$headerHTML = $tmpl->fetch('frontpage.members');
$alreadyLogin = 1;
} else {
$uri = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_login'), false);
$uri = base64_encode($uri);
$fbHtml = '';
if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) {
CFactory::load('libraries', 'facebook');
$facebook = new CFacebook();
$fbHtml = $facebook->getLoginHTML();
}
$usersConfig =& JComponentHelper::getParams('com_users');
$tmpl->set('useractivation', $useractivation);
$headerHTML = $tmpl->set('fbHtml', $fbHtml)->set('return', $uri)->set('config', $config)->set('usersConfig', $usersConfig)->fetch('frontpage.guests');
}
$my = CFactory::getUser();
$totalMembers = $model->getMembersCount();
unset($tmpl);
$latestMembersData = $this->_cachedCall('showLatestMembers', array($config->get('frontpageusers')), '', array(COMMUNITY_CACHE_TAG_FRONTPAGE));
$latestMembersHTML = $latestMembersData['HTML'];
$latestGroupsData = $this->_cachedCall('showLatestGroups', array($config->get('frontpagegroups')), '', array(COMMUNITY_CACHE_TAG_FRONTPAGE));
$latestGroupsHTML = $latestGroupsData['HTML'];
$latestVideoData = $this->showLatestVideos($config->get('frontpagevideos'));
$latestVideoHTML = $latestVideoData['HTML'];
$latestPhotosData = $this->_cachedCall('showLatestPhotos', array(false), '', array(COMMUNITY_CACHE_TAG_FRONTPAGE));
$latestPhotosHTML = $latestPhotosData['HTML'];
$latestEventsData = $this->_cachedCall('showLatestEvents', array($config->get('frontpage_events_limit')), '', array(COMMUNITY_CACHE_TAG_FRONTPAGE));
$latestEventsHTML = $latestEventsData['HTML'];
$latestActivitiesData = $this->showLatestActivities();
$latestActivitiesHTML = $latestActivitiesData['HTML'];
$tmpl = new CTemplate();
$tmpl->set('totalMembers', $totalMembers)->set('my', $my)->set('alreadyLogin', $alreadyLogin)->set('header', $headerHTML)->set('onlineMembers', $this->getOnlineMembers())->set('userActivities', $latestActivitiesHTML)->set('config', $config)->set('latestMembers', $latestMembersHTML)->set('latestGroups', $latestGroupsHTML)->set('latestPhotosHTML', $latestPhotosHTML)->set('latestVideosHTML', $latestVideoHTML)->set('latestEvents', $latestEventsHTML)->set('customActivityHTML', $this->getCustomActivityHTML());
/** Compatibility fix **/
CFactory::load('helpers', 'string');
/* User status */
CFactory::load('libraries', 'userstatus');
$status = new CUserStatus();
if ($my->authorise('community.view', 'frontpage.statusbox')) {
// Add default status box
CFactory::load('helpers', 'user');
CUserHelper::addDefaultStatusCreator($status);
if (COwnerHelper::isCommunityAdmin() && $config->get('custom_activity')) {
$template = new CTemplate();
$template->set('customActivities', CActivityStream::getCustomActivities());
$creator = new CUserStatusCreator('custom');
$creator->title = JText::_('COM_COMMUNITY_CUSTOM');
$creator->html = $template->fetch('status.custom');
$status->addCreator($creator);
}
}
echo $tmpl->set('userstatus', $status)->fetch('frontpage.index');
}
示例4: _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');
}