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


PHP Model_User::getTotal方法代码示例

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


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

示例1: output

 public function output(Pagemill_Data $data, Pagemill_Stream $stream)
 {
     $this->pluginTemplate = '/users/online.plug.html';
     $data = $data->fork();
     $users = new Model_User();
     $users->where('DATE_ADD(lastrequest, INTERVAL 30 MINUTE) > NOW()');
     $data->set('usersonline', $users->getTotal());
     parent::output($data, $stream);
 }
开发者ID:ssrsfs,项目名称:blg,代码行数:9,代码来源:Online.php

示例2: ForUser

 /**
  * Create an Auth object based on a user's auth setting or the default authentication method.
  * @param string $usernameOrEmail The user name or email address of the user.
  * @param string $field Which field to use (username, email, or either)
  * @param string $method Default authentication method for nonexistent users (e.g., so users can authenticate through LDAP even if they don't have a user record yet)
  * @return Auth
  */
 public static function ForUser($usernameOrEmail, $field = 'either', $method = TYPEF_AUTH_DEFAULT)
 {
     switch ($field) {
         case 'username':
             $field = 'username';
             break;
         case 'email':
             $field = 'email';
             break;
         default:
             $field = 'username';
             if (preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i', $usernameOrEmail)) {
                 $field = 'email';
             }
             break;
     }
     $users = new Model_User();
     $users->where("{$field} = ?", $usernameOrEmail);
     $obj = null;
     if ($users->getTotal() == 0) {
         $user = Model_User::Create();
         $user[$field] = $usernameOrEmail;
         $cls = 'Auth_' . $method;
     } else {
         if ($users->getTotal() > 1) {
             Typeframe::Log("WARNING: {$usernameOrEmail} matches more than one {$field} in the user table.");
         }
         $user = $users->getFirst();
         $userAuth = $user['auth'];
         if (!$userAuth) {
             $userAuth = 'Hash';
         }
         // Older users might have a blank auth field. Assume Hash
         $cls = 'Auth_' . $userAuth;
     }
     if (!is_subclass_of($cls, 'Auth')) {
         throw new Exception("{$cls} is not a subclass of Auth");
     }
     $obj = new $cls($user);
     return $obj;
 }
开发者ID:ssrsfs,项目名称:blg,代码行数:48,代码来源:Auth.php

示例3: index

 public function index()
 {
     if ($this->registry["ui"]["admin"]) {
         $this->view->setTitle("Статистика");
         $this->view->setLeftContent($this->view->render("left_users", array()));
         $users = new Model_User();
         $data = $users->getTotal();
         if ($data["all"] / 1024 / 1024 > 1) {
             $data["all_val"] = round($data["all"] / 1024 / 1024, 2);
             $data["all_unit"] = "mb";
         }
         if ($data["all"] / 1024 / 1024 / 1024 > 1) {
             $data["all_val"] = round($data["all"] / 1024 / 1024 / 1024, 2);
             $data["all_unit"] = "gb";
         }
         foreach ($data["users"] as $part) {
             if ($part["quota"] == 0) {
                 $user[$part["login"]]["quota_val"] = "<span style='font-size: 18px; position: relative; top: 3px'>&infin;</span> (квота не задана)";
             }
             if ($part["quota"] / 1024 / 1024 > 1) {
                 $user[$part["login"]]["quota_val"] = round($part["quota"] / 1024 / 1024, 2);
                 $user[$part["login"]]["quota_unit"] = "mb";
             }
             if ($part["quota"] / 1024 / 1024 / 1024 > 1) {
                 $user[$part["login"]]["quota_val"] = round($part["quota"] / 1024 / 1024 / 1024, 2);
                 $user[$part["login"]]["quota_unit"] = "gb";
             }
             if ($part["sum"] / 1024 / 1024 > 1) {
                 $user[$part["login"]]["val"] = round($part["sum"] / 1024 / 1024, 2);
                 $user[$part["login"]]["unit"] = "mb";
             }
             if ($part["sum"] / 1024 / 1024 / 1024 > 1) {
                 $user[$part["login"]]["val"] = round($part["sum"] / 1024 / 1024 / 1024, 2);
                 $user[$part["login"]]["unit"] = "gb";
             }
             if ($part["quota"] != 0) {
                 $user[$part["login"]]["percent"] = round($part["sum"] / $part["quota"] * 100, 0);
             } else {
                 $user[$part["login"]]["percent"] = "0";
             }
         }
         $this->view->users_statistic(array("total" => $data, "users" => $user));
     }
 }
开发者ID:rosko,项目名称:workapp,代码行数:44,代码来源:Statistics.php

示例4: index

 function index()
 {
     $this->view->setTitle("Statistics");
     if ($this->registry["ui"]["admin"]) {
         $users = new Model_User();
         $data = $users->getTotal();
         if ($data["all"] / 1024 / 1024 > 1) {
             $data["all_val"] = round($data["all"] / 1024 / 1024, 2);
             $data["all_unit"] = "mb";
         }
         if ($data["all"] / 1024 / 1024 / 1024 > 1) {
             $data["all_val"] = round($data["all"] / 1024 / 1024 / 1024, 2);
             $data["all_unit"] = "gb";
         }
         foreach ($data["users"] as $part) {
             $user[$part["login"]]["quota"] = $part["quota"];
             if ($part["quota"] / 1024 / 1024 > 1) {
                 $user[$part["login"]]["quota_val"] = round($part["quota"] / 1024 / 1024, 2);
                 $user[$part["login"]]["quota_unit"] = "mb";
             }
             if ($part["quota"] / 1024 / 1024 / 1024 > 1) {
                 $user[$part["login"]]["quota_val"] = round($part["quota"] / 1024 / 1024 / 1024, 2);
                 $user[$part["login"]]["quota_unit"] = "gb";
             }
             if ($part["sum"] / 1024 / 1024 > 1) {
                 $user[$part["login"]]["val"] = round($part["sum"] / 1024 / 1024, 2);
                 $user[$part["login"]]["unit"] = "mb";
             }
             if ($part["sum"] / 1024 / 1024 / 1024 > 1) {
                 $user[$part["login"]]["val"] = round($part["sum"] / 1024 / 1024 / 1024, 2);
                 $user[$part["login"]]["unit"] = "gb";
             }
             $user[$part["login"]]["percent"] = round($part["sum"] / $part["quota"] * 100, 0);
         }
         $this->view->users_statistic(array("total" => $data, "users" => $user));
     }
 }
开发者ID:sydorenkovd,项目名称:FM,代码行数:37,代码来源:Statistic.php

示例5: randomID

<?php

/**
 * User password reset controller.
 *
 * Allows users to begin the password reset process. 
 *
 * @package User
 */
// process the form
if ('POST' == $_SERVER['REQUEST_METHOD']) {
    $users = new Model_User();
    $users->where('email = ?', $_REQUEST['email']);
    if (1 == $users->getTotal()) {
        // get userid, resetkey, and set to expire in 1 day
        $user = $users->getFirst();
        $userid = $user->get('userid');
        $resetkey = randomID();
        $expire = date('Y-m-d H:i:s', time() + 86400);
        // create an entry in the password reset table
        $reset = Model_UserReset::Create();
        $reset->set('userid', $userid);
        $reset->set('resetkey', $resetkey);
        $reset->set('expire', $expire);
        $reset->save();
        // construct e-mail body
        $mm = new Pagemill($pm->root()->fork());
        $mm->setVariable('username', $user->get('username'));
        $mm->setVariable('reseturl', sprintf('http://%s%s/password?userid=%d&resetkey=%s', $_SERVER['HTTP_HOST'], TYPEF_WEB_DIR, $userid, $resetkey));
        $body = str_replace('&amp;', '&', $mm->writeString('<pm:include template="/users/reset.eml" />', true));
        // e-mail the user so they can reset their password
开发者ID:ssrsfs,项目名称:blg,代码行数:31,代码来源:reset.php

示例6: trim

$searchfield = trim(@$_REQUEST['searchfield']);
$searchrange = trim(@$_REQUEST['searchrange']);
$searchquery = trim(@$_REQUEST['searchquery']);
$pm->setVariable('searchfield', $searchfield);
$pm->setVariable('searchrange', $searchrange);
$pm->setVariable('searchquery', $searchquery);
if (!empty($searchquery)) {
    $pm->setVariable('searched', true);
    // filter users using given criteria
    $field = 'email' == $searchfield ? $searchfield : 'username';
    $what = 'starts' == $searchrange ? "{$searchquery}%" : "%{$searchquery}%";
    $users->where("{$field} LIKE ?", $what);
}
// set up pagination
$page = trim(@$_REQUEST['page']);
if (!ctype_digit($page)) {
    $page = 1;
}
$perpage = 20;
$totalresults = $users->getTotal();
$totalpages = max(ceil($totalresults / $perpage), 1);
$limit = ($page - 1) * $perpage;
$pagedurl = sprintf(TYPEF_WEB_DIR . '/admin/users?searchfield=%s&searchrange=%s&searchquery=%s', urlencode($searchfield), urlencode($searchrange), urlencode($searchquery));
$pm->setVariable('page', $page);
$pm->setVariable('totalpages', $totalpages);
$pm->setVariable('pagedurl', $pagedurl);
// set up limits
$users->limit("{$limit}, {$perpage}");
// add users and their count to the template
$pm->setVariable('users', $users);
$pm->setVariable('totalresults', $totalresults);
开发者ID:ssrsfs,项目名称:blg,代码行数:31,代码来源:index.php


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