function getNice()
 {
     if ($this->config['source']['type'] == 'table' && isset($this->config['source']['name'])) {
         global $thinkedit;
         $config = new config();
         //$table = $thinkedit->newTable($this->config['source']['name']);
         //
         //$source->filter('id', '=', $this->getRaw());
         $source_table = $this->config['source']['name'];
         $title_fields = $config->getTitleFields($source_table);
         require_once 'query.class.php';
         $query = new query();
         $query->addTable($this->config['source']['name']);
         $query->addWhere('id', '=', $this->getRaw());
         $results = $query->select();
         if (count($results) > 0) {
             foreach ($config->getTitleFields($source_table) as $field) {
                 $out .= $results[0][$field] . ' ';
             }
             return $out;
         } else {
             return $this->getRaw();
         }
     } else {
         return $this->getRaw();
     }
 }
예제 #2
0
<?php

require_once '../thinkedit.init.php';
require_once '../class/query.class.php';
$query = new query();
$query->addTable('roles');
$query->addWhere('id', '=', 5);
echo $query->getSelectQuery();
echo '<hr>';
$query->addValue("id", "5 and the like's");
$query->addValue("role", "john");
echo $query->getInsertQuery();