/var/www/doncode.com.ua/www/models
NameSizeModeActions
class.admin_model.php377020644editdlrm
class.api_model.php328640644editdlrm
class.archive_model.php29750644editdlrm
class.arm_model.php93930644editdlrm
class.dcccatalog_model.php98710644editdlrm
class.dcclist_model.php108290644editdlrm
class.dccsupport_model.php4710644editdlrm
class.dccupdate_model.php4700644editdlrm
class.dmp_platforms_model.php79590644editdlrm
class.docs_model.php11280644editdlrm
class.doncode_users_model.php67120644editdlrm
class.driver_model.php3690644editdlrm
class.exchange_model.php82660644editdlrm
class.files_model.php1940644editdlrm
class.index_model.php11290644editdlrm
class.login_model.php250140644editdlrm
class.mobile_users_model.php100090644editdlrm
class.news_model.php77210644editdlrm
class.orders_model.php97820644editdlrm
class.settings_model.php117990644editdlrm
class.support_model.php287830644editdlrm
class.users_model.php91540644editdlrm
class.user_model.php448730644editdlrm
Edit: /var/www/doncode.com.ua/www/models/class.support_model.php (28783B)
form->post('number','номер телефона')->val('digit')->val('emptyStr'); $this->form->submit(); $data = $this->form->fetch(); }catch(Exception $e){ ajax::fail($e->getMessage()); return false; } try{ $sth = $this->database->prepare ("SELECT `id`,`FIO`,`discount`,`price_type` FROM `support` WHERE `phone`=:phone LIMIT 1 "); if (strlen($data['number'])>10){ $number = substr($data['number'],strlen($data['number'])-10); }else{ $number = $data['number']; } $sth->execute(array( ':phone'=> $number) ); }catch(PDOException $e){ ajax::fail($e->getMessage()); return false; } if($sth->rowCount()==0){ echo json_encode(array('none'=>time())); return false; }else{ echo json_encode($sth->fetch()); } } public function fetchCountRecords(){ $sth = $this->database->prepare('SELECT count(id) as `count` FROM `support` WHERE `deleted`=\'0\'; '); $sth->execute(); return $sth->fetch (); } public function fetchSingleRecordsFromCode(){ $msg_fail = "Не найден ..... "; try{ $this->form->post('code')->val('emptyStr'); $this->form->submit(); $data = $this->form->fetch(); }catch(Exception $e){ ajax::fail( $msg_fail.$e->getMessage() ); return false; } try{ $sth = $this->database->prepare("SELECT * FROM `support` WHERE `deleted`='0' AND `code_clients` =:code LIMIT 1;"); $sth->execute(array(':code'=>$data['code'])); }catch(PDOException $e){ ajax::fail( $msg_fail ); return false; } if ($sth->rowCount() > 0) echo json_encode($sth->fetch()); else ajax::fail( $msg_fail ); } public function getTypeSupport (){ try{ $sth = $this->database->prepare("SELECT * FROM `support`"); $sth->execute(); return $sth->fetchAll(); }catch(PDOException $e){ return array(); } } public function getListSupport(){ $filter = ''; //$performer_user_id = session::get('id_user'); //Выводит все не принятые заявки $performer_user_id = session::get('support_user_filter'); if($performer_user_id > 0 and $performer_user_id !=19){ //$user = session::get('support_user_filter'); $filter.=' AND s.performer_user_id = '.session::get('support_user_filter'); //$filter.=' AND s.performer_user_id > 0'; } else{ $filter.=' AND s.performer_user_id >= 0'; } $status = session::get('support_status_filter'); //не понятно что с фильтром? if ($status > 0 and $status!=4 ) { //$filter.=' AND s.status >= 0'; $filter.=' AND s.status = '.session::get('support_status_filter'); } else{ if($status = 0){ $filter.=' AND s.status = 0'; } else { $filter.=' AND s.status >= 0'; } } $typestatus = session::get('support_type_filter'); if($typestatus > 0 and $typestatus != 14 ){ if($typestatus != 15){ $filter.=' AND s.troubles_id = '.session::get('support_type_filter'); } else{ $filter.=' AND s.troubles_id = 0'; } } else{ $filter.=' AND s.troubles_id >= 0'; } $sth = $this->database->prepare('SELECT s.id as sid, s.*,sw.*,cids.city_name_ru as gids, d.taxi_name,w.name as who,tg.name as troubles_name FROM `support` s LEFT OUTER JOIN `dcc` d ON d.gid=s.gid LEFT OUTER JOIN `status_work` sw ON sw.wid=s.status LEFT OUTER JOIN `troubles_group` tg ON tg.id=s.troubles_id LEFT OUTER JOIN `who` w ON w.wid=s.who LEFT OUTER JOIN `city_` cids ON d.city_id=cids.id_city WHERE s.deleted= 0'.$filter.' ORDER BY s.`create_date` DESC LIMIT 50'); $sth->execute(); if($sth->rowCount()>0){ $arr = $sth->fetchAll(); $count = 0; $d_users = bootstrap::getDoncodeUsers (); foreach($arr as $k => $value){ $count++; $arr[$k]['nn'] = $count; //$arr[$k]['event'] = $this->getCurrentEvent($arr[$k]['et'],$arr[$k]['host'].':'.$arr[$k]['port'],$arr[$k]['gid']); //$arr[$k]['id'] = bootstrap::HumanDatePrecise($arr[$k]['id']); if($arr[$k]['troubles_name']==''){ $arr[$k]['troubles_name'] = 'НЕТ';} $arr[$k]['create_date'] = bootstrap::HumanDatePrecise($arr[$k]['create_date']); if($arr[$k]['read_user_id']==0){ $arr[$k]['read_user_id'] = 'новое'; }else{ $arr[$k]['read_user_id'] = $d_users[$arr[$k]['read_user_id']]; } if($arr[$k]['who_perform_user_id']==0){ $arr[$k]['who_perform_user_id'] = 'не назначен'; $arr[$k]['display_accept1'] = 'display:none;'; } else{ $arr[$k]['who_perform_user_id'] = $d_users[$arr[$k]['who_perform_user_id']]; } if($arr[$k]['performer_user_id']==0){ $arr[$k]['performer_user_id'] = 'ЗАКРЫТЬ'; $arr[$k]['performer_user_'] = 'important'; }else{ $arr[$k]['complite_date'] = $d_users[$arr[$k]['performer_user_id']]; $arr[$k]['performer_user_id'] = 'ЗАКРЫТЬ'; $arr[$k]['display_performer'] = 'display:none;'; } if($arr[$k]['read_date']=='0000-00-00 00:00:00'){ $arr[$k]['read_date'] = 'ПРИНЯТЬ'; $arr[$k]['read_'] = 'success'; $arr[$k]['display_performer'] = 'display:none;'; $arr[$k]['display_performer_user'] = 'display:none;'; }else{ $arr[$k]['read_date1'] = bootstrap::HumanDatePrecise($arr[$k]['read_date']); //$arr[$k]['read_'] = 'info'; $arr[$k]['display_accept'] = 'display:none;'; } if($arr[$k]['perform_date']=='0000-00-00 00:00:00'){ $arr[$k]['perform_date'] = 'НАЗНАЧИТЬ'; $arr[$k]['perform_'] = 'info'; $arr[$k]['display_accept1'] = 'display:none;'; }else{ $arr[$k]['perform_date1'] = bootstrap::HumanDatePrecise($arr[$k]['perform_date']); $arr[$k]['perform_'] = 'info'; } if($arr[$k]['complite_date']=='0000-00-00 00:00:00'){ $arr[$k]['complite_date'] = 'нет исполнителя'; $arr[$k]['complite_'] = 'important'; }else{ if($arr[$k]['performer_user_id']!=0){ $arr[$k]['complite_date1'] = bootstrap::HumanDatePrecise($arr[$k]['complite_date']); } if($arr[$k]['status'] == 3){ $arr[$k]['display_performer'] = 'display:none;'; $arr[$k]['display_performer_user'] = 'display:none;'; $arr[$k]['display_accept1'] = 'display:none;'; } //$arr[$k]['complite_date1'] = bootstrap::HumanDatePrecise($arr[$k]['complite_date']); $arr[$k]['complite_'] = 'success'; } } } echo json_encode($arr,true); return; return false; } public function fetchSingleRecordsFromId ($id,$ajax=true){ $sth=$this->database->prepare("SELECT * FROM `support` WHERE deleted='0'"); $sth->execute(); if ($ajax){ echo json_encode($sth->fetch()); }else{ return $sth->fetch(); } } public function get_pay_type ($ajax=true){ $sth=$this->database->prepare("SELECT * FROM `pay_type` WHERE deleted='0'"); $sth->execute(); if ($ajax){ echo json_encode($sth->fetch()); }else{ return $sth->fetchAll(); } } public function deleteRecords($id){ $sth=$this->database->prepare("UPDATE `support` SET `deleted`='1' WHERE `id`=$id ;"); $sth->execute(); if ($sth->rowCount()>0){ echo json_encode(array('msg'=>'success')); $this->database->log('Удален клиент id='.$id); }else{ echo json_encode(array('msg'=> 'fail')); $this->database->log('Не удалось удалить клиента id='.$id); } } public function saveEditRecords ( ){ try{ $this->form->post('id') ->post('taxi_name') ->post('gid') ->post('key') ->post('obmen') ->post('internet') ->post('host') ->post('ip') ->post('port') ->post('pay_type') ->post('site'); $this->form->submit(); $data = $this->form->fetch(); if(isset($data['obmen'])){ if($data['obmen']=='on'){ $data['obmen']=1; }else{ $data['obmen']=0; } }else{ $data['obmen']=0; } if(isset($data['internet'])){ if($data['internet']=='on'){ $data['internet']=1; }else{ $data['internet']=0; } }else{ $data['internet']=0; } }catch(Exception $e){ ajax::fail($e->getMessage()); $this->database->log('Не удалось обновить данные Support '.$e->getMessage() ); return false; } try{ $id=$data['id']; unset($data['id']); $this->database->update('dcc',$data,'id='.$id); }catch(PDOException $e){ ajax::fail($e->getMessage()); $this->database->log('Не удалось обновить данные Support '.$e->getMessage() ); return false; } ajax::success("Данные клиента ".$data['taxi_name']." обновлены."); $this->database->log("Данные клиента ".$data['taxi_name']." обновлены." ); } public function createSupport(){ try{ $this->form->post('gid') ->post('taxi_name') ->post('site'); $this->form->submit(); $data = $this->form->fetch(); }catch(Exception $e){ if(ajax::check_ajax_request()){ ajax::fail($e->getMessage()); }else{ session::set('msgFail',$e->getMessage()); $this->database->log('Не удалось создать Support '.$e->getMessage() ); header("Location:".$_SERVER["HTTP_REFERER"]); } exit; } try{ $this->database->insert('dcc',$data); }catch(PDOException $e){ session::set('msgFail',$e->getMessage()); $this->database->log('Не удалось создать Support '.$data['taxi_name']); header("Location:".$_SERVER["HTTP_REFERER"]); exit; } if(ajax::check_ajax_request()){ ajax::success("Создан Support ".$data['taxi_name']); }else{ session::set('msgSuccess',"Создан Support ".$data['taxi_name']); $this->database->log('Создан Support '.$data['taxi_name']); header("Location:".URL."dcc"); } exit; } public function search ($ch,$type){ try{ $char = $this->database->quote('%'.$ch.'%'); $sth = $this->database->prepare("SELECT `id`,`FIO` FROM `support` WHERE `$type` LIKE $char AND `deleted`='0' LIMIT ".LIMIT); $sth->execute( ); ajax::out($sth->fetchAll()); } catch (Exception $e){ ajax::fail($e->getMessage()); return false; } } public function fetechSupport ($id){ try{ $sth = $this->database->prepare("SELECT c.*,t.name as tName FROM `support` c INNER JOIN `type_support` t ON (c.type=t.id) WHERE c.deleted='0' AND c.id=:id LIMIT 1 "); $sth->execute(array(':id'=>$id)); ajax::out($sth->fetchAll()); return; }catch(PDOException $e){ ajax::fail($e->getMessage()); return ; } } /*new*/ public function setUser($id){ if($id !=19){ session::set('support_user_filter',$id); $sth = $this->database->prepare('SELECT login FROM `doncode_users` WHERE id='.$id); $sth->execute(); } else{ session::set('support_user_filter',$id); $sth = $this->database->prepare('SELECT login FROM `doncode_users` WHERE id > 0'); $sth->execute(); } if($sth->rowCount()>0){ $arr = $sth->fetchAll(); echo json_encode($arr,true); } return; } public function setUserArchiveType($id){ if($id !=19){ session::set('support_archiveuser_filter',$id); $sth = $this->database->prepare('SELECT login FROM `doncode_users` WHERE id='.$id); $sth->execute(); } else{ session::set('support_archiveuser_filter',$id); $sth = $this->database->prepare('SELECT login FROM `doncode_users` WHERE id > 0'); $sth->execute(); } if($sth->rowCount()>0){ $arr = $sth->fetchAll(); echo json_encode($arr,true); } return; } public function getStatus(){ return session::get('support_status_filter'); } public function getTypesStatus(){ return session::get('support_type_filter'); } public function getListArchive(){ return session::get('support_delstatus_filter'); } public function getUsersFilter(){ return session::get('support_user_filter'); } public function getUsersArchiveFilter(){ return session::get('support_archiveuser_filter'); } public function setStatus($wid){ if($wid != 4){ session::set('support_status_filter',$wid); $sth = $this->database->prepare('SELECT works FROM `status_work` WHERE wid='.$wid); $sth->execute(); } else { session::set('support_status_filter',$wid); $sth = $this->database->prepare('SELECT works FROM `status_work` WHERE wid>=0'); $sth->execute(); } if($sth->rowCount()>0){ $arr = $sth->fetchAll(); echo json_encode($arr,true); } return; } public function setStatusType($id){ // if ($id !=99 and $id !=88){ // ///session::set('support_type_filter',$id); //$sth = $this->database->prepare('SELECT `name` FROM `troubles_group` WHERE `deleted` = 0 AND id='.$id); // $sth->execute(); // } /* if ($id = 14){ session::set('support_type_filter',$id); $sth = $this->database->prepare('SELECT `name` FROM `troubles_group` WHERE `deleted` = 0 AND `id` >=0'); //$sth = $this->database->prepare('SELECT `name` FROM `troubles_group` WHERE `deleted` = 0 AND id='.$id); $sth->execute(); } if ($id = 15){ session::set('support_type_filter',$id); $sth = $this->database->prepare('SELECT `name` FROM `troubles_group` WHERE `deleted` = 0 AND `id` =0'); //$sth = $this->database->prepare('SELECT `name` FROM `troubles_group` WHERE `deleted` = 0 AND id='.$id); $sth->execute(); } */ if ($id !=14 and $id !=15) { session::set('support_archivetype_filter',$id); $sth = $this->database->prepare('SELECT `name` FROM `troubles_group` WHERE `deleted` = 0 AND id='.$id); $sth->execute(); } if($sth->rowCount()>0){ $arr = $sth->fetchAll(); echo json_encode($arr,true); } return; } public function setStatusArchiveType($id){ if ($id !=14 and $id !=13){ session::set('support_archivetype_filter',$id); $sth = $this->database->prepare('SELECT `name` FROM `troubles_group` WHERE `deleted` = 0 AND id='.$id); $sth->execute(); } else { session::set('support_archivetype_filter',$id); $sth = $this->database->prepare('SELECT `name` FROM `troubles_group` WHERE `deleted` = 0 AND id>0'); $sth->execute(); } if($sth->rowCount()>0){ $arr = $sth->fetchAll(); echo json_encode($arr,true); } return; } public function getStatuses(){ $sth = $this->database->prepare('SELECT * FROM `status_work` '); $sth->execute(); if($sth->rowCount()>0){ $arr = $sth->fetchAll(); return $arr;// json_encode($arr,true); } return; } public function getStatusType(){ $sth = $this->database->prepare('SELECT * FROM `troubles_group` where `deleted`=0 '); $sth->execute(); if($sth->rowCount()>0){ $arr = $sth->fetchAll(); return $arr;//echo json_encode($arr,true); } return; } public function ListArchive(){ $filter = ''; $performer_user_id = session::get('support_archiveuser_filter'); //$performer_user_id = session::get('id_user'); //Выводит все не принятые заявки if($performer_user_id > 0 and $performer_user_id !=19){ //$user = session::get('support_user_filter'); $filter.=' AND s.performer_user_id = '.session::get('support_archiveuser_filter'); } $typestatus = session::get('support_archivetype_filter'); if($typestatus > 0 and $typestatus != 14){ if($typestatus != 13){ $filter.=' AND s.troubles_id = '.session::get('support_archivetype_filter'); } else{ $filter.=' AND s.troubles_id =0 '; } } else{ $filter.=' AND s.troubles_id >= 0'; } $sth = $this->database->prepare('SELECT s.id as sid, s.*,sw.*,cids.city_name_ru as gids, d.taxi_name,w.name as who,tg.name as troubles_name FROM `support` s LEFT OUTER JOIN `dcc` d ON d.gid=s.gid LEFT OUTER JOIN `status_work` sw ON sw.wid=s.status LEFT OUTER JOIN `troubles_group` tg ON tg.id=s.troubles_id LEFT OUTER JOIN `who` w ON w.wid=s.who LEFT OUTER JOIN `city_` cids ON d.city_id=cids.id_city WHERE s.deleted= 1'.$filter.' ORDER BY s.`create_date` DESC LIMIT 30'); $sth->execute(); if($sth->rowCount()>0){ $arr = $sth->fetchAll(); $count = 0; $d_users = bootstrap::getDoncodeUsers (); foreach($arr as $k => $value){ $count++; $arr[$k]['nn'] = $count; //$arr[$k]['id'] = bootstrap::HumanDatePrecise($arr[$k]['id']); if($arr[$k]['troubles_name']==''){ $arr[$k]['troubles_name'] = 'НЕТ';} $arr[$k]['create_date'] = bootstrap::HumanDatePrecise($arr[$k]['create_date']); if($arr[$k]['read_user_id']==0){ $arr[$k]['read_user_id'] = 'новое'; }else{ $arr[$k]['read_user_id'] = $d_users[$arr[$k]['read_user_id']]; } if($arr[$k]['who_perform_user_id']==0){ $arr[$k]['who_perform_user_id'] = 'не назначен'; $arr[$k]['display_accept1'] = 'display:none;'; } else{ $arr[$k]['who_perform_user_id'] = $d_users[$arr[$k]['who_perform_user_id']]; } if($arr[$k]['performer_user_id']==0){ $arr[$k]['performer_user_id'] = 'ЗАКРЫТЬ'; $arr[$k]['performer_user_'] = 'important'; }else{ $arr[$k]['complite_date'] = $d_users[$arr[$k]['performer_user_id']]; $arr[$k]['performer_user_id'] = 'ЗАКРЫТЬ'; $arr[$k]['display_performer'] = 'display:none;'; } if($arr[$k]['read_date']=='0000-00-00 00:00:00'){ $arr[$k]['read_date'] = 'ПРИНЯТЬ'; $arr[$k]['read_'] = 'success'; $arr[$k]['display_performer'] = 'display:none;'; $arr[$k]['display_performer_user'] = 'display:none;'; }else{ $arr[$k]['read_date1'] = bootstrap::HumanDatePrecise($arr[$k]['read_date']); //$arr[$k]['read_'] = 'info'; $arr[$k]['display_accept'] = 'display:none;'; } if($arr[$k]['perform_date']=='0000-00-00 00:00:00'){ $arr[$k]['perform_date'] = 'НАЗНАЧИТЬ'; $arr[$k]['perform_'] = 'info'; $arr[$k]['display_accept1'] = 'display:none;'; }else{ $arr[$k]['perform_date1'] = bootstrap::HumanDatePrecise($arr[$k]['perform_date']); $arr[$k]['perform_'] = 'info'; } if($arr[$k]['complite_date']=='0000-00-00 00:00:00'){ $arr[$k]['complite_date'] = 'нет исполнителя'; $arr[$k]['complite_'] = 'important'; }else{ if($arr[$k]['performer_user_id']!=0){ $arr[$k]['complite_date1'] = bootstrap::HumanDatePrecise($arr[$k]['complite_date']); } if($arr[$k]['status'] == 3){ $arr[$k]['display_performer'] = 'display:none;'; $arr[$k]['display_performer_user'] = 'display:none;'; $arr[$k]['display_accept1'] = 'display:none;'; } //$arr[$k]['complite_date1'] = bootstrap::HumanDatePrecise($arr[$k]['complite_date']); $arr[$k]['complite_'] = 'success'; } } } echo json_encode($arr,true); return; return false; } public function getTypeStatus(){ $sth = $this->database->prepare('SELECT * FROM `troubles_group` '); $sth->execute(); if($sth->rowCount()>0){ $arr = $sth->fetchAll(); return $arr;// json_encode($arr,true); } return; } public function getUserFilter(){ $sth = $this->database->prepare('SELECT * FROM `doncode_users` WHERE `block`="0" AND `block`="0"'); $sth->execute(); if($sth->rowCount()>0){ $arr = $sth->fetchAll(); return $arr; } return; } function createMSG($support){ $this->support = $support; $this->datetime = $this->mysql_datetime(); $this->db_query("INSERT INTO `support` SET `support`='$support'"); $this->id = $this->db_insert_id(); } public function createDoncode_SupportSubmit($MSGSupport){ $array=array ( 'message' => $_POST['MSGSupport'], 'performer_user_id' => $_POST['performer_user_id'], 'troubles_id' => $_POST['troubles_id'], 'gid' => $_POST['gid'] ); if ($array != '') { $this->database->insert('support',$array ); } } public function deleteSupportMsg($id){ $sth=$this->database->prepare("UPDATE `support` SET `deleted`='1' WHERE `id`=$id"); $sth->execute(); if ($sth->rowCount()>0){ echo json_encode(array('msg'=>'success')); $this->database->log('Обращение удалено'); }else{ echo json_encode(array('msg'=> 'fail')); $this->database->log('Не удалось удалить обращение'); } } public function redeleteSupportMsg($id){ $sth=$this->database->prepare("UPDATE `support` SET `deleted`='0' WHERE `id`=$id"); $sth->execute(); if ($sth->rowCount()>0){ echo json_encode(array('msg'=>'success')); $this->database->log('Обращение восстановлено'); }else{ echo json_encode(array('msg'=> 'fail')); $this->database->log('Не удалось восстановить обращение'); } } public function acceptSupportMsg(){ $id=$_POST['id']; $troubles_id=$_POST['troubles_group']; $msg =$_POST['MSGSupport']; $performer_user_id = $_POST['performer_user_id']; if ($msg <> ''){ $MSGSupport='Действия по проблеме: '.$msg; } $performer_user_id=$_POST['performer_user_id']; if($performer_user_id>0){ $who_perform_user_id = session::get('id_user'); $per_date = '`perform_date`=NOW(), '; $status = 2; }else{ $who_perform_user_id = 0; $per_date = ''; $status = 1; } $sth=$this->database->prepare("UPDATE `support` SET `status`= '$status',`read_user_id`='".session::get('id_user')."', `read_date`=NOW(), `troubles_id`=$troubles_id, `read_comment`='$MSGSupport', `ticket_status`='2', $per_date `who_perform_user_id`='$who_perform_user_id', `performer_user_id`='$performer_user_id' WHERE `id`=$id"); $sth->execute(); if ($sth->rowCount()>0){ echo json_encode(array('msg'=>'success')); $this->database->log('Обращение принято'); }else{ echo json_encode(array('msg'=> 'fail')); $this->database->log('Не удалось принять обращение'); } } public function getMSG($id){ $sth = $this->database->prepare('SELECT s.id as sid, s.*,sw.*,cids.city_name_ru as gids, d.taxi_name,w.name as who FROM `support` s LEFT OUTER JOIN `dcc` d ON d.gid=s.gid LEFT OUTER JOIN `status_work` sw ON sw.wid=s.status LEFT OUTER JOIN `who` w ON w.wid=s.who LEFT OUTER JOIN `city_` cids ON d.city_id=cids.id_city WHERE s.deleted=0 AND s.id='.$id.' LIMIT 1'); $sth->execute(); if($sth->rowCount()>0){ $arr = $sth->fetchAll(); return $arr;// json_encode($arr,true); } return; } public function getTroublesGroup(){ $sth = $this->database->prepare('SELECT * FROM `troubles_group`'); $sth->execute(); if($sth->rowCount()>0){ $arr = $sth->fetchAll(); return $arr;// json_encode($arr,true); } return; } public function getGids(){ $sth = $this->database->prepare('SELECT id, gid, taxi_name, host, ip,port FROM `dcc` WHERE deleted =0'); $sth->execute(); if($sth->rowCount()>0){ $arr = $sth->fetchAll(); return $arr;// json_encode($arr,true); } return; } public function getGidById($gid){ $sth = $this->database->prepare('SELECT * from `dcc` where `gid`='.$gid); $sth->execute(); if($sth->rowCount()>0){ $arr = $sth->fetchAll(); return $arr;// json_encode($arr,true); } return; } public function closeOrder(){ $id=$_POST['id']; $MSGClose="Прична закрытия: ".$_POST['MSGClose']; $remoteAnswer=$_POST['remoteAnswer']; $remoteStatus=$_POST['remoteStatus']; $sth=$this->database->prepare("UPDATE `support` SET `close_comment`= '$MSGClose', `ticket_answer`= '$remoteAnswer', `ticket_status`= '$remoteStatus', `status`='3', `complite_date`=NOW() WHERE `id`=$id"); $sth->execute(); if ($sth->rowCount()>0){ echo json_encode(array('msg'=>'success')); $this->database->log('Заявка закрыта'); }else{ //echo json_encode(array('msg'=> 'fail')); console_log('NO!'); $this->database->log('Не удалось закрыть заявку'); } } public function getCurrentEvent($type,$host,$gid=0){ switch($type){ case 1: return ' Остановить'; case 2: return ' Запустить'; /*case 3: return ' Перезагрузка';*/ case 4: //return 'Перезапуск'; /*case 7: return ''; case 8: return ' Файлы'; case 9: return ''; case 10: return ''; */ default: return "NULL ".$type; } } public function getSystem(){ $sth = $this->database->prepare('SELECT distinct gid,host,ip,port,taxi_name FROM dcc WHERE deleted =0 and gid >0'); $sth->execute(); if($sth->rowCount()>0){ $arr = $sth->fetchAll(); return $arr;// json_encode($arr,true); } return; } }