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


PHP Profile::set方法代码示例

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


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

示例1: stateTask

 /**
  * Sets the emailConfirmed state of a member
  *
  * @return     void
  */
 public function stateTask($state = 1)
 {
     // Check for request forgeries
     Request::checkToken(['get', 'post']);
     // Incoming user ID
     $ids = Request::getVar('id', array());
     $ids = !is_array($ids) ? array($ids) : $ids;
     // Do we have an ID?
     if (empty($ids)) {
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_MEMBERS_NO_ID'), 'error');
         return;
     }
     foreach ($ids as $id) {
         // Load the profile
         $profile = new Profile();
         $profile->load(intval($id));
         if ($state) {
             $profile->set('emailConfirmed', $state);
         } else {
             $confirm = Helpers\Utility::genemailconfirm();
             $profile->set('emailConfirmed', $confirm);
         }
         if (!$profile->update()) {
             App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), $profile->getError(), 'error');
             return;
         }
     }
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_MEMBERS_CONFIRMATION_CHANGED'));
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:34,代码来源:members.php

示例2: submitter

 /**
  * Get the submitter of this entry
  *
  * Accepts an optional property name. If provided
  * it will return that property value. Otherwise,
  * it returns the entire user object
  *
  * @param   string  $property  User property to look up
  * @param   mixed   $default   Value to return if property not found
  * @return  mixed
  */
 public function submitter($property = null, $default = null)
 {
     if (!$this->_data->get('submitter.profile') instanceof Profile) {
         $user = Profile::getInstance($this->get('login'));
         if (!is_object($user) || !$user->get('uidNumber')) {
             $user = new Profile();
         }
         $user->set('name', $this->get('name'));
         $user->set('username', $this->get('login'));
         $user->set('email', $this->get('email'));
         $this->_data->set('submitter.profile', $user);
     }
     if ($property) {
         $property = $property == 'id' ? 'uidNumber' : $property;
         return $this->_data->get('submitter.profile')->get($property, $default);
     }
     return $this->_data->get('submitter.profile');
 }
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:29,代码来源:ticket.php

示例3: addTask

 /**
  * Add a user as a manager of a course
  *
  * @return  void
  */
 public function addTask()
 {
     // Check for request forgeries
     Request::checkToken(['get', 'post']);
     if ($this->getError()) {
         return $this->displayTask();
     }
     // Incoming host
     $m = Request::getVar('author', '');
     $mbrs = explode(',', $m);
     $mbrs = array_map('trim', $mbrs);
     foreach ($mbrs as $mbr) {
         $user = null;
         if (!strstr($mbr, ' ')) {
             $user = Profile::getInstance($mbr);
         }
         // Make sure the user exists
         if (!is_object($user) || !$user->get('username')) {
             $user = new Profile();
             $user->set('name', $mbr);
         }
         $author = new Author($this->database);
         $author->cid = $this->citation->id;
         $author->author = $user->get('name');
         $author->uidNumber = $user->get('uidNumber');
         $author->organization = $user->get('organization');
         $author->givenName = $user->get('givenName');
         $author->middleName = $user->get('middleName');
         $author->surname = $user->get('surname');
         $author->email = $user->get('email');
         if (!$author->check()) {
             $this->setError($author->getError());
             continue;
         }
         if (!$author->store()) {
             $this->setError($author->getError());
             continue;
         }
     }
     // Push through to the view
     $this->displayTask();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:47,代码来源:authors.php


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