Exemplo n.º 1
0
 function getFields($table)
 {
     $folder = $this->db->name();
     require find_view(array($folder . '/templates/datatypes', 'templates/datatypes'));
     $table_fields = $this->db->getTableFields($table);
     $fields = array();
     for ($i = 0; $i < count($table_fields); $i++) {
         preg_match('/(.*)\\(.*\\).*$/', $table_fields[$i]->type, $matches);
         $fieldType = count($matches) > 1 ? $matches[1] : $table_fields[$i]->type;
         $dataType = isset($dataTypes[$fieldType]) ? $dataTypes[$fieldType]['type'] : '';
         if (isset($this->fieldTypes[$dataType]) && $this->fieldTypes[$dataType]) {
             $fields[] = $table_fields[$i]->name;
         }
     }
     return $fields;
 }
Exemplo n.º 2
0
/**
 * This file is a part of MyWebSQL package
 *
 * @file:      modules/infoserver.php
 * @author     Samnan ur Rehman
 * @copyright  (c) 2008-2014 Samnan ur Rehman
 * @web        http://mywebsql.net
 * @license    http://mywebsql.net/license
 */
function processRequest(&$db)
{
    if (!$db->hasServer()) {
        echo view('infoserverless', array());
        return;
    }
    if ($db->queryVariables()) {
        $folder = $db->name();
        include find_view(array($folder . '/templates/variables', 'templates/variables'));
        $vars = parseVariables($db);
        $replace = $vars + array('JS' => '');
        if (getDbName() == '') {
            // no database selected, hide menus that belong to a db only
            $replace['JS'] = 'parent.$("#main-menu").find(".db").hide();';
        }
        echo view(array($folder . '/infoserver', 'infoserver'), $replace);
    }
}
Exemplo n.º 3
0
function view($name, $replace = array(), $data = NULL)
{
    ob_start();
    include find_view($name);
    $file = ob_get_clean();
    if (count($replace) > 0) {
        $find = array();
        foreach ($replace as $key => $value) {
            $find[] = '{{' . $key . '}}';
        }
        $replace = array_values($replace);
        return str_replace($find, $replace, $file);
    }
    return $file;
}
Exemplo n.º 4
0
function find_view_and_layout()
{
    $view = find_view();
    $view_file = false;
    $layout_file = false;
    if ($view) {
        $view_file = $view[1];
        $layout_file = find_layout_file($view[0]);
        if ($layout_file) {
            array_unshift(App::$controller->view_path, $view[0]);
        }
    }
    if (!$layout_file) {
        foreach (App::$controller->view_path as $view_path) {
            $layout_file = find_layout_file($view_path);
            if ($layout_file) {
                break;
            }
        }
    }
    return array($view_file, $layout_file);
}