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


PHP CFactory类代码示例

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


在下文中一共展示了CFactory类的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: getActivityContentHTML

 static function getActivityContentHTML($act)
 {
     // Ok, the activity could be an upload OR a wall comment. In the future, the content should
     // indicate which is which
     $html = '';
     $param = new CParameter($act->params);
     $action = $param->get('action', false);
     $count = $param->get('count', false);
     $config = CFactory::getConfig();
     switch ($action) {
         case CAdminstreamsAction::TOP_USERS:
             $model = CFactory::getModel('user');
             $members = $model->getPopularMember($count);
             $html = '';
             //Get Template Page
             $tmpl = new CTemplate();
             $html = $tmpl->set('members', $members)->fetch('activity.members.popular');
             return $html;
             break;
         case CAdminstreamsAction::TOP_PHOTOS:
             $model = CFactory::getModel('photos');
             $photos = $model->getPopularPhotos($count, 0);
             $tmpl = new CTemplate();
             $html = $tmpl->set('photos', $photos)->fetch('activity.photos.popular');
             return $html;
             break;
         case CAdminstreamsAction::TOP_VIDEOS:
             $model = CFactory::getModel('videos');
             $videos = $model->getPopularVideos($count);
             $tmpl = new CTemplate();
             $html = $tmpl->set('videos', $videos)->fetch('activity.videos.popular');
             return $html;
             break;
     }
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:35,代码来源:adminstreams.php

示例3: getThumbnail

 public function getThumbnail($obj)
 {
     $config = CFactory::getConfig();
     $file = $obj->thumb;
     // Site origin
     if (JString::substr($file, 0, 4) == 'http') {
         $uri = $file;
         return $uri;
     }
     // Remote storage
     if ($obj->storage != 'file') {
         $storage = CStorage::getStorage($obj->storage);
         $uri = $storage->getURI($file);
         return $uri;
     }
     // Default thumbnail
     if (empty($file) || !JFile::exists(JPATH_ROOT . '/' . $file)) {
         $template = new CTemplateHelper();
         $asset = $template->getTemplateAsset('video_thumb.png', 'images');
         $uri = $asset->url;
         return $uri;
     }
     // Strip cdn path if exists.
     // Note: At one point, cdn path was stored along with the thumbnail path
     //       in the db which is the mistake we are trying to rectify here.
     $file = str_ireplace($config->get('videocdnpath'), '', $file);
     // CDN or local
     $baseUrl = $config->get('videobaseurl') or $baseUrl = JURI::root();
     $uri = str_replace('\\', '/', rtrim($baseUrl, '/') . '/' . ltrim($file, '/'));
     return $uri;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:31,代码来源:view.html.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: onProfileDisplay

 /**
  * Ajax function to save a new wall entry
  *
  * @param message	A message that is submitted by the user
  * @param uniqueId	The unique id for this group
  *
  * */
 function onProfileDisplay()
 {
     //Load language file.
     JPlugin::loadLanguage('plg_community_myarticles', JPATH_ADMINISTRATOR);
     // Attach CSS
     $document = JFactory::getDocument();
     $css = JURI::base() . 'plugins/community/myarticles/myarticles/style.css';
     $document->addStyleSheet($css);
     if (JRequest::getVar('task', '', 'REQUEST') == 'app') {
         $app = 1;
     } else {
         $app = 0;
     }
     $user = CFactory::getRequestUser();
     $userid = $user->id;
     $def_limit = $this->params->get('count', 10);
     $limit = JRequest::getVar('limit', $def_limit, 'REQUEST');
     $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
     $row = $this->getArticle($userid, $limitstart, $limit, $this->section);
     $cat = $this->getCatAlias();
     $total = $this->countArticle($userid, $this->section);
     if ($this->params->get('hide_empty', 0) && !$total) {
         return '';
     }
     $mainframe = JFactory::getApplication();
     $caching = $this->params->get('cache', 1);
     if ($caching) {
         $caching = $mainframe->getCfg('caching');
     }
     $cache = JFactory::getCache('plgCommunityMyArticles');
     $cache->setCaching($caching);
     $callback = array('plgCommunityMyArticles', '_getArticleHTML');
     $content = $cache->call($callback, $userid, $limit, $limitstart, $row, $app, $total, $cat, $this->params);
     return $content;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:42,代码来源:myarticles.php

示例6: getAccessLevel

 public static function getAccessLevel($actorId, $targetId)
 {
     $actor = CFactory::getUser($actorId);
     $target = CFactory::getUser($targetId);
     //CFactory::load( 'helpers' , 'owner' );
     //CFactory::load( 'helpers' , 'friends' );
     // public guest
     $access = 0;
     // site members
     if ($actor->id > 0) {
         $access = 20;
     }
     // they are friends
     if ($target->id > 0 && CFriendsHelper::isConnected($actor->id, $target->id)) {
         $access = 30;
     }
     // mine, target and actor is the same person
     if ($target->id > 0 && COwnerHelper::isMine($actor->id, $target->id)) {
         $access = 40;
     }
     if (COwnerHelper::isCommunityAdmin()) {
         $access = 40;
     }
     return $access;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:25,代码来源:privacy.php

示例7: _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

示例8: getFieldHTML

    public function getFieldHTML($field, $required)
    {
        $class = $field->required == 1 ? ' required' : '';
        $class .= !empty($field->tips) ? ' jomNameTips tipRight' : '';
        $lists = explode(',', $field->value);
        CFactory::load('helpers', 'string');
        $html = '<select id="field' . $field->id . '" name="field' . $field->id . '[]" type="select-multiple" multiple="multiple" class="jomNameTips tipRight select' . $class . '" title="' . CStringHelper::escape(JText::_($field->tips)) . '">';
        $elementSelected = 0;
        foreach ($field->options as $option) {
            $selected = in_array($option, $lists) ? ' selected="selected"' : '';
            if (empty($selected)) {
                $elementSelected++;
            }
            $html .= '<option value="' . $option . '"' . $selected . '>' . JText::_($option) . '</option>';
        }
        if ($elementSelected == 0) {
            //if nothing is selected, we default the 1st option to be selected.
            $elementName = 'field' . $field->id;
            $html .= <<<HTML
\t\t\t\t   
\t\t\t\t   <script type='text/javascript'>
\t\t\t\t\t   var slt = document.getElementById('{$elementName}');
\t\t\t\t\t   if(slt != null){
\t\t\t\t\t      slt.options[0].selected = true;\t\t\t\t\t       
\t\t\t\t\t   }
\t\t\t\t   </script>
HTML;
        }
        $html .= '</select>';
        $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;">&nbsp;</span>';
        return $html;
    }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:32,代码来源:list.php

示例9: onSystemStart

 function onSystemStart()
 {
     if (!self::kunenaInstalled()) {
         return;
     }
     //initialize the toolbar object
     $toolbar = CFactory::getToolbar();
     // Kunena online check
     if (!Kunena::enabled()) {
         $toolbar->addGroup('KUNENAMENU', JText::_('PLG_COMMUNITY_KUNENAMENU_KUNENA_OFFLINE'), JRoute::_('index.php?option=com_kunena'));
         return;
     }
     //adding new 'tab' 'Forum Settings' to JomSocial toolbar
     $toolbar->addGroup('KUNENAMENU', JText::_('PLG_COMMUNITY_KUNENANENU_FORUM'), KunenaRoute::_('index.php?option=com_kunena&func=myprofile'));
     if ($this->params->get('sh_editprofile')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_EDITPROFILE', JText::_('PLG_COMMUNITY_KUNENAMENU_EDITPROFILE'), KunenaRoute::_('index.php?option=com_kunena&func=myprofile&task=edit'));
     }
     if ($this->params->get('sh_myprofile')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_PROFILE', JText::_('PLG_COMMUNITY_KUNENAMENU_PROFILE'), KunenaRoute::_('index.php?option=com_kunena&func=myprofile'));
     }
     if ($this->params->get('sh_myposts')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_POSTS', JText::_('PLG_COMMUNITY_KUNENAMENU_POSTS'), KunenaRoute::_('index.php?option=com_kunena&func=latest&do=userposts'));
     }
     if ($this->params->get('sh_mysubscriptions')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_SUBSCRIBES', JText::_('PLG_COMMUNITY_KUNENAMENU_SUBSCRIBTIONS'), KunenaRoute::_('index.php?option=com_kunena&func=latest&do=subscriptions'));
     }
     if ($this->params->get('sh_myfavorites')) {
         $toolbar->addItem('KUNENAMENU', 'KUNENAMENU_FAVORITES', JText::_('PLG_COMMUNITY_KUNENAMENU_FAVORITES'), KunenaRoute::_('index.php?option=com_kunena&func=latest&do=favorites'));
     }
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:30,代码来源:kunenamenu.php

示例10: getProfileLink

 public function getProfileLink($user_id, &$object, &$attribs = array())
 {
     $user = CFactory::getUser($user_id);
     //parameters
     $params = $this->params;
     if (!$user || $params->get('view_individual_link', '1') == 0) {
         return true;
     }
     JHTML::_('behavior.tooltip');
     $name = $user->getDisplayName();
     $url = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user_id);
     switch ($params->get('view_individual_link', '1')) {
         case 2:
             $avatar = $user->getThumbAvatar();
             $text = '<img class="hasTip" src="' . $avatar . '" title="' . $name . '"/>';
             break;
         case 1:
         default:
             $text = JText::_('PLG_TRACKS_JOMSOCIAL_VIEW_USER_PROFILE');
             break;
     }
     $attribs = array_merge($attribs, array('alt' => $user->get('username')));
     $object->text = JHTML::link($url, $text, $attribs);
     return true;
 }
开发者ID:julienV,项目名称:Joomla-Tracks,代码行数:25,代码来源:jomsocial.php

示例11: isAccessAllowed

 /**
  * Return true if actor have access to target's item
  * @param type where the privacy setting should be extracted, {user, group, global, custom}
  * Site super admin waill always have access to all area	 
  */
 static function isAccessAllowed($actorId, $targetId, $type, $userPrivacyParam)
 {
     $actor = CFactory::getUser($actorId);
     $target = CFactory::getUser($targetId);
     CFactory::load('helpers', 'owner');
     CFactory::load('helpers', 'friends');
     // Load User params
     $params =& $target->getParams();
     // guest
     $relation = 10;
     // site members
     if ($actor->id != 0) {
         $relation = 20;
     }
     // friends
     if (CFriendsHelper::isConnected($actorId, $targetId)) {
         $relation = 30;
     }
     // mine, target and actor is the same person
     if (COwnerHelper::isMine($actor->id, $target->id)) {
         $relation = 40;
     }
     // @todo: respect privacy settings
     // If type is 'custom', then $userPrivacyParam will contain the exact
     // permission level
     $permissionLevel = $type == 'custom' ? $userPrivacyParam : $params->get($userPrivacyParam);
     if ($relation < $permissionLevel && !COwnerHelper::isCommunityAdmin($actorId)) {
         return false;
     }
     return true;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:36,代码来源:privacy.php

示例12: display

 function display($data = null)
 {
     $mainframe = JFactory::getApplication();
     $config = CFactory::getConfig();
     $document =& JFactory::getDocument();
     $document->setTitle(JText::sprintf('CC FRONTPAGE TITLE', $config->get('sitename')));
     $document->setLink(CRoute::_('index.php?option=com_community'));
     $my = CFactory::getUser();
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'string');
     $act = new CActivityStream();
     $rows = $act->getFEED('', '', null, $mainframe->getCfg('feed_limit'));
     if ($config->get('showactivitystream') == COMMUNITY_SHOW || $config->get('showactivitystream') == COMMUNITY_MEMBERS_ONLY && $my->id != 0) {
         foreach ($rows->data as $row) {
             if ($row->type != 'title') {
                 // load individual item creator class
                 $item = new JFeedItem();
                 // cannot escape the title. it's already formated. we should
                 // escape it during CActivityStream::add
                 //$item->title 		= CStringHelper::escape($row->title);
                 $item->title = $row->title;
                 $item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->actor);
                 $item->description = "<img src=\"{$row->favicon}\" alt=\"\"/>&nbsp;" . $row->title;
                 $item->date = $row->createdDate;
                 $item->category = '';
                 //$row->category;
                 // Make sure url is absolute
                 $item->description = JString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
                 // loads item info into rss array
                 $document->addItem($item);
             }
         }
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:34,代码来源:view.feed.php

示例13: _displayEditLayout

 function _displayEditLayout($tpl)
 {
     // Load frontend language file.
     $lang =& JFactory::getLanguage();
     $lang->load('com_community', JPATH_ROOT);
     $userId = JRequest::getVar('id', '', 'REQUEST');
     $user = CFactory::getUser($userId);
     // Set the titlebar text
     JToolBarHelper::title($user->username, 'users');
     // Add the necessary buttons
     JToolBarHelper::back('Back', 'index.php?option=com_community&view=users');
     JToolBarHelper::divider();
     JToolBarHelper::cancel('removeavatar', JText::_('CC REMOVE AVATAR'));
     JToolBarHelper::save();
     $model = CFactory::getModel('Profile');
     $profile = $model->getEditableProfile($user->id, $user->getProfileType());
     $config =& CFactory::getConfig();
     $params = $user->getParams();
     $userDST = $params->get('daylightsavingoffset');
     $offset = !empty($userDST) ? $userDST : $config->get('daylightsavingoffset');
     $counter = -4;
     $options = array();
     for ($i = 0; $i <= 8; $i++, $counter++) {
         $options[] = JHTML::_('select.option', $counter, $counter);
     }
     $offsetList = JHTML::_('select.genericlist', $options, 'daylightsavingoffset', 'class="inputbox" size="1"', 'value', 'text', $offset);
     $user->profile =& $profile;
     $this->assignRef('user', $user);
     $this->assignRef('params', $user->getParameters(true));
     $this->assignRef('offsetList', $offsetList);
     parent::display($tpl);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:32,代码来源:view.html.php

示例14: 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');
     $keys = array('groupid' => $group->id, 'userid' => $userId);
     if ($groupInvite->load($keys)) {
         $groupInvite->delete();
     }
     $member = JTable::getInstance('GroupMembers', 'CTable');
     $keys = array('memberId' => $userId, 'groupId' => $group->id);
     $member->load($keys);
     $groupModel = CFactory::getModel('groups');
     $admins = $groupModel->getAdmins($group->id, null);
     $params = $group->getParams();
     //@rule: Send notification when necessary
     if ($params->get('joinrequestnotification') || $params->get('newmembernotification')) {
         $user = CFactory::getUser($userId);
         $subject = JText::sprintf('COM_COMMUNITY_GROUPS_EMAIL_NEW_MEMBER_JOINED_SUBJECT', '{user}', '{group}');
         if (!$member->approved) {
             $subject = JText::sprintf('COM_COMMUNITY_NEW_MEMBER_REQUESTED_TO_JOIN_GROUP_EMAIL_SUBJECT', '{user}', '{group}');
         }
         $params = new CParameter('');
         $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
         $params->set('group', $group->name);
         $params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
         $params->set('user', $user->getDisplayName());
         $params->set('user_url', 'index.php?option=com_community&view=profile&userid=' . $user->id);
         $params->set('approved', $member->approved);
         foreach ($admins as $admin) {
             CNotificationLibrary::add('groups_member_join', $user->id, $admin->id, $subject, '', 'groups.memberjoin', $params);
         }
     }
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:33,代码来源:groups.trigger.php

示例15: populateUserData

 public function populateUserData($obj, $user_id)
 {
     // joomla fills the info
     $obj = parent::populateUserData($obj, $user_id);
     //populate jomsocial
     require_once JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
     $pModel = CFactory::getModel('profile');
     $profile = $pModel->getEditableProfile($this->activationUserID);
     $fields = $profile['fields'];
     //$obj->jomsocial = array();
     foreach ($fields as $name => $fieldGroup) {
         foreach ($fieldGroup as $field) {
             $name = $field['name'];
             if ($field['fieldcode'] == 'XIPT_PROFILETYPE') {
                 require_once JPATH_BASE . DS . 'components' . DS . 'com_xipt' . DS . 'api.xipt.php';
                 $profiletypeName = XiptAPI::getUserProfiletype($user_id, 'name');
                 $obj['profile'][$name] = $profiletypeName;
                 continue;
             }
             $fieldId = $pModel->getFieldId($field['fieldcode']);
             $query = 'SELECT value FROM #__community_fields_values' . ' ' . 'WHERE `field_id`=' . $this->db->Quote($fieldId) . ' ' . 'AND `user_id`=' . $this->db->Quote($user_id);
             $result = $this->db->setQuery($query)->loadresult();
             if (!empty($result)) {
                 $obj['profile'][$name] = $result;
             }
         }
     }
     return $obj;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:29,代码来源:jomsocial.php


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