本文整理匯總了PHP中Incident_Model::num_incidents_by_sms方法的典型用法代碼示例。如果您正苦於以下問題:PHP Incident_Model::num_incidents_by_sms方法的具體用法?PHP Incident_Model::num_incidents_by_sms怎麽用?PHP Incident_Model::num_incidents_by_sms使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Incident_Model
的用法示例。
在下文中一共展示了Incident_Model::num_incidents_by_sms方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
public function index()
{
$this->template->header->this_page = 'home';
$this->template->content = new View('main');
//get images from flickr
$flickr = new PhpFlickr('7ffd3c4b9d9f3a486b67124d5b530f11');
$haiti_photos = $flickr->photos_search(array('text' => 'earthquake in haiti', 'per_page' => 12));
$this->template->content->flickr = $flickr;
$this->template->content->haiti_photos = $haiti_photos;
// Get all active top level categories
$parent_categories = array();
foreach (ORM::factory('category')->where('category_visible', '1')->where('parent_id', '0')->find_all() as $category) {
// Get The Children
$children = array();
foreach ($category->children as $child) {
$children[$child->id] = array($child->category_title, $child->category_color, $child->category_image);
}
// Put it all together
$parent_categories[$category->id] = array($category->category_title, $category->category_color, $category->category_image, $children);
}
$this->template->content->categories = $parent_categories;
// Get all active Layers (KMZ/KML)
$layers = array();
foreach (ORM::factory('layer')->where('layer_visible', 1)->find_all() as $layer) {
$layers[$layer->id] = array($layer->layer_name, $layer->layer_color, $layer->layer_url, $layer->layer_file);
}
$this->template->content->layers = $layers;
// Get all active Shares
$shares = array();
foreach (ORM::factory('sharing')->where('sharing_active', 1)->where('sharing_type', 1)->find_all() as $share) {
$shares[$share->id] = array($share->sharing_site_name, $share->sharing_color);
}
$this->template->content->shares = $shares;
// Get Reports
// XXX: Might need to replace magic no. 8 with a constant
$this->template->content->total_items = ORM::factory('incident')->where('incident_active', '1')->limit('8')->count_all();
$this->template->content->incidents = ORM::factory('incident')->where('incident_active', '1')->limit('14')->orderby('incident_date', 'desc')->with('location')->find_all();
// Get quick stats for "Latest Activity"
// note: Kohana ORM doesn't support these fancy date search features
$this->template->content->latest_activity_today = count($this->db->query('SELECT id FROM incident WHERE incident_dateadd >= DATE_SUB(CURDATE(),INTERVAL 0 DAY);'));
$this->template->content->latest_activity_yesterday = count($this->db->query('SELECT id FROM incident WHERE incident_dateadd >= DATE_SUB(CURDATE(),INTERVAL 1 DAY) AND incident_dateadd < DATE_SUB(CURDATE(),INTERVAL 0 DAY);'));
$this->template->content->latest_activity_week = count($this->db->query('SELECT id FROM incident WHERE incident_dateadd >= DATE_SUB(CURDATE(),INTERVAL 1 WEEK);'));
$this->template->content->latest_activity_total_from_sms = Incident_Model::num_incidents_by_sms();
// End getting of quick stats for "Latest Activity"
// Get Default Color
$this->template->content->default_map_all = Kohana::config('settings.default_map_all');
// Get Twitter Hashtags
$this->template->content->twitter_hashtag_array = array_filter(array_map('trim', explode(',', Kohana::config('settings.twitter_hashtags'))));
// Get Report-To-Email
$this->template->content->report_email = Kohana::config('settings.site_email');
// Get SMS Numbers
$phone_array = array();
$sms_no1 = Kohana::config('settings.sms_no1');
$sms_no2 = Kohana::config('settings.sms_no2');
$sms_no3 = Kohana::config('settings.sms_no3');
if (!empty($sms_no1)) {
$phone_array[] = $sms_no1;
}
if (!empty($sms_no2)) {
$phone_array[] = $sms_no2;
}
if (!empty($sms_no3)) {
$phone_array[] = $sms_no3;
}
$this->template->content->phone_array = $phone_array;
$this->template->header->phone_array = $phone_array;
// Because we need some custom language around these numbers,
// I'm just sending them straight to the template for "hardcoding"
$this->template->content->sms_no1 = $sms_no1;
$this->template->content->sms_no2 = $sms_no2;
$this->template->header->sms_no1 = $sms_no1;
$this->template->header->sms_no2 = $sms_no2;
// Get RSS News Feeds but don't include Global Voices (8)
$this->template->content->feeds = ORM::factory('feed_item')->limit('10')->where('feed_id !=', '8')->orderby('item_date', 'desc')->find_all();
// Get Global Voices Feed
$this->template->content->gvfeeds = ORM::factory('feed_item')->limit('10')->where('feed_id', '8')->orderby('item_date', 'desc')->find_all();
// Get The START, END and most ACTIVE Incident Dates
$startDate = "";
$endDate = "";
$active_month = 0;
$active_startDate = 0;
$active_endDate = 0;
$db = new Database();
// First Get The Most Active Month
$query = $db->query('SELECT incident_date, count(*) AS incident_count FROM incident WHERE incident_active = 1 GROUP BY DATE_FORMAT(incident_date, \'%Y-%m\') ORDER BY incident_count DESC LIMIT 1');
foreach ($query as $query_active) {
$active_month = date('n', strtotime($query_active->incident_date));
$active_year = date('Y', strtotime($query_active->incident_date));
$active_startDate = strtotime($active_year . "-" . $active_month . "-01");
$active_endDate = strtotime($active_year . "-" . $active_month . "-" . date('t', mktime(0, 0, 0, $active_month, 1)) . " 23:59:59");
}
/** HARDCODED SLIDER SET UP **/
// We'll Hardcode in the Start/End Dates
$timeframe_start = strtotime("2010-01-12", 0);
$timeframe_stop = strtotime(date("Y-m-d"), 0);
$active_startDate = $timeframe_start;
$active_endDate = $timeframe_stop + 86399;
$days = floor(($timeframe_stop - $timeframe_start) / 86400);
$startDate = "<optgroup label=\"2010\">";
$endDate = "<optgroup label=\"2010\">";
//.........這裏部分代碼省略.........