當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Incident_Model::get_incident_messages方法代碼示例

本文整理匯總了PHP中Incident_Model::get_incident_messages方法的典型用法代碼示例。如果您正苦於以下問題:PHP Incident_Model::get_incident_messages方法的具體用法?PHP Incident_Model::get_incident_messages怎麽用?PHP Incident_Model::get_incident_messages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Incident_Model的用法示例。


在下文中一共展示了Incident_Model::get_incident_messages方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index


//.........這裏部分代碼省略.........
        }

		$order = 0;
		$order_string = "desc";
		if( isset($_GET['order']) )
		{
			$order = intval($_GET['order']);
			if ( $order == 0 )
			{
				$order_string = "desc";
			} elseif ( $order == 1 ) {
				$order_string = "asc";
			} else {
				$order = 0;
				$order_string = "desc";
			}
		}

        // Pagination
        $pagination = new Pagination(array(
            'query_string'   => 'page',
            'items_per_page' => (int) Kohana::config('settings.items_per_page_admin'),
            'total_items'    => ORM::factory('incident')
				->join('location', 'incident.location_id', 'location.id','INNER')
				->where($filter)
				->count_all()
            ));
		$incidents = Incident_Model::get_incident_reports($filter,$order_string,$pagination->sql_offset);
        $location_ids = array();
        foreach ($incidents as $incident)
        {
            $location_ids[] = $incident->location_id;
        }
        foreach ($incidents as $incident)
        {
            $incident_ids[] = $incident->id;
        }
        //add_param_get
        $filter = " incident_id IN (".implode(',',$incident_ids).")";
        $incident_persons = Incident_Model::get_incident_persons($filter);
        $incident_messages = Incident_Model::get_incident_messages($filter);
		$incident_incident_langs = Incident_Model::get_incident_incident_langs($filter);
		$incident_incident_categories = Incident_Model::get_incident_incident_categories($filter);
        
        //check if location_ids is not empty
        if( count($location_ids ) > 0 ) 
        {
            $locations_result = ORM::factory('location')->in('id',implode(',',$location_ids))->find_all();
            $locations = array();
            foreach ($locations_result as $loc)
            {
                $locations[$loc->id] = $loc->location_name;
            }
        }
        else
        {
            $locations = array();
        }

        $this->template->content->locations = $locations;

        //GET countries
        $countries = array();
        foreach (ORM::factory('country')->orderby('country')->find_all() as $country)
        {
            // Create a list of all categories
            $this_country = $country->country;
            if (strlen($this_country) > 35)
            {
                $this_country = substr($this_country, 0, 35) . "...";
            }
            $countries[$country->id] = $this_country;
        }

		$this->template->content->from = $r_from;
		$this->template->content->to = $r_to;
		$this->template->content->order = $order;
		$this->template->content->filter = $filter_range;
        $this->template->content->countries = $countries;
        $this->template->content->incidents = $incidents;
        $this->template->content->pagination = $pagination;
        $this->template->content->form_error = $form_error;
        $this->template->content->form_saved = $form_saved;
		// ORM分離
        $this->template->content->incident_persons = $incident_persons;
        $this->template->content->incident_messages = $incident_messages;
        $this->template->content->incident_incident_langs = $incident_incident_langs;
        $this->template->content->incident_incident_categories = $incident_incident_categories;
        // Total Reports
        $this->template->content->total_items = $pagination->total_items;

		// via
		$this->template->content->via = $via;

        // Status Tab
        $this->template->content->status = $status;

        // Javascript Header
        $this->template->js = new View('admin/reports_js');
    }
開發者ID:rindou240,項目名稱:Ushahidi_Web,代碼行數:101,代碼來源:reports.php


注:本文中的Incident_Model::get_incident_messages方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。