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


PHP UserModel::get方法代码示例

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


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

示例1: ResolveProfileLink

 /**
  * Get the resolved profile link for a given user
  *
  * @param UserModel $user
  * @return string
  */
 public static function ResolveProfileLink(UserModel $user)
 {
     if ($user->get('username')) {
         return \Core\resolve_link('/userprofile/view/' . $user->get('username'));
     } else {
         return \Core\resolve_link('/userprofile/view/' . $user->get('id'));
     }
 }
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:14,代码来源:UserSocialHelper.class.php

示例2: _formatArchive

 protected function _formatArchive($archives)
 {
     $ret = array();
     if ($archives) {
         $departmentList = $this->_departmentList();
         if (isset($archives[0]) && is_array($archives[0])) {
             $authorIds = array();
             foreach ($archives as $archive) {
                 $authorIds[] = $archive['author'];
             }
             $authors = UserModel::getByUids($authorIds);
             foreach ($archives as $key => $archive) {
                 $author = $authors[$archive['author']];
                 $archive['author'] = $author;
                 $archive['department'] = $departmentList[$author['department_id']];
                 $archive['catalog'] = $this->catalogList[$archive['catalog_id']];
                 $ret[] = $archive;
             }
         } else {
             $author = UserModel::get($archives['author']);
             $archives['author'] = $author;
             $archives['department'] = $departmentList[$author['department_id']];
             $archives['catalog'] = $this->catalogList[$archives['catalog_id']];
             $ret = $archives;
         }
     }
     return $ret;
 }
开发者ID:BGCX261,项目名称:zhflash-svn-to-git,代码行数:28,代码来源:default.php

示例3: getDisplayName

 public function getDisplayName()
 {
     if ($this->user_id) {
         $user = UserModel::get($this->user_id);
         return $user->getDisplayName();
     } else {
         return $this->name;
     }
 }
开发者ID:xxxcoltxxx,项目名称:blog,代码行数:9,代码来源:PostCommentModel.php

示例4: listAction

 public function listAction()
 {
     $param['page'] = $this->getLegalParam('page', 'int');
     $model = new UserModel();
     $result = $model->get(1);
     //var_dump($result);
     //var_dump($model);
     $this->assign('user_list', $result);
     //$this->render('user/list.phtml');
 }
开发者ID:jixiaod,项目名称:yaf-swoole-framework,代码行数:10,代码来源:User.php

示例5: index

 public function index($args)
 {
     //var_dump(func_get_args());
     print_r($args);
     $user = new UserModel();
     /*$user->insert('user', array(
         'username' => 'chipolata',
         'passwd'   => 'shit happens',
         'role'     => 0
       ));*/
     $user->select('uid');
     var_dump($user->get(1));
 }
开发者ID:kranack,项目名称:frmwrk,代码行数:13,代码来源:UserController.php

示例6: createComponent

 function createComponent($name)
 {
     switch ($name) {
         case 'userTabella':
             $model = new UserModel();
             $grid = new Tabella($model->getFluent(false)->toDatasource(), array('sorting' => 'desc', 'order' => 'id_gui_user'));
             $grid->addColumn("Login/Email", "login", array("width" => 100));
             $grid->addColumn("Meno", "name", array("width" => 100));
             $grid->addColumn("Priezvisko", "surname", array("width" => 100));
             $grid->addColumn("Naposledy prihlásený", "lastvisit", array("width" => 100));
             $grid->addColumn("", "", array("width" => 30, 'filter' => NULL, "options" => '', "renderer" => function ($row) {
                 $el = NHtml::el("td");
                 /*
                  * link na zmazanie produktu
                  */
                 $el->add(NHtml::el('a')->href(NEnvironment::getApplication()->getPresenter()->link('deleteUser!', array('id' => $row->id_gui_user)))->addClass('deleteIcon ajax'));
                 /*
                  * link na editaciu produktu
                  */
                 $el->add(NHtml::el('a')->href(NEnvironment::getApplication()->getPresenter()->link('edit', array('id' => $row->id_gui_user)))->addClass('editIcon'));
                 /*
                  * ikona aktivan polozka, neaktivan polozka
                  */
                 $span = NHtml::el('span');
                 if ($row->activate) {
                     $span->addClass('activeIcon active');
                 } else {
                     $span->addClass('unactiveIcon active ');
                 }
                 $el->add($span);
                 return $el;
             }));
             $this->addComponent($grid, $name);
             break;
         case 'userForm':
             $form = UserModel::baseForm(false);
             $form->addGroup('');
             $form->addText('discount', 'Zľava použivateľa');
             $form->addHidden('id');
             $form->addSubmit('btn_submit', 'Uložiť');
             $form->onSuccess[] = array($this, 'saveUser');
             $form->setDefaults(UserModel::get($this->getParam('id')));
             return $form;
             break;
         default:
             return parent::createComponent($name);
             break;
     }
 }
开发者ID:oaki,项目名称:demoshop,代码行数:49,代码来源:Admin_User.php

示例7: login

 function login()
 {
     $uname = request('uname');
     $passwd = request('passwd');
     if (false == ($uname && $passwd)) {
         $this->ajaxError('用户名或者密码没有填写');
     }
     //echo mymd5($passwd);
     $user = UserModel::get('', $uname);
     if (!$user) {
         $this->ajaxError('用户不存在');
     }
     if ($user['passwd'] != mymd5($passwd)) {
         $this->ajaxError('密码不正确');
     }
     $_SESSION['user'] = $user;
     $this->ajaxSuccess($user);
 }
开发者ID:BGCX261,项目名称:zhflash-svn-to-git,代码行数:18,代码来源:index.php

示例8: SetUser

	/**
	 * Set the current session to be owned by the given user,
	 * effectively logging the user in.
	 *
	 * Drop support for the User class in favour of UserModel after pre-2.8.x is no longer supported.
	 *
	 * @param \UserModel $u
	 */
	public static function SetUser($u) {
		$model = self::_GetModel(session_id());

		$model->set('user_id', $u->get('id'));
		$model->save();

		// If this user is currently SUDO, then set the SUDO'd user and NOT the actual user.
		if(isset($_SESSION['user_sudo'])){
			Session::Set('user_sudo', $u);
		}
		else{
			Session::Set('user', $u);
		}
	}
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:22,代码来源:Session.class.php

示例9: catch

} catch (\Exception $e) {
    //测试插入冲突
    echo "\r\n";
    echo $e->getMessage();
}
//测试忽略冲突
$user->save(YZE_SQL::INSERT_ON_DUPLICATE_KEY_IGNORE);
echo "\r\n";
echo $user->get_key() ? "ignore false" : "ignore true";
//测试冲突是更新
$user->set("name", "aaaa");
$user->save(YZE_SQL::INSERT_ON_DUPLICATE_KEY_UPDATE);
echo "\r\n";
echo $insert_key == $user->get_key() ? "UPDATE true" : "UPDATE false";
echo "\r\n";
echo $user->get("name") == "aaaa" ? "UPDATE true" : "UPDATE false";
//测试删除原来的,插入新的
$user->save(YZE_SQL::INSERT_ON_DUPLICATE_KEY_REPLACE);
echo "\r\n";
echo $insert_key + 1 == $user->get_key() ? "REPLACE true" : "REPLACE false";
$insert_key += 1;
//测试存在时添加
$user1 = new UserModel();
$user1->set("name", "aa");
$user1->set("register_time", "2015-12-17 17:50:30");
$sql = new \yangzie\YZE_SQL();
$sql->from("\\yangzie\\UserModel", "u")->where("u", "name", \yangzie\YZE_SQL::EQ, "aaaa");
$user1->set("email", "1234");
$user1->save(YZE_SQL::INSERT_EXIST, $sql);
echo "\r\n";
echo $user1->get_key() && $user1->Get("email") == "1234" ? "INSERT_EXIST true" : "INSERT_EXIST false";
开发者ID:ydhl,项目名称:yangzie,代码行数:31,代码来源:dba-save2.php

示例10: register

 public function register(array $me)
 {
     $last_id = UserModel::insert(array('login' => $me['email'], 'fbuid' => $me['id'], 'name' => $me['first_name'], 'surname' => $me['last_name'], 'activate' => 1, 'password' => Tools::random(12), 'newsletter' => 0, 'iso' => 'SVK'));
     return UserModel::get($last_id);
 }
开发者ID:oaki,项目名称:demoshop,代码行数:5,代码来源:FacebookAuthenticator.php

示例11: profile

 public function profile()
 {
     if (in_array(Auth::getCapability(), array(CAPABILITY_ADMINISTRATOR))) {
         Model::autoloadModel('User');
         $model = new UserModel($this->db);
         $this->para = new stdClass();
         $this->para->user_id = Session::get('user_id');
         if (isset($this->para->user_id)) {
             $this->view->userBO = $model->get($this->para->user_id);
             $this->view->renderAdmin(RENDER_VIEW_USER_INFO);
         } else {
             header('location: ' . URL . CONTEXT_PATH_USER_EDIT);
         }
     } else {
         $this->login();
     }
 }
开发者ID:khanhdnhut,项目名称:tours,代码行数:17,代码来源:user_ctrl.php

示例12: getUserInfo

 public function getUserInfo($id)
 {
     return $this->userDao->get('*', ['id' => $id]);
 }
开发者ID:loncool,项目名称:yaf-admin,代码行数:4,代码来源:Manage.php

示例13: publicShow

 static function publicShow($uid)
 {
     return self::format(UserModel::get($uid), 'public');
 }
开发者ID:BGCX261,项目名称:zhflash-svn-to-git,代码行数:4,代码来源:user.php

示例14: SendVerificationEmail

	/**
	 * Send the commands to a user to verify they have access to the provided GPG key.
	 *
	 * @param \UserModel $user
	 * @param string     $fingerprint
	 * @param boolean    $cli         Set to false to send non-CLI instructions.
	 *
	 * @return false|string
	 */
	public static function SendVerificationEmail(\UserModel $user, $fingerprint, $cli = true){
		$sentence = trim(\BaconIpsumGenerator::Make_a_Sentence());

		$nonce = \NonceModel::Generate(
			'30 minutes',
			null,
			[
				'sentence' => $sentence,
				'key' => $fingerprint,
				'user' => $user->get('id'),
			]
		);

		$key = $user->get('apikey');
		$url = \Core\resolve_link('/gpgauth/rawverify');
		if($cli){
			$cmd = <<<EOD
echo -n "{$sentence}" \\
| gpg -b -a --default-key $fingerprint \\
| curl --data-binary @- \\
--header "X-Core-Nonce-Key: $nonce" \\
$url

EOD;
		}
		else{
			$cmd = <<<EOD
echo -n "{$sentence}" | gpg -b -a
EOD;
		}


		$email = new \Email();
		$email->templatename = 'emails/user/gpgauth_key_verification.tpl';
		$email->setSubject('GPG Key Change Request');
		$email->assign('key', $fingerprint);
		$email->assign('sentence', $sentence);
		$email->assign('user', $user);
		$email->assign('cmd', $cmd);
		$email->to($user->get('email'));
		$email->setEncryption($fingerprint);

		\SystemLogModel::LogSecurityEvent('/user/gpg/submit', 'Verification requested for key ' . $fingerprint, null, $user->get('id'));

		if(!$email->send()){
			return false;
		}
		else{
			return $nonce;
		}
	}
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:60,代码来源:gpg.php

示例15: saveProfil

 function saveProfil(NFORM $form)
 {
     $values = $form->getValues();
     $data = $this->user->getIdentity()->data;
     //		print_r($data);exit;
     $user = UserModel::getFluent(false)->where(' login = %s', $values['login'], "AND login != %s", $data['login'])->fetch();
     try {
         if ($user and $user['login'] == $values['login']) {
             throw new InvalidStateException(_('Uživateľ pod týmto prihlasovacím meno už existuje.'));
         }
         //			if($user AND $user['email'] == $values['email'])
         //				throw new InvalidStateException( _('Emailová adresa sa už nachádza v databáze. ') );
         //
         unset($values['passwordCheck']);
         unset($values['terms_and_conditions']);
         //ak nevyplni heslo, zostava stare
         if ($values['password'] == '') {
             unset($values['password']);
         }
         UserModel::update($data['id'], $values);
         $values = UserModel::get($data['id']);
         //			$this->user->getIdentity()->updating();
         foreach ($values as $key => $value) {
             // zmenime to i v aktualni identite, aby se nemusel prihlasovat znovu
             $this->user->getIdentity()->{$key} = $value;
         }
         $this->flashMessage("Váš profil bol aktualizovaný.");
         $this->redirect('this');
     } catch (InvalidStateException $e) {
         $form->addError($e->getMessage());
         //			throw $e;
     }
 }
开发者ID:oaki,项目名称:demoshop,代码行数:33,代码来源:Front_ProfilPresenter.php


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