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


PHP Model_Users::current_user方法代码示例

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


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

示例1: game

    /**
     *
     * @param Ultimatum_Model_Ultplayergroupknowledge $pScan
     * @return string
     */
    public function game(Ultimatum_Model_Ultplayergroupknowledge $pScan)
    {
        $game = Zend_Registry::get('ultimatum_game');
        if ($game) {
            $user = Model_Users::current_user();
            ob_start();
            ?>
<fieldset id="ultimatum_game">
    <legend>Ultimatum</legend>
<b>Game:</b> <?php 
            echo $game;
            ?>
, turn <?php 
            echo $game->turn();
            if ($user && $user->can('ultimatum_manage')) {
                echo $this->view->zupallinkbutton("/ultimatum/game/nextturn/game/" . $game->identity(), 'Next Turn');
            }
            ?>
<br />
<?php 
            echo $this->view->zupallinkbutton("/ultimatum/game/switch/", 'Stop Playing');
            ?>
</fieldset>
<?php 
            return ob_get_clean();
        } else {
            return '';
        }
    }
开发者ID:BGCX262,项目名称:zupal-svn-to-git,代码行数:34,代码来源:Game.php

示例2: is_allowed

 /**
  *
  * @param <type> $pResource
  * @return <type>
  */
 public function is_allowed($pResource, Model_Users $pUser = NULL)
 {
     if (!$pUser) {
         $pUser = Model_Users::current_user();
     }
     return self::acl()->isAllowed($pUser ? $pUser->role : Model_Roles::ROLE_ANONYMOUS, $pResource);
 }
开发者ID:BGCX262,项目名称:zupal-svn-to-git,代码行数:12,代码来源:ACL.php

示例3: preDispatch

 /**
  * 
  */
 public function preDispatch()
 {
     $u = Model_Users::current_user();
     if (!$u || !$u->can('site_admin')) {
         $param = array('error' => 'This area is reserved for administrators');
         $this->_forward('insecure', 'error', 'administer', $param);
     }
 }
开发者ID:BGCX262,项目名称:zupal-svn-to-git,代码行数:11,代码来源:IndexController.php

示例4: get_user

 function get_user($pReload = FALSE)
 {
     if ($pReload || is_null($this->_user)) {
         // process
         $this->_user = Model_Users::current_user();
     }
     return $this->_user;
 }
开发者ID:BGCX262,项目名称:zupal-svn-to-git,代码行数:8,代码来源:Nav.php

示例5: preDispatch

 /**
  *
  */
 public function preDispatch()
 {
     $u = Model_Users::current_user();
     if (!$u || !$u->can('ultimatum_manage')) {
         $param = array('error' => 'This area is reserved for administrators');
         return $this->_forward('insecure', 'error', 'administer', $param);
     }
     $this->_helper->layout->setLayout('admin');
     parent::preDispatch();
 }
开发者ID:BGCX262,项目名称:zupal-svn-to-git,代码行数:13,代码来源:AdminController.php

示例6: user_active_player

 /**
  *
  * @param Model_Users $pUser = NULL
  * @return Ultimatum_Model_Ultplayers
  */
 public static function user_active_player($pUser = NULL)
 {
     if ($pUser == NULL) {
         if (!($pUser = Model_Users::current_user())) {
             throw new Exception(__METHOD__ . ': no user logged in');
         }
         $pUser = $pUser->identity();
     } elseif (!($pUser = self::_as($pUser, 'Model_Users', TRUE))) {
         throw new Exception(__METHOD__ . ': bad user passed: ' . print_r($pUser, TRUE));
     }
     $params = array('user' => $pUser, 'active' => 1);
     $game = self::getInstance()->findOne($params);
     return $game;
 }
开发者ID:BGCX262,项目名称:zupal-svn-to-git,代码行数:19,代码来源:Ultplayers.php

示例7: run

 /**
  *
  */
 public function run()
 {
     $user = Model_Users::current_user();
     if ($user) {
         $pi = Ultimatum_Model_Ultplayers::getInstance();
         $params = array('user' => $user->identity(), 'active' => 1, 'status' => 'active');
         $active_games = $pi->find($params, 'id DESC');
         foreach ($active_games as $ag) {
             $ag->active = FALSE;
             $ag->save();
         }
     } else {
         $this->view()->nouser = true;
     }
     return $this->forward('index');
 }
开发者ID:BGCX262,项目名称:zupal-svn-to-git,代码行数:19,代码来源:SwitchAction.php

示例8: zupalusermenu

    public function zupalusermenu()
    {
        ob_start();
        ?>
<div id="user_menu">
    <h1>User</h1>
<?php 
        $user_menu = array();
        $ini = Administer_Model_Modules::getInstance()->get('default')->module_path('configuration/info.ini');
        $user = Model_Users::current_user();
        if ($user) {
            echo '<span class="tagline">Viewing As ', $user->username, '</span>';
            $pages = new Zend_Config_Ini($ini, 'user_menu_in');
        } else {
            $pages = new Zend_Config_Ini($ini, 'user_menu_anon');
        }
        echo $this->getView()->navigation()->menu()->renderMenu(new Zend_Navigation($pages));
        ?>
</div>
<?php 
        return ob_get_clean();
    }
开发者ID:BGCX262,项目名称:zupal-svn-to-git,代码行数:22,代码来源:Zupalusermenu.php

示例9: usergamesAction

 /**
  *
  */
 public function usergamesAction()
 {
     $data = array();
     $game = $this->_getParam('game', '');
     $user = $this->_getParam('user');
     if ($user) {
         $user = Model_Users::getInstance()->get($user);
     } else {
         $user = Model_Users::current_user();
     }
     $params = array('user' => $user->identity());
     $game_type = $game ? Game_Model_Gametypes::game_type($game) : NULL;
     $user_sessions = Game_Model_Gamesessionplayers::getInstance()->find($prarams);
     foreach ($user_sessions as $us) {
         $session = $us->session();
         if ($game_type && !$session->is_game_type($game_type)) {
             continue;
         }
         $out[] = $session->toArray(TRUE);
     }
     $this->_store('id', $out, 'name');
 }
开发者ID:BGCX262,项目名称:zupal-svn-to-git,代码行数:25,代码来源:IndexController.php

示例10: nextturnAction

 public function nextturnAction()
 {
     if (!$this->_prep()) {
         $this->_forward('index', 'index', NULL, array('error' => 'problem loading game'));
     }
     $user = Model_Users::current_user();
     if ($user && $user->can('ultimatum_manage')) {
         $this->view->game->next_turn();
     }
 }
开发者ID:BGCX262,项目名称:zupal-svn-to-git,代码行数:10,代码来源:GameController.php

示例11: activate

 public function activate($pFor_user = NULL)
 {
     $game_type = $this->game_type();
     $gtid = $game_type->identity();
     if ($pFor_user) {
         $uid = Zupal_Domain_Abstract::_as($pFor_user, 'Model_Users', TRUE);
     } elseif ($user = Model_Users::current_user()) {
         $uid = $user->identity();
     } else {
         throw new Exception(__METHOD__ . ': no user present');
     }
     $params = array('game_type' => $gtid, 'user' => $uid);
     $other_player_sessions = Game_Model_Gamesessionplayers::getInstance()->find($params);
     foreach ($other_player_sessions as $other_player_session) {
         if ($other_player_session->game_session == $this->identity()) {
             $other_player_session->active = 1;
         } else {
             $other_player_session->active = 0;
         }
         $other_player_session->save();
     }
     /*
     
             $bond = new Model_Zupalbonds();
             if (!$pFor_user):
                 $pFor_user = Model_Users::current_user();
                 if (!$pFor_user):
                     throw new Exception(__METHOD__ . ': trying to bond missing user to session');
                 endif;
             endif;
     
             $bond->type = 'active';
             $bond->set_to_atom($this);
             $bond->set_from_atom($pFor_user);
             $bond->set_bond_atom($this->game_type());
     
             $params = array(
                 'from_atom' => $bond->from_atom()->get_atomic_id(),
                 'bond_atom' => $bond->to_atom()->get_atomic_id(),
                 'type' => 'active'
                 );
     
            $other_bonds = $bond->find($params);
     
            $other_bond = array_pop($other_bonds);
     
            if (count($other_bonds)):
                 foreach($other_bonds as $extra_bond):
                     $extra_bond->delete();
                 endforeach;
            endif;
     
            // find an existing bond that is a syner-G game activation for this user.
     
            if ($other_bond):
                 $other_bond->set_to_atom($this);
                 $other_bond->save();
            else:
                 $bond->save();
            endif;
     */
 }
开发者ID:BGCX262,项目名称:zupal-svn-to-git,代码行数:62,代码来源:Gamesessions.php

示例12: editmeexecuteAction

 /**
  * Note -- becuase the processing of the user data is inherently custom
  * it takes place in manual form here, not via form.
  */
 public function editmeexecuteAction()
 {
     $user = Model_Users::current_user();
     if (!$user) {
         throw new Exception("No user found");
     }
     extract($this->_getAllParams());
     if ($username) {
         $user->set_username($username);
     }
     if ($new_password) {
         $user->set_password($password, $new_password, $new_password_2);
     }
     // note -- intentionally NOT saving email change!
     $user->save();
     $params = array('message' => 'Updated User Record');
     $this->_forward('me', NULL, NULL, $params);
 }
开发者ID:BGCX262,项目名称:zupal-svn-to-git,代码行数:22,代码来源:UserController.php


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