@ 2012-07-06T12:48:34Z <?php
class Note extends CI_Controller {
/***************************
Note CRUD
***************************/
// list records
function notes_records()
{
$data = array();
if($query = $this->note_model->get_records())
{
$data['records'] = $query;
}
$this->load->view('note', $data);
}
// note create
function create()
{
if($_POST)
{
$data = array(
'title' => $this->input->post('title'),
'note' => $this->input->post('note')
);
$this->note_model->add_record($data);
redirect('site/members_area');
}
else
{
$data['main_content'] = 'create_note';
$this->load->view('includes/template', $data);
}
}
// edit form
function edit()
{
if($query = $this->note_model->get_edit())
{
$data['records'] = $query;
}
$data['main_content'] = 'note_edit';
$this->load->view('includes/template', $data);
}
// update data
function update()
{
$data = array(
'title' => $this->input->post('title'),
'note' => $this->input->post('note')
);
$this->note_model->update_record($data);
redirect('site/members_area');
}
// delete note
function delete()
{
$this->note_model->delete_record();
redirect('site/members_area');
}
/***************************
CATEGORY
***************************/
// create category
function create_category()
{
$this->load->helper('form');
$this->load->library(array('form_validation'));
// set validation rules
$this->form_validation->set_rules('category_name', 'Name', 'required|max_length[200]|xss_clean');
if ($this->form_validation->run() == FALSE)
{
//if not valid
$data['main_content'] = 'create_category';
$this->load->view('includes/template', $data);
}
else
{
//if valid
$data = array(
'cat_title' => $this->input->post('category_name')
);
$this->note_model->create_category($data);
redirect('site/members_area');
}
}
// list notes by category`s
function category_records()
{
if($query = $this->note_model->get_category())
{
$data['records'] = $query;
}
if($query_note = $this->note_model->get_records())
{
$data['notes_by_category'] = $query_note;
}
$data['main_content'] = 'category';
$this->load->view('includes/template', $data);
}
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.7 Fatal error: Uncaught Error: Class "CI_Controller" not found in /in/QuuWE:3
Stack trace:
#0 {main}
thrown in /in/QuuWE on line 3
Process exited with code 255 . Output for 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 Fatal error: Uncaught Error: Class 'CI_Controller' not found in /in/QuuWE:3
Stack trace:
#0 {main}
thrown in /in/QuuWE on line 3
Process exited with code 255 . Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.36 , 5.6.0 - 5.6.28 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 Fatal error: Class 'CI_Controller' not found in /in/QuuWE on line 3
Process exited with code 255 . Output for 4.3.2 - 4.3.11 , 4.4.0 - 4.4.9 Fatal error: Class note: Cannot inherit from undefined class ci_controller in /in/QuuWE on line 3
Process exited with code 255 . Output for 4.3.0 - 4.3.1 Fatal error: Class note: Cannot inherit from undefined class ci_controller in /in/QuuWE on line 3
preferences:dark mode live preview
218.35 ms | 401 KiB | 378 Q