function edit($id) { $query = $this->db->where('id', intval($id))->get($this->table); $result = array_shift($query->result_array()); auto_charset($result); $this->load->model('admin/content_model'); $this->data['order'] = $result; Displayview::display('order/order_form', $this->data); }
function update() { $db2 = $this->load->database('fangwei', true); $db2->set('status', $this->input->post('status')); $result = $db2->where('id', intval($this->input->post('id')))->update('fangwei'); if ($result) { Displayview::display('fangwei/index', $this->data); } }
function edit($id) { $this->db->where('id', intval($id)); $result = $this->db->get('comments')->result_array(); $result = array_shift($result); auto_charset($result); $this->data['form'] = $result; Displayview::display('comment/edit.html', $this->data); }
public function index() { //site $this->data['site'] = $this->setting_model->get_setting('site'); //contact $this->data['contact'] = $this->setting_model->get_setting('contact'); //seo $this->data['seo'] = $this->setting_model->get_setting('seo'); Displayview::display('system/system.php', $this->data); }
function many($content_type, $catid = NULL) { $this->load->library('tree'); $this->load->model('category_model'); $this->tree->init($this->category_model->lists('type=' . $content_type)); if (isset($catid)) { $this->data['categories'] = $this->tree->get_tree_select(0, "<option value=\$id \$selected>\$spacer\$name</option>", $catid); } else { $this->data['categories'] = $this->tree->get_tree_select(0, "<option value=\$id \$selected>\$spacer\$name</option>", 0); } Displayview::display('content/uploadmany', $this->data); }
/** * 输出字段添加页面 * create new field * * @param * @return void */ function form($id = false) { //验证失败,返回false if (!($data = $this->fields_model->validate($this->input->post()))) { Displayview::display('field/form', $this->data); } else { //添加新字段 $field_options = $this->field_types->{$data}['field_type']->custom_parameters; foreach ($field_options as $name => $val) { $field_option[$val] = $data[$val]; unset($data[$val]); } $data['field_options'] = serialize($field_option); $insert_id = $this->fields_model->insert($data, true); redirect('field/lists'); } }
/** * 输出操作界面 */ function index() { Displayview::display('tools/index', $this->data); }
function list_positions() { $this->data['lists'] = $this->positions; Displayview::display('content_position/list_positions', $this->data); }
/** * 输出编辑page * * * @param * @return void */ public function edit() { $id = $this->current['id']; $content = $this->model->get($id); $this->tree->init($this->category_model->lists($this->current + array('fetch' => ''))); $this->data['categories'] = $this->tree->get_tree(0, "<option value=\$id \$selected>\$spacer\$name</option>", $content['catid']); $this->data['content'] = $content; $this->data['forward'] = $_SERVER['HTTP_REFERER']; $this->data['form'] = $this->load->view('content/' . Contentfactory::$types[$this->current['type']]['editform'], $this->data, true); unset($this->data['content']); Displayview::display('content/edit.html', $this->data); }
/** * 添加分类 * * * @param */ function form() { $this->load->helper('form'); $this->load->library('form_validation'); //分类 select options $this->tree->init($this->category_model->lists()); $data['page_title'] = '分类表单'; //default values are empty if the customer is new $this->data['id'] = ''; $this->data['catname'] = ''; $this->data['slug'] = ''; $this->data['content'] = ''; $this->data['excerpt'] = ''; $this->data['sort'] = ''; $this->data['thumb'] = ''; $this->data['pid'] = 0; $this->data['status'] = '1'; if (isset($this->current['id'])) { $category = $this->category_model->get($this->current['id']); //如果分类不存在,返回到分类首页 if (!$category) { $this->session->set_flashdata('error', '没有找到分类'); redirect('admin/category'); } $this->data['id'] = $category['id']; $this->data['catname'] = $category['name']; $this->data['slug'] = $category['slug']; $this->data['content'] = $category['content']; $this->data['sort'] = $category['sort']; $this->data['pid'] = $category['pid']; $this->data['thumb'] = $category['thumb']; $this->data['status'] = $category['status']; $this->data['categories'] = $this->tree->get_tree_select(0, "<option value=\$id \$selected>\$spacer\$name</option>", $category['pid']); } $this->form_validation->set_rules('name', '名称', 'trim|required|max_length[64]'); // 存在分类,显示分类修改页面 if ($this->form_validation->run() === FALSE) { if (!isset($this->current['id'])) { $this->data['categories'] = $this->tree->get_tree_select(0, "<option value=\$id \$selected>\$spacer\$name</option>", $this->input->post('pid')); } Displayview::display('category/category_form', $this->data); } else { //保存表单数据,应用于写入或更新数据 $save['id'] = (int) $this->current['id']; $save['typeid'] = $this->input->post('typeid'); $save['name'] = $this->input->post('name'); $save['content'] = $this->input->post('content'); $save['thumb'] = $this->input->post('thumb'); $save['pid'] = intval($this->input->post('pid')); $save['sort'] = intval($this->input->post('sort')); $save['status'] = $this->input->post('status'); $category_id = $this->category_model->save($save); if ($category_id !== false) { $this->session->set_flashdata('msg', '添加成功'); } else { $this->session->set_flashdata('msg', '添加失败'); } //返回分类首页 redirect('admin/category/index/' . $this->current['type']); } }
public function index() { Displayview::display('index.html', $this->data); }