Example #1
0
define("APP_PATH", $_SERVER['DOCUMENT_ROOT'] . $app['path'] . "/");
include_once "../" . $app['framework'] . "Autoloader.class.php";
Autoloader::setCacheFilePath(APP_PATH . 'tmp/class_path_cache.txt');
Autoloader::excludeFolderNamesMatchingRegex('/^CVS|\\..*$/');
Autoloader::setClassPaths(array('../' . $app['framework'], '../entities/', '../lib/'));
spl_autoload_register(array('Autoloader', 'loadClass'));
$parametros = $_REQUEST['parametros'];
$accion = $parametros['accion'];
$datos = $parametros['datos'];
switch ($accion) {
    case 'add':
        $fav = new FavoritosTpv();
        $rows = $fav->cargaCondicion("Id", "IDTpv='{$datos['IDTpv']}' and IDArticulo='{$datos['IDArticulo']}'");
        if ($rows[0]['Id'] == '') {
            $fav->setIDTpv($datos['IDTpv']);
            $fav->setIDArticulo($datos['IDArticulo']);
            $fav->setDescripcion($datos['Descripcion']);
            $idCreado = $fav->create();
            $errores = $fav->getErrores();
            $alertas = $fav->getAlertas();
        }
        unset($fav);
        break;
    case 'remove':
        $fav = new FavoritosTpv($datos['Id']);
        $fav->erase();
        $errores = $fav->getErrores();
        $alertas = $fav->getAlertas();
        unset($fav);
        break;
}