Пример #1
0
 public static function doAction($action, &$view, $id)
 {
     switch ($action) {
         case 'showList':
             $out = Projekt::getAll();
             $out = self::transform($out);
             break;
         case 'showUpdate':
             $out = Projekt::getById($id);
             $out = self::transformUpdate($out);
             break;
         case 'showInsert':
             $out = self::transformUpdate();
             break;
         case 'update':
             $daten = $_POST['daten'];
             $daten = json_decode($daten, FALSE);
             $out = new Projekt($daten->projekt, $daten->uprid);
             $out = Projekt::update($out);
             $out = Projekt::getAll();
             $out = self::transform($out);
             break;
         case 'insert':
             $daten = $_POST['daten'];
             $daten = json_decode($daten, FALSE);
             $out = new Projekt($daten->projekt, NULL);
             $out = Projekt::insert($out);
             $out = Projekt::getAll();
             $out = self::transform($out);
             break;
         case 'delete':
             $out = $_POST['lprid'];
             $out = Projekt::delete($out);
             $out = Projekt::getAll();
             $out = self::transform($out);
             break;
         default:
             break;
     }
     return $out;
 }
 public static function doAction($action, $id)
 {
     switch ($action) {
         case 'showList':
             $out = Projekt::getAll();
             $out = self::transform($out);
             break;
         case 'showUpdate':
             $out = Projekt::getById($id);
             $out = self::transformUpdate($out);
             break;
         case 'showInsert':
             $out = self::transformUpdate();
             break;
         case 'update':
             $ProjektFiltered = filter_input(INPUT_POST, 'Projekt', FILTER_SANITIZE_MAGIC_QUOTES & FILTER_SANITIZE_SPECIAL_CHARS);
             $updateprojektidFiltered = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT & FILTER_SANITIZE_SPECIAL_CHARS);
             $out = new Projekt($ProjektFiltered, $updateprojektidFiltered);
             $out = Projekt::update($out);
             $out = Projekt::getAll();
             $out = self::transform($out);
             break;
         case 'insert':
             $projektFiltered = filter_input(INPUT_POST, 'projekt', FILTER_SANITIZE_MAGIC_QUOTES & FILTER_SANITIZE_SPECIAL_CHARS);
             $out = new Projekt($projektFiltered, NULL);
             $out = Projekt::insert($out);
             $out = Projekt::getAll();
             $out = self::transform($out);
             break;
         case 'delete':
             $deleteprojektidFiltered = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT & FILTER_SANITIZE_SPECIAL_CHARS);
             $out = $deleteprojektidFiltered;
             $out = Projekt::delete($out);
             $out = Projekt::getAll();
             $out = self::transform($out);
             break;
         default:
             break;
     }
     return $out;
 }