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


PHP UserInfo::getByID方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     Loader::model('user_statistics');
     Loader::model('page_statistics');
     $u = new User();
     $ui = UserInfo::getByID($u->getUserID());
     $us = new UserStatistics($ui);
     $this->set('uLastActivity', $us->getPreviousSessionPageViews());
     $timeStr = '';
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         $timeStr = '%x ' . t('at') . ' %I:%M %p';
     } else {
         $timeStr = '%x ' . t('at') . ' %l:%M %p';
     }
     $this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user')));
     $this->set('uName', $ui->getUserName());
     $this->set('totalViews', PageStatistics::getTotalPageViewsForOthers($u));
     $this->set('totalVersions', PageStatistics::getTotalPageVersions());
     $this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user'))));
     $llu = UserStatistics::getLastLoggedInUser();
     if ($llu->getUserID() == $u->getUserID()) {
         $this->set('lastLoginSite', t('Your login is the most recent.'));
     } else {
         $this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin()));
     }
     $this->set('totalEditMode', PageStatistics::getTotalPagesCheckedOut());
     Loader::block('form');
     $this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions());
     $this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d')));
 }
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:30,代码来源:activity.php

示例2: save

 public function save()
 {
     $config = Core::make('config');
     if (Core::make('token')->validate('conversations.settings.save')) {
         $helper_file = Core::make('helper/concrete/file');
         $config->save('conversations.files.guest.max_size', intval($this->post('maxFileSizeGuest')));
         $config->save('conversations.files.registered.max_size', intval($this->post('maxFileSizeRegistered')));
         $config->save('conversations.files.guest.max', intval($this->post('maxFilesGuest')));
         $config->save('conversations.files.registered.max', intval($this->post('maxFilesRegistered')));
         $config->save('conversations.attachments_enabled', (bool) $this->post('attachmentsEnabled'));
         $config->save('conversations.subscription_enabled', (bool) $this->post('subscriptionEnabled'));
         $users = array();
         if (is_array($this->post('defaultUsers'))) {
             foreach ($this->post('defaultUsers') as $uID) {
                 $ui = \UserInfo::getByID($uID);
                 if (is_object($ui)) {
                     $users[] = $ui;
                 }
             }
         }
         Conversation::setDefaultSubscribedUsers($users);
         if ($this->post('fileExtensions')) {
             $types = preg_split('{,}', $this->post('fileExtensions'), null, PREG_SPLIT_NO_EMPTY);
             $types = $helper_file->serializeUploadFileExtensions($types);
             $config->save('conversations.files.allowed_types', $types);
         }
         $this->saveEditors();
         $this->success();
     } else {
         $this->error->add('Invalid Token.');
         $this->view();
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:33,代码来源:settings.php

示例3: getWorkflowProgressApprovalUsers

 public function getWorkflowProgressApprovalUsers(WorkflowProgress $wp)
 {
     $pk = Key::getByHandle('approve_basic_workflow_action');
     $pk->setPermissionObject($this);
     $access = $pk->getPermissionAssignmentObject()->getPermissionAccessObject();
     $users = array(\UserInfo::getByID(USER_SUPER_ID));
     $usersToRemove = array();
     if (is_object($access)) {
         // Loop through all items and get the relevant users.
         $items = $access->getAccessListItems(Key::ACCESS_TYPE_INCLUDE);
         foreach ($items as $item) {
             $entity = $item->getAccessEntityObject();
             $users = array_merge($entity->getAccessEntityUsers($access), $users);
         }
         // Now we loop through the array and remove
         $items = $access->getAccessListItems(Key::ACCESS_TYPE_EXCLUDE);
         foreach ($items as $item) {
             $entity = $item->getAccessEntityObject();
             foreach ($entity->getAccessEntityUsers($access) as $user) {
                 $usersToRemove[] = $user->getUserID();
             }
         }
         $users = array_unique($users);
         $usersToRemove = array_unique($usersToRemove);
         $users = array_filter($users, function ($element) use($usersToRemove) {
             if (in_array($element->getUserID(), $usersToRemove)) {
                 return false;
             }
             return true;
         });
     }
     return $users;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:33,代码来源:BasicWorkflow.php

示例4: save

 public function save($post)
 {
     // clear all selected permissions
     $tps = array();
     foreach ($post['tpID'] as $tpID) {
         $tp = TaskPermission::getByID($tpID);
         $tps[] = $tp;
         $tp->clearPermissions();
     }
     foreach ($post['selectedEntity'] as $e) {
         if ($e != '') {
             $o1 = explode('_', $e);
             if ($o1[0] == 'uID') {
                 $obj = UserInfo::getByID($o1[1]);
             } else {
                 $obj = Group::getByID($o1[1]);
             }
             foreach ($tps as $tp) {
                 if ($post[$e . '_' . $tp->getTaskPermissionID()] == 1) {
                     $tp->addAccess($obj);
                 }
             }
         }
     }
 }
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:25,代码来源:task_permissions.php

示例5: save

 public function save()
 {
     $helper_file = Loader::helper('concrete/file');
     Config::save('conversations.files.guest.max_size', intval($this->post('maxFileSizeGuest')));
     Config::save('conversations.files.registered.max_size', intval($this->post('maxFileSizeRegistered')));
     Config::save('conversations.files.guest.max', intval($this->post('maxFilesGuest')));
     Config::save('conversations.files.registered.max', intval($this->post('maxFilesRegistered')));
     Config::save('conversations.attachments_enabled', !!$this->post('attachmentsEnabled'));
     Config::save('conversations.subscription_enabled', !!$this->post('subscriptionEnabled'));
     $users = array();
     if (is_array($this->post('defaultUsers'))) {
         foreach ($this->post('defaultUsers') as $uID) {
             $ui = \UserInfo::getByID($uID);
             if (is_object($ui)) {
                 $users[] = $ui;
             }
         }
     }
     Conversation::setDefaultSubscribedUsers($users);
     if ($this->post('fileExtensions')) {
         $types = preg_split('{,}', $this->post('fileExtensions'), null, PREG_SPLIT_NO_EMPTY);
         $types = $helper_file->serializeUploadFileExtensions($types);
         Config::save('conversations.files.allowed_types', $types);
     }
     $this->saveEditors();
     $this->success();
 }
开发者ID:ngreimel,项目名称:kovent,代码行数:27,代码来源:settings.php

示例6: view

 public function view()
 {
     $u = new User();
     $ui = UserInfo::getByID($u->getUserID());
     Loader::model("page_statistics");
     Loader::model("user_statistics");
     $timeStr = '';
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         $timeStr = '%x ' . t('at') . ' %I:%M %p';
     } else {
         $timeStr = '%x ' . t('at') . ' %l:%M %p';
     }
     if (is_object($ui)) {
         $this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user')));
         $this->set('uName', $ui->getUserName());
         $this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user'))));
         $llu = UserStatistics::getLastLoggedInUser();
         if ($llu->getUserID() == $u->getUserID()) {
             $this->set('lastLoginSite', t('Your login is the most recent.'));
         } else {
             $this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin()));
         }
         Loader::block('form');
     }
     $this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions());
     $this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d')));
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:27,代码来源:dashboard_site_activity.php

示例7: view

 public function view($userID = 0)
 {
     if (!ENABLE_USER_PROFILES) {
         $this->render("/page_not_found");
     }
     $html = Loader::helper('html');
     $canEdit = false;
     $u = new User();
     if ($userID > 0) {
         $profile = UserInfo::getByID($userID);
         if (!is_object($profile)) {
             throw new Exception('Invalid User ID.');
         }
     } else {
         if ($u->isRegistered()) {
             $profile = UserInfo::getByID($u->getUserID());
             $canEdit = true;
         } else {
             $this->set('intro_msg', t('You must sign in order to access this page!'));
             $this->render('/login');
         }
     }
     $this->set('profile', $profile);
     $this->set('av', Loader::helper('concrete/avatar'));
     $this->set('t', Loader::helper('text'));
     $this->set('canEdit', $canEdit);
 }
开发者ID:homer6,项目名称:concrete5-mirror,代码行数:27,代码来源:friends.php

示例8: attemptAuthentication

 protected function attemptAuthentication()
 {
     $user = parent::attemptAuthentication();
     $userInfo = \UserInfo::getByID($user->getUserID());
     $extractor = $this->getExtractor();
     $roles = $extractor->getExtra('roles');
     // sync groups with roles
     if (is_array($roles)) {
         $groupIds = array();
         foreach ($roles as $role) {
             $roleApplicationCode = $role['role_application']['application_code'];
             if ($roleApplicationCode == \Config::get('auth.worldskills.roles_application_code')) {
                 $roleName = $role['name'];
                 // check for entity role and append entity name
                 if (isset($role['ws_entity'])) {
                     $roleName = $roleName . ' - ' . $role['ws_entity']['name']['text'];
                 }
                 // check if group exists
                 $group = \Group::getByName($roleName);
                 if (!is_object($group)) {
                     // add missing groups
                     $group = \Group::add($roleName, '');
                 }
                 $groupIds[] = $group->getGroupID();
             }
         }
         // remove duplicate groups
         $groupIds = array_unique($groupIds);
         // update groups of user
         $userInfo->updateGroups($groupIds);
     }
     // login user again to make sure groups are reloaded
     return \User::loginByUserID($user->getUserID());
 }
开发者ID:worldskills,项目名称:concrete5-worldskills,代码行数:34,代码来源:Controller.php

示例9: getAccessEntityUsers

 public function getAccessEntityUsers(PermissionAccess $pa)
 {
     $f = $pa->getPermissionObject();
     if (is_object($f) && $f instanceof File) {
         return UserInfo::getByID($f->getUserID());
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:7,代码来源:file_uploader.php

示例10: on_start

 public function on_start()
 {
     $ihm = Loader::helper('concrete/ui/menu');
     $p = new Permissions(Page::getByPath('/dashboard/forums/'));
     if ($p->canRead()) {
         $ihm->addPageHeaderMenuItem('forums', 'webli_forums', array('icon' => '', 'label' => t('Forums'), 'position' => 'right', 'href' => URL::to('/dashboard/forums'), 'linkAttributes' => array('style' => 'padding:0 5px;width:auto;')));
     }
     Events::addListener('on_page_add', function ($e) {
         $page = $e->getPageObject();
         if ($page->getCollectionTypeHandle() == 'forum_post') {
             $settings = $this->get_saved_settings($page->getCollectionParentID());
             if ($settings['notification']) {
                 if (Config::get('concrete.email.webli_forum.address') && strstr(Config::get('concrete.email.webli_forum.address'), '@')) {
                     $formFormEmailAddress = Config::get('concrete.email.webli_forum.address');
                 } else {
                     if (Config::get('concrete.email.default.address') && strstr(Config::get('concrete.email.default.address'), '@')) {
                         $formFormEmailAddress = Config::get('concrete.email.default.address');
                     } else {
                         $adminUserInfo = UserInfo::getByID(USER_SUPER_ID);
                         $formFormEmailAddress = $adminUserInfo->getUserEmail();
                     }
                 }
                 $mh = Core::make('helper/mail');
                 $mh->to($settings['email_addresses']);
                 $mh->from($formFormEmailAddress);
                 $parentPage = Page::getByID($page->getCollectionParentID());
                 $mh->addParameter('forumName', $parentPage->getCollectionName());
                 $mh->addParameter('forumPath', BASE_URL . DIR_REL . $parentPage->getCollectionPath());
                 $mh->load('forum_notification', 'webli_forums');
                 $mh->setSubject(t('New Forum Post to %s', $parentPage->getCollectionName()));
                 @$mh->sendMail();
             }
         }
     });
 }
开发者ID:katzueno,项目名称:forums,代码行数:35,代码来源:controller.php

示例11: send_notification_email

    private function send_notification_email($data)
    {
        $subject = '[' . SITE . '] New Contact Form Submission';
        $optInString = $data['optIn'] ? 'Yes' : 'No';
        $body = <<<EOB
A new submission has been made to the custom contact form:

Name: {$data['name']}
Email: {$data['email']}
Newsletter: {$optInString}

Message:
{$data['message']}

EOB;
        //Dev Note: The "EOB;" above must be at the far-left of the page (no whitespace before it),
        //          and cannot have anything after it (not even comments).
        //			See http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
        //Send email
        $mh = Loader::helper('mail');
        $mh->from(UserInfo::getByID(USER_SUPER_ID)->getUserEmail());
        $mh->to($this->notifyEmail);
        $mh->setSubject($subject);
        $mh->setBody($body);
        //Use $mh->setBodyHTML() if you want an HTML email instead of (or in addition to) plain-text
        $mh->sendMail();
    }
开发者ID:rowejd,项目名称:c5_custom_contact_form,代码行数:27,代码来源:controller.php

示例12: get

	public function get($itemsToGet = 100, $offset = 0) {
		$userInfos = array(); 
		$this->createQuery();
		$r = parent::get( $itemsToGet, intval($offset));
		foreach($r as $row) {
			$ui = UserInfo::getByID($row['uID']);			
			$userInfos[] = $ui;
		}
		return $userInfos;
	}	
开发者ID:rii-J,项目名称:concrete5-de,代码行数:10,代码来源:user_list.php

示例13: on_start

 public function on_start()
 {
     $u = new \User();
     if (!$u->isRegistered()) {
         $this->render('/login');
     }
     $this->error = Loader::helper('validation/error');
     $this->set('valt', Loader::helper('validation/token'));
     $this->set('av', Loader::helper('concrete/avatar'));
     $this->set('profile', \UserInfo::getByID($u->getUserID()));
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:11,代码来源:AccountPageController.php

示例14: getWorkflowProgressHistoryDescription

 public function getWorkflowProgressHistoryDescription()
 {
     if ($this->object instanceof WorkflowRequest) {
         $d = $this->object->getWorkflowRequestDescriptionObject();
         $ui = UserInfo::getByID($this->object->getRequesterUserID());
         return $d->getDescription() . ' ' . t('Originally requested by %s.', $ui->getUserName());
     }
     if ($this->object instanceof WorkflowHistoryEntry) {
         $d = $this->object->getWorkflowProgressHistoryDescription();
         return $d;
     }
 }
开发者ID:ronlobo,项目名称:concrete5-de,代码行数:12,代码来源:history.php

示例15: __construct

	public function __construct() {
		$html = Loader::helper('html');
		parent::__construct();
		$u = new User();
		if (!$u->isRegistered()) {
			$this->set('intro_msg', t('You must sign in order to access this page!'));
			Loader::controller('/login');
			$this->render('/login');
		}
		$this->set('ui', UserInfo::getByID($u->getUserID()));
		$this->set('av', Loader::helper('concrete/avatar'));
	}
开发者ID:nveid,项目名称:concrete5,代码行数:12,代码来源:edit.php


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