예제 #1
0
 function editEvent()
 {
     $id = (int) $this->Get['id'];
     load::logic('event');
     $EventLogic = new EventLogic();
     $postman = $EventLogic->get_postman($id);
     if ($postman != MEMBER_ID) {
         $this->Messager("你无权修改该活动");
     }
     $free = 'checked';
     $all = 'checked';
     $info = array();
     $info = jconf::get('profileeventinfo');
     $val = array();
     if ($id) {
         $act = "edit";
         $val = $EventLogic->get_event_info($id);
         $item_id = $val['item_id'];
         $title = $val['title'];
         $moneys = $val['money'];
         $content = $val['content'];
         $address = $val['address'];
         if ($val['image']) {
             $image = $val['image'];
         }
         $edit_fromt = date("Y-m-d", $val['fromt']);
         $edit_fromt_h = date("H", $val['fromt']);
         $edit_fromt_i = date("i", $val['fromt']);
         $edit_tot = date("Y-m-d", $val['tot']);
         $edit_tot_h = date("H", $val['tot']);
         $edit_tot_i = date("i", $val['tot']);
         if ($val['money']) {
             $money = 'checked';
             $free = '';
         } else {
             $money = '';
             $free = 'checked';
         }
         $qualification = unserialize($val['qualification']);
         if (count($qualification)) {
             $qua = "checked";
             $all = "";
             if ($qualification['fans_num']) {
                 $fans = "checked";
                 $fans_num = $qualification['fans_num'];
             }
             if ($qualification['same_city']) {
                 $same_city = "checked";
             }
             if ($qualification['inqun']) {
                 $inqun = " checked ";
             }
         }
         $need_app_info = unserialize($val['need_app_info']);
         if (count($need_app_info)) {
             foreach ($need_app_info as $value) {
                 $info[$value]['checked'] = "checked";
             }
         }
     }
     $rs = $EventLogic->get_event_type(TRUE);
     $event_type = jform()->Select("type", $rs, $val['type_id']);
     $province = $EventLogic->get_province();
     $province_id = $val['province_id'];
     $hid_province = $province_id;
     $province_list = jform()->Select("province", $province, $province_id, "onchange=\"changeProvince();\"");
     $city_id = $val['city_id'];
     $hid_city = $city_id;
     $area_id = $val['area_id'];
     $hid_area = $area_id;
     $fromt = $edit_fromt ? $edit_fromt : my_date_format(TIMESTAMP, 'Y-m-d');
     $edit_fromt_h = $edit_fromt_h ? $edit_fromt_h : false;
     $edit_fromt_i = $edit_fromt_i ? $edit_fromt_i : false;
     $hour_select_from = mk_time_select('hour', $edit_fromt_h, 'hour_select_from');
     $min_select_from = mk_time_select('min', $edit_fromt_i, 'min_select_from');
     $tot = $edit_tot ? $edit_tot : my_date_format(TIMESTAMP + 7 * 24 * 3600, 'Y-m-d');
     $edit_tot_h = $edit_tot_h ? $edit_tot_h : false;
     $edit_tot_i = $edit_tot_i ? $edit_tot_i : false;
     $hour_select_to = mk_time_select('hour', $edit_tot_h, 'hour_select_to');
     $min_select_to = mk_time_select('min', $edit_tot_i, 'min_select_to');
     $member = $this->Member;
     $this->Title = "修改活动";
     include template('event/event_create');
 }
예제 #2
0
 function eventPost()
 {
     $is_allowed = '';
     if (MEMBER_ID < 1) {
         $is_allowed = "请先登录或者注册一个帐号";
     }
     if (MEMBER_ROLE_TYPE != 'admin' && !$is_allowed) {
         load::logic('event');
         $EventLogic = new EventLogic();
         $is_allowed = $EventLogic->allowedCreate(MEMBER_ID, $this->Member);
     }
     if ($is_allowed) {
         exit($is_allowed);
     }
     $item = $this->Get['item'];
     $item_id = $this->Get['item_id'];
     $top = 'top';
     $free = 'checked';
     $all = 'checked';
     $info = array();
     $info = jconf::get('profileeventinfo');
     $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "event_sort order by id");
     while ($rsdb = $query->GetRow()) {
         $rs[$rsdb[id]]['value'] = $rsdb['id'];
         $rs[$rsdb[id]]['name'] = $rsdb['type'];
     }
     $event_type = jform()->Select("type", $rs);
     if ($this->Member['province']) {
         $province_id = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '" . $this->Member['province'] . "' and `upid` = '0'");
     } else {
         $province_id = DB::result_first("select id from " . TABLE_PREFIX . "common_district where `upid` = '0' order by list");
     }
     $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "common_district where `upid` = '0' order by list");
     while ($rsdb = $query->GetRow()) {
         $province[$rsdb['id']]['value'] = $rsdb['id'];
         $province[$rsdb['id']]['name'] = $rsdb['name'];
     }
     $hid_province = $province_id;
     $province_list = jform()->Select("province", $province, $province_id, "onchange=\"changeProvince();\"");
     if ($this->Member['city']) {
         $city_id = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '" . $this->Member['city'] . "' and upid = '{$province_id}'");
         $where_city = " and upid = '{$city_id}' ";
     }
     $hid_city = $city_id;
     if ($this->Member['area']) {
         $area_id = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '" . $this->Member['area'] . "' {$where_city}");
     }
     $hid_area = $area_id;
     $fromt = my_date_format(TIMESTAMP, 'Y-m-d');
     $hour_select_from = mk_time_select('hour', false, 'hour_select_from');
     $min_select_from = mk_time_select('min', false, 'min_select_from');
     $tot = my_date_format(TIMESTAMP + 7 * 24 * 3600, 'Y-m-d');
     $hour_select_to = mk_time_select('hour', false, 'hour_select_to');
     $min_select_to = mk_time_select('min', false, 'min_select_to');
     include template('event/event_options');
 }
예제 #3
0
 function get_publish_form_param($dateline = '')
 {
     if (empty($dateline)) {
         $expiration = my_date_format(TIMESTAMP + 7 * 24 * 3600, 'Y-m-d');
         $hour_select = mk_time_select();
         $min_select = mk_time_select('min');
     } else {
         $expiration = my_date_format($dateline, 'Y-m-d ');
         $hour_select = mk_time_select('hour', my_date_format($dateline, 'H'));
         $min_select = mk_time_select('min', my_date_format($dateline, 'i'));
     }
     return array('expiration' => $expiration, 'hour_select' => $hour_select, 'min_select' => $min_select);
 }
예제 #4
0
 function edit()
 {
     $vid = empty($this->Get['vid']) ? 0 : intval($this->Get['vid']);
     $vote = $this->VoteLogic->id2voteinfo($vid);
     if (empty($vote)) {
         $this->Messager("当前投票不存在");
     }
     $opt_info = $this->VoteLogic->get_option_by_vid($vid);
     $options = $opt_info['option'];
     $max_range_num = count($options) > 40 ? 50 : count($options) + 9;
     $range = range(0, $max_range_num);
     $checked = array();
     $checked['is_view'][$vote['is_view']] = 'checked="checked"';
     $checked['recd'] = $vote['recd'] ? 'checked="checked"' : '';
     $selected[$vote['maxchoice']] = 'selected="selected"';
     $date = my_date_format($vote['expiration'], 'Y-m-d');
     $hour_select = mk_time_select('hour', my_date_format($vote['expiration'], 'H'));
     $min_select = mk_time_select('min', my_date_format($vote['expiration'], 'i'));
     include template('admin/vote_edit');
 }
예제 #5
0
 function manage()
 {
     $tab = 'word';
     $op = empty($this->Get['op']) ? '' : $this->Get['op'];
     if (empty($op)) {
         exit;
     }
     $vid = empty($this->Get['vid']) ? 0 : intval($this->Get['vid']);
     $vote = $this->VoteLogic->id2voteinfo($vid, 'm');
     if ($vote['tab']) {
         $tab = 'pic';
     }
     if (empty($vote) || $vote['verify'] == 0) {
         json_error('当前投票不存在或正在审核中');
     }
     if (jdisallow($vote['uid'])) {
         json_error("你没有权限");
     }
     if ($op == 'modify_date') {
         $exp_info = $this->VoteLogic->get_publish_form_param($vote['expiration']);
         extract($exp_info);
     } else {
         if ($op == 'edit_opt') {
             $info = $this->VoteLogic->get_option_by_vid($vid);
             $options = $info['option'];
             $option_num = count($info['option']);
             if (MEMBER_ROLE_TYPE != 'admin') {
                 $is_voted = $this->VoteLogic->get_count_vote_user($vid);
             }
         } else {
             if ($op == 'edit') {
                 $max_option = 50;
                 $this->Get['arf'] = "edit";
                 $opt_info = $this->VoteLogic->get_option_by_vid($vid);
                 $opts = $opt_info['option'];
                 $vote['message'] = $this->VoteLogic->get_vote_field_message($vid);
                 $options_num = count($opts);
                 $maxchoice = array();
                 if ($options_num > 1) {
                     $maxchoice = range(1, $options_num);
                 }
                 $perpage = ceil($options_num / 5) * 5;
                 $options = range(1, $perpage);
                 for ($i = $options_num; $i < $perpage; $i++) {
                     $opts[$i]['picurl'] = 'images/none.png';
                 }
                 $is_voted = $this->VoteLogic->get_count_vote_user($vid);
                 $checked = array();
                 $checked['is_view'][$vote['is_view']] = 'checked="checked"';
                 $checked['recd'] = $vote['recd'] ? 'checked="checked"' : '';
                 $selected[$vote['maxchoice']] = 'selected="selected"';
                 $expiration = my_date_format($vote['expiration'], 'Y-m-d');
                 $hour_select = mk_time_select('hour', my_date_format($vote['expiration'], 'H'));
                 $min_select = mk_time_select('min', my_date_format($vote['expiration'], 'i'));
                 include template('vote/vote_edit');
                 exit;
             }
         }
     }
     include template('vote/vote_manage');
 }