/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.arm_model.php (9393B)
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 `arm` 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 `arm` WHERE `deleted`=\'0\'; '); $sth->execute(); return $sth->fetch (); } public function getTypeArm (){ try{ $sth = $this->database->prepare("SELECT * FROM `arm`"); $sth->execute(); return $sth->fetchAll(); }catch(PDOException $e){ return array(); } } public function clientsGetList ($page=0){ //error_reporting(0); if ($page!=0){ $page_number=abs(($page-1)*LIMIT); }else{ $page_number=0; } try{ $sth=$this->database->prepare("SELECT a.*,d.taxi_name FROM `arm` a LEFT OUTER JOIN `dcc` d ON a.gid=d.gid WHERE a.deleted='0' ORDER BY a.`last_update` DESC LIMIT $page_number , ".LIMIT." "); $sth->execute(); }catch(PDOException $e){ ajax::fail($e->getMessage()); return false; } $max_sum_call = 0; $count_accepted = 0; $count_disconnected = 0; $count_nabirzu = 0;; $count_sbirzy = 0; $count_connected = 0; $count_rejecepted = 0; if($sth->rowCount()>0){ $arr= $sth->fetchAll(); $mess_ids = ""; $record = 1+($page_number); foreach($arr as $k => $value){ $arr[$k]['nn'] = $record; $record++; if($mess_ids != ""){ $mess_ids = ",".$mess_ids; } $mess_ids = $arr[$k]['id'].$mess_ids; //------------------------- if ($value['license'] == '1') { $license = 'Лицензия'; $count_accepted++; } else { $license = 'ДЕМО'; $count_rejecepted++; } $last_update = time() - strtotime($value['last_update']); if ((($last_update > 604800) && (($value['gid'] < 10000)||($value['gid'] == 10005)))) { $stat = 'BAD'; $count_disconnected++; $last_update = round($last_update/60/60/24).' дн.'; } else { $stat = 'OK'; $count_connected++; if($last_update>604800){ $last_update = round($last_update/60/60/24).' дн.'; }else{ $last_update = round($last_update/60/60).' ч'; } } $arr[$k]['stat'] = $stat; $arr[$k]['last_update'] = $last_update; $arr[$k]['license'] = $license; //------------------------- } echo json_encode($arr); }else{ if($page_number==0){ ajax::fail( 'нет DCC, а это очень грутсно :(' ); return false; } $page_number-=1; $this->clientsGetList($page_number); } } public function fetchSingleRecordsFromId ($id,$ajax=true){ $sth=$this->database->prepare("SELECT * FROM `arm` 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 `arm` SET `deleted`='1' WHERE `id`=$id ;"); $sth->execute(); if ($sth->rowCount()>0){ echo json_encode(array('msg'=>'success')); $this->database->log('Удален ARM id='.$id); }else{ echo json_encode(array('msg'=> 'fail')); $this->database->log('Не удалось удалить ARM id='.$id); } } public function saveEditRecords ( ){ try{ $this->form->post('id','Номер контрагента')->val('digit')->val('zeroField') ->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('Не удалось обновить данные Arm '.$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('Не удалось обновить данные Arm '.$e->getMessage() ); return false; } ajax::success("Данные клиента ".$data['taxi_name']." обновлены."); $this->database->log("Данные клиента ".$data['taxi_name']." обновлены." ); } public function createArm(){ 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('Не удалось создать Arm '.$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('Не удалось создать Arm '.$data['taxi_name']); header("Location:".$_SERVER["HTTP_REFERER"]); exit; } if(ajax::check_ajax_request()){ ajax::success("Создан Arm ".$data['taxi_name']); }else{ session::set('msgSuccess',"Создан Arm ".$data['taxi_name']); $this->database->log('Создан Arm '.$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 `arm` 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 fetechArm ($id){ try{ $sth = $this->database->prepare("SELECT c.*,t.name as tName FROM `arm` c INNER JOIN `type_arm` 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 ; } } }