本文整理汇总了PHP中Model_User::getCurrentUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::getCurrentUser方法的具体用法?PHP Model_User::getCurrentUser怎么用?PHP Model_User::getCurrentUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_User
的用法示例。
在下文中一共展示了Model_User::getCurrentUser方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createPage
public function createPage($pageName, $parentId = 0, $contentTemplate = null, $showOnMenu = null)
{
if (empty($pageName)) {
$pageName = $this->_defaultPageName;
}
if ($contentTemplate == null) {
$contentTemplate = $this->_defaultTemplate;
}
if ($showOnMenu !== null) {
if ($showOnMenu == true) {
$makeMenuLinks = 1;
} else {
$makeMenuLinks = 0;
}
} else {
$settings = new Model_SiteSettings();
$makeMenuLinks = $settings->get('add_menu_links');
}
$u = new Model_User();
$user = $u->getCurrentUser();
if ($user) {
$userId = $user->id;
} else {
$userId = 0;
}
//first create the new page
$data = array('namespace' => $this->_namespace, 'create_date' => time(), 'author_id' => $userId, 'name' => $pageName, 'content_template' => $contentTemplate, 'parent_id' => $parentId, 'show_on_menu' => $makeMenuLinks);
$this->insert($data);
$id = $this->_db->lastInsertId();
$this->_flushCache();
//return the new page
return $this->find($id)->current();
}
示例2: currentAdminUser
/**
* comments
*/
public function currentAdminUser($id = 'currentUser')
{
$u = new Model_User();
$user = $u->getCurrentUser();
if (isset($user) && Model_Group::GUEST_ROLE != $user->name) {
$xhtml = '<ul id="' . $id . '">' . '<li title="' . $user->first_name . ' ' . $user->last_name . '">' . ' ' . $this->view->getTranslation('Current User') . ': ' . $user->name . '</li>' . '<li>' . $this->view->getTranslation('Role') . ': ' . $user->role . '</li>' . '<li><a href="' . $this->view->getBaseUrl() . '/admin/auth/logout/">' . $this->view->getTranslation('Log Out') . '</a></li>' . '</ul>';
return $xhtml;
}
return false;
}
示例3: CurrentAdminUser
/**
* comments
*/
public function CurrentAdminUser($id = 'current-user')
{
$u = new Model_User();
$user = $u->getCurrentUser();
if ($user) {
$xhtml = "<ul id='{$id}'>\r\n <li>Current User : <a href='{$this->view->getBaseUrl()}/admin/user/edit/id/{$user->user_id}'>{$user->first_name} {$user->last_name}</a></li>\r\n <li>Role : {$user->role}</li>\r\n <li>[<a href='{$this->view->getBaseUrl()}/admin/auth/logout/'>Log Out</a>]</li>\r\n </ul>";
return $xhtml;
} else {
return false;
}
}
示例4: RenderAdminMainMenu
public function RenderAdminMainMenu()
{
$userModel = new Model_User();
$currentUser = $userModel->getCurrentUser();
$cache = Digitalus_Cache_Manager::getInstance();
$key = 'admin_main_menu_' . $currentUser->user_id;
if (($data = $cache->loadCache($key)) != false) {
return $data;
}
$this->view->addScriptPath(BASE_TEMPLATES);
$data = $this->view->render('main_menu.phtml');
$cache->saveCache($data, $key);
return $data;
}
示例5: RenderAdminMainMenu
public function RenderAdminMainMenu()
{
$userModel = new Model_User();
$currentUser = $userModel->getCurrentUser();
$objMenus = new Model_Menus();
$rsRootLevel = $objMenus->fetchAll('parent = 0', 'order ASC');
$html = "<div id='main_menu'><ul class='menu' id='menu'>";
foreach ($rsRootLevel as $rowRootLevel) {
$html .= "<li>";
if (empty($rowRootLevel->admin_menu_link)) {
$html .= "<a href='javascript:void(0)' class='menulink'>{$rowRootLevel->name}</a>";
} else {
$html .= "<a href='{$rowRootLevel->admin_menu_link}' class='menulink'>{$rowRootLevel->name}</a>";
}
$rsNextLevel = $rowRootLevel->findDependentRowset($rowRootLevel->getTableClass(), null, $rowRootLevel->select()->order('order ASC'));
if (count($rsNextLevel) > 0) {
$html .= self::RenderAdminMenu($rsNextLevel, 0);
}
$html .= "</li>";
}
$html .= "</ul></div>";
return $html;
}
示例6: indexAction
/**
* The default action
*
* Displays the admin dashboard
*
* @return void
*/
public function indexAction()
{
$notes = new Model_Note();
$this->view->notes = $notes->getUsersNotes();
$content = new Model_Page();
$this->view->pages = $content->getCurrentUsersPages('create_date DESC', 5);
$user = new Model_User();
$identity = $user->getCurrentUser();
$form = new Admin_Form_User();
$form->onlyIndexIndexActionElements();
$form->setAction($this->baseUrl . '/admin/user/update-my-account');
$firstName = $form->getElement('first_name');
$firstName->setValue($identity->first_name);
$lastName = $form->getElement('last_name');
$lastName->setValue($identity->last_name);
$email = $form->getElement('email');
$email->setValue($identity->email);
$submit = $form->getElement('submitAdminUserForm');
$submit->setLabel($this->view->getTranslation('Update My Account'));
$displayGroup = $form->getDisplayGroup('adminUserGroup');
$displayGroup->setLegend($this->view->getTranslation('My Account'))->setAttrib('class', 'formColumn');
$this->view->form = $form;
}
示例7: createPage
public function createPage($pageName, $parentId = 0, $contentTemplate = null, $showOnMenu = null, $publishPage = null)
{
if (empty($pageName)) {
$pageName = $this->_defaultPageName;
}
if ($contentTemplate == null) {
$contentTemplate = $this->_defaultTemplate;
}
if ($showOnMenu !== null) {
if ($showOnMenu == true) {
$makeMenuLinks = 1;
} else {
$makeMenuLinks = 0;
}
} else {
$settings = new Model_SiteSettings();
$makeMenuLinks = $settings->get('add_menu_links');
}
// get current time to ensure create and publish date are exactly the same
$time = time();
if ($publishPage === null) {
$settings = new Model_SiteSettings();
$publishPage = $settings->get('publish_pages');
}
if ($publishPage == true) {
$publishDate = $time;
$publishLevel = self::PUBLISH_ID;
} else {
$publishDate = 'NULL';
$publishLevel = self::UNPUBLISH_ID;
}
$u = new Model_User();
$user = $u->getCurrentUser();
if ($user) {
$userName = $user->name;
} else {
$userName = NULL;
}
//first create the new page
$data = array('namespace' => $this->_namespace, 'create_date' => $time, 'publish_date' => $publishDate, 'publish_level' => $publishLevel, 'user_name' => $userName, 'name' => $pageName, 'content_template' => $contentTemplate, 'parent_id' => $parentId, 'show_on_menu' => $makeMenuLinks);
$this->insert($data);
$id = $this->_db->lastInsertId();
$this->_flushCache();
//return the new page
return $this->find($id)->current();
}
示例8: loadCurrentUsersPermissions
public function loadCurrentUsersPermissions()
{
$user = new Model_User();
$currentUser = $user->getCurrentUser();
$permissions = $user->getCurrentUsersAclResources();
if ($permissions) {
foreach ($permissions as $key => $value) {
if ($this->has($key)) {
if ($value == 1) {
$this->allow($currentUser->role, $key);
} else {
$this->deny($currentUser->role, $key);
}
}
}
}
}
示例9: updateMyAccountAction
/**
* Update my account action
*
* @return void
*/
public function updateMyAccountAction()
{
$u = new Model_User();
$user = $u->getCurrentUser();
$user->first_name = Digitalus_Filter_Post::get('first_name');
$user->last_name = Digitalus_Filter_Post::get('last_name');
$user->email = Digitalus_Filter_Post::get('email');
$user->save();
if (Digitalus_Filter_Post::int('update_password') === 1) {
$password = Digitalus_Filter_Post::get('password');
$passwordConfirm = Digitalus_Filter_Post::get('password_confirm');
$u->updatePassword($user->name, $password, true, $passwordConfirm);
}
$url = 'admin/index';
$this->_redirect($url);
}
示例10: loadCurrentUsersPermissions
public function loadCurrentUsersPermissions()
{
$mdlUser = new Model_User();
$user = $mdlUser->getCurrentUser();
$group = $mdlUser->getGroupByUsername($user->name);
$permissions = $mdlUser->getCurrentUsersAclResources();
if (Model_Group::SUPERUSER_ROLE != $group && !empty($permissions)) {
foreach ($permissions as $key => $value) {
if ($this->has($key)) {
if ($value == 1) {
$this->allow($group, $key);
} else {
$this->deny($group, $key);
}
}
}
}
}