/**
  * 修改审核文档
  */
 public function verifyedit()
 {
     $id = (int) $this->input->get('id');
     $cid = (int) $this->input->get('catid');
     $data = $this->content_model->get($id);
     $catid = $cid ? $cid : $data['catid'];
     $error = array();
     // 数据验证
     if (!$data) {
         $this->admin_msg(lang('019'));
     }
     $category = $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category', $catid, 'field');
     // 可用字段
     $myfield = $this->_get_field($catid);
     if (IS_POST) {
         $cid = (int) $this->input->post('catid');
         // 判断栏目权限
         if ($cid != $catid && !$this->is_category_auth($catid, 'add')) {
             $this->admin_msg(lang('160'));
         }
         $catid = $cid;
         $category = $cid != $catid ? $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category', $catid) : $category;
         unset($cid);
         // 设置uid便于校验处理
         $uid = $this->input->post('data[author]') ? get_member_id($this->input->post('data[author]')) : 0;
         $_POST['data']['id'] = $id;
         $_POST['data']['uid'] = $uid;
         $status = $this->input->post('status');
         $post = $this->validate_filter($myfield, $data);
         if (isset($post['error'])) {
             $error = $post;
             $data = $this->input->post('data', TRUE);
         } elseif (!$catid) {
             $data = $this->input->post('data', TRUE);
             $error = array('error' => 'catid', 'msg' => lang('cat-22'));
         } else {
             $post[1]['uid'] = $uid;
             $post[1]['catid'] = $catid;
             $post[1]['status'] = $status;
             $result = $this->_verify($id, $post, '`id`=' . $id);
             $this->system_log('处理站点【#' . SITE_ID . '】模块【' . APP_DIR . '】审核内容【#' . $id . '】');
             // 记录日志
             if (is_array($result)) {
                 $this->admin_msg(lang('000') . (MODULE_HTML ? dr_module_create_show_file($id) . dr_module_create_list_file($catid) : ''), $this->input->post('backurl'), 1, 1);
             } elseif ($result) {
                 $this->admin_msg($result);
             }
             $this->admin_msg(lang('000'), $this->input->post('backurl'), 1);
         }
     }
     if ($data['status'] == 0) {
         // 退回
         $backuri = APP_DIR . '/admin/home/verify/status/0';
     } elseif ($data['status'] > 0 && $data['status'] < 9) {
         $backuri = APP_DIR . '/admin/home/verify/status/' . $data['status'];
     } else {
         $backuri = APP_DIR . '/admin/home/verify/';
     }
     $this->template->assign(array('data' => $data, 'menu' => $this->get_menu(array(lang('back') => $backuri, lang('edit') => APP_DIR . '/admin/home/verifyedit/id/' . $data['id'])), 'catid' => $catid, 'error' => $error, 'select' => $this->select_category($this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category'), $catid, 'id=\'dr_catid\' name=\'catid\' onChange="show_category_field(this.value)"', '', 1), 'backurl' => $_SERVER['HTTP_REFERER'], 'myfield' => $this->new_field_input($myfield, $data, TRUE), 'is_category_field' => $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category_field')));
     $this->template->display('content_edit.html');
 }
 /**
  * 修改
  */
 public function edit()
 {
     // 初始化参数
     $id = (int) $this->input->get('id');
     $did = (int) $this->input->get('did');
     $cid = (int) $this->input->get('catid');
     $data = $this->content_model->get($id);
     $error = array();
     $catid = $cid ? $cid : $data['catid'];
     // 数据是否存在
     if (!$data) {
         $this->member_msg(lang('019'));
     }
     // 禁止修改他人文档
     if ($data['author'] != $this->member['username'] && $data['uid'] != $this->member['uid']) {
         $this->member_msg(lang('mod-05'));
     }
     // 修改权限判断
     if (!$this->module_rule[$catid]['edit']) {
         $this->member_msg(lang('mod-20'));
     }
     // 可用字段
     $field = $this->_get_member_field($catid);
     $isedit = (int) $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category', $catid, 'setting', 'edit');
     // 保存修数据
     if (IS_POST) {
         $_data = $data;
         // 字段验证与过滤
         $catid = $isedit ? $catid : (int) $this->input->post('catid');
         // 修改权限判断
         if (!$this->module_rule[$catid]['edit']) {
             $this->member_msg(lang('mod-20'));
         }
         $cat = $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category', $catid);
         $field = $cat['field'] ? array_merge($field, $cat['field']) : $field;
         // 设置uid便于校验处理
         $_POST['data']['id'] = $id;
         $_POST['data']['uid'] = $this->uid;
         $_POST['data']['author'] = $this->member['username'];
         $_POST['data']['inputtime'] = $data['inputtime'];
         $_POST['data']['updatetime'] = SYS_TIME;
         $data = $this->validate_filter($field, $_data);
         if (isset($data['error'])) {
             $error = $data;
             $data = $this->input->post('data', TRUE);
         } elseif (!$isedit && !$catid) {
             $data = $this->input->post('data', TRUE);
             $error = array('error' => 'catid', 'msg' => lang('cat-22'));
         } else {
             // 初始化数据
             $status = isset($data['status']) && $data['status'] ? 9 : ($this->module_rule[$catid]['verify'] ? 1 : 9);
             $status = isset($this->module_rule[$catid]['edit_verify']) && $this->module_rule[$catid]['edit_verify'] ? 9 : $status;
             $data[1]['uid'] = $this->uid;
             $data[1]['author'] = $this->member['username'];
             $data[1]['catid'] = $catid;
             $data[1]['status'] = $status;
             $data[1]['updatetime'] = SYS_TIME;
             // 保存为草稿
             if ($this->input->post('action') == 'draft') {
                 $data[1]['id'] = $data[0]['id'] = $id;
                 $id = $this->content_model->save_draft($did, $data, 0);
                 $this->attachment_handle($this->uid, $this->content_model->prefix . '_draft-' . $id, $field);
                 if (IS_AJAX) {
                     exit(dr_json(0, lang('m-229'), dr_url(APP_DIR . '/home/draft/')));
                 }
                 $this->admin_msg(lang('m-229'), dr_url(APP_DIR . '/home/draft/'), 1);
                 exit;
             }
             // 修改数据
             if ($this->content_model->edit($_data, $data)) {
                 // 发布草稿时删除草稿数据
                 if ($did && $this->content_model->delete_draft($did, 'cid=' . $id . ' and eid=0')) {
                     $this->attachment_replace_draft($did, $id, 0, $this->content_model->prefix, $data[1]['status']);
                 }
                 $this->attachment_handle($this->uid, $this->content_model->prefix . '-' . $id, $field, $_data, $data[1]['status'] == 9 ? TRUE : FALSE);
                 if ($data[1]['status'] == 9) {
                     // 审核通过
                     if (IS_AJAX) {
                         exit(dr_json(1, lang('m-340'), dr_member_url(APP_DIR . '/home/index')));
                     }
                     $this->template->assign(array('url' => SITE_URL . APP_DIR . '/index.php?c=show&id=' . $id, 'add' => dr_member_url(APP_DIR . '/home/add', array('catid' => $catid)), 'edit' => 1, 'list' => dr_member_url(APP_DIR . '/home/index'), 'html' => MODULE_HTML ? dr_module_create_show_file($id) . dr_module_create_list_file($catid) : '', 'catid' => $catid, 'meta_name' => lang('mod-03')));
                     $this->template->display('success.html');
                 } else {
                     if (IS_AJAX) {
                         exit(dr_json(1, lang('m-341'), dr_member_url(APP_DIR . '/verify/index')));
                     }
                     $this->template->assign(array('url' => dr_member_url(APP_DIR . '/verify/index'), 'add' => dr_member_url(APP_DIR . '/home/add', array('catid' => $catid)), 'edit' => 1, 'list' => dr_member_url(APP_DIR . '/home/index'), 'catid' => $catid, 'meta_name' => lang('mod-03')));
                     $this->template->display('verify.html');
                 }
             } else {
                 $this->member_msg(lang('mod-06'));
             }
             exit;
         }
         if (IS_AJAX) {
             exit(dr_json(0, $error['msg'], $error['error']));
         }
     } else {
         if ($did) {
             $temp = $this->content_model->get_draft($did);
             if ($temp['draft']['cid'] == $data['id'] && $temp['draft']['eid'] == 0) {
                 $temp['id'] = $id;
                 $data = $temp;
                 $catid = $temp['catid'] ? $temp['catid'] : $catid;
             }
         }
     }
     $backurl = str_replace(MEMBER_URL, '', $_SERVER['HTTP_REFERER']);
     $this->template->assign(array('did' => $did, 'purl' => dr_url(APP_DIR . '/home/add', array('id' => $id)), 'data' => $data, 'catid' => $catid, 'error' => $error, 'isedit' => $isedit, 'select' => $this->select_category($this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category'), $catid, 'id=\'dr_catid\' name=\'catid\' onChange="show_category_field(this.value)"', '', 1, 1), 'backurl' => $_SERVER['HTTP_REFERER'], 'myfield' => $this->field_input($field, $data, TRUE), 'listurl' => $backurl ? $backurl : dr_url(APP_DIR . '/home/index'), 'meta_name' => lang('mod-21'), 'draft_url' => MEMBER_URL . dr_url(APP_DIR . '/home/edit', array('id' => $id)), 'draft_list' => $this->content_model->get_draft_list('cid=' . $id . ' and eid=0'), 'result_error' => $error, 'category_field_url' => $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category_field') ? dr_url(APP_DIR . '/home/edit', array('id' => $id, 'did' => $did)) : ''));
     $this->template->display('content_add.html');
 }
 /**
  * 修改
  */
 public function edit()
 {
     // 作者判断
     if ($this->content['uid'] != $this->uid) {
         $this->member_msg(lang('mod-05'));
     }
     // 修改权限
     if (!$this->catrule['edit']) {
         $this->member_msg(lang('160'));
     }
     $id = (int) $this->input->get('id');
     $did = (int) $this->input->get('did');
     $data = $this->content_model->get_extend($id);
     if (!$data) {
         $this->member_msg(lang('019'));
     }
     $error = array();
     $result = '';
     if (IS_POST) {
         $_data = $data;
         $type = (int) $this->input->post('type');
         $_POST['data']['cid'] = $this->content['id'];
         $_POST['data']['uid'] = $this->content['uid'];
         $data = $this->validate_filter($this->field, $_data);
         if (isset($data['error'])) {
             $error = $data;
             $data = $this->input->post('data', TRUE);
         } else {
             $status = isset($data['status']) && $data['status'] ? 9 : ($this->module_rule[$this->content['catid']]['verify'] ? 1 : 9);
             $status = isset($this->module_rule[$this->content['catid']]['edit_verify']) && $this->module_rule[$this->content['catid']]['edit_verify'] ? 9 : $status;
             $data[1]['cid'] = $this->content['id'];
             $data[1]['uid'] = $_data['uid'];
             $data[1]['catid'] = $this->content['catid'];
             $data[1]['status'] = $status;
             $data[1]['author'] = $_data['author'];
             $data[1]['updatetime'] = SYS_TIME;
             // 保存为草稿
             if ($this->input->post('action') == 'draft') {
                 $data[1]['id'] = $data[0]['id'] = $id;
                 $id = $this->content_model->save_draft($did, $data, 1);
                 $this->attachment_handle($this->uid, $this->content_model->prefix . '_draft-' . $id, $this->field);
                 $this->admin_msg(lang('m-229'), dr_url(APP_DIR . '/home/draft/'), 1);
                 exit;
             }
             // 正常保存
             if ($id = $this->content_model->edit_extend($_data, $data)) {
                 // 发布草稿时删除草稿数据
                 if ($did && $this->content_model->delete_draft($did, 'cid=' . $this->content['id'] . ' and eid=' . $id)) {
                     $this->attachment_replace_draft($did, $this->content['id'], $id, $this->content_model->prefix, $data[1]['status']);
                 }
                 if ($data[1]['status'] == 9) {
                     $mark = $this->content_model->prefix . '-' . $this->content['id'] . '-' . $id;
                     // 操作成功处理附件
                     $this->attachment_handle($this->content['uid'], $mark, $this->field, $_data);
                     if (IS_AJAX) {
                         exit(dr_json(1, lang('m-340'), dr_member_url(APP_DIR . '/extend/index', array('cid' => $this->content['id']))));
                     }
                     $this->template->assign(array('url' => SITE_URL . APP_DIR . '/index.php?c=extend&id=' . $id, 'add' => dr_member_url(APP_DIR . '/extend/add', array('cid' => $this->content['id'], 'type' => $data[1]['mytype'])), 'edit' => 1, 'html' => MODULE_HTML ? dr_module_create_show_file($this->content['id']) . dr_module_create_list_file($this->content['catid']) : '', 'list' => dr_member_url(APP_DIR . '/extend/index', array('cid' => $this->content['id'])), 'meta_name' => lang('mod-19')));
                     $this->template->display('success.html');
                 } else {
                     $this->attachment_handle($this->uid, $this->content_model->prefix . '_verify-' . $this->content['id'] . '-' . $id, $this->field);
                     if (IS_AJAX) {
                         exit(dr_json(1, lang('m-341'), dr_member_url(APP_DIR . '/everify/index')));
                     }
                     $this->template->assign(array('url' => dr_member_url(APP_DIR . '/everify/index'), 'add' => dr_member_url(APP_DIR . '/extend/add', array('cid' => $this->content['id'], 'type' => $data[1]['mytype'])), 'edit' => 0, 'list' => dr_member_url(APP_DIR . '/extend/index', array('cid' => $this->content['id'])), 'meta_name' => lang('mod-19')));
                     $this->template->display('verify.html');
                 }
                 exit;
             } else {
                 $error = array('error' => $id);
             }
         }
     } else {
         if ($did) {
             $temp = $this->content_model->get_draft($did);
             if ($temp['draft']['cid'] == $this->content['id'] && $temp['draft']['eid'] == $id) {
                 $data = $temp;
             }
         }
     }
     $this->template->assign(array('did' => $did, 'data' => $data, 'error' => $error, 'result' => $result, 'myfield' => $this->field_input($this->field, $data, TRUE), 'draft_url' => MEMBER_URL . dr_url(APP_DIR . '/extend/edit', array('cid' => $this->content['id'], 'catid' => $this->catid, 'id' => $id)), 'draft_list' => $this->content_model->get_draft_list('cid=' . $this->content['id'] . ' and eid=' . $id), 'result_error' => $error));
     $this->template->display('content_extend_add.html');
 }
示例#4
0
 /**
  * 修改审核文档
  */
 public function verifyedit()
 {
     $id = (int) $this->input->get('id');
     $data = $this->content_model->get_verify($id);
     $catid = $data['catid'];
     $error = array();
     if (!$data) {
         $this->admin_msg(lang('019'));
     }
     if (IS_POST) {
         $_data = $data;
         $catid = (int) $this->input->post('catid');
         $cate = $this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category', $catid, 'field');
         $field = $cate ? array_merge($this->field, $cate) : $this->field;
         // 设置uid便于校验处理
         $uid = $this->input->post('data[author]') ? get_member_id($this->input->post('data[author]')) : 0;
         $_POST['data']['id'] = $id;
         $_POST['data']['uid'] = $uid;
         $data = $this->validate_filter($field, $_data);
         if (isset($data['error'])) {
             $error = $data;
             $data = $this->input->post('data', TRUE);
         } elseif (!$catid) {
             $data = $this->input->post('data', TRUE);
             $error = array('error' => 'catid', 'msg' => lang('cat-22'));
         } elseif (!$this->input->post('flagid')) {
             $data = $this->input->post('data', TRUE);
             $error = array('error' => 'flagid', 'msg' => lang('161'));
         } else {
             $data[1]['uid'] = $uid;
             $data[1]['catid'] = $catid;
             $result = $this->_verify($id, $data, '`id`=' . $id);
             if (is_array($result)) {
                 $this->admin_msg(lang('000') . (MODULE_HTML ? dr_module_create_show_file($id) . dr_module_create_list_file($catid) : ''), $this->input->post('backurl'), 1, 1);
             } elseif ($result) {
                 $this->admin_msg($result);
             }
             $this->admin_msg(lang('000'), $this->input->post('backurl'), 1);
         }
     }
     if ($data['status'] == 0) {
         // 退回
         $backuri = APP_DIR . '/admin/home/verify/status/0';
     } elseif ($data['status'] > 0 && $data['status'] < 9) {
         $backuri = APP_DIR . '/admin/home/verify/status/' . $data['status'];
     } else {
         $backuri = APP_DIR . '/admin/home/verify/';
     }
     $this->template->assign(array('data' => $data, 'page' => max((int) $this->input->post('page'), 0), 'menu' => $this->get_menu(array(lang('back') => $backuri, lang('edit') => APP_DIR . '/admin/home/verifyedit/id/' . $data['id'])), 'catid' => $catid, 'error' => $error, 'select' => $this->select_category($this->get_cache('module-' . SITE_ID . '-' . APP_DIR, 'category'), $data['catid'], 'id=\'dr_catid\' name=\'catid\' onChange="show_category_field(this.value)"', '', 1), 'backurl' => $_SERVER['HTTP_REFERER'], 'myfield' => $this->field_input($this->field, $data, TRUE)));
     $this->template->display('content_edit.html');
 }
示例#5
0
 /**
  * 修改
  */
 public function edit()
 {
     if (!$this->catrule['edit']) {
         $this->admin_msg(lang('160'));
     }
     $id = (int) $this->input->get('id');
     $did = (int) $this->input->get('did');
     $data = $this->content_model->get_extend($id);
     if (!$data) {
         $this->admin_msg(lang('019'));
     }
     $error = array();
     $result = '';
     if (IS_POST) {
         $_data = $data;
         $type = (int) $this->input->post('type');
         $_POST['data']['cid'] = $this->content['id'];
         $_POST['data']['uid'] = $this->content['uid'];
         $data = $this->validate_filter($this->field, $_data);
         if (isset($data['error'])) {
             $error = $data;
             $data = $this->input->post('data', TRUE);
         } else {
             $data[1]['cid'] = $this->content['id'];
             $data[1]['uid'] = $this->content['uid'];
             $data[1]['catid'] = $this->content['catid'];
             $data[1]['status'] = $_data['status'];
             $data[1]['author'] = $this->content['author'];
             // 保存为草稿
             if ($this->input->post('action') == 'draft') {
                 $data[1]['id'] = $data[0]['id'] = $id;
                 $id = $this->content_model->save_draft($did, $data, 1);
                 $this->attachment_handle($this->uid, $this->content_model->prefix . '_draft-' . $id, $this->field);
                 $this->admin_msg(lang('m-229'), dr_url(APP_DIR . '/home/draft/'), 1);
                 exit;
             }
             // 正常保存
             if ($id = $this->content_model->edit_extend($_data, $data)) {
                 // 发布草稿时删除草稿数据
                 if ($did && $this->content_model->delete_draft($did, 'cid=' . $this->content['id'] . ' and eid=' . $id)) {
                     $this->attachment_replace_draft($did, $this->content['id'], $id, $this->content_model->prefix);
                 }
                 $mark = $this->content_model->prefix . '-' . $this->content['id'] . '-' . $id;
                 // 操作成功处理附件
                 $this->attachment_handle($this->content['uid'], $mark, $this->field, $_data);
                 $this->admin_msg(lang('000') . (MODULE_HTML ? dr_module_create_show_file($this->content['id']) . dr_module_create_list_file($this->content['catid']) : ''), dr_url(APP_DIR . '/extend/index', array('cid' => $this->content['id'], 'catid' => (int) $_GET['catid'], 'type' => (int) $_GET['type'])), 1, 0);
             } else {
                 $error = array('error' => 'error');
             }
         }
     } else {
         if ($did) {
             $temp = $this->content_model->get_draft($did);
             if ($temp['draft']['cid'] == $this->content['id'] && $temp['draft']['eid'] == $id) {
                 $data = $temp;
             }
         }
     }
     $data['inputtime'] = SYS_TIME;
     $this->template->assign(array('did' => $did, 'data' => $data, 'error' => $error, 'result' => $result, 'draft_url' => SITE_URL . dr_url(APP_DIR . '/extend/edit', array('cid' => $this->content['id'], 'catid' => $this->catid, 'id' => $id)), 'draft_list' => $this->content_model->get_draft_list('cid=' . $this->content['id'] . ' and eid=' . $id), 'myfield' => $this->field_input($this->field, $data, TRUE)));
     $this->template->display('content_extend_add.html');
 }
 /**
  * 修改审核文档
  */
 public function edit()
 {
     $id = (int) $this->input->get('id');
     $data = $this->content_model->get_extend_verify($id);
     $error = array();
     if (!$data) {
         $this->admin_msg(lang('019'));
     }
     if (IS_POST) {
         $_data = $data;
         $this->content = $this->content_model->get($data['cid']);
         $_POST['data']['cid'] = $this->content['id'];
         $_POST['data']['uid'] = $this->content['uid'];
         $data = $this->validate_filter($this->field, $_data);
         if (isset($data['error'])) {
             $error = $data;
             $data = $this->input->post('data', TRUE);
         } else {
             $data[1]['cid'] = $this->content['id'];
             $data[1]['uid'] = $this->content['uid'];
             $data[1]['catid'] = $this->content['catid'];
             $data[1]['status'] = $_data['status'];
             $data[1]['author'] = $this->content['author'];
             if (isset($data[1]['mytype'])) {
                 $data[1]['mytype'] = $_data['mytype'];
             }
             $result = $this->_verify($id, $data, '`id`=' . $id);
             if (is_array($result)) {
                 $this->admin_msg(lang('000') . (MODULE_HTML ? dr_module_create_show_file($this->content['id']) . dr_module_create_list_file($this->content['catid']) : ''), $this->input->post('backurl'), 1, 0);
             } elseif ($result) {
                 $this->admin_msg($result);
             }
             $this->admin_msg(lang('000'), $this->input->post('backurl'), 1);
         }
     }
     if ($data['status'] == 0) {
         // 退回
         $backuri = APP_DIR . '/admin/verify/index/status/0';
     } elseif ($data['status'] > 0 && $data['status'] < 9) {
         $backuri = APP_DIR . '/admin/verify/index/status/' . $data['status'];
     } else {
         $backuri = APP_DIR . '/admin/verify/index/';
     }
     $this->template->assign(array('page' => max((int) $this->input->post('page'), 0), 'data' => $data, 'menu' => $this->get_menu(array(lang('back') => $backuri)), 'error' => $error, 'backurl' => $_SERVER['HTTP_REFERER'], 'myfield' => $this->field_input($this->field, $data, TRUE)));
     $this->template->display('content_extend_edit.html');
 }
示例#7
0
 /**
  * 修改
  */
 public function edit()
 {
     if (!$this->catrule['edit']) {
         $this->admin_msg(lang('160'));
     }
     $id = (int) $this->input->get('id');
     $data = $this->content_model->get_extend($id);
     if (!$data) {
         $this->admin_msg(lang('019'));
     }
     $error = array();
     $result = '';
     if (IS_POST) {
         $_data = $data;
         $type = (int) $this->input->post('type');
         $_POST['data']['cid'] = $this->content['id'];
         $_POST['data']['uid'] = $this->content['uid'];
         $data = $this->validate_filter($this->field, $_data);
         if (isset($data['error'])) {
             $error = $data;
             $data = $this->input->post('data', TRUE);
         } else {
             $data[1]['cid'] = $this->content['id'];
             $data[1]['uid'] = $this->content['uid'];
             $data[1]['catid'] = $this->content['catid'];
             $data[1]['status'] = $_data['status'];
             $data[1]['author'] = $this->content['author'];
             if ($id = $this->content_model->edit_extend($_data, $data)) {
                 $mark = $this->content_model->prefix . '-' . $this->content['id'] . '-' . $id;
                 // 操作成功处理附件
                 $this->attachment_handle($this->content['uid'], $mark, $this->field, $_data);
                 $this->admin_msg(lang('000') . (MODULE_HTML ? dr_module_create_show_file($this->content['id']) . dr_module_create_list_file($this->content['catid']) : ''), dr_url(APP_DIR . '/extend/index', array('cid' => $this->content['id'], 'catid' => (int) $_GET['catid'], 'type' => (int) $_GET['type'])), 1, 0);
             } else {
                 $error = array('error' => 'error');
             }
         }
     }
     $this->template->assign(array('data' => $data, 'error' => $error, 'result' => $result, 'myfield' => $this->field_input($this->field, $data, TRUE)));
     $this->template->display('content_extend_add.html');
 }
示例#8
0
 /**
  * 修改
  */
 public function edit()
 {
     if (!$this->catrule['edit']) {
         $this->member_msg(lang('160'));
     }
     $id = (int) $this->input->get('id');
     $data = $this->content_model->get_extend($id);
     if (!$data) {
         $this->member_msg(lang('019'));
     }
     $error = array();
     $result = '';
     if (IS_POST) {
         $_data = $data;
         $type = (int) $this->input->post('type');
         $_POST['data']['cid'] = $this->content['id'];
         $_POST['data']['uid'] = $this->content['uid'];
         $data = $this->validate_filter($this->field, $_data);
         if (isset($data['error'])) {
             $error = $data;
             $data = $this->input->post('data', TRUE);
         } else {
             $status = isset($data['status']) && $data['status'] ? 9 : ($this->module_rule[$this->content['catid']]['verify'] ? 1 : 9);
             $status = isset($this->module_rule[$this->content['catid']]['edit_verify']) && $this->module_rule[$this->content['catid']]['edit_verify'] ? 9 : $status;
             $data[1]['cid'] = $this->content['id'];
             $data[1]['uid'] = $this->content['uid'];
             $data[1]['catid'] = $this->content['catid'];
             $data[1]['status'] = $status;
             $data[1]['author'] = $this->content['author'];
             if ($id = $this->content_model->edit_extend($_data, $data)) {
                 if ($data[1]['status'] == 9) {
                     $mark = $this->content_model->prefix . '-' . $this->content['id'] . '-' . $id;
                     // 操作成功处理附件
                     $this->attachment_handle($this->content['uid'], $mark, $this->field, $_data);
                     if (IS_AJAX) {
                         exit(dr_json(1, lang('m-340'), dr_member_url(APP_DIR . '/extend/index', array('cid' => $this->content['id']))));
                     }
                     $this->template->assign(array('url' => SITE_URL . APP_DIR . '/index.php?c=extend&id=' . $id, 'add' => dr_member_url(APP_DIR . '/extend/add', array('cid' => $this->content['id'], 'type' => $data[1]['mytype'])), 'edit' => 1, 'html' => MODULE_HTML ? dr_module_create_show_file($this->content['id']) . dr_module_create_list_file($this->content['catid']) : '', 'list' => dr_member_url(APP_DIR . '/extend/index', array('cid' => $this->content['id'])), 'meta_name' => lang('mod-19')));
                     $this->template->display('success.html');
                 } else {
                     $this->attachment_handle($this->uid, $this->content_model->prefix . '_verify-' . $this->content['id'] . '-' . $id, $field);
                     if (IS_AJAX) {
                         exit(dr_json(1, lang('m-341'), dr_member_url(APP_DIR . '/everify/index')));
                     }
                     $this->template->assign(array('url' => dr_member_url(APP_DIR . '/everify/index'), 'add' => dr_member_url(APP_DIR . '/extend/add', array('cid' => $this->content['id'], 'type' => $data[1]['mytype'])), 'edit' => 0, 'list' => dr_member_url(APP_DIR . '/extend/index', array('cid' => $this->content['id'])), 'meta_name' => lang('mod-19')));
                     $this->template->display('verify.html');
                 }
                 exit;
             } else {
                 $error = array('error' => $id);
             }
         }
     }
     $this->template->assign(array('data' => $data, 'error' => $error, 'result' => $result, 'myfield' => $this->field_input($this->field, $data, TRUE), 'result_error' => $error));
     $this->template->display('content_extend_add.html');
 }