Пример #1
0
 public function doConfigPageInit($page)
 {
     $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '';
     $parking_defaults = array("name" => "Lot Name", "type" => "public", "parkext" => "", "parkpos" => "", "numslots" => 4, "parkingtime" => 45, "parkedmusicclass" => "default", "generatehints" => "yes", "generatefc" => "yes", "findslot" => "first", "parkedplay" => "both", "parkedcalltransfers" => "caller", "parkedcallreparking" => "caller", "alertinfo" => "", "cidpp" => "", "autocidpp" => "", "announcement_id" => null, "comebacktoorigin" => "yes", "dest" => "");
     $data = array();
     switch ($_REQUEST['action']) {
         case 'add':
         case 'update':
             $vars = array();
             foreach (array_keys($parking_defaults) as $k) {
                 if (isset($_REQUEST[$k])) {
                     $vars[$k] = $_REQUEST[$k];
                 }
             }
             if (!empty($vars)) {
                 $vars['dest'] = isset($_REQUEST['goto0']) && isset($_REQUEST[$_REQUEST['goto0'] . '0']) ? $_REQUEST[$_REQUEST['goto0'] . '0'] : '';
                 if ($_REQUEST['action'] == 'update') {
                     $vars['id'] = $_REQUEST['id'];
                 }
                 $id = parking_save($vars);
                 if ($id !== false) {
                     $_REQUEST['action'] = 'modify';
                     $_REQUEST['id'] = $id;
                 }
             }
             break;
         case 'delete':
             if (function_exists('parkpro_del')) {
                 if (parkpro_del($id)) {
                     $_REQUEST['action'] = '';
                     $_REQUEST['id'] = '';
                 }
             }
             break;
         default:
             break;
     }
 }
Пример #2
0
 /**
  * @verb PUT
  * @uri /parking
  */
 function put_parking($params)
 {
     return parking_save($params);
 }