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


PHP Incident_Model::get_incident_reports方法代碼示例

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


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

示例1: index


//.........這裏部分代碼省略.........
            }
            else
            {
                $form_error = TRUE;
            }

        }

		$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;
開發者ID:rindou240,項目名稱:Ushahidi_Web,代碼行數:67,代碼來源:reports.php


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