Skip to content

Commit

Permalink
Refactorizar codigo
Browse files Browse the repository at this point in the history
  • Loading branch information
Luraguse committed Mar 9, 2013
1 parent c01de3a commit ac348b8
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 481 deletions.
1 change: 0 additions & 1 deletion application/models/career.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class Career extends Model {
protected $has_many = array("news", "videos");
protected $has_one = array("main_pic");


function __construct() {
parent::__construct();
}
Expand Down
File renamed without changes.
20 changes: 0 additions & 20 deletions library/bootstrap.php

This file was deleted.

3 changes: 1 addition & 2 deletions library/combinararchivos.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,4 @@ protected function getFile() {
}
return $this->getRutaArchivo();
}
}
?>
}
14 changes: 1 addition & 13 deletions library/combinarcss.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,6 @@ private function array_de_variables($id_template, $id_cliente) {
* @return string Regresa el link al css.
*/
public function regresarCss() {
/*
if(file_exists($this->_ruta_para_archivo)) {
if ($this->_fecha_de_modificacion_archivo < $this->_fecha_modificacion_template) {
$this->guardar_archivo($this->_ruta_para_archivo, $this->parse_archivos($this->_lista_de_archivos, $this->_array_de_valores));
}
} else {
$this->guardar_archivo($this->_ruta_para_archivo, $this->parse_archivos($this->_lista_de_archivos, $this->_array_de_valores));
}
return "<a href='".$this->_ruta_para_archivo."'>CSS Creado</a>";
*/
return $this->getFile();
}
}

?>
}
13 changes: 1 addition & 12 deletions library/combinarjs.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,5 @@ function __construct() {

public function regresarJs() {
return $this->getFile();
/*
if(file_exists($this->_ruta_para_archivo)) {
if($this->comparar_fechas_de_modificacion($this->_lista_de_archivos, $this->_ruta_para_archivo)) {
$this->guardar_archivo($this->_ruta_para_archivo, $this->combinar_contenido_de_archivos($this->_lista_de_archivos));
}
} else {
$this->guardar_archivo($this->_ruta_para_archivo, $this->combinar_contenido_de_archivos($this->_lista_de_archivos));
}
return $this->_ruta_para_archivo;
*/
}
}
?>
}
2 changes: 1 addition & 1 deletion library/connection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Connection{

private $connection;

public function __construct($DB_TYPE, $DB_HOST, $DB_NAME, $DB_USER, $DB_PASS) {
public function __construct($DB_TYPE = "mysql", $DB_HOST = DB_HOST, $DB_NAME = DB_NAME, $DB_USER = DB_USER, $DB_PASS = DB_PASSWORD) {
$this->connect($DB_TYPE, $DB_HOST, $DB_NAME, $DB_USER, $DB_PASS);
}

Expand Down
22 changes: 11 additions & 11 deletions library/controller.class.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
<?php
class Controller {
protected $_controller;
protected $_action;
protected $_template;
protected $_model;
protected $controller;
protected $action;
protected $template;
protected $model;

public $doNotRenderHeader;
public $render;

function __construct($controller, $action) {
$this->_controller = ucfirst($controller);
$this->_action = $action;
$this->controller = ucfirst($controller);
$this->action = $action;

$model = ucfirst($controller);
$this->doNotRenderHeader = 0;
$this->render = 1;
$this->_model = new $model();
$this->_template = new Template($controller, $action);
$this->model = new $model();
$this->template = new Template($controller, $action);
}

public function Buscar() {
return $this->_model->Buscar();
return $this->model->Buscar();
}

function set($name, $value) {
$this->_template->set($name,$value);
$this->template->set($name,$value);
}

function __destruct() {
if($this->render) {
$this->_template->render($this->doNotRenderHeader);
$this->template->render($this->doNotRenderHeader);
}
}
}
9 changes: 2 additions & 7 deletions library/database.class.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<?php

class Database extends PDO {

public function __construct($DB_TYPE, $DB_HOST, $DB_NAME, $DB_USER, $DB_PASS) {
parent::__construct($DB_TYPE.':host='.$DB_HOST.';dbname='.$DB_NAME, $DB_USER, $DB_PASS);
parent::setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
class DataBase {

}
2 changes: 0 additions & 2 deletions library/html.class.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php

class HTML {
private $js = array();
public $CombinarJs;

function shortenUrls($data) {
$data = preg_replace_callback('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', array(get_class($this), '_fetchTinyUrl'), $data);
Expand Down
12 changes: 6 additions & 6 deletions library/model.class.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
class Model {
protected $_model;
protected $ModelName;
protected $Buscar;

public $Sanitize = array();
public $Validate = array();
public $_jsFiles;
public $jsFiles;
public $CombinarJs;

function __construct() {
//$this->buscar = new SQLQuery(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$this->Connection = new Connection( $DB_TYPE = "mysql", $DB_HOST = DB_HOST, $DB_NAME = DB_NAME, $DB_USER = DB_USER, $DB_PASS = DB_PASSWORD);
$this->Buscar = new Busqueda($this->Connection, strtolower(get_class($this)));
$this->_model = get_class($this);
$this->ModelName = get_class($this);
$this->Connection = new Connection();
$this->Buscar = new Busqueda($this->Connection, strtolower($this->ModelName));
$this->DataBase = new DataBase($this->Connection, strtolower($this->ModelName));
}

public function Buscar() {
Expand Down
Loading

0 comments on commit ac348b8

Please sign in to comment.