本文整理匯總了PHP中Incident_Model::get_number_reports_by_date方法的典型用法代碼示例。如果您正苦於以下問題:PHP Incident_Model::get_number_reports_by_date方法的具體用法?PHP Incident_Model::get_number_reports_by_date怎麽用?PHP Incident_Model::get_number_reports_by_date使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Incident_Model
的用法示例。
在下文中一共展示了Incident_Model::get_number_reports_by_date方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
function index()
{
$this->template->content = new View('admin/dashboard');
$this->template->content->title = Kohana::lang('ui_admin.dashboard');
$this->template->this_page = 'dashboard';
// Retrieve Dashboard Count...
// Total Reports
$this->template->content->reports_total = ORM::factory('incident')->count_all();
// Total Unapproved Reports
$this->template->content->reports_unapproved = ORM::factory('incident')->where('incident_active', '0')->count_all();
// Total Unverified Reports
$this->template->content->reports_unverified = ORM::factory('incident')->where('incident_verified', '0')->count_all();
// Total Categories
$this->template->content->categories = ORM::factory('category')->count_all();
// Total Locations
$this->template->content->locations = ORM::factory('location')->count_all();
// Total Incoming Media
$this->template->content->incoming_media = ORM::factory('feed_item')->count_all();
// Messages By Service
$total_message_count = 0;
$message_services = array();
$services = ORM::factory('service')->find_all();
foreach ($services as $service) {
$message_count = ORM::factory('message')->join('reporter', 'message.reporter_id', 'reporter.id')->where('service_id', $service->id)->where('message_type', '1')->count_all();
$message_services[] = array('id' => $service->id, 'name' => $service->service_name, 'count' => $message_count);
$total_message_count += $message_count;
}
$this->template->content->message_services = $message_services;
// Total Messages
$this->template->content->message_count = $total_message_count;
// Get reports for display
$incidents = ORM::factory('incident')->limit(5)->orderby('incident_dateadd', 'desc')->find_all();
$this->template->content->incidents = $incidents;
// Get Incoming Media (We'll Use NewsFeeds for now)
$this->template->content->feeds = ORM::factory('feed_item')->limit('3')->orderby('item_date', 'desc')->find_all();
/*
// Javascript Header
$this->template->flot_enabled = TRUE;
$this->template->js = new View('admin/dashboard_js');
// Graph
$this->template->js->all_graphs = Incident_Model::get_incidents_by_interval('ALL',NULL,NULL,'all');
$this->template->js->current_date = date('Y') . '/' . date('m') . '/01';
*/
// Javascript Header
$this->template->protochart_enabled = TRUE;
$this->template->js = new View('admin/stats_js');
$this->template->content->failure = '';
// Build dashboard chart
// Set the date range (how many days in the past from today?)
// default to one year
$range = isset($_GET['range']) ? $_GET['range'] : 365;
if (isset($_GET['range']) and $_GET['range'] == 0) {
$range = NULL;
}
$this->template->content->range = $range;
$incident_data = Incident_Model::get_number_reports_by_date($range);
$data = array('Reports' => $incident_data);
$options = array('xaxis' => array('mode' => '"time"'));
$this->template->content->report_chart = protochart::chart('report_chart', $data, $options, array('Reports' => 'CC0000'), 410, 310);
}
示例2: index
function index()
{
$this->template->content = new View('members/dashboard');
$this->template->content->title = Kohana::lang('ui_admin.dashboard');
$this->template->this_page = 'dashboard';
// User
$this->template->content->user = $this->user;
// User Reputation Score
$this->template->content->reputation = reputation::calculate($this->user->id);
// Get Badges
$this->template->content->badges = Badge_Model::users_badges($this->user->id);
// Retrieve Dashboard Counts...
// Total Reports
$this->template->content->reports_total = ORM::factory('incident')->where("user_id", $this->user->id)->count_all();
// Total Unapproved Reports
$this->template->content->reports_unapproved = ORM::factory('incident')->where('incident_active', '0')->where("user_id", $this->user->id)->count_all();
// Total Checkins
$this->template->content->checkins = ORM::factory('checkin')->where("user_id", $this->user->id)->count_all();
// Total Alerts
$this->template->content->alerts = ORM::factory('alert')->where("user_id", $this->user->id)->count_all();
// Total Votes
$this->template->content->votes = ORM::factory('rating')->where("user_id", $this->user->id)->count_all();
// Total Votes Positive
$this->template->content->votes_up = ORM::factory('rating')->where("user_id", $this->user->id)->where("rating", "1")->count_all();
// Total Votes Negative
$this->template->content->votes_down = ORM::factory('rating')->where("user_id", $this->user->id)->where("rating", "-1")->count_all();
// Get reports for display
$this->template->content->incidents = ORM::factory('incident')->where("user_id", $this->user->id)->limit(5)->orderby('incident_dateadd', 'desc')->find_all();
// To support the "welcome" or "not enough info on user" form
if ($this->user->public_profile == 1) {
$this->template->content->profile_public = TRUE;
$this->template->content->profile_private = FALSE;
} else {
$this->template->content->profile_public = FALSE;
$this->template->content->profile_private = TRUE;
}
$this->template->content->hidden_welcome_fields = array('email' => $this->user->email, 'notify' => $this->user->notify, 'color' => $this->user->color, 'password' => '', 'needinfo' => 0);
/*
// Javascript Header
$this->template->flot_enabled = TRUE;
$this->template->js = new View('admin/dashboard_js');
// Graph
$this->template->js->all_graphs = Incident_Model::get_incidents_by_interval('ALL',NULL,NULL,'all');
$this->template->js->current_date = date('Y') . '/' . date('m') . '/01';
*/
// Javascript Header
$this->template->protochart_enabled = TRUE;
$this->template->js = new View('admin/stats_js');
$this->template->content->failure = '';
// Build dashboard chart
// Set the date range (how many days in the past from today?)
// Default to one year if invalid or not set
$range = (isset($_GET['range']) and preg_match('/^\\d+$/', $_GET['range']) > 0) ? (int) $_GET['range'] : 365;
// Phase 3 - Invoke Kohana's XSS cleaning mechanism just incase an outlier wasn't caught
$range = $this->input->xss_clean($range);
$incident_data = Incident_Model::get_number_reports_by_date($range, $this->user->id);
$data = array('Reports' => $incident_data);
$options = array('xaxis' => array('mode' => '"time"'));
$this->template->content->report_chart = protochart::chart('report_chart', $data, $options, array('Reports' => 'CC0000'), 410, 310);
}