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


PHP User::getUsersCount方法代码示例

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


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

示例1: hasUsersAvailable

 public function hasUsersAvailable()
 {
     return $this->getMaxUsers() ? \thebuggenie\core\entities\User::getUsersCount() < $this->getMaxUsers() : true;
 }
开发者ID:RTechSoft,项目名称:thebuggenie,代码行数:4,代码来源:Scope.php

示例2: runAddUser

 public function runAddUser(framework\Request $request)
 {
     try {
         if (!framework\Context::getScope()->hasUsersAvailable()) {
             throw new \Exception($this->getI18n()->__('This instance of The Bug Genie cannot add more users'));
         }
         if ($username = trim($request['username'])) {
             if (!entities\User::isUsernameAvailable($username)) {
                 if ($request->getParameter('mode') == 'import') {
                     $user = entities\User::getByUsername($username);
                     $user->addScope(framework\Context::getScope());
                     return $this->renderJSON(array('imported' => true, 'message' => $this->getI18n()->__('The user was successfully added to this scope (pending user confirmation)')));
                 } elseif (framework\Context::getScope()->isDefault()) {
                     throw new \Exception($this->getI18n()->__('This username already exists'));
                 } else {
                     $this->getResponse()->setHttpStatus(400);
                     return $this->renderJSON(array('allow_import' => true));
                 }
             }
             $user = new entities\User();
             $user->setUsername($username);
             $user->setRealname($request->getParameter('realname', $username));
             $user->setBuddyname($request->getParameter('buddyname', $username));
             $user->setEmail($request->getParameter('email'));
             $group_id = $request->getParameter('group_id') ? $request->getParameter('group_id') : framework\Settings::get(framework\Settings::SETTING_USER_GROUP);
             $user->setGroup($group_id);
             if ($request->hasParameter('password') && !(empty($request['password']) && empty($request['password_repeat']))) {
                 if (empty($request['password']) || $request['password'] != $request['password_repeat']) {
                     throw new \Exception($this->getI18n()->__('Please enter the same password twice'));
                 }
                 $password = $request['password'];
                 $user->setPassword($password);
             } else {
                 $password = entities\User::createPassword();
                 $user->setPassword($password);
             }
             $user->save();
             foreach ((array) $request['teams'] as $team_id) {
                 $user->addToTeam(entities\Team::getB2DBTable()->selectById((int) $team_id));
             }
             framework\Event::createNew('core', 'config.createuser.save', $user, array('password' => $password))->trigger();
         } else {
             throw new \Exception($this->getI18n()->__('Please enter a username'));
         }
         $this->getResponse()->setTemplate('configuration/findusers');
         $this->too_short = false;
         $this->created_user = true;
         $this->users = array($user);
         $this->total_results = 1;
         $this->title = $this->getI18n()->__('User %username created', array('%username' => $username));
         $this->total_count = entities\User::getUsersCount();
         $this->more_available = framework\Context::getScope()->hasUsersAvailable();
     } catch (\Exception $e) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => $e->getMessage()));
     }
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:57,代码来源:Main.php

示例3: __

<?php

$tbg_response->setTitle(__('Configure users, teams and clients'));
$users_text = \thebuggenie\core\framework\Context::getScope()->getMaxUsers() ? __('Users (%num/%max)', array('%num' => '<span id="current_user_num_count">' . \thebuggenie\core\entities\User::getUsersCount() . '</span>', '%max' => \thebuggenie\core\framework\Context::getScope()->getMaxUsers())) : __('Users');
$teams_text = \thebuggenie\core\framework\Context::getScope()->getMaxTeams() ? __('Teams (%num/%max)', array('%num' => '<span id="current_team_num_count">' . \thebuggenie\core\entities\Team::countAll() . '</span>', '%max' => \thebuggenie\core\framework\Context::getScope()->getMaxTeams())) : __('Teams');
?>
<table style="table-layout: fixed; width: 100%" cellpadding=0 cellspacing=0 class="configuration_page">
    <tr>
        <?php 
include_component('leftmenu', array('selected_section' => \thebuggenie\core\framework\Settings::CONFIGURATION_SECTION_USERS));
?>
        <td valign="top" style="padding-left: 15px;">
            <div style="width: 730px;">
                <h3><?php 
echo __('Configure users, teams and clients');
?>
</h3>
                <div class="tab_menu inset">
                    <ul id="usersteamsgroups_menu">
                        <li id="tab_users" class="selected"><?php 
echo javascript_link_tag($users_text, array('onclick' => "TBG.Main.Helpers.tabSwitcher('tab_users', 'usersteamsgroups_menu');"));
?>
</li>
                        <li id="tab_teams"><?php 
echo javascript_link_tag($teams_text, array('onclick' => "TBG.Main.Helpers.tabSwitcher('tab_teams', 'usersteamsgroups_menu');"));
?>
</li>
                        <li id="tab_clients"><?php 
echo javascript_link_tag(__('Clients'), array('onclick' => "TBG.Main.Helpers.tabSwitcher('tab_clients', 'usersteamsgroups_menu');"));
?>
</li>
开发者ID:founderio,项目名称:thebuggenie,代码行数:31,代码来源:configureusers.html.php


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