@ 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 git.master , git.master_jit , rfc.property-hooks 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 . This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.
Active branches Archived branches Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page
preferences:dark mode live preview
36.48 ms | 401 KiB | 8 Q