<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Builder extends CI_Controller {
private $uri_segment = 4;
private $per_page = 4;
private $num_links = 6;
private $model;
public function __construct()
{
parent::__construct();
// Your own constructor code
$this->load->library('parser');
$this->load->model($this->model);
//$this->model = $this->User;
}
public function get_start_row(){
return $this->uri->segment($this->uri_segment, 0);
}
public function get_total_row(){
return $this->model->count();
}
public function pagination($data){
$this->load->library('pagination');
$config['base_url'] = $data['url'];
$config['total_rows'] = $data['total_row'];
$config['per_page'] = $this->per_page;
$config['num_links'] = $this->num_links;
$config['uri_segment'] = $this->uri_segment;
$config['full_tag_open'] = '<div class="text-center"><ul class="pagination">';
$this->pagination->initialize($config);
return $this->pagination->create_links();
}
public function index() {
//$this->session->unset_userdata('_task');
//$this->session->unset_userdata('_value');
$start = $this->get_start_row();
$data['result_list'] = $this->model->get_list(array(), $start, $this->per_page);
$display_row = '';
if(empty($data['result_list'])){
$data['result_list'] = array(
array('user_id' => '','user_name' => '','user_tel' => '','user_email' => '',
'user_username' => '','user_password' => '','user_permission' => '')
);
$display_row = 'display:none';
}
$data['txt_search'] = '';
$data['pagination'] = '';
$data['display_list'] = $display_row;
$this->parser->parse('builder/user', $data);
}
public function save() {
$post = $this->input->post(NULL, TRUE); // returns all POST/GET items with XSS filter
$data = array(
'user_id' => $post['user_id(Primary)'],
'user_name' => $post['user_name'],
'user_tel' => $post['user_tel'],
'user_email' => $post['user_email'],
'user_username' => $post['user_username'],
'user_password' => $post['user_password'],
'user_permission' => $post['user_permission']
);
$this->model->id = $post['id'];
if($this->model->save($data)){
$result = array('result' => true);
}else{
$result = array(
'result' => false,
'message' => $this->db->error()
);
}
echo json_encode($result);
}
public function delete() {
$this->user->id = $this->input->post('id', true);
if($this->user->save($data)){
$result = array('result' => true);
}else{
$result = array(
'result' => false,
'message' => $this->db->error()
);
}
echo json_encode($result);
}
}
?>
A PHP Fehler aufgetreten
Severity: Fehlermeldung: Aufruf an ein Mitglied Funktion get_list() auf einem Nicht-Objekt
Dateiname : Controller/Builder.php
Zeilennummer: 46 Backtrace:Aufruf an eine Elementfunktion getList() auf einem Nicht-Objekt
'private $ model' ist leer kein model load .... geben Sie den Namen Ihrer Modelldatei an wo die get_list() Methode existiert –
Was ist in Zeile 46? Die goldene Regel für Fragen: "Stellen Sie sich vor, Sie versuchen, die Frage zu beantworten" ** –