Esempio n. 1
0
 public function eliminar()
 {
     //Modificar carpetas vistas
     $this->usarScaffold();
     //Conectarse a la base de datos
     if ($this->db == "") {
         $this->db = "default";
     }
     $conexion = $this->nucleo->getConexion($this->db);
     $conexion->Execute("SET NAMES utf8");
     //Obtenemos las columnas
     $columnas = $conexion->MetaColumns($this->modelo);
     foreach ($columnas as $c) {
         if ($c->primary_key == 1) {
             $nombres_primarias[] = $c->name;
         }
     }
     $cen = false;
     foreach ($nombres_primarias as $p) {
         if ($cen) {
             $where .= " AND " . $p . "=" . $this->par[$p];
         } else {
             $where .= $p . "='" . $this->par[$p] . "'";
             $cen = true;
         }
     }
     $sql = "DELETE FROM " . $this->modelo . " WHERE {$where}";
     if ($conexion->Execute($sql)) {
         $this->set("mensaje", "El registro ha sido eliminado correctamente");
     } else {
         $this->set("mensaje", "El registro no puede ser eliminado ");
     }
     $this->set("vista", "listado");
     $this->listado();
 }
function smarty_function_componente($params, &$smarty)
{
    $nucleo = Nucleo::getInstancia();
    if ($params['c'] != "") {
        //llamar la ejecucion del modulo, mostrar salida y aplicar llamado
        $nucleo->ejecutar($params['c'], $params['p'], true, true);
    }
    return;
}
Esempio n. 3
0
<?php

include_once '../../includes.sys/ini.php';
include_once '../../includes.sys/metodos.php';
include_once '../DAO/NucleoDAO.php';
include_once '../Nucleo.class.php';
checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true');
include_once '../../head.php';
$acesso = listarAcesso();
if (!in_array(110, $acesso)) {
    echo '<script language= "JavaScript">location.href="' . EXTERNAL_ROOT_PORTAL . '/projeto/documentos/fase_projeto.php";</script>';
}
$DAO = new NucleoDAO();
$nucleo = new Nucleo();
//Verifica se foi executado a acao de salvar
if (!empty($_POST['cmd']) && $_POST['cmd'] == 'editar') {
    $id = limpaTexto($_POST['id']);
    $nucleo->setNome(limpaTexto($_POST['nome']));
    $nucleo->setCodigo(limpaTexto($_POST['codigo']));
    $nucleo->setId($id);
    $nome = $nucleo->getNome();
    if (preg_match("/[0-9]/", $nucleo->getCodigo())) {
        //Verifica se o nome esta em branco
        if ($nucleo->getNome() != "" && $nucleo->getCodigo() != "") {
            $retorno = $DAO->Atualizar($nucleo);
            if ($retorno == true) {
                echo '<script language= "JavaScript">alert("Registro alterado com sucesso");</script>';
                echo '<script language= "JavaScript">location.href="index.php";</script>';
            } else {
                echo $retorno . 'asdasd';
            }
Esempio n. 4
0
include_once 'afw/lib/error.class.php';
include_once 'afw/lib/enrutador.class.php';
include_once 'afw/lib/smarty/Smarty.class.php';
include_once 'afw/lib/smarty/SmartyAFW.class.php';
include_once 'afw/lib/adodb/adodb.inc.php';
include_once 'afw/lib/adodb/adodb-active-record.inc.php';
include_once 'afw/lib/libscaffold.class.php';
include_once 'afw/lib/componente.class.php';
include_once 'afw/lib/modelo.class.php';
include_once 'afw/nucleo.class.php';
include_once 'afw/lib/libsesion.class.php';
include_once 'afw/autoload.php';
spl_autoload_register("autoload");
//error_reporting (FATAL + ERROR);
ADODB_Active_Record::$_changeNames = false;
//Obtener la peticion
preg_match("/^.*index.php\\?([^?]*)\\?*(.*)\$/", $_SERVER['REQUEST_URI'], $url);
$url_index = $url[1];
if ($url[2]) {
    $url_index .= "&{$url['2']}";
}
$url_index = explode("&", $url_index);
if (count($url_index) != 0) {
    $peticion = $url_index[0];
} else {
    $peticion = $url_index;
}
$peticion = Enrutador::enrutar($peticion);
$nucleo = Nucleo::getInstancia();
$nucleo->ejecutar($peticion);
exit(0);
Esempio n. 5
0
<?php

include_once '../../includes.sys/ini.php';
include_once '../../includes.sys/metodos.php';
include_once '../DAO/NucleoDAO.php';
include_once '../Nucleo.class.php';
checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true');
include_once '../../head.php';
$acesso = listarAcesso();
if (!in_array(108, $acesso)) {
    echo '<script language= "JavaScript">location.href="' . EXTERNAL_ROOT_PORTAL . '/projeto/documentos/fase_projeto.php";</script>';
}
//Verifica se a opcao de salvar foi iniciada
if (!empty($_POST['cmd']) && $_POST['cmd'] == 'inserir') {
    $nucleo = new Nucleo();
    $DAO = new NucleoDAO();
    $nucleo->setNome(limpaTexto($_POST['nome']));
    $nucleo->setCodigo(strtoupper(limpaTexto($_POST['codigo'])));
    $nucleo->setUsuario(userId());
    //Verifica se o nome foi preenchido
    if (preg_match("/[0-9]/", $nucleo->getCodigo())) {
        if ($nucleo->getNome() != "" && $nucleo->getCodigo() != "") {
            $retorno = $DAO->Gravar($nucleo);
            if ($retorno == true) {
                echo '<script language= "JavaScript">alert("Registro cadastrado com sucesso");</script>';
                echo '<script language= "JavaScript">location.href="new.php";</script>';
            }
        } else {
            echo '<script language= "JavaScript">alert("Preencha o(s) campo(s)");</script>';
        }
    } else {
Esempio n. 6
0
 /**
  * Implementación de Singleton
  * Devuelve la instancia acutual del nucleo
  * Se usa para compatibilidad de modulos independientes en la plantilla
  *
  */
 public static function getInstancia()
 {
     if (!self::$instancia instanceof self) {
         self::$instancia = new self();
     }
     return self::$instancia;
 }