Ejemplo n.º 1
0
                         }
                     }
                     // se não tem imagem anterior então estamos mudando a imagem atual para a primeira posição
                     if (empty($_REQUEST['newPosPrev'])) {
                         $newPos = $_REQUEST['newPosNext'];
                         $fieldValue = 'ORDEM + 1';
                         $extraConditional = " AND ORDEM < {$_REQUEST['oldPos']} ";
                     }
                     // se não tem próxima imagem então estamos mudando a imagem atual para a derradeira posição
                     if (empty($_REQUEST['newPosNext'])) {
                         $newPos = $_REQUEST['newPosPrev'];
                         $fieldValue = 'ORDEM - 1';
                         $extraConditional = " AND ORDEM > {$_REQUEST['oldPos']} ";
                     }
                     Imagens::updateImagensFieldByDigital('ORDEM', $fieldValue, $_REQUEST['digital'], $extraConditional);
                     Imagens::updateImagensFieldByDigital('ORDEM', $newPos, $_REQUEST['digital'], " AND ORDEM = {$temporaryOrdemValue} ");
                     $out = array('success' => 'true');
                 } catch (Exception $e) {
                     $out = array('success' => 'false', 'error' => Util::fixErrorString($e->getMessage()));
                 }
             } else {
                 $out = array('success' => 'false', 'error' => Util::fixErrorString('Informações importantes estão ausentes!'));
             }
         } else {
             $out = array('success' => 'false', 'error' => Util::fixErrorString('Acesso negado!'));
         }
         break;
     default:
         $out = array('success' => 'false', 'error' => 'Opcao Invalida!');
         break;
 }