Exemple #1
0
 public function render($variables, $templates)
 {
     //helpers
     $html = new HTML();
     $form = new Form();
     //opening the varibales
     extract($variables);
     //rendering the header
     global $mainController;
     $mainController = lowCase($mainController);
     //if there is a special header for the class
     if (file_exists(APP_VIEWS_LIB . $mainController . '/header.php')) {
         include_once APP_VIEWS_LIB . $mainController . '/header.php';
     } else {
         include_once APP_VIEWS_LIB . 'header.php';
     }
     //rendering all the templates
     foreach ($templates as $arrays) {
         foreach ($arrays as $controller => $action) {
             $controller = lowCase($controller);
             $action = lowCase($action);
             if (file_exists(APP_VIEWS_LIB . $controller . DS . $action . '.php')) {
                 include_once APP_VIEWS_LIB . $controller . DS . $action . '.php';
             }
         }
     }
     //rendering the footer
     include_once APP_VIEWS_LIB . 'footer.php';
 }
Exemple #2
0
 /**
  * @todo PUT IT TO CRUD GENERATIONG CLASS 
  **/
 public function read()
 {
     // feldolgozó tömb ami tartalmazza a megfelelő elemeket $this->data ;
     $this->data = $this->describe();
     $this->key = '';
     foreach ($this->data as $fields) {
         foreach ($fields as $property => $value) {
             $property = lowCase($property);
             if ($property == 'field') {
                 $this->fields = array_push($this->fields, $value);
                 if (lowCase($value) == 'id') {
                     $this->key = $value;
                 } else {
                     $name = $value;
                 }
             } elseif ($property == 'type') {
                 $type = 'text';
             } elseif (!$this->key and $property == 'key') {
                 $this->key = $fields['Field'];
             }
         }
     }
     $query = 'SELECT ' . $fields . 'FROM ' . $this->_table . ' WHERE ' . $condition . ' ' . $join . $groupBy . $orderBy . $having;
 }
Exemple #3
0
/**
 * __autoload()
 * 
 * @param mixed $className
 * @return
 */
function __autoload($className)
{
    global $numOfClasses, $classes;
    $numOfClasses++;
    $classes = $classes . ' - ' . $className;
    $className = lowCase($className);
    if (file_exists(CORE_LIB . $className . '.php')) {
        include_once CORE_LIB . $className . '.php';
        return true;
    } elseif (file_exists(CONTROLLERS_LIB . $className . '.php')) {
        include_once CONTROLLERS_LIB . $className . '.php';
        return true;
    } elseif (file_exists(MODELS_LIB . $className . '.php')) {
        include_once MODELS_LIB . $className . '.php';
        return true;
    } elseif (file_exists(VIEWS_LIB . $className . '.php')) {
        include_once VIEWS_LIB . $className . '.php';
        return true;
    } elseif (file_exists(APP_CONTROLLERS_LIB . $className . '.php')) {
        include_once APP_CONTROLLERS_LIB . $className . '.php';
        return true;
    } elseif (file_exists(APP_MODELS_LIB . $className . '.php')) {
        include_once APP_MODELS_LIB . $className . '.php';
        return true;
    } else {
        /** MAKE A LOG HERE **/
        return false;
    }
}
Exemple #4
0
 public function setQuery($type, $conditions = null, $orderBy = null, $groupBy = null, $having = null, $limit = null)
 {
     $type = lowCase($type);
     switch ($type) {
         case 'create':
             $table = $this->_table;
             $fields = self::makingFieldsList();
             $values = $this->data;
             $data = compact('table', 'fields', 'values');
             break;
         case 'read':
             $fields = self::makingFieldsList();
             $table = self::makingFrom();
             if (self::makingWhere($field, $value)) {
                 $where = ' WHERE ' . self::makingWhere($conditions);
             } else {
                 $where = '';
             }
             $data = compact('fields', 'table', 'where');
             break;
         case 'update':
             break;
         case 'delete':
             $table = $this->_table;
             $where = ' WHERE ' . self::makingWhere($conditions, 0);
             $data = compact('table', 'where');
             break;
     }
     $this->_query = self::renderSqlStatement($type, $data);
     return $this;
 }