用户
 找回密码
 入住 CI 中国社区
搜索
查看: 10586|回复: 26
收起左侧

[已解决] 求助..Fatal error: Call to a member function initialize() on a non-object in

  [复制链接]
发表于 2011-2-10 11:35:35 | 显示全部楼层 |阅读模式
A PHP Error was encountered

Severity: Notice

Message: Undefined property: News:pagination

Filename: controllers/news.php

Line Number: 28
---------------------------------------------------------------



class News extends Controller{
        function News(){
                parent::controller();
                $this->load->helper('url');
        }

        function index(){
                $this->load->model('news_model');
                $this->load->model('information_model');

                $this->config->load('bnlc_config');
                $count = $this->config->item('COUNT_LIST_NEWS');

                $this->load->library('pagination');

                $this->db->where('KBN','NS');
                $total_rows = $this->db->count_all_results('bnlc_user_data');

                $config['base_url'] = site_url('news/index');
                $config['total_rows'] = $total_rows;
                $config['per_page'] = $count;
                $config['uri_segment'] = 3;
                $config['count'] = $count;
                $config['link_name'] = 'NEWS TOP';
                $config['link_target'] = 'news';

                $this->pagination->initialize($config);

                $news = $this->news_model->list_limit_news($config['per_page'],$this->uri->segment(3));

                $ticket_info = $this->information_model->list_ticket_info();
                $pickup_event = $this->information_model->list_pickup_event();

                $data['info'] = array(
                        'news' => $news,
                        'ticket_info' => $ticket_info,
                        'pickup_event' => $pickup_event
                );

                $this->load->view('news/news_view', $data);
        }
发表于 2011-2-10 11:48:58 | 显示全部楼层
CI版本?
 楼主| 发表于 2011-2-10 11:55:42 | 显示全部楼层
我也怀疑,但是,这个项目开发完以后就没动过。。只是今天要修改一些东西,打开才发现这样的。
而且,model也是无法用。。要在autoload.php 里写$autoload['model'] = array('information_model','news_model'); 才能用。直接在controller里写$this->load->model('information_model');是不行的。。为什么啊
发表于 2011-2-10 13:38:14 | 显示全部楼层
parent::controller();
改成
parent::Controller();

试试
 楼主| 发表于 2011-2-10 14:18:26 | 显示全部楼层
回复 4# Hex
改成
parent::Controller();还是不行
但是我现在发现了另外一些问题,只要是$this->load->library('');的写在控制器里的都不行。
比如
$this->load->library('upload');
$this->load->library('pagination');
$this->load->model("")
.....
我把它们的位置改到构造函数里就可以了。。为什么
 楼主| 发表于 2011-2-10 14:19:46 | 显示全部楼层
还有,$this->load->library('upload');写在构造函数里。
但是controller里还是要写一次$this->load->library('upload',$config);
这样,$config的配置信息也失效了。。狂晕。。
发表于 2011-2-10 14:20:34 | 显示全部楼层
你可以把代码都发上来再看看。

你的代码如果写对了,不可能会这样,肯定是哪里你写错了,但你贴的代码没问题。
 楼主| 发表于 2011-2-10 14:26:13 | 显示全部楼层
<?php
class Event extends Controller{
        function Event(){
                parent::Controller();
                $this->load->helper('url');
                $this->load->helper('image');
                $this->load->library('DB_Session');
               
                $this->load->library('upload');
               
               
                $this->load->model('dashboard/event_model');
               
                $USER_STATUS = $this->db_session->userdata('USER_STATUS');
                if($USER_STATUS != 'LOGIN'){
                        redirect('dashboard/home/entry','location');
                }
        }

        function index(){
                $data['events_now'] = $this->event_model->list_events();
                $data['events_comingsoon'] = $this->event_model->list_events_comingsoon();
                $this->load->view('dashboard/list_events_view',$data);
        }
       
        function add_event(){
                $this->load->view('/dashboard/add_event_view');
        }
       
        function do_add_event(){
                $showInfoArr = array("KBN"=>'EV',"DATE_DISP"=>'',"PUBLISH_DATE_FROM"=>'',"PUBLISH_DATE_TO"=>'',"TITLE"=>'',"EXCERPT_TOP"=>'',"EV_DATE"=>'',"EV_OPEN_TIME"=>'',"EV_START_TIME"=>'',"EV_HALL"=>'',"EV_ACTOR"=>'',"EV_TICKET_MARKET"=>'',"EV_INQUIRY"=>'',"EV_CHARGE_SEAT"=>'',"EV_SPONSORING"=>'',"EV_BACKUP"=>'',"EV_DETAILS"=>'',"EV_COOPERATION"=>'',"EV_PROJECT_PRODUCT"=>'',"EV_DESCRIPTION"=>'',"EV_SCHEDULE_DATES"=>'',"BODY_T_INFO"=>'',"HE_EV_BAN_SEQ"=>'',"G_CAL_URL"=>'',"IMG_URL_HE_EV_BAN_L"=>'',"IMG_URL_HE_EV_BAN_S"=>'',"IMG_URL_TOP"=>'',"IMG_URL_P_EVENTS"=>'',"IMG_URL_DETAIL"=>'');
               
                $showInfoArr['DATE_DISP'] = $this->input->post('date_disp',true);
                $showInfoArr['PUBLISH_DATE_FROM'] = $this->input->post('publish_date_from',true);
                $showInfoArr['PUBLISH_DATE_TO'] = $this->input->post('publish_date_to',true);
                $showInfoArr['TITLE'] = $this->input->post('title',true);
                $showInfoArr['EXCERPT_TOP'] = $this->input->post('excerpt_top',true);
                $showInfoArr['BODY_T_INFO'] = $this->input->post('body_t_info',true);
                $showInfoArr['EV_DATE'] = $this->input->post('ev_date',true);
                $showInfoArr['EV_OPEN_TIME'] = $this->input->post('ev_open_time',true);
                $showInfoArr['EV_START_TIME'] = $this->input->post('ev_start_time',true);
                $showInfoArr['EV_HALL'] = $this->input->post('ev_hall',true);
                $showInfoArr['EV_ACTOR'] = $this->input->post('ev_actor',true);
                $showInfoArr['EV_TICKET_MARKET'] = $this->input->post('ev_ticket_market',true);
                $showInfoArr['EV_INQUIRY'] = $this->input->post('ev_inquiry',true);       
                $showInfoArr['EV_CHARGE_SEAT'] = $this->input->post('ev_charge_seat',true);
                $showInfoArr['EV_DETAILS'] = $this->input->post('ev_details',true);
                $showInfoArr['EV_SPONSORING'] = $this->input->post('ev_sponsoring',true);
                $showInfoArr['EV_BACKUP'] = $this->input->post('ev_backup',true);
                $showInfoArr['EV_COOPERATION'] = $this->input->post('ev_cooperation',true);
                $showInfoArr['EV_PROJECT_PRODUCT'] = $this->input->post('ev_project_product',true);
                $showInfoArr['EV_DESCRIPTION'] = $this->input->post('ev_description',true);
                $showInfoArr['EV_SCHEDULE_DATES'] = $this->input->post('ev_schedule_dates',true);
//                $showInfoArr['image_1'] = $this->input->post('images_1',true);
//                $showInfoArr['image_2'] = $this->input->post('images_2',true);
//                $showInfoArr['image_3'] = $this->input->post('images_3',true);
//                $showInfoArr['image_4'] = $this->input->post('images_4',true);
//                $showInfoArr['image_5'] = $this->input->post('images_5',true);

               
                if($showInfoArr['PUBLISH_DATE_FROM'] == '') $showInfoArr['PUBLISH_DATE_FROM'] = "1000-01-01";
                if($showInfoArr['PUBLISH_DATE_TO'] == '') $showInfoArr['PUBLISH_DATE_TO'] = "9999-12-31";
               
               
                $config['upload_path'] = './imageFile/';
                $config['allowed_types'] = 'gif|jpg|png';
               
                $config['max_width_0'] = '960';
                $config['max_height_0'] = '350';
                $config['max_width_1'] = '136';
                $config['max_height_1'] = '47';
                $config['max_width_2'] = '99';
                $config['max_height_2'] = '58';
                $config['max_width_3'] = '310';
                $config['max_height_3'] = '120';
                $config['max_width_4'] = '170';
                $config['max_height_4'] = '0';
               
                //$config['overwrite'] = 'FALSE';
                //$config['encrypt_name'] = 'false';
               
                $this->load->library('upload',$config);
               
                if(!$this->upload->do_upload()){
                        $error = array('error'=>$this->upload->display_errors(),'file_name'=>$this->upload->file_name);
                        $this->load->view('dashboard/handle_event_report_view',$error);
                        return;
                }else{
                                foreach($this->upload->file_msg as $k=>$v){
                                        if($k == 0) $showInfoArr['IMG_URL_HE_EV_BAN_L'] = 'imageFile/'.$v;
                                        else if($k == 1) $showInfoArr['IMG_URL_HE_EV_BAN_S'] = 'imageFile/'.$v;
                                        else if($k == 2) $showInfoArr['IMG_URL_TOP'] = 'imageFile/'.$v;
                                        else if($k == 3) $showInfoArr['IMG_URL_P_EVENTS'] = 'imageFile/'.$v;
                                        else if($k == 4) $showInfoArr['IMG_URL_DETAIL'] = 'imageFile/'.$v;
                                  }
                }
               
               
                //update imageFile/image.xml
                $new_content = '<?xml version="1.0" encoding="utf-8"?>'.chr(13).'<images>'.chr(13);
                $this->load->model('dashboard/event_model');
                $data = $this->event_model->list_event_banner();
                foreach($data as $row){
                        $line = '<image src="'.$row->IMG_URL_HE_EV_BAN_L.'" thumb_src="'.$row->IMG_URL_HE_EV_BAN_S.'" url="index.php/information/detail/'.$row->ROWID.'" date="'.str_replace('-','/',$row->PUBLISH_DATE_TO).'"/>';
                       
                        $new_content = $new_content.$line.chr(13);
                }
                $new_content = $new_content.'</images>';
               
                $curdir =  getcwd();
                $imgFile = $curdir.DIRECTORY_SEPARATOR.'imageFile'.DIRECTORY_SEPARATOR.'image.xml';
                if(file_exists($imgFile)){
                        $handle = fopen($imgFile,'w');
                        if(flock($handle,LOCK_EX)){
                                fwrite($handle, $new_content);
                                flock($handle,LOCK_UN);
                        }else{
                                echo "lock file failure..." ;
                        }
                        fclose($handle) ;
                }
               
               
                $this->load->model('dashboard/event_model');
                $this->event_model->insert_event($showInfoArr);
               
                //$success = array('success'=>"handle event successfully");
                //$this->load->view('dashboard/handle_event_report_view',$success);
                redirect('dashboard/event/');
        }
       
        /*function do_add_confirm(){
                $showInfoArr = array("date_disp"=>'',"publish_date_from"=>'',"publish_date_to"=>'',"title"=>'',"excerpt_top"=>'',"ev_date"=>'',"ev_open_time"=>'',"ev_start_time"=>'',"ev_hall"=>'',"ev_actor"=>'',"ev_ticket_market"=>'',"ev_inquiry"=>'',"ev_charge_seat"=>'',"ev_details"=>'',"ev_sponsoring"=>'',"ev_backup"=>'',"images_1"=>'',"images_2"=>'',"images_3"=>'',"images_4"=>'',"images_5"=>'');
                $showInfoArr['date_disp'] = $this->input->post('date_disp',true);
                $showInfoArr['publish_date_from'] = $this->input->post('publish_date_from',true);
                $showInfoArr['publish_date_to'] = $this->input->post('publish_date_to',true);
                $showInfoArr['title'] = $this->input->post('title',true);
                $showInfoArr['excerpt_top'] = $this->input->post('excerpt_top',true);
                $showInfoArr['ev_date'] = $this->input->post('ev_date',true);
                $showInfoArr['ev_open_time'] = $this->input->post('ev_open_time',true);
                $showInfoArr['ev_start_time'] = $this->input->post('ev_start_time',true);
                $showInfoArr['ev_hall'] = $this->input->post('ev_hall',true);
                $showInfoArr['ev_actor'] = $this->input->post('ev_actor',true);
                $showInfoArr['ev_ticket_market'] = $this->input->post('ev_ticket_market',true);
                $showInfoArr['ev_inquiry'] = $this->input->post('ev_inquiry',true);       
                $showInfoArr['ev_charge_seat'] = $this->input->post('ev_charge_seat',true);
                $showInfoArr['ev_details'] = $this->input->post('ev_details',true);
                $showInfoArr['ev_sponsoring'] = $this->input->post('ev_sponsoring',true);
                $showInfoArr['ev_backup'] = $this->input->post('ev_backup',true);
                $showInfoArr['image_1'] = $this->input->post('images_1',true);
                $showInfoArr['image_2'] = $this->input->post('images_2',true);
                $showInfoArr['image_3'] = $this->input->post('images_3',true);
                $showInfoArr['image_4'] = $this->input->post('images_4',true);
                $showInfoArr['image_5'] = $this->input->post('images_5',true);
               
                $uploaddir = "./tmpFile/";
                $imageDir = "./imageFile/";
                $p = 1;
                foreach ($_FILES["pictures"]["error"] as $key => $error) {
                   if ($error == UPLOAD_ERR_OK) {
                     
                       move_uploaded_file($_FILES["pictures"]["tmp_name"][$key], $uploaddir.$_FILES["pictures"]["name"][$key]) or die("Problems with upload");
                       
                             
                             
                              $imageType = get_image_type($uploaddir.$_FILES["pictures"]["name"][$key]);
                              if($imageType != "false"){
                                       $dateTime = date("ymd-His");
                                       if(rename($uploaddir.$_FILES["pictures"]["name"][$key],$imageDir.$dateTime.".".$imageType)){
                                               $showInfoArr['image_'.$p] = $imageDir."/".$dateTime.".".$imageType;
                                       }
                       }
                       $p++;
                   }
                   sleep(1);
                }
               
               
                $this->load->view('dashboard/add_event_confirm_view',$showInfoArr);
        }*/
        function update_event(){
                $id = $this->uri->segment(4);
               
                $this->load->model('dashboard/event_model');
                $event = $this->event_model->list_event_by_id($id);
               
                /*$DATE_DISP = $event->DATE_DISP;
                $PUBLISH_DATE_FROM = $event->PUBLISH_DATE_FROM;
                $PUBLISH_DATE_TO = $event->PUBLISH_DATE_TO;
                $TITLE = $event->TITLE;
                $EXCERPT_TOP = $event->EXCERPT_TOP;
                $EV_DATE = $event->EV_DATE;
                $EV_OPEN_TIME = $event->EV_OPEN_TIME;
                $EV_START_TIME = $event->EV_START_TIME;
                $EV_HALL = $event->EV_HALL;
                $EV_ACTOR = $event->EV_ACTOR;
                $EV_TICKET_MARKET = $event->EV_TICKET_MARKET;
                $EV_INQUIRY = $event->EV_INQUIRY;
                $EV_CHARGE_SEAT = $event->EV_CHARGE_SEAT;
               
                $EV_SPONSORING = $event->EV_SPONSORING;
                $EV_BACKUP = $event->EV_BACKUP;
                $EV_DETAILS = $event->EV_DETAILS;
                $EV_COOPERATION = $event->EV_COOPERATION;
                $EV_PROJECT_PRODUCT = $event->EV_PROJECT_PRODUCT;
                $EV_DESCRIPTION = $event->EV_DESCRIPTION;
                $FLG_T_INFO = $event->FLG_T_INFO;
                $BODY_T_INFO = $event->BODY_T_INFO;
                $IMG_URL_HE_EV_BAN_L = $event->IMG_URL_HE_EV_BAN_L;
                $IMG_URL_HE_EV_BAN_S = $event->IMG_URL_HE_EV_BAN_S;
                $HE_EV_BAN_SEQ = $event->HE_EV_BAN_SEQ;
                $IMG_URL_TOP = $event->IMG_URL_TOP;
                $FLG_P_EVENTS = $event->FLG_P_EVENTS;
               
                $IMG_URL_P_EVENTS = $event->IMG_URL_P_EVENTS;
                $IMG_URL_DETAIL = $event->IMG_URL_DETAIL;
                $G_CAL_URL = $event->G_CAL_URL;
                $FLG_RESERVE = $event->FLG_RESERVE;*/
               
               
                $this->load->view('dashboard/update_event_view',$event);
        }
       
       
        function do_update_event(){
                //$showInfoArr = array("URL"=>'',"DATE_DISP"=>'',"PUBLISH_DATE_FROM"=>'2010-09-08 12:00:00',"PUBLISH_DATE_TO"=>'2010-09-09 12:00:00',"TITLE"=>'',"EXCERPT_TOP"=>'',"EV_DATE"=>'',"EV_OPEN_TIME"=>'',"EV_START_TIME"=>'',"EV_HALL"=>'',"EV_ACTOR"=>'',"EV_TICKET_MARKET"=>'',"EV_INQUIRY"=>'',"EV_CHARGE_SEAT"=>'',"EV_SPONSORING"=>'',"EV_BACKUP"=>'',"EV_DETAILS"=>'',"EV_COOPERATION"=>'',"EV_PROJECT_PRODUCT"=>'',"EV_DESCRIPTION"=>'',"BODY_T_INFO"=>'',"HE_EV_BAN_SEQ"=>'',"G_CAL_URL"=>'',"IMG_URL_HE_EV_BAN_L"=>'',"IMG_URL_HE_EV_BAN_S"=>'',"IMG_URL_TOP"=>'',"IMG_URL_P_EVENTS"=>'',"IMG_URL_DETAIL"=>'');
               
                $id = $this->input->post('eid',true);
                $showInfoArr = array();
               
               
                $showInfoArr['DATE_DISP'] = $this->input->post('date_disp',true);
                $showInfoArr['PUBLISH_DATE_FROM'] = $this->input->post('publish_date_from',true);
                $showInfoArr['PUBLISH_DATE_TO'] = $this->input->post('publish_date_to',true);
                $showInfoArr['TITLE'] = $this->input->post('title',true);
                $showInfoArr['EXCERPT_TOP'] = $this->input->post('excerpt_top',true);
                $showInfoArr['BODY_T_INFO'] = $this->input->post('body_t_info',true);
                $showInfoArr['EV_DATE'] = $this->input->post('ev_date',true);
                $showInfoArr['EV_OPEN_TIME'] = $this->input->post('ev_open_time',true);
                $showInfoArr['EV_START_TIME'] = $this->input->post('ev_start_time',true);
                $showInfoArr['EV_HALL'] = $this->input->post('ev_hall',true);
                $showInfoArr['EV_ACTOR'] = $this->input->post('ev_actor',true);
                $showInfoArr['EV_TICKET_MARKET'] = $this->input->post('ev_ticket_market',true);
                $showInfoArr['EV_INQUIRY'] = $this->input->post('ev_inquiry',true);       
                $showInfoArr['EV_CHARGE_SEAT'] = $this->input->post('ev_charge_seat',true);
                $showInfoArr['EV_DETAILS'] = $this->input->post('ev_details',true);
                $showInfoArr['EV_SPONSORING'] = $this->input->post('ev_sponsoring',true);
                $showInfoArr['EV_BACKUP'] = $this->input->post('ev_backup',true);
                $showInfoArr['EV_COOPERATION'] = $this->input->post('ev_cooperation',true);
                $showInfoArr['EV_PROJECT_PRODUCT'] = $this->input->post('ev_project_product',true);
                $showInfoArr['EV_DESCRIPTION'] = $this->input->post('ev_description',true);
                $showInfoArr['EV_SCHEDULE_DATES'] = $this->input->post('ev_schedule_dates',true);
               
                if(trim($showInfoArr['BODY_T_INFO']) == '') $showInfoArr['FLG_T_INFO'] = "0";
               
               
                if($showInfoArr['PUBLISH_DATE_FROM'] == '') $showInfoArr['PUBLISH_DATE_FROM'] = "1000-01-01";
                if($showInfoArr['PUBLISH_DATE_TO'] == '') $showInfoArr['PUBLISH_DATE_TO'] = "9999-12-31";
               
                $delimage_1 = $this->input->post('delimage_1',true);
                $delimage_2 = $this->input->post('delimage_2',true);
                $delimage_3 = $this->input->post('delimage_3',true);
                $delimage_4 = $this->input->post('delimage_4',true);
                $delimage_5 = $this->input->post('delimage_5',true);
               
               
                $config['upload_path'] = './imageFile/';
                $config['allowed_types'] = 'gif|jpg|png';
               
                $config['max_width_0'] = '960';
                $config['max_height_0'] = '350';
                $config['max_width_1'] = '136';
                $config['max_height_1'] = '47';
                $config['max_width_2'] = '99';
                $config['max_height_2'] = '58';
                $config['max_width_3'] = '310';
                $config['max_height_3'] = '120';
                $config['max_width_4'] = '170';
                $config['max_height_4'] = '0';
               
                $this->load->library('upload',$config);
               
                if(!$this->upload->do_upload()){
                       
                        $error = array('error'=>$this->upload->display_errors(),'file_name'=>$this->upload->file_name);
                        $this->load->view('dashboard/handle_event_report_view',$error);
                        return;
                }else{
                                foreach($this->upload->file_msg as $k=>$v){
                                        if($k == 0) $showInfoArr['IMG_URL_HE_EV_BAN_L'] = 'imageFile/'.$v;
                                        else if($k == 1) $showInfoArr['IMG_URL_HE_EV_BAN_S'] = 'imageFile/'.$v;
                                        else if($k == 2) $showInfoArr['IMG_URL_TOP'] = 'imageFile/'.$v;
                                        else if($k == 3) $showInfoArr['IMG_URL_P_EVENTS'] = 'imageFile/'.$v;
                                        else if($k == 4) $showInfoArr['IMG_URL_DETAIL'] = 'imageFile/'.$v;
                                  }
                }
               
                if(file_exists('./'.$delimage_1) && is_file('./'.$delimage_1)) {unlink('./'.$delimage_1);if(array_key_exists('IMG_URL_HE_EV_BAN_L',$showInfoArr)) ;else{$showInfoArr['IMG_URL_HE_EV_BAN_L'] = '';}}
                if(file_exists('./'.$delimage_2) && is_file('./'.$delimage_2)) {unlink('./'.$delimage_2);if(array_key_exists('IMG_URL_HE_EV_BAN_S',$showInfoArr)) ;else{$showInfoArr['IMG_URL_HE_EV_BAN_S'] = '';}}
                if(file_exists('./'.$delimage_3) && is_file('./'.$delimage_3)) {unlink('./'.$delimage_3);if(array_key_exists('IMG_URL_TOP',$showInfoArr)) ;else{$showInfoArr['IMG_URL_TOP'] = '';}}
                if(file_exists('./'.$delimage_4) && is_file('./'.$delimage_4)) {unlink('./'.$delimage_4);if(array_key_exists('IMG_URL_P_EVENTS',$showInfoArr)) ;else{$showInfoArr['IMG_URL_P_EVENTS'] = '';$showInfoArr['FLG_P_EVENTS'] = '0';}}
                if(file_exists('./'.$delimage_5) && is_file('./'.$delimage_5)) {unlink('./'.$delimage_5);if(array_key_exists('IMG_URL_DETAIL',$showInfoArr)) ;else{$showInfoArr['IMG_URL_DETAIL'] = '';}}
               
                $this->load->model('dashboard/event_model');
                $status = $this->event_model->update_event_by_id($id,$showInfoArr);
               
                //update imageFile/image.xml
                $new_content = '<?xml version="1.0" encoding="utf-8"?>'.chr(13).'<images>'.chr(13);
                $data = $this->event_model->list_event_banner();
                foreach($data as $row){
                        $line = '<image src="'.$row->IMG_URL_HE_EV_BAN_L.'" thumb_src="'.$row->IMG_URL_HE_EV_BAN_S.'" url="index.php/information/detail/'.$row->ROWID.'" date="'.str_replace('-','/',$row->PUBLISH_DATE_TO).'"/>';
                       
                        $new_content = $new_content.$line.chr(13);
                }
                $new_content = $new_content.'</images>';
               
                $curdir =  getcwd();
                $imgFile = $curdir.DIRECTORY_SEPARATOR.'imageFile'.DIRECTORY_SEPARATOR.'image.xml';
                if(file_exists($imgFile)){
                        $handle = fopen($imgFile,'w');
                        if(flock($handle,LOCK_EX)){
                                fwrite($handle, $new_content);
                                flock($handle,LOCK_UN);
                        }else{
                                echo "lock file failure..." ;
                        }
                        fclose($handle) ;
                }
               
                //$success = array('success'=>"update event successfully");
                //$this->load->view('dashboard/handle_event_report_view',$success);
                redirect('dashboard/event/');
                       
        }
       
       
        function delete_event(){
                $id = $this->uri->segment(4);
                if(is_numeric($id)){
                        $this->load->model('dashboard/event_model');
                        $r = $this->event_model->delete_event_by_id($id);
                        $info = array();
                        if($r){
                                redirect('dashboard/event/');
                        }else{
                                $this->load->view('dashboard/handle_event_report_view',array('info'=>'delete event failure'));
                        }
                }
        }
       
       
        function set_event_pickup(){
                $this->load->model('dashboard/event_model');
               
               
                $after_from_and_before_to_1 = $this->event_model->list_event_pickup_by_condition(1);
                $after_from_and_before_to_2 = $this->event_model->list_event_pickup_by_condition(0);
                $before_from = $this->event_model->list_event_pickup_comingsoon();
               
               
                $data['info'] = array(
                        'after_from_and_before_to_1' => $after_from_and_before_to_1,
                        'after_from_and_before_to_2' => $after_from_and_before_to_2,
                        'before_from' => $before_from
                );
                $this->load->view('dashboard/set_event_pickup_view',$data);
        }
       
        function update_flg_p_events(){
                $id_arr = $this->input->post('flg_p_events',true);
                $flg_p_events_on = array('FLG_P_EVENTS' => 1);
                $flg_p_events_off = array('FLG_P_EVENTS' => 0);
               
                $this->load->model('dashboard/event_model');
                if($id_arr){//var_dump($id_arr);
                        $this->event_model->set_flg_p_events_on_by_id($id_arr,$flg_p_events_on);
                        $this->event_model->set_flg_p_events_off_by_id($id_arr,$flg_p_events_off);
                }else{
                        $this->event_model->set_flg_p_events_off($flg_p_events_off);
                }
               
                //update imageFile/image.xml
                $new_content = '<?xml version="1.0" encoding="utf-8"?>'.chr(13).'<images>'.chr(13);
                $data = $this->event_model->list_event_banner();
                foreach($data as $row){
                        $line = '<image src="'.$row->IMG_URL_HE_EV_BAN_L.'" thumb_src="'.$row->IMG_URL_HE_EV_BAN_S.'" url="index.php/information/detail/'.$row->ROWID.'" date="'.str_replace('-','/',$row->PUBLISH_DATE_TO).'"/>';
                       
                        $new_content = $new_content.$line.chr(13);
                }
                $new_content = $new_content.'</images>';
               
                $curdir =  getcwd();
                $imgFile = $curdir.DIRECTORY_SEPARATOR.'imageFile'.DIRECTORY_SEPARATOR.'image.xml';
                if(file_exists($imgFile)){
                        $handle = fopen($imgFile,'w');
                        if(flock($handle,LOCK_EX)){
                                fwrite($handle, $new_content);
                                flock($handle,LOCK_UN);
                        }else{
                                echo "lock file failure..." ;
                        }
                        fclose($handle) ;
                }
               
               
                redirect('dashboard/event/set_event_pickup');
        }
       

        function set_event_banner(){
                $this->load->model('dashboard/event_model');

                $after_from_and_before_to_1 = $this->event_model->list_event_banner_by_condition('1');
                $after_from_and_before_to_2 = $this->event_model->list_event_banner_by_condition('0');
                $before_from = $this->event_model->list_event_banner_comingsoon();

                $data['info'] = array(
                        'after_from_and_before_to_1' => $after_from_and_before_to_1,
                        'after_from_and_before_to_2' => $after_from_and_before_to_2,
                        'before_from' => $before_from
                );

                $this->load->view('dashboard/set_event_banner_view',$data);
        }
       
       
        function update_event_banner(){
                $he_ev_ban_seq = $this->input->post('he_ev_ban_seq',true);
                $ids = $this->input->post('ids',true);
               
                $this->load->model('dashboard/event_model');
               
                //update table bnlc_user_data (field:he_ev_ban_seq)
                $this->event_model->update_event_banner($ids,$he_ev_ban_seq);
               
               
                //update imageFile/image.xml
                $new_content = '<?xml version="1.0" encoding="utf-8"?>'.chr(13).'<images>'.chr(13);
                $data = $this->event_model->list_event_banner();
                foreach($data as $row){
                        $line = '<image src="'.$row->IMG_URL_HE_EV_BAN_L.'" thumb_src="'.$row->IMG_URL_HE_EV_BAN_S.'" url="index.php/information/detail/'.$row->ROWID.'" date="'.str_replace('-','/',$row->PUBLISH_DATE_TO).'"/>';
                       
                        $new_content = $new_content.$line.chr(13);
                }
                $new_content = $new_content.'</images>';
               
                $curdir =  getcwd();
                $imgFile = $curdir.DIRECTORY_SEPARATOR.'imageFile'.DIRECTORY_SEPARATOR.'image.xml';
                if(file_exists($imgFile)){
                        $handle = fopen($imgFile,'w');
                        if(flock($handle,LOCK_EX)){
                                fwrite($handle, $new_content);
                                flock($handle,LOCK_UN);
                        }else{
                                echo "lock file failure..." ;
                        }
                        fclose($handle) ;
                }
               
               
                redirect('dashboard/event/set_event_banner');
        }


        function set_event_ticket(){
                $this->load->model('dashboard/event_model');
               
                $after_from_and_before_to_1 = $this->event_model->list_ticket_info_by_condition('1');
                $after_from_and_before_to_2 = $this->event_model->list_ticket_info_by_condition('0');
                $before_from = $this->event_model->list_ticket_info_comingsoon();
               
               
                $data['info'] = array(
                        'after_from_and_before_to_1' => $after_from_and_before_to_1,
                        'after_from_and_before_to_2' => $after_from_and_before_to_2,
                        'before_from' => $before_from
                );
               
                $this->load->view('dashboard/set_event_ticket_view',$data);
        }

       
        function update_flg_t_info(){
                $id_arr = $this->input->post('flg_t_infos',true);
                $flg_t_info_on = array('FLG_T_INFO' => 1);
                $flg_t_info_off = array('FLG_T_INFO' => 0);
               
                $this->load->model('dashboard/event_model');
                if($id_arr){//var_dump($id_arr);
                        $this->event_model->set_flg_t_info_on_by_id($id_arr,$flg_t_info_on);
                        $this->event_model->set_flg_t_info_off_by_id($id_arr,$flg_t_info_off);
                }else{
                        $this->event_model->set_flg_t_info_off($flg_t_info_off);
                }
               
               
                //update imageFile/image.xml
                $new_content = '<?xml version="1.0" encoding="utf-8"?>'.chr(13).'<images>'.chr(13);
                $data = $this->event_model->list_event_banner();
                foreach($data as $row){
                        $line = '<image src="'.$row->IMG_URL_HE_EV_BAN_L.'" thumb_src="'.$row->IMG_URL_HE_EV_BAN_S.'" url="index.php/information/detail/'.$row->ROWID.'" date="'.str_replace('-','/',$row->PUBLISH_DATE_TO).'"/>';
                       
                        $new_content = $new_content.$line.chr(13);
                }
                $new_content = $new_content.'</images>';
               
                $curdir =  getcwd();
                $imgFile = $curdir.DIRECTORY_SEPARATOR.'imageFile'.DIRECTORY_SEPARATOR.'image.xml';
                if(file_exists($imgFile)){
                        $handle = fopen($imgFile,'w');
                        if(flock($handle,LOCK_EX)){
                                fwrite($handle, $new_content);
                                flock($handle,LOCK_UN);
                        }else{
                                echo "lock file failure..." ;
                        }
                        fclose($handle) ;
                }
               
               
                redirect('dashboard/event/set_event_ticket');
        }

        function list_events_nearly(){
                $this->load->model('dashboard/event_model');
                $data['after_from_and_before_expired'] = $this->event_model->list_record_today_is_after_from_and_before_expired();
               
                $this->load->view('dashboard/list_events_nearly_view',$data);
        }


        function list_events_expired(){
                $this->load->model('dashboard/event_model');
                $data['after_to'] = $this->event_model->list_record_today_is_after_to();
                $this->load->view('dashboard/list_events_expired_view',$data);
        }
}
 楼主| 发表于 2011-2-10 14:28:05 | 显示全部楼层
以上代码,我输出library/upload.php里输出看了一下,结果upload_path为空,
 楼主| 发表于 2011-2-10 14:29:55 | 显示全部楼层
class Information extends Controller{
        function Information(){
                parent::controller();
                $this->load->helper('url');
               
                $this->load->model('information_model');
               
                $this->load->library('pagination');
        }

        function index(){
               
               
                $this->config->load('bnlc_config');
                $count = $this->config->item('COUNT_LIST_EVENTS');
               
               
                       
                $this->db->where('KBN','EV');
                $this->db->where('((PUBLISH_DATE_FROM = "1000-01-01" and PUBLISH_DATE_TO = "9999-12-31") or (PUBLISH_DATE_FROM != "1000-01-01" and PUBLISH_DATE_FROM <= curdate() and PUBLISH_DATE_TO = "9999-12-31") or (PUBLISH_DATE_FROM = "1000-01-01" and PUBLISH_DATE_TO != "9999-12-31" and curdate() <= PUBLISH_DATE_TO) or (PUBLISH_DATE_FROM != "1000-01-01" and PUBLISH_DATE_FROM <= curdate() and PUBLISH_DATE_TO != "9999-12-31" and curdate() <= PUBLISH_DATE_TO))');
                $total_rows = $this->db->count_all_results('bnlc_user_data');
               
                $config['base_url'] = site_url('information/index');
                $config['total_rows'] = $total_rows;
                $config['per_page'] = $count;
                $config['uri_segment'] = 3;
                $config['count'] = $count;
                $config['link_name'] = 'INFORMATION TOP';
                $config['link_target'] = 'information';
               
                $this->pagination->initialize($config);
               
               
                //$event = $this->information_model->list_events('COUNT_LIST_EVENTS');
                $event = $this->information_model->list_limit_events($config['per_page'],$this->uri->segment(3));
                $ticket_info = $this->information_model->list_ticket_info();
                $pickup_event = $this->information_model->list_pickup_event();
               
               
                $data['info'] = array(
                        'event' => $event,
                        'ticket_info' => $ticket_info,
                        'pickup_event' => $pickup_event
                );
               
               
               
                $this->load->view('information/information_view',$data);
        }



$this->load->model('information_model');
$this->load->library('pagination');
这2 句放在function Information()  里没问题。要是放在function index()就出错

本版积分规则