Example #1
0
 public function article_edit()
 {
     if (isset($_POST['dosubmit'])) {
         $_data_post = $this->input->post();
         $article_id = $this->input->post('article_id');
         $article['article_title'] = $this->input->post('article_title');
         $article['ac_id'] = $this->input->post('ac_id');
         $article['code_type'] = $this->input->post('code_type');
         $article['article_url'] = $this->input->post('article_url');
         $article['article_show'] = $this->input->post('article_show');
         $article['listorder'] = $this->input->post('article_sort');
         $article['article_content'] = $this->input->post('article_content');
         $article['article_time'] = time();
         if ($_FILES['acticle_logo']['error'] == 0) {
             /***保存图片***/
             $this->user_id = $this->session->userdata('admin_user_id');
             $this->load->library('iupload_lib');
             $config = array('module' => 'acticle_logo', 'dir' => 'acticle', 'shop_id' => 0, 'isadmin' => 1);
             $this->iupload_lib->initialize($config);
             //配置初始化文件
             $this->iupload_lib->do_uploadfile('acticle_logo');
             //上传附件
             $file_id = $this->iupload_lib->save_data();
             //保存数据到数据库
             if ($file_id == TRUE) {
                 $link_pic = $this->article->get_one(array('file_id' => $file_id), 'uploadfile', 'filepath');
                 $article['article_logo'] = $link_pic['filepath'];
                 $this->article->del(array('rel_id' => $article_id, 'shop_id' => 0, 'module' => 'article_logo'), 'uploadfile_rel');
                 $this->article->add(array('file_id' => $file_id, 'rel_id' => $article_id, 'shop_id' => 0, 'module' => 'article_logo'), 'uploadfile_rel');
             }
         }
         $this->article->update(array('article_id' => $article_id), $article);
         $file_ids = $this->input->post('file_id');
         if (!empty($file_ids)) {
             $this->article->del(array('rel_id' => $article_id, 'module' => 'article_content'), 'uploadfile_rel');
             foreach ($file_ids as $v) {
                 $this->article->add(array('file_id' => intval($v), 'rel_id' => $article_id, 'shop_id' => 0, 'module' => 'article_content'), 'uploadfile_rel');
             }
         }
         $this->showmessage('success', lang('com_edit'), $this->admin_url . 'content/help/lists?loghash=' . $this->session->userdata('loghash'));
     } else {
         $article_id = $this->input->get('article_id');
         $article_info = $this->article->get_one(array('article_id' => intval($article_id)), 'article');
         if (empty($article_info)) {
             $this->showmessage('error', lang('com_parameter'), HTTP_REFERER);
         }
         $ac_list = $this->article_category->get_query(array('ac_code' => 'help', 'order_by' => 'listorder desc'), 'article_category');
         foreach ($ac_list as $key => $val) {
             $ac_list[$key]['id'] = $val['ac_id'];
             $ac_list[$key]['name'] = $val['ac_name'];
         }
         $this->load->helper('tree');
         $ac_list = tr_sortdata($ac_list);
         $this->load->model('uploadfile');
         $file_rel_list = $this->article_category->get_query(array('rel_id' => $article_info['article_id'], 'module' => 'article_content'), 'uploadfile_rel');
         $file_list = array();
         if (!empty($file_rel_list)) {
             $ids = 0;
             foreach ($file_rel_list as $v) {
                 $ids .= ',' . $v['file_id'];
             }
             $file_list = $this->article_category->get_query('file_id in(' . $ids . ')', 'uploadfile');
         }
         $this->cismarty->assign('article', $article_info);
         $this->cismarty->assign('ac_list', $ac_list);
         $this->cismarty->assign('file_list', $file_list);
         $this->cismarty->display('content/help/help_edit.html');
     }
 }
Example #2
0
 public function public_map()
 {
     $this->load->model('a_system_model');
     $roleid = $this->session->userdata('admin_role_id');
     $list = $this->a_system_model->get_role_menu($roleid);
     $this->load->helper('tree');
     $list = tr_sortdata($list);
     $list0 = array();
     $i = 1;
     foreach ($list as $key => $val) {
         if ($val['parent_id'] == 0) {
             $val['i'] = $i;
             $i++;
         } else {
             $val['i'] = 0;
         }
         $list0[] = $val;
     }
     $this->cismarty->assign('list', $list0);
     $this->cismarty->display('map.html');
 }