Ejemplo n.º 1
0
 function component_generate($args, $output = "text")
 {
     // Only return this data when run from the commandline
     if ($output == "commandline") {
         $ret = "[not found]";
         if (!empty($args["model"])) {
             $data = DataManager::singleton();
             $model = new ORMModel($args["model"]);
             $ret = $model->Generate();
         }
     } else {
         $ret = "";
     }
     return $ret;
 }
Ejemplo n.º 2
0
 public function getPageById($id)
 {
     $id = $this->data->clearArray($id);
     if (!empty($id)) {
         $_val = 'menu.alias';
         if ($this->data->clearInt($id) > 0) {
             $_val = 'content.id';
         }
         $id = $this->ORM->quote($id);
         $sql = "SELECT content.id, name,alias_content,tizer,description,price,\r\n\t\t\t\timg, parent_content,date_content, public_content, alias, link, public_menu \r\n\t\t\t\tFROM content LEFT OUTER JOIN menu \r\n\t\t\t\tON content.id = menu.id_content WHERE {$_val}={$id} AND content.public_content='1' limit 1";
         $row = $this->ORM->getQueryDB($sql);
         if (!empty($row)) {
             $row_sub = ORMModel::for_table('content')->id()->name()->alias_content()->tizer()->description()->price()->img()->parent_content()->date_content()->public_content()->where('parent_content', '=', $row['id'])->and_where('public_content', '=', '1')->arbitrary("ORDER BY id ASC")->selectDB();
             $row['blog'] = '';
         }
         if (!empty($row_sub)) {
             $row['blog'] = $row_sub;
         }
         return $row;
     } else {
         return false;
     }
 }
Ejemplo n.º 3
0
 public function insertDB($table = '')
 {
     $fields = '';
     $values = '';
     if (empty($table)) {
         $table = self::$_table;
         self::$_table = '';
     }
     if (!empty($this->_val)) {
         $fields = implode(", ", array_keys($this->_val));
         $values = implode(", ", array_values($this->_val));
         $this->_val = '';
     }
     $sql = "INSERT INTO {$table} ({$fields}) VALUES ({$values})";
     $row = $this->setQueryDB($sql);
     return $row;
 }