本文整理汇总了PHP中Project::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::count方法的具体用法?PHP Project::count怎么用?PHP Project::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::count方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDestroy
public function testDestroy()
{
$project = Factory::create('Project');
$this->action('DELETE', 'Admin\\ProjectsController@destroy', $project->slug);
$this->assertRedirectedToRoute('admin.projects.index');
$this->assertEquals(0, Project::count());
}
示例2: postProjectsSort
public function postProjectsSort($param)
{
$lang = Cookie::get('lang', 'ru');
$sort = Cookie::get("sort_{$param}", 'ASC');
$load = Input::get('load');
$projects = Project::select('project_id', 'project_alias', "project_keywords_{$lang}", "project_description_{$lang}", "project_name_{$lang}", "project_text_{$lang}", "project_image_preview", "project_date_start", "project_date_stop", "updated_at")->orderBy($param, $sort)->limit($load)->get();
$projects_count = Project::count();
if ($sort == 'ASC') {
Cookie::queue("sort_{$param}", 'DESC');
} else {
Cookie::queue("sort_{$param}", 'ASC');
}
$tpl = View::make('layouts.projects')->with(array('projects' => $projects, 'projects_count' => $projects_count, 'lang' => $lang))->render();
return Response::json(array('success' => true, 'status' => 200, 'tpl' => $tpl, 'param' => $param, 'sort' => $sort));
}
示例3: filter
function filter($year = FALSE)
{
if (!$year) {
$year = date('Y', time());
}
$tax = $this->view_data['core_settings']->tax;
$this->load->database();
$sql = "select invoices.paid_date, ROUND(sum(invoice_has_items.value*invoice_has_items.amount)-if(SUBSTR(invoices.discount,-1)='%',(sum(invoice_has_items.value*invoice_has_items.amount)/100*(SUBSTRING(invoices.discount, 1, CHAR_LENGTH(invoices.discount) - 1))), invoices.discount)+(sum(invoice_has_items.value*invoice_has_items.amount)-if(SUBSTR(invoices.discount,-1)='%',(sum(invoice_has_items.value*invoice_has_items.amount)/100*(SUBSTRING(invoices.discount, 1, CHAR_LENGTH(invoices.discount) - 1))), invoices.discount))/100*{$tax},0) as summary FROM invoices, invoice_has_items where invoices.id = invoice_has_items.invoice_id AND invoices.`status` = 'Paid' AND paid_date between '{$year}-01-01'\nAND '{$year}-12-31' GROUP BY SUBSTR(invoices.paid_date,1,7)";
$query = $this->db->query($sql);
$this->view_data["stats"] = $query->result();
$this->view_data["year"] = $year;
//Projects
//open
$this->view_data["projects_open"] = Project::count(array('conditions' => array('progress < ?', 100)));
//all
$this->view_data["projects_all"] = Project::count();
//invoices
//open
$this->view_data["invoices_open"] = Invoice::count(array('conditions' => array('status != ?', 'Paid')));
//all
$this->view_data["invoices_all"] = Invoice::count();
//payments open
$thismonth = date('m');
$this->view_data["month"] = date('M');
$sql = "select invoices.paid_date, ROUND(sum(invoice_has_items.value*invoice_has_items.amount)-if(SUBSTR(invoices.discount,-1)='%',(sum(invoice_has_items.value*invoice_has_items.amount)/100*(SUBSTRING(invoices.discount, 1, CHAR_LENGTH(invoices.discount) - 1))), invoices.discount)+(sum(invoice_has_items.value*invoice_has_items.amount)-if(SUBSTR(invoices.discount,-1)='%',(sum(invoice_has_items.value*invoice_has_items.amount)/100*(SUBSTRING(invoices.discount, 1, CHAR_LENGTH(invoices.discount) - 1))), invoices.discount))/100*{$tax},0) as summary FROM invoices, invoice_has_items where invoices.id = invoice_has_items.invoice_id AND invoices.`status` = 'Paid' AND paid_date between '{$year}-{$thismonth}-01'\nAND '{$year}-{$thismonth}-31' ";
$query = $this->db->query($sql);
$this->view_data["payments"] = $query->result();
//payments outstanding
$thismonth = date('m');
$this->view_data["month"] = date('M');
$sql = "select invoices.paid_date, ROUND(sum(invoice_has_items.value*invoice_has_items.amount)-if(SUBSTR(invoices.discount,-1)='%',(sum(invoice_has_items.value*invoice_has_items.amount)/100*(SUBSTRING(invoices.discount, 1, CHAR_LENGTH(invoices.discount) - 1))), invoices.discount)+(sum(invoice_has_items.value*invoice_has_items.amount)-if(SUBSTR(invoices.discount,-1)='%',(sum(invoice_has_items.value*invoice_has_items.amount)/100*(SUBSTRING(invoices.discount, 1, CHAR_LENGTH(invoices.discount) - 1))), invoices.discount))/100*{$tax},0) as summary FROM invoices, invoice_has_items where invoices.id = invoice_has_items.invoice_id AND invoices.`status` != 'Paid' ";
$query = $this->db->query($sql);
$this->view_data["paymentsoutstanding"] = $query->result();
//Events
$events = array();
$date = date('Y-m-d', time());
$eventcount = 0;
foreach ($this->view_data['menu'] as $key => $value) {
if ($value->link == "invoices") {
$sql = 'SELECT * FROM invoices WHERE status != "Paid" AND due_date < "' . $date . '" ORDER BY due_date';
$res = $this->db->query($sql);
$res = $res->result();
foreach ($res as $key2 => $value2) {
$eventline = str_replace("{invoice_number}", '<a href="' . base_url() . 'invoices/view/' . $value2->id . '">#' . $value2->reference . '</a>', $this->lang->line('event_invoice_overdue'));
$events[$value2->due_date . "." . $value2->id] = $eventline;
$eventcount = $eventcount + 1;
}
}
if ($value->link == "projects") {
$sql = 'SELECT * FROM projects WHERE progress != "100" AND end < "' . $date . '" ORDER BY end';
$res = $this->db->query($sql);
$res = $res->result();
foreach ($res as $key2 => $value2) {
if ($this->user->admin == 0) {
$sql = "SELECT id FROM `project_has_workers` WHERE project_id = " . $value->id . " AND user_id = " . $this->user->id;
$query = $this->db->query($sql);
$res = $query->result();
if ($res) {
$eventline = str_replace("{project_number}", '<a href="' . base_url() . 'projects/view/' . $value2->id . '">#' . $value2->reference . '</a>', $this->lang->line('event_project_overdue'));
$events[$value2->end . "." . $value2->id] = $eventline;
$eventcount = $eventcount + 1;
}
} else {
$eventline = str_replace("{project_number}", '<a href="' . base_url() . 'projects/view/' . $value2->id . '">#' . $value2->reference . '</a>', $this->lang->line('event_project_overdue'));
$events[$value2->end . "." . $value2->id] = $eventline;
$eventcount = $eventcount + 1;
}
}
}
if ($value->link == "subscriptions") {
$sql = 'SELECT * FROM subscriptions WHERE status != "Inactive" AND end_date > "' . $date . '" AND next_payment <= "' . $date . '" ORDER BY next_payment';
$res = $this->db->query($sql);
$res = $res->result();
foreach ($res as $key2 => $value2) {
$eventline = str_replace("{subscription_number}", '<a href="' . base_url() . 'subscriptions/view/' . $value2->id . '">#' . $value2->reference . '</a>', $this->lang->line('event_subscription_new_invoice'));
$events[$value2->next_payment . "." . $value2->id] = $eventline;
$eventcount = $eventcount + 1;
}
}
if ($value->link == "messages") {
$sql = 'SELECT privatemessages.id, privatemessages.`status`, privatemessages.subject, privatemessages.message, privatemessages.`time`, privatemessages.`recipient`, clients.`userpic` as userpic_c, users.`userpic` as userpic_u , users.`email` as email_u , clients.`email` as email_c , CONCAT(users.firstname," ", users.lastname) as sender_u, CONCAT(clients.firstname," ", clients.lastname) as sender_c
FROM privatemessages
LEFT JOIN clients ON CONCAT("c",clients.id) = privatemessages.sender
LEFT JOIN users ON CONCAT("u",users.id) = privatemessages.sender
GROUP by privatemessages.id HAVING privatemessages.recipient = "u' . $this->user->id . '"AND privatemessages.status != "deleted" ORDER BY privatemessages.`time` DESC LIMIT 6';
$query = $this->db->query($sql);
$this->view_data["message"] = array_filter($query->result());
}
if ($value->link == "projects") {
$sql = 'SELECT * FROM project_has_tasks WHERE status != "done" AND user_id = "' . $this->user->id . '" ORDER BY project_id';
$taskquery = $this->db->query($sql);
$this->view_data["tasks"] = $taskquery->result();
}
}
krsort($events);
$this->view_data["events"] = $events;
$this->view_data["eventcount"] = $eventcount;
$this->content_view = 'dashboard/dashboard';
}
示例4: explode
use Agil\Config\Config;
$request = View::route($_GET);
if (isset($_FILES['image']) && !empty($_FILES['image']) && !empty($request['pk']) && is_numeric($request['pk'])) {
$logado = Session::get('logado');
$id_admin = $logado['id_member'];
$pk = $request['pk'];
$name = md5(sha1(date("Y-m-d H:m:s")));
$file = $_FILES['image'];
$ds = Config::get('ds');
$media = Config::get('media');
$extensions = Config::get('images');
$ext = explode(".", $file['name']);
$ext = $ext[count($ext) - 1];
$sql = array("id_project" => $pk, "id_admin" => $id_admin);
$project = new Project();
$row = $project->count($sql);
if ($row == 1 && in_array($ext, $extensions)) {
$user = $media . $id_admin;
if (!is_dir($user)) {
$mkdir = mkdir($user, 0700);
$chmod = chmod($user, 0700);
}
$project = $media . $id_admin . $ds . $pk;
if (!is_dir($project)) {
$mkdir = mkdir($project, 0700);
$chmod = chmod($project, 0700);
}
$tmp = $file['tmp_name'];
$name .= "." . $ext;
$source = $project . $ds . $name;
if (move_uploaded_file($tmp, $source)) {
示例5: array
if ($logado['email'] == $email) {
?>
<script>
html = "<div style=\"padding:20px;text-align:center;\"><kbd><?php
echo $email;
?>
</kbd> já é colaborador.</div>";
window.parent.boss.popup('Erro 42', html);
</script>
<?php
die;
}
try {
$sql = array('id_project' => $pk, 'id_admin' => $logado['id_member'], 'status' => '1');
$project = new Project();
$count = $project->count($sql);
if ($count == 1) {
$project = $project->get($sql);
$project = $project[0];
$sql = array('email' => $email);
$member = new Member();
$member->fields = array('id_member', 'name', 'email');
$count = $member->count($sql);
if ($count == 1) {
$rs = $member->get($sql);
$rs = $rs[0];
$id_project = $pk;
$id_member = $rs['id_member'];
$sql = array('id_project' => $id_project, 'id_member' => $id_member, 'status' => 1);
$member_set = new ProjectMemberSet($sql);
$countMemberSetSend = $member_set->count($sql);
示例6: listAction
/**
* @usage jqgrid 显示
*/
public function listAction()
{
$this->view->disable();
$page = $this->request->get('page');
$rows = $this->request->get('rows');
$offset = $rows * ($page - 1);
$limit = $rows;
$sidx = $this->request->getQuery('sidx', 'string');
$sord = $this->request->getQuery('sord', 'string');
if ($sidx != null) {
$sort = $sidx;
} else {
$sort = 'id';
$sord = 'desc';
}
if ($sord != null) {
$sort = $sort . ' ' . $sord;
}
//default get
$search_state = $this->request->get('_search');
if ($search_state == 'false') {
$result = $this->modelsManager->createBuilder()->columns(array('Project.id as id', 'Project.begintime as begintime', 'Project.endtime as endtime', 'Project.description as description', 'Project.name as name', 'Manager.name as manager_name', 'Manager.username as manager_username', 'Manager.password as manager_password', 'COUNT(Examinee.id) as user_count'))->from('Project')->join('Manager', 'Project.manager_id = Manager.id ')->leftJoin('Examinee', 'Project.id = Examinee.project_id AND Examinee.type = 0')->groupBy('Project.id')->limit($limit, $offset)->orderBy($sort)->getQuery()->execute();
$rtn_array = array();
$count = Project::count();
$rtn_array['total'] = ceil($count / $rows);
$rtn_array['records'] = $count;
$rtn_array['rows'] = array();
foreach ($result as $value) {
$rtn_array['rows'][] = $value;
}
$rtn_array['page'] = $page;
$this->dataReturn($rtn_array);
return;
} else {
//处理search情况
$search_field = $this->request->get('searchField');
$search_string = $this->request->get('searchString');
$search_oper = $this->request->get('searchOper');
#分情况讨论
#先取出最特殊情况
if ($search_field == 'user_count') {
$oper = '';
switch ($search_oper) {
case 'eq':
$oper = '=';
break;
case 'lt':
$oper = '<';
break;
case 'le':
$oper = '<=';
break;
case 'gt':
$oper = '>';
break;
case 'ge':
$oper = '>=';
break;
}
$filed = 'COUNT(Examinee.id)';
$value = $search_string;
$result = $this->modelsManager->createBuilder()->columns(array('Project.id as id', 'Project.begintime as begintime', 'Project.endtime as endtime', 'Project.description as description', 'Project.name as name', 'Manager.name as manager_name', 'Manager.username as manager_username', 'Manager.password as manager_password', 'COUNT(Examinee.id) as user_count'))->from('Project')->join('Manager', "Project.manager_id = Manager.id")->leftJoin('Examinee', 'Project.id = Examinee.project_id AND Examinee.type = 0')->groupBy('Project.id')->having("{$filed} {$oper} {$value}")->orderBy($sort)->getQuery()->execute();
$rtn_array = array();
$count = count($result);
$rtn_array['total'] = ceil($count / $rows);
$rtn_array['records'] = $count;
$rtn_array['rows'] = array();
foreach ($result as $value) {
$rtn_array['rows'][] = $value;
}
$rtn_array['page'] = $page;
$this->dataReturn($rtn_array);
return;
}
if ($search_field == 'id' || $search_field == 'manager_username') {
//equal
$oper = '=';
if ($search_field == 'id') {
$field = 'Project.' . $search_field;
} else {
if ($search_field == 'manager_username') {
$field = 'Manager.username';
} else {
//
}
}
$value = "'{$search_string}'";
} else {
if ($search_field == 'name' || $search_field == 'manager_name') {
$oper = 'LIKE';
if ($search_field == 'name') {
$field = 'Project.' . $search_field;
} else {
if ($search_field == 'manager_name') {
$field = 'Manager.name';
} else {
//
//.........这里部分代码省略.........
示例7: Project
<?php
require_once 'init.php';
use Agil\View\View;
use Agil\Session\Session;
$logado = Session::get('logado');
$request = View::route($_GET);
$pk = $request['pk'];
$model = new Project();
$admin = $model->is_admin($request['pk'], $logado['id_member']);
$sql = array('id_project' => $pk, 'status' => 1);
$project = null;
$fields = array('id_project', 'title');
$model->fields = $fields;
$projects = $model->get($sql);
$count = $model->count($sql);
$project = $projects[0];
?>
<div class="app-pane">
<div class="app-pane-header">
<div class="col-6 pull-left">
<div id="btn_group_options" class="btn-group">
<a class="btn btn-primary" onclick="boss.bookmark.remove('tab_project_<?php
echo $request['pk'];
?>
');boss.ajax.load('/app/project/view_project_graph/?pk=<?php
echo $request['pk'];
?>
', '#app_conteiner');">Projeto</a>
<a class="btn" onclick="boss.bookmark.set('tab_project_<?php
echo $request['pk'];