protected function view($nome, $vars = null) { debug(__FILE__); if (is_array($vars) && count($vars) > 0) { extract($vars, EXTR_PREFIX_ALL, 'telas'); } debugDentro(' >> carregando: ' . TELAS . $nome . '.phtml'); require_once TELAS . $nome . '.phtml'; }
public function read($where = null, $limit = null, $offset = null, $orderby = null) { debug(__FILE__ . '[' . __FUNCTION__ . ']'); debugDentro(' >> tabela >> ' . $this->_tabela); $limit = $limit != null ? "LIMIT {$limit}" : ""; $offset = $offset != null ? "OFFSET {$offset}" : ""; $orderby = $orderby != null ? "ORDER BY {$orderby}" : ""; //$q = $this->db->query("SELECT * FROM {$this->_tabela} {$where} "); $sql = "SELECT * FROM {$this->_tabela} {$where} {$orderby} {$limit} {$offset}"; debugDentro($sql); $q = $this->db->query($sql); $q->setFetchMode(PDO::FETCH_ASSOC); return $q->fetchAll(); }
function __autoload($file) { $sem = ""; $encontrouUm = FALSE; if (file_exists(TABELAS . $file . '.php')) { debugDentro('> carregando tabela: ' . TABELAS . $file . '.php'); $encontrouUm = TRUE; require_once TABELAS . $file . '.php'; } else { $sem = "Tabela "; } if (file_exists(HELPERS . $file . '.php')) { debugDentro('> carregando helper: ' . HELPERS . $file . '.php'); $encontrouUm = TRUE; require_once HELPERS . $file . '.php'; } else { $sem = "Helper "; } if (!$encontrouUm && $sem != "") { die($sem . "não encontrado! " . $file . '.php'); } }
public function run() { debug(__FILE__ . '[' . __FUNCTION__ . ']'); $controller_path = CONTROLADORES . $this->_controller . 'Controlador.php'; if (!file_exists($controller_path)) { die('Houve um erro. O controlador [' . $controller_path . '] não existe. =( '); } require_once $controller_path; $app = new $this->_controller(); debugDentro('>> carregando controller: [' . $this->_controller . ']'); if (!method_exists($app, $this->_action)) { die('Houve um erro. A ação [' . $this->_action . '] não existe. =( '); } debugDentro('>> carregando controller: [' . CONTROLADORES . $this->_controller . 'Controlador.php]'); $action = $this->_action; debugDentro('>> carregando init da action: [' . $this->_action . ']'); $app->init(); debugDentro('>> carregando action: [' . $this->_controller . "." . $this->_action . ']'); $app->{$action}(); debugDentro('>> carregando: ' . CONTROLADORES . $this->_controller . 'Controlador.php'); }