Ejemplo n.º 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'));
$v = $_GET;
$relacion = new CpanRelaciones();
$idRelacion = $relacion->getIdRelacion($v['entidadOrigen'], $v['idOrigen'], $v['entidadDestino'], $v['idDestino']);
if ($v['onOff']) {
    // Hacer relacion
    if (!$idRelacion) {
        $relacion = new CpanRelaciones();
        $relacion->setEntidadOrigen($v['entidadOrigen']);
        $relacion->setIdEntidadOrigen($v['idOrigen']);
        $relacion->setEntidadDestino($v['entidadDestino']);
        $relacion->setIdEntidadDestino($v['idDestino']);
        $relacion->setPublish(1);
        $relacion->create();
    }
} else {
    // Quitar la relación
    if ($idRelacion) {
        $relacion = new CpanRelaciones($idRelacion);
        $relacion->erase();
    }
}
unset($relacion);
$tag = "";
echo $tag;