Exemplo n.º 1
0
include_once './inc/menubar.php';
$body->line('Executed query : <br />');
$body->line('<p class="qs">' . $sessie->getS('psa-query-results') . '<hr />');
$sessie->unsetS('psa-query-results');
$titles = FALSE;
if (!$res) {
    $body->line('no further feedback');
} else {
    $table = new Table();
    $table->setClas('result');
    $table->setId('listing');
    $table->build();
    $odd = TRUE;
    foreach ($res as $item) {
        if (!$titles) {
            $tr = new Th();
            $names = array_keys(get_object_vars($item));
            foreach ($names as $title) {
                $tr->add($title);
            }
            $tr->build();
            $titles = TRUE;
        }
        $tr = new Tr();
        if ($odd) {
            $tr->setGlobalClass('even');
            $odd = FALSE;
        } else {
            $tr->setGlobalClass('odd');
            $odd = TRUE;
        }
Exemplo n.º 2
0
$body = new Body();
$body->build();
include_once './inc/menubar.php';
if (!$res) {
    $body->line('no tables defined yet');
} else {
    foreach ($res as $item) {
        $body->line('<div class="schema"><h3>' . $item->name . '</h3>');
        $q_fields = "PRAGMA table_info('" . $item->name . "')";
        $sql->qo($q_fields);
        $res_fields = $sql->fo();
        $table = new Table();
        $table->setClas('result_schema');
        $table->setId('listing');
        $table->build();
        $th = new Th();
        $th->add('name');
        $th->add('type');
        $th->add('size');
        $th->add('null allowed');
        $th->add('default');
        $th->build();
        $odd = TRUE;
        foreach ($res_fields as $item_fields) {
            $pos = strpos($item_fields->type, '(');
            if (!$pos) {
                $type = $item_fields->type;
                $size = '-';
            } else {
                $type = substr($item_fields->type, 0, $pos);
                $size = substr($item_fields->type, $pos + 1, -1);
Exemplo n.º 3
0
 $body->line('<h3>Indexes</h3>');
 $idxadd = new Link();
 $idxadd->setHref('controller.php?cmd=index_add&table=' . $req->get('table'));
 $idxadd->setName('Add index');
 $idxadd->build();
 $body->line();
 $q = "PRAGMA index_list(" . $req->get('table') . ")";
 $sql->qo($q);
 $res = $sql->fo();
 if (!$res) {
     $body->line('No indexes defined<br>');
 } else {
     $table = new Table();
     $table->setClas('result');
     $table->build();
     $th = new Th();
     $th->add('Name');
     $th->add('Unique ?');
     $th->add('Columns');
     $th->add('&nbsp;');
     $th->build();
     foreach ($res as $item) {
         if ($item->unique == 1) {
             $uniq = 'Y';
         } else {
             $uniq = 'N';
         }
         $drop = new Link();
         $drop->setHref('controller.php?cmd=drop_idx&idxname=' . $item->name . '&table=' . $req->get('table'));
         $drop->setName('[ drop ]');
         $drop->setJs(' onclick="return PSA.really_drop(\' index [' . $item->name . ']\');" ');
Exemplo n.º 4
0
 $lastlink->build();
 $low = $sessie->getS('bottom') + 1;
 $high = $sessie->getS('bottom') + LIMIT;
 if ($high > $records) {
     $high = $records;
 }
 $body->line(' (total # of records : <b> ' . $records . '</b> -- showing <b>' . $low . '</b> till <b>' . $high . '</b>)<br />');
 $titles = FALSE;
 $table = new Table();
 $table->setClas('result');
 $table->setId('listing');
 $table->build();
 foreach ($res as $item) {
     /**/
     if (!$titles) {
         $tr = new Th();
         if (!$is_view) {
             $tr->add('edit');
             $tr->add('delete');
         }
         if (!$pk) {
             $tr->add('ROWID');
         }
         // $names = array_keys(get_object_vars($item));
         for ($i = 0; $i < sizeof($col); ++$i) {
             $tr->add($col[$i]);
         }
         $tr->build();
         $titles = TRUE;
     }
     /**/
Exemplo n.º 5
0
$name->setName('tblname');
$name->setSize(50);
$name->setMaxlength(128);
$name->setId('tblname');
$body->line('<span class="vet">Table name</span><br /> ');
$body->line($name->dump());
$create = new Link();
$create->setHref('controller.php?cmd=table_add_action');
$create->setName('<button>Create</button>');
$body->line($create->dump());
$body->line('<hr />');
$body->line('<span class="vet">Fields</span><br /> ');
$table = new Table();
$table->setClas('result');
$table->build();
$th = new Th();
$th->add('name');
$th->add('type');
$th->add('primary');
$th->add('size');
$th->add('null');
$th->add('default');
$th->build();
$colname = new Input();
$colname->setName('colname');
$colname->setSize(25);
$colname->setMaxlength(128);
$colname->setId('colname');
$coltype = new Select();
$coltype->setName('coltype');
$coltype->setSize(1);
Exemplo n.º 6
0
$cmd->build();
$submit->build();
unset($form);
$body->line('<hr />');
$psa = new PDO("sqlite:./data/base.sqlite");
$q = "SELECT * FROM queries ORDER BY datum DESC LIMIT 10";
$tps = $psa->prepare($q);
$tps->execute();
$res = $tps->fetchAll();
if (!$res) {
    $body->line('no queries found.');
} else {
    $table = new Table();
    $table->setClas('result');
    $table->build();
    $th = new Th();
    $th->add('database');
    $th->add('date - time');
    $th->add('query (click to copy in execution field)');
    $th->build();
    foreach ($res as $item) {
        $tr = new Tr();
        if ($item['fine'] == 0) {
            $tr->setGlobalClass('query_error');
            $tr->add($item['db']);
            $tr->add($item['datum']);
            $tr->add(str_repeat("&nbsp;", 2) . $item['qs']);
        } else {
            $tr->add($item['db']);
            $tr->add($item['datum']);
            $tr->add('<div class="qs">
Exemplo n.º 7
0
function set_log_out($id_log)
{
    if ($id_log > 0) {
        $sql = Th::getDb();
        $thtime = date("H:i:s");
        $query_rs_1 = "UPDATE  utenti_catalogo_log  SET ORA_OUT  = '" . $thtime . "'where ID='" . $id_log . "'";
        $sql->query($query_rs_1);
    }
}
Exemplo n.º 8
0
 /**
  * Prepares tr th html
  * 
  * @return string
  */
 protected function prepareHeaders()
 {
     $result = NULL;
     foreach ($this->getColumns() as $name) {
         if (count($this->visible_columns)) {
             if (!in_array($name, $this->visible_columns)) {
                 continue;
             }
         }
         $header = $this->getHeader($name);
         if ($header instanceof Column or $header instanceof Th) {
             $this->importFromColumn($header, $name);
             $result .= $header->render();
         } else {
             if ($column = $this->getColumn($name)) {
                 $column->setData($header);
                 $column->setHeader();
             } else {
                 $column = Th::create($header);
             }
             $result .= $column->render();
         }
     }
     return "<tr class='header'>{$result}</tr>\n";
 }