ジョイント テーブルの CI ページネーションについて助けが必要です。
次のコードは機能しません。すべての情報は単一のページに表示されますが、リンク ( $this->pagination->create_links(); ) は、正しいページングで必要なページの正しい量を示しています。次のページまたは他のページをクリックするたびに、同じ結果が表示されます。これをうまく機能させるための提案。ありがとうございました。
public function last_three_months(){
$this->load->model('mymodel');
$this->load->database();
$this->load->library('btree');
$this->load->library('session');
$this->load->library('string');
$this->load->library("Pagination");
if(date("l",strtotime('now')) == "Monday")
$isMonday = strtotime('now');
else
$isMonday = strtotime('last Monday');
$min = $isMonday - 7257600; // 7257600 = 12 weeks
$max = strtotime('now');
//echo(date("l d M Y",$duration));
$result = $this->mymodel->query('SELECT DISTINCT pi.ID PLAN_ID, pi.IMP_PLAN_DATE DUE_DATE, pi.CHANGE_TICKET CHANGE_TICKET,
pi.PLAN_DESC PLAN_DESC, pi.EC_STAT EC_STAT, per_info.ID PERSON_ID, per_info.FIRSTNAME OWNER_FIRST,per_info.LASTNAME OWNER_LAST,ps.STATUS PLAN_STAT,
pi.TIMESTAMP TIMESTAMP, sn.SN SN, loc.ABBR ABBR, sf.SF SF, pn.ID pn_id, pn.TYPE pn_type, pn.CODE pn_code, pn.YEAR pn_year, pn.NAME pn_name, si.IMP_STAT IMP_STAT
FROM `Plan_Info` pi, `Member` member,`Person_Info` per_info,`Plan_Stat` ps,`Sn_Imp` si,`System_Name` sn,
`Location` loc, System_Family sf, PN pn
WHERE member.MEM_TYPE = "Implementer" AND pi.OWNER = member.PERSON_ID AND member.PERSON_ID = per_info.ID AND pi.PLAN_STAT = ps.ID AND pi.ID = si.PLAN_ID AND si.SN_ID = sn.ID AND sn.LOC_ID = loc.ID AND sn.SF_ID = sf.ID
AND pi.PN_ID = pn.ID AND pi.IMP_PLAN_DATE >= '.$min. ' AND pi.IMP_PLAN_DATE < '.$max.' ORDER BY pi.IMP_PLAN_DATE, loc.ABBR, sf.SF')->result_array();
$plan_info = $this->btree->convertToBtree($result, array('PLAN_ID','DUE_DATE','CHANGE_TICKET','PLAN_DESC','EC_STAT','PERSON_ID','OWNER_FIRST',
'OWNER_LAST','PLAN_STAT','TIMESTAMP','SN','ABBR','SF','pn_id','pn_type','pn_code','pn_year','pn_name','IMP_STAT'), array('PLAN_ID','pn_id','DUE_DATE','ABBR'));
$total = count($plan_info);
$config = array();
$config["base_url"] = base_url() . 'index.php/implementer/last_three_months/';
$config["total_rows"] = $total;
$config["per_page"] = 3;
$config["uri_segment"] = 3;
$config['first_link'] = 'First';
$config['last_link'] = 'Last';
$config['next_link'] = 'next';
$config['prev_link'] = 'prev';
//$config['use_page_numbers'] = TRUE;
$this->pagination->initialize($config);
$link = $this->pagination->create_links();
$content_data = array(
'plan_info' => $plan_info,
'link' => $link
);
$this->load->view('implementer/view_weekly/header');
$this->load->view('logo');
$this->load->view('nev');
$this->load->view('implementer/view_weekly/content',$content_data);
$this->load->view('implementer/view_weekly/footer');
}