Exemple #1
0
 /**
  * Bookmark actions
  */
 public function actionShowBookmark()
 {
     $id = Yii::app()->getRequest()->getParam('id');
     $bookmark = Yii::app()->user->settings->get('bookmarks', 'database', $this->schema, 'id', $id);
     $query = Yii::app()->getRequest()->getParam('query');
     $browsePage = new BrowsePage();
     $browsePage->schema = $this->schema;
     $browsePage->db = $this->db;
     $browsePage->query = !$query ? $bookmark['query'] : $query;
     $browsePage->route = 'schema/' . $this->schema . '/bookmark/show/' . $id;
     $browsePage->formTarget = 'schema/' . $this->schema . '/bookmark/show/' . $id;
     $browsePage->execute = true;
     $browsePage->run();
     $this->render('../global/browse', array('model' => $browsePage));
 }
Exemple #2
0
 public function actionSearch()
 {
     $operatorConfig = array('LIKE' => array('needsValue' => true), 'NOT LIKE' => array('needsValue' => true), '=' => array('needsValue' => true), '!=' => array('needsValue' => true), 'REGEXP' => array('needsValue' => "?"), 'NOT REGEXP' => array('needsValue' => "?"), 'IS NULL' => array('needsValue' => false), 'IS NOT NULL' => array('needsValue' => false));
     $operators = array_keys($operatorConfig);
     $config = array_values($operatorConfig);
     Row::$db = $this->db;
     Row::$schema = $this->schema;
     Row::$table = $this->table;
     $row = new Row();
     $commandBuilder = $this->db->getCommandBuilder();
     if (isset($_POST['Row'])) {
         $criteria = new CDbCriteria();
         $i = 0;
         foreach ($_POST['Row'] as $column => $value) {
             $operator = $operators[$_POST['operator'][$column]];
             if (strlen($value) > 0) {
                 $criteria->condition .= ($i > 0 ? ' AND ' : ' ') . $this->db->quoteColumnName($column) . ' ' . $operator . ' ' . $this->db->quoteValue($value);
                 $i++;
             } elseif (isset($_POST['operator'][$column]) && $config[$_POST['operator'][$column]]['needsValue'] === false) {
                 $criteria->condition .= ($i > 0 ? ' AND ' : ' ') . $this->db->quoteColumnName($column) . ' ' . $operator;
                 $i++;
             }
         }
         $query = $this->db->getCommandBuilder()->createFindCommand($this->table, $criteria)->getText();
     } elseif (isset($_POST['query'])) {
         $query = $_POST['query'];
     }
     if (isset($query)) {
         $browsePage = new BrowsePage();
         $browsePage->schema = $this->schema;
         $browsePage->table = $this->table;
         $browsePage->db = $this->db;
         $browsePage->route = 'schema/' . $this->schema . '/tables/' . $this->table . '/browse';
         $browsePage->formTarget = 'schema/' . $this->schema . '/tables/' . $this->table . '/sql';
         $browsePage->execute = true;
         $browsePage->query = $query;
         $browsePage->run();
         $this->render('../global/browse', array('model' => $browsePage));
     } else {
         $this->render('../table/search', array('row' => $row, 'operators' => $operators));
     }
 }
Exemple #3
0
<?php

require "md5base.php";
$page = new BrowsePage();
$entries = $page->BrowseValues();
require "head.php";
?>
	<div id="contentdiv">
		<div id="browse">
		<h1>Browse entries</h1>
		<table>
		<tr><td class="aright" colspan="3"><div class="pagenumbers"><?php 
echo $page->getPageNumbers('first');
echo $page->getPageNumbers('middle');
echo $page->getPageNumbers('last');
?>
</div></td></tr>
		</table>
		<table>
		<tr class="table_heading"><?php 
echo $page->tableSortHeading();
?>
</tr>
			<?php 
for ($i = 0; $i < count($entries); $i++) {
    $datetmp = explode('-', $entries[$i]->getDate());
    $date = $datetmp[2] . '.' . $datetmp[1] . '.' . $datetmp[0];
    if ($i % 2 == 0) {
        $class = ' class="altrow"';
        $classb = ' class="altrow_rec_border"';
    } else {