本文整理汇总了PHP中Domain::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Domain::count方法的具体用法?PHP Domain::count怎么用?PHP Domain::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain::count方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionList
public function actionList()
{
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$list = array();
$criteria = new CDbCriteria(array('order' => 'id ASC'));
$request = Yii::app()->getRequest();
$id = trim($request->getParam("id"));
if ($id) {
$criteria->addCondition("id = {$id}");
}
$domains = new Domain();
$count = $domains->count($criteria);
$pager = new CPagination($count);
$pager->pageSize = Yii::app()->params['postsPerPage'];
$pager->setCurrentPage($page - 1);
$pager->applyLimit($criteria);
$list = $domains->findAll($criteria);
$this->render('list', array('r' => Yii::app()->request->baseUrl . '/', 'pages' => $pager, 'list' => $list));
}
示例2: process_page
function process_page($app, $action, &$var)
{
$var['domain_count'] = Domain::count();
$var['user_count'] = User::count();
$var['domains'] = Domain::list_all();
// perform requested actions
switch ($app->action) {
case 'edit_domain':
$var['domain_name'] = Domain::list_by_id($var['domain_id'])->get_name();
break;
case 'insert_new_domain':
$domain = new Domain();
$domain->set_name($var['domain_name']);
if ($domain->insert()) {
$app->reload();
} else {
$app->action = 'new_domain';
}
break;
case 'update_edit_domain':
$domain = Domain::list_by_id($var['domain_id']);
$domain->set_name($var['domain_name']);
if ($domain->update()) {
$app->reload();
} else {
$app->action = 'edit_domain';
}
break;
case 'delete_domain':
$domain = Domain::list_by_id($var['domain_id']);
if ($domain->delete()) {
$app->reload();
}
break;
}
}
示例3: _e
<?php
include __DIR__ . '/../start.php';
use Illuminate\Database\Capsule\Manager as DB;
$total = Domain::count();
$totalCompleted = Domain::where('status', 'finished')->count();
$page = isset($_GET['page']) == true ? $_GET['page'] : 1;
$perPage = 100;
$totalPages = floor($total / $perPage);
$sortBy = isset($_GET['sortBy']) == true ? $_GET['sortBy'] : 'tf';
$sortType = isset($_GET['sortType']) == true ? $_GET['sortType'] : 'desc';
$domains = Domain::take($perPage)->skip($perPage * ($page - 1))->orderBy($sortBy, $sortType)->get();
$newSortType = $sortType == 'desc' ? 'asc' : 'desc';
?>
<!DOCTYPE html>
<html>
<head>
<title>Domain Metrics Checker</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="assets/style.css">
</head>
<body>
<?php
include __DIR__ . '/menu.php';
?>
<div class='container'>
<div class='clearfix'>
<h2 class='pull-left'>Total <?php
echo _e($total);
示例4: process_page
function process_page($app, $action, &$var)
{
$var['domain_count'] = Domain::count();
$var['user_count'] = User::count();
$var['domains'] = Domain::list_all();
if (!isset($var['domain_id'])) {
if (isset($_COOKIE['app/users/domain_id'])) {
$var['domain_id'] = filter_var($_COOKIE['app/users/domain_id'], FILTER_SANITIZE_STRING);
if (Domain::list_by_id($var['domain_id']) == null) {
$var['domain_id'] = 0;
}
} else {
$var['domain_id'] = 0;
}
}
if ($var['domain_id'] != 0) {
$var['users'] = User::list_by_domain_id($var['domain_id']);
$var['active_domain'] = Domain::list_by_id($var['domain_id']);
} else {
$var['users'] = User::list_all();
}
switch ($app->action) {
case 'select_domain':
setcookie('app/users/domain_id', $var['domain_id']);
$app->reload();
break;
case 'edit_user':
$user = User::list_by_id($var['user_id']);
$var['user_email'] = $user->get_email();
$var['user_password'] = '';
if ($user->is_admin()) {
$var['user_admin'] = 'on';
} else {
unset($var['user_admin']);
}
break;
case 'insert_new_user':
$user = new User();
$user->set_email($var['user_email']);
$user->set_password($var['user_password']);
$user->set_domain_id($var['domain_id']);
$user->set_admin(isset($var['user_admin']));
if ($user->insert()) {
$app->reload();
} else {
$app->action = 'new_user';
}
break;
case 'update_edit_user':
$user = User::list_by_id($var['user_id']);
$user->set_email($var['user_email']);
$user->set_password($var['user_password']);
$user->set_admin(isset($var['user_admin']));
if ($user->update()) {
$app->reload();
} else {
$app->action = 'edit_user';
}
break;
case 'delete_user':
$user = User::list_by_id($var['user_id']);
if ($user->delete()) {
$app->reload();
}
break;
}
}
示例5: process_page
function process_page($app, $action, &$var)
{
$var['domain_count'] = Domain::count();
$var['user_count'] = User::count();
$var['domains'] = Domain::list_all();
if (!isset($var['domain_id'])) {
if (isset($_COOKIE['app/aliases/domain_id'])) {
$var['domain_id'] = filter_var($_COOKIE['app/aliases/domain_id'], FILTER_SANITIZE_STRING);
if (Domain::list_by_id($var['domain_id']) == null) {
$var['domain_id'] = 0;
}
} else {
$var['domain_id'] = 0;
}
}
if ($var['domain_id'] != 0) {
$var['users'] = User::list_by_domain_id($var['domain_id']);
$var['active_domain'] = Domain::list_by_id($var['domain_id']);
} else {
$var['users'] = User::list_all();
}
if (!isset($var['user_id'])) {
if (isset($_COOKIE['app/aliases/user_id'])) {
$var['user_id'] = filter_var($_COOKIE['app/aliases/user_id'], FILTER_SANITIZE_STRING);
if (User::list_by_id($var['user_id']) == null) {
$var['user_id'] = 0;
}
} else {
$var['user_id'] = 0;
}
}
if ($var['user_id'] != 0) {
$var['active_user'] = User::list_by_id($var['user_id']);
$var['aliases'] = Alias::list_by_destination($var['active_user']->get_email());
} else {
if ($var['domain_id'] != 0) {
$var['aliases'] = Alias::list_by_domain_id($var['domain_id']);
} else {
$var['aliases'] = Alias::list_all();
}
}
switch ($app->action) {
case 'select_domain':
setcookie('app/aliases/domain_id', $var['domain_id']);
setcookie('app/aliases/user_id', null);
$app->reload();
break;
case 'select_user':
setcookie('app/aliases/user_id', $var['user_id']);
$app->reload();
break;
case 'edit_alias':
$var['alias_source'] = Alias::list_by_id($var['alias_id'])->get_source();
break;
case 'insert_new_alias':
$alias = new Alias();
$alias->set_destination($var['active_user']->get_email());
$alias->set_domain_id($var['domain_id']);
$alias->set_source($var['alias_source']);
if ($alias->insert()) {
$app->reload();
} else {
$app->action = 'new_alias';
}
break;
case 'update_edit_alias':
$alias = Alias::list_by_id($var['alias_id']);
$alias->set_source($var['alias_source']);
if ($alias->update()) {
$app->reload();
} else {
$app->action = 'edit_alias';
}
break;
case 'delete_alias':
$alias = Alias::list_by_id($var['alias_id']);
if ($alias->delete()) {
$app->reload();
}
break;
}
}