Beispiel #1
0
 public static function &get_instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Beispiel #2
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     $params = $req->get_parameters();
     if (!isset($params['bookmark_name'])) {
         $status = "process";
         $book_value = $_SERVER['QUERY_STRING'];
         $req->set_attribute('book_value', $book_value);
     } else {
         $input_arr = array();
         $input_arr['user'] = $req->get_username();
         $input_arr['name'] = trim($params['bookmark_name']);
         $input_arr['type'] = "2";
         $input_arr['value'] = $params['bookmark_value'];
         $id = Bll_BookmarkBiz::get_instance()->insert_condition($input_arr);
         $status = "success";
     }
     $req->set_attribute('status', $status);
     return 'Ticket_SaveCondition';
 }
Beispiel #3
0
 public function handle_request_internal()
 {
     $req = APF::get_instance()->get_request();
     $res = APF::get_instance()->get_response();
     $params = $req->get_parameters();
     if ($params['delete']) {
         $suc = Bll_BookmarkBiz::get_instance()->delete_bookmark_by_id($params['delete']);
         $location = Home_PersonalQueryController::build_uri();
         $res->redirect($location);
     }
     if ($params['type'] && ($params['id'] || $params['owner'])) {
         $tickets_opened = array();
         $i = 0;
         $tickets_accepted = array();
         $j = 0;
         $tickets_verified = array();
         $k = 0;
         $tickets_released = array();
         $m = 0;
         $tickets_closed = array();
         $n = 0;
         $type = $params['type'];
         if ($type == 'pmtid') {
             $pmt_id = trim($params['id']);
             $name = 'Tickets of pmt id is ' . $pmt_id;
             if (preg_match('/^\\d*$/', $pmt_id)) {
                 $pmt_tickets = Bll_TicketBiz::get_instance()->get_tickets_by_pmtid($pmt_id);
                 foreach ($pmt_tickets as $ticket) {
                     if ($ticket->status == 'opened') {
                         $tickets_opened[$i] = $ticket;
                         $i = $i + 1;
                     } elseif ($ticket->status == 'accepted') {
                         $tickets_accepted[$j] = $ticket;
                         $j = $j + 1;
                     } elseif ($ticket->status == 'verified') {
                         $tickets_verified[$k] = $ticket;
                         $k = $k + 1;
                     } elseif ($ticket->status == 'released') {
                         $tickets_released[$m] = $ticket;
                         $m = $m + 1;
                     } elseif ($ticket->status == 'closed') {
                         $tickets_closed[$n] = $ticket;
                         $n = $n + 1;
                     }
                 }
             } else {
                 $tickets_opened = array();
                 $tickets_accepted = array();
                 $tickets_verified = array();
                 $tickets_released = array();
                 $tickets_closed = array();
             }
             if ($params['bc'] == 'yes') {
                 $input_arr = array();
                 $input_arr['user'] = $req->get_username();
                 $input_arr['name'] = $params['name'];
                 $input_arr['type'] = "1";
                 $input_arr['value'] = "type=" . $type . '&id=' . $pmt_id;
                 $id = Bll_BookmarkBiz::get_instance()->insert_condition($input_arr);
                 $url_again = Home_PersonalQueryController::build_uri() . '?' . $bookmark_value . '&bced=yes';
                 $res->redirect($url_again);
             } else {
                 if ($params['bced'] == 'yes') {
                 } else {
                     $value = "type=" . $type . '&id=' . $pmt_id;
                 }
             }
         } else {
             if ($type == 'owner') {
                 $owner = $params['owner'];
                 $tmp_owner = explode(';', $owner);
                 $owner_whole = $tmp_owner[0];
                 $owner_user = Bll_UserBiz::get_instance()->get_username_by_wholename($owner_whole);
                 if (!$owner_user) {
                     $owner_user = $owner_whole;
                 }
                 $name = 'Tickets of owner is ' . $owner_whole;
                 //if($params['time_begin']&&$params['time_end']){  2012-1-1
                 if ($params['time_begin'] && preg_match('/^\\d{4}\\-\\d{1,2}\\-\\d{1,2}$/', $params['time_begin'])) {
                     $time_begin = $params['time_begin'];
                 }
                 if ($params['time_end'] && preg_match('/^\\d{4}\\-\\d{1,2}\\-\\d{1,2}$/', $params['time_end'])) {
                     $time_end = $params['time_end'] . ' 23:59:59';
                 }
                 $owner_tickets = Bll_TicketBiz::get_instance()->get_tickets_by_query_owner($owner_user, $time_begin, $time_end);
                 foreach ($owner_tickets as $ticket) {
                     if ($ticket->status == 'opened') {
                         $tickets_opened[$i] = $ticket;
                         $i = $i + 1;
                     } else {
                         if ($ticket->status == 'accepted') {
                             $tickets_accepted[$j] = $ticket;
                             $j = $j + 1;
                         } else {
                             if ($ticket->status == 'verified') {
                                 $tickets_verified[$k] = $ticket;
                                 $k = $k + 1;
                             } else {
                                 if ($ticket->status == 'released') {
                                     $tickets_released[$m] = $ticket;
                                     $m = $m + 1;
                                 } else {
                                     if ($ticket->status == 'closed') {
                                         $tickets_closed[$n] = $ticket;
                                         $n = $n + 1;
                                     }
                                 }
                             }
                         }
                     }
                 }
                 if ($params['bc'] == 'yes') {
                     $input_arr = array();
                     $input_arr['user'] = $req->get_username();
                     $input_arr['name'] = $params['name'];
                     $input_arr['type'] = "1";
                     $input_arr['value'] = "type=" . $type . "&owner=" . $owner_user;
                     $id = Bll_BookmarkBiz::get_instance()->insert_condition($input_arr);
                     $url_again = Home_PersonalQueryController::build_uri() . '?' . $bookmark_value . '&bced=yes';
                     $res->redirect($url_again);
                 } else {
                     if ($params['bced'] == 'yes') {
                     } else {
                         $value = 'type=' . $type . '&owner=' . $owner_user;
                     }
                 }
             }
         }
         $tickets = array();
         $tickets['opened'] = $tickets_opened;
         $tickets['accepted'] = $tickets_accepted;
         $tickets['verified'] = $tickets_verified;
         $tickets['released'] = $tickets_released;
         $tickets['closed'] = $tickets_closed;
         $req->set_attribute('name', $name);
         $req->set_attribute('tickets', $tickets);
         $req->set_attribute('value', $value);
         return 'Home_IndexAllMyQ';
     }
     $personal_conditions = Bll_BookmarkBiz::get_instance()->get_personal_conditions($req->get_username());
     $all_users = Bll_UserBiz::get_instance()->get_all_users();
     $tmp_all = array();
     foreach ($all_users as $key => $value) {
         $tmp_all[$key] = $value->whole_name;
     }
     $all_users = json_encode($tmp_all);
     $req->set_attribute('all_users', $all_users);
     $req->set_attribute('personal_conditions', $personal_conditions);
     return 'Home_PersonalQuery';
 }