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


PHP Model_User::getCurrentUser方法代码示例

本文整理汇总了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();
 }
开发者ID:robsta,项目名称:brightfamecms,代码行数:33,代码来源:Page.php

示例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;
 }
开发者ID:laiello,项目名称:digitalus-cms,代码行数:13,代码来源:CurrentAdminUser.php

示例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;
     }
 }
开发者ID:ngukho,项目名称:ducbui-cms,代码行数:14,代码来源:CurrentAdminUser.php

示例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;
 }
开发者ID:ngukho,项目名称:ducbui-cms,代码行数:14,代码来源:RenderAdminMainMenu(2).php

示例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;
 }
开发者ID:ngukho,项目名称:ducbui-cms,代码行数:23,代码来源:RenderAdminMainMenu(3).php

示例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;
 }
开发者ID:laiello,项目名称:digitalus-cms,代码行数:30,代码来源:IndexController.php

示例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();
 }
开发者ID:laiello,项目名称:digitalus-cms,代码行数:46,代码来源:Page.php

示例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);
                 }
             }
         }
     }
 }
开发者ID:ngukho,项目名称:ducbui-cms,代码行数:17,代码来源:Acl.php

示例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);
 }
开发者ID:laiello,项目名称:digitalus-cms,代码行数:21,代码来源:UserController.php

示例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);
                 }
             }
         }
     }
 }
开发者ID:laiello,项目名称:digitalus-cms,代码行数:18,代码来源:Acl.php


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