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


PHP CFactory::getUser方法代码示例

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


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

示例1: _getAllEvents

 private function _getAllEvents()
 {
     $mainframe = JFactory::getApplication();
     $rows = $this->model->getEvents();
     $items = array();
     foreach ($rows as $row) {
         $item = new stdClass();
         $table =& JTable::getInstance('Event', 'CTable');
         $table->bind($row);
         $table->thumbnail = $table->getThumbAvatar();
         $table->avatar = $table->getAvatar();
         $author = CFactory::getUser($table->creator);
         $item->id = $row->id;
         $item->created = $row->created;
         $item->creator = CStringHelper::escape($author->getDisplayname());
         $item->title = $row->title;
         $item->description = CStringHelper::escape($row->description);
         $item->location = CStringHelper::escape($row->location);
         $tiem->startdate = $row->startdate;
         $item->enddate = $row->enddate;
         $item->thumbnail = $table->thumbnail;
         $tiem->avatar = $table->avatar;
         $item->ticket = $row->ticket;
         $item->invited = $row->invitedcount;
         $item->confirmed = $row->confirmedcount;
         $item->declined = $row->declinedcount;
         $item->maybe = $row->maybecount;
         $item->latitude = $row->latitude;
         $item->longitude = $row->longitude;
         $items[] = $item;
     }
     return $items;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:33,代码来源:view.raw.php

示例2: ajaxSendMessage

 public function ajaxSendMessage($title, $message, $limit = 1)
 {
     if (!$title || !$message) {
         $response = new JAXResponse();
         $response->addScriptCall("joms.jQuery('#error').remove();");
         $response->addScriptCall('joms.jQuery("#messaging-form").prepend("<p id=error style=color:red>Error:Title or Message cannot be empty</p>");');
         return $response->sendResponse();
     }
     $limitstart = $limit - 1;
     $model =& $this->getModel('users');
     $userId = $model->getSiteUsers($limitstart, 1);
     $response = new JAXResponse();
     $response->addScriptCall('joms.jQuery("#messaging-form").hide();');
     $response->addScriptCall('joms.jQuery("#messaging-result").show();');
     $user = CFactory::getUser($userId);
     $my =& JFactory::getUser();
     if (!empty($userId)) {
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'notification.php';
         CNotificationLibrary::add('etype_system_messaging', $my->id, $user->id, $title, $message);
         $response->addScriptCall('joms.jQuery("#no-progress").css("display","none");');
         $response->addScriptCall('joms.jQuery("#progress-status").append("<div>' . JText::sprintf('Sending message to <strong>%1$s</strong>', str_replace(array("\r", "\n"), ' ', $user->getDisplayname())) . '<span style=\\"color: green;margin-left: 5px;\\">' . JText::_('COM_COMMUNITY_SUCCESS') . '</span></div>");');
         $response->addScriptCall('sendMessage', $title, $message, $limit + 1);
     } else {
         $response->addScriptCall('joms.jQuery("#progress-status").append("<div style=\\"font-weight:700;\\">' . JText::_('COM_COMMUNITY_UPDATED') . '</div>");');
     }
     return $response->sendResponse();
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:27,代码来源:messaging.php

示例3: plgCommunityJreviews_myfavorites

 function plgCommunityJreviews_myfavorites(&$subject, $config)
 {
     $this->_path = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_jreviews';
     $this->_user = CFactory::getActiveProfile();
     $this->_my = CFactory::getUser();
     parent::__construct($subject, $config);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:7,代码来源:jreviews_myfavorites.php

示例4: addPoints_jomsocial

 static function addPoints_jomsocial($action, $username, $course_id, $course_name)
 {
     if (file_exists(JPATH_ADMINISTRATOR . '/components/com_community/tables/cache.php')) {
         require_once JPATH_ADMINISTRATOR . 'components/com_community/tables/cache.php';
     }
     require_once JPATH_SITE . '/components/com_community/libraries/core.php';
     require_once JPATH_SITE . '/components/com_community/libraries/userpoints.php';
     if (class_exists('CFactory')) {
         $userPoint = CFactory::getModel('userpoints');
     } else {
         $userPoint = new CommunityModelUserPoints();
     }
     $upObj = $userPoint->getPointData($action);
     $published = $upObj->published;
     if ($published) {
         $points = $upObj->points;
     } else {
         $points = 0;
     }
     if ($points == 0) {
         return 0;
     }
     $user = CFactory::getUser($username);
     $points += $user->getKarmaPoint();
     $user->_points = $points;
     $user->save();
     return $points;
 }
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:28,代码来源:points.php

示例5: _getMutualFriendsHTML

 public static function _getMutualFriendsHTML($userid = null)
 {
     $my = CFactory::getUser();
     if ($my->id == $userid) {
         return;
     }
     $friendsModel = CFactory::getModel('Friends');
     $friends = $friendsModel->getFriends($userid, 'latest', false, 'mutual');
     $html = "<ul class='joms-list--friend single-column'>";
     if (sizeof($friends)) {
         foreach ($friends as $friend) {
             $html .= "<li class='joms-list__item'>";
             $html .= "<div class='joms-list__avatar'>";
             $html .= '<div class="joms-avatar ' . CUserHelper::onlineIndicator($friend) . '"><a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id) . '">';
             $html .= '<img src="' . $friend->getThumbAvatar() . '" data-author="' . $friend->id . '" />';
             $html .= "</a></div></div>";
             $html .= "<div class='joms-list__body'>";
             $html .= CFriendsHelper::getUserCog($friend->id, null, null, true);
             $html .= CFriendsHelper::getUserFriendDropdown($friend->id);
             $html .= '<a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id) . '">';
             $html .= '<h4 class="joms-text--username">' . $friend->getDisplayName() . '</h4></a>';
             $html .= '<span class="joms-text--title">' . JText::sprintf('COM_COMMUNITY_TOTAL_MUTUAL_FRIENDS', CFriendsHelper::getTotalMutualFriends($friend->id)) . '</span>';
             $html .= "</div></li>";
         }
         $html .= "</ul>";
     } else {
         $html .= JText::_('COM_COMMUNITY_NO_MUTUAL_FRIENDS');
     }
     return $html;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:30,代码来源:mutualfriends.php

示例6: isConnected

 /**
  * Check if 2 friends is connected or not
  * @param	int userid1
  * @param	int userid2
  * @return	bool  
  */
 public static function isConnected($id1, $id2)
 {
     // Static caching for this session
     static $isFriend = array();
     if (!empty($isFriend[$id1 . '-' . $id2])) {
         return $isFriend[$id1 . '-' . $id2];
     }
     if ($id1 == $id2 && $id1 != 0) {
         return true;
     }
     if ($id1 == 0 || $id2 == 0) {
         return false;
     }
     /*
     $db =& JFactory::getDBO();
     $sql = 'SELECT count(*) FROM ' . $db->nameQuote('#__community_connection')
     	  .' WHERE ' . $db->nameQuote('connect_from') .'=' . $db->Quote($id1) .' AND ' . $db->nameQuote('connect_to') .'=' . $db->Quote($id2)
     	  .' AND ' . $db->nameQuote('status') .' = ' . $db->Quote(1);
     	
     $db->setQuery($sql);
     $result = $db->loadResult();
     if($db->getErrorNum()) {
     	JError::raiseError( 500, $db->stderr());
     }
     
     $isFriend[$id1.'-'.$id2] = $result;
     */
     // change method to get connection since list friends stored in community_users as well
     $user = CFactory::getUser($id1);
     $isConnected = $user->isFriendWith($id2);
     return $isConnected;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:38,代码来源:friends.php

示例7: update

 /**
  * Update the user status
  * 
  * @param	int		user id
  * @param	string	the message. Should be < 140 char (controller check)	 	 	 
  */
 function update($id, $status)
 {
     $db =& $this->getDBO();
     $my = CFactory::getUser();
     // @todo: posted_on should be constructed to make sure we take into account
     // of Joomla server offset
     // Current user and update id should always be the same
     CError::assert($my->id, $id, 'eq', __FILE__, __LINE__);
     // Trigger onStatusUpdate
     require_once COMMUNITY_COM_PATH . DS . 'libraries' . DS . 'apps.php';
     $appsLib =& CAppPlugins::getInstance();
     $appsLib->loadApplications();
     $args = array();
     $args[] = $my->id;
     // userid
     $args[] = $my->getStatus();
     // old status
     $args[] = $status;
     // new status
     $appsLib->triggerEvent('onProfileStatusUpdate', $args);
     $today =& JFactory::getDate();
     $data = new stdClass();
     $data->userid = $id;
     $data->status = $status;
     $data->posted_on = $today->toMySQL();
     $db->updateObject('#__community_users', $data, 'userid');
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:36,代码来源:status.php

示例8: exceedDaily

 public static function exceedDaily($view, $userId = null, $returnRemaining = false)
 {
     $my = CFactory::getUser($userId);
     // Guests shouldn't be even allowed here.
     if ($my->id == 0) {
         return true;
     }
     $view = JString::strtolower($view);
     // We need to include the model first before using ReflectionClass so that the model file is included.
     $model = CFactory::getModel($view);
     // Since the model will always return a CCachingModel which is a proxy,
     // for the real model, we can't really test what type of object it is.
     $modelClass = 'CommunityModel' . ucfirst($view);
     $reflection = new ReflectionClass($modelClass);
     if (!$reflection->implementsInterface('CLimitsInterface')) {
         return false;
     }
     $config = CFactory::getConfig();
     $total = $model->getTotalToday($my->id);
     $max = $config->getInt('limit_' . $view . '_perday');
     if ($returnRemaining) {
         return $max - $total;
     }
     return $total >= $max && $max != 0;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:25,代码来源:limits.php

示例9: onGroupJoin

 public function onGroupJoin($group, $userId)
 {
     //@rule: Clear existing invites fromt he invitation table once the user joined the group
     $groupInvite =& JTable::getInstance('GroupInvite', 'CTable');
     if ($groupInvite->load($group->id, $userId)) {
         $groupInvite->delete();
     }
     $member =& JTable::getInstance('GroupMembers', 'CTable');
     $member->load($userId, $group->id);
     $params = $group->getParams();
     //@rule: Send notification when necessary
     if ($params->get('joinrequestnotification') || $params->get('newmembernotification')) {
         $user = CFactory::getUser($userId);
         $subject = JText::sprintf('CC NEW MEMBER JOIN EMAIL SUBJECT', $user->getDisplayName(), $group->name);
         if (!$member->approved) {
             $subject = JText::sprintf('CC NEW MEMBER REQUESTED TO JOIN GROUP EMAIL SUBJECT', $user->getDisplayName(), $group->name);
         }
         // Add notification
         CFactory::load('libraries', 'notification');
         $params = new JParameter('');
         $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
         $params->set('group', $group->name);
         $params->set('user', $user->getDisplayName());
         $params->set('approved', $member->approved);
         CNotificationLibrary::add('groups.member.join', $user->id, $group->ownerid, $subject, '', 'groups.memberjoin', $params);
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:27,代码来源:groups.trigger.php

示例10: __construct

 public function __construct($event)
 {
     $this->my = CFactory::getUser();
     $this->model = CFactory::getModel('events');
     $this->event = $event;
     $this->url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $this->event->id;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:7,代码来源:event.php

示例11: onProfileStatusUpdate

 /**
  * Method is called during the status update triggers.
  **/
 public function onProfileStatusUpdate($userid, $oldMessage, $newMessage)
 {
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     if ($config->get('fbconnectpoststatus')) {
         //CFactory::load( 'libraries' , 'facebook' );
         $facebook = new CFacebook();
         if ($facebook) {
             $fbuserid = $facebook->getUser();
             $connectModel = CFactory::getModel('Connect');
             $connectTable = JTable::getInstance('Connect', 'CTable');
             $connectTable->load($fbuserid);
             // Make sure the FB session match the user session
             if ($connectTable->userid == $my->id) {
                 /**
                  * Check post status to facebook settings
                  */
                 //echo "posting to facebook"; exit;
                 $targetUser = CFactory::getUser($my->id);
                 $userParams = $targetUser->getParams();
                 if ($userParams->get('postFacebookStatus')) {
                     $result = $facebook->postStatus($newMessage);
                     //print_r($result); exit;
                 }
             }
         }
     }
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:31,代码来源:profile.trigger.php

示例12: deletewallpost

 function deletewallpost($data)
 {
     require_once JPATH_SITE . '/components/com_community/libraries/core.php';
     $error_messages = array();
     $response = NULL;
     $validated = true;
     $db =& JFactory::getDBO();
     if ($data['wall_id'] == "" || $data['wall_id'] == "0") {
         $validated = false;
         $error_messages[] = array("id" => 1, "fieldname" => "wallid", "message" => "Wall id cannot be blank");
     }
     //@rule: Check if user is really allowed to remove the current wall
     $my = CFactory::getUser();
     $model =& CFactory::getModel('wall');
     $wall = $model->get($data['wall_id']);
     $groupModel =& CFactory::getModel('groups');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($wall->contentid);
     $query = "SELECT contentid FROM #__community_wall WHERE id ='" . $data['wall_id'] . "' AND type = 'groups'";
     $db->setQuery($query);
     $contentid = $db->LoadResult();
     CFactory::load('helpers', 'owner');
     $query = "SELECT id FROM #__community_wall WHERE id ='" . $data['wall_id'] . "' AND type = 'groups'";
     $db->setQuery($query);
     $isdiscussion = $db->LoadResult();
     if (!$isdiscussion) {
         $error_messages[] = array("id" => 1, "fieldname" => "wallid", "message" => "wall id for type groups does not exists. Modify the wall_id field");
     } else {
         if (!$model->deletePost($data['wall_id'])) {
             $validated = false;
             //$error_messages[] = 'wall id does not exists. Modify the wall_id fields in request';
             $error_messages[] = array("id" => 1, "fieldname" => "wallid", "message" => "wall id does not exists. Modify the wall_id field");
         } else {
             if ($wall->post_by != 0) {
                 //add user points
                 CFactory::load('libraries', 'userpoints');
                 CUserPoints::assignPoint('wall.remove', $wall->post_by);
             }
         }
         //$groupModel->substractWallCount( $data['wall_id'] );
         // Substract the count
         $query = 'SELECT COUNT(*) FROM ' . $db->nameQuote('#__community_wall') . ' ' . 'WHERE contentid=' . $db->Quote($contentid) . ' ' . 'AND type="groups"';
         $db->setQuery($query);
         $wall_count = $db->loadResult();
         $wallcount = new stdClass();
         $wallcount->id = $contentid;
         $wallcount->wallcount = $wall_count;
         $db->updateObject('#__community_groups', $wallcount, 'id');
     }
     if (true == isset($error_messages) && 0 < sizeof($error_messages)) {
         $res = array();
         foreach ($error_messages as $key => $error_message) {
             $res[] = $error_message;
         }
         $response = array("id" => 0, 'errors' => $res);
     } else {
         $response = array('id' => $wall->id);
     }
     return $response;
 }
开发者ID:beingsane,项目名称:Joomla-REST-API,代码行数:60,代码来源:wall_post_delete.php

示例13: getProfileURL

	public function getProfileURL($userid, $task='', $xhtml = true) {
		// Make sure that user profile exist.
		if (!$userid || CFactory::getUser($userid) === null) {
			return false;
		}
		return CRoute::_('index.php?option=com_community&view=profile&userid=' . (int) $userid, $xhtml);
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:7,代码来源:profile.php

示例14: plgCommunityPlg_RSMembership

 function plgCommunityPlg_RSMembership(&$subject, $config)
 {
     $this->_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsmembership' . DS . 'helpers' . DS . 'rsmembership.php';
     $this->_user =& CFactory::getActiveProfile();
     $this->_my =& CFactory::getUser();
     parent::__construct($subject, $config);
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:7,代码来源:plg_rsmembership.php

示例15: send

 /**
  * Do a batch send
  */
 function send($total = 100)
 {
     $mailqModel = CFactory::getModel('mailq');
     $userModel = CFactory::getModel('user');
     $mails = $mailqModel->get($total);
     $jconfig = JFactory::getConfig();
     $mailer = JFactory::getMailer();
     $config = CFactory::getConfig();
     $senderEmail = $jconfig->getValue('mailfrom');
     $senderName = $jconfig->getValue('fromname');
     if (empty($mails)) {
         return;
     }
     CFactory::load('helpers', 'string');
     foreach ($mails as $row) {
         // @rule: only send emails that is valid.
         // @rule: make sure recipient is not blocked!
         $userid = $userModel->getUserFromEmail($row->recipient);
         $user = CFactory::getUser($userid);
         if (!$user->isBlocked() && !JString::stristr($row->recipient, 'foo.bar')) {
             $mailer->setSender(array($senderEmail, $senderName));
             $mailer->addRecipient($row->recipient);
             $mailer->setSubject($row->subject);
             $tmpl = new CTemplate();
             $raw = isset($row->params) ? $row->params : '';
             $params = new JParameter($row->params);
             $base = $config->get('htmlemail') ? 'email.html' : 'email.text';
             if ($config->get('htmlemail')) {
                 $row->body = JString::str_ireplace(array("\r\n", "\r", "\n"), '<br />', $row->body);
                 $mailer->IsHTML(true);
             } else {
                 //@rule: Some content might contain 'html' tags. Strip them out since this mail should never contain html tags.
                 $row->body = CStringHelper::escape(strip_tags($row->body));
             }
             $tmpl->set('content', $row->body);
             $tmpl->set('template', rtrim(JURI::root(), '/') . '/components/com_community/templates/' . $config->get('template'));
             $tmpl->set('sitename', $config->get('sitename'));
             $row->body = $tmpl->fetch($base);
             // Replace any occurences of custom variables within the braces scoe { }
             if (!empty($row->body)) {
                 preg_match_all("/{(.*?)}/", $row->body, $matches, PREG_SET_ORDER);
                 foreach ($matches as $val) {
                     $replaceWith = $params->get($val[1], null);
                     //if the replacement start with 'index.php', we can CRoute it
                     if (strpos($replaceWith, 'index.php') === 0) {
                         $replaceWith = CRoute::getExternalURL($replaceWith);
                     }
                     if (!is_null($replaceWith)) {
                         $row->body = JString::str_ireplace($val[0], $replaceWith, $row->body);
                     }
                 }
             }
             unset($tmpl);
             $mailer->setBody($row->body);
             $mailer->send();
         }
         $mailqModel->markSent($row->id);
         $mailer->ClearAllRecipients();
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:63,代码来源:mailq.php


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