本文整理汇总了PHP中Model_User::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::get方法的具体用法?PHP Model_User::get怎么用?PHP Model_User::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_User
的用法示例。
在下文中一共展示了Model_User::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_showUser
public function action_showUser()
{
$user_id = $this->request->param('user_id');
if (!empty($user_id)) {
$viewUser = Model_User::get($user_id);
} else {
$viewUser = $this->user;
}
if (!$viewUser->id) {
$this->redirect('/');
}
$this->title = $viewUser->name ?: 'Пользователь #' . $viewUser->id;
$this->view['viewUser'] = $viewUser;
$this->template->content = View::factory('templates/users/user', $this->view);
}
示例2: fillByRow
/**
* Заполняет текущий объект строкой из базы данных.
*
* @param $article_row array строка из базы данных с создаваемой статьёй
* @return Model_Article модель, заполненная полями из статьи, либо пустая модель, если была передана пустая строка.
*/
private function fillByRow($article_row)
{
if (!empty($article_row['id'])) {
$this->id = $article_row['id'];
$this->title = $article_row['title'];
$this->text = $article_row['text'];
$this->description = $article_row['description'];
$this->cover = $article_row['cover'];
$this->user_id = $article_row['user_id'];
$this->dt_create = $article_row['dt_create'];
$this->dt_update = $article_row['dt_update'];
$this->is_removed = $article_row['is_removed'];
$this->is_published = $article_row['is_published'];
$this->author = Model_User::get($this->user_id);
$this->commentsCount = Model_Comment::countCommentsByArticle($this->id);
}
return $this;
}
示例3: selectInstanceId
asort($optInstance);
$instanceId = $env->getSession()->get('instanceId');
$optInstance = UI_HTML_Elements::Options($optInstance, $instanceId);
$badges = array();
$infos = array($words['footer_info']['copyright'], sprintf($words['footer_info']['date'], date('d.m.Y')), sprintf($words['footer_info']['time'], date('H:i:s')));
if (!$config->get('app.production')) {
$infos[] = sprintf($words['footer_info']['time_stopped'], $env->getClock()->stop(0, 2));
if ($env->has('dbc') && $env->getDatabase()->numberStatements) {
$infos[] = sprintf($words['footer_info']['requests'], $env->getDatabase()->numberStatements);
}
}
$userId = (int) $session->get('userId');
$roleId = (int) $session->get('roleId');
if ($userId) {
$modelUser = new Model_User($env);
$infos[] = 'Benutzer: ' . $modelUser->get($userId, 'username') . ' <small>(' . $userId . ')</small>';
}
if ($roleId) {
$modelRole = new Model_Role($env);
$infos[] = 'Rolle: ' . $modelRole->get($userId, 'title') . ' <small>(' . $roleId . ')</small>';
}
$badges[] = '<a href="http://validator.w3.org/check?uri=referer"><img style="border: 0; width: 48px; height: 16px" src="http://www.w3.org/Icons/valid-xhtml10" alt="validate HTML (as XHTML 1.0 Strict)"/></a>';
$badges[] = '<a href="http://jigsaw.w3.org/css-validator/check/referer"><img style="border: 0; width: 48px; height: 16px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="validate CSS"/></a>';
$infos = '<span>' . join('</span><span>', $infos) . '</span>';
$badges = '<span>' . join('</span><span>', $badges) . '</span>';
$linkReset = '<a href="./?resetInstanceId">Instanz</a>';
$path = $env->getRequest()->get('__path');
$body = '
<script>
function selectInstanceId(id, forward){
var url = "./admin/instance/select/"+id;
示例4: signInAction
public function signInAction()
{
if (!$this->_request->isXmlHttpRequest()) {
return;
}
$arp = new AjaxResponse();
$arp->setStatus(AjaxResponse::STATUS_FAILED);
$email = trim($this->_getParam('email'));
$password = trim($this->_getParam('password'));
if (empty($email) || empty($password)) {
$arp->setMessage('E-mail and password can not be empty.');
$this->json($arp);
return;
}
$hashedPassword = hash('sha256', $password);
$user = new Model_User($email);
if (!$user->exists() || $user->get('password') != $hashedPassword) {
$arp->setMessage('Authentication failed, You entered an incorrect username, or password.');
$this->json($arp);
return;
}
$this->setLoginCookie($email, $hashedPassword);
$arp->setStatus(AjaxResponse::STATUS_OK);
$this->json($arp);
}