當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。