示例#1
0
 public function __construct($default = array())
 {
     parent::__construct($default);
     $this->_db = MFactory::getDBO();
     $this->_table = MiwosqlHelper::getVar('tbl');
     $this->_query = MiwosqlHelper::getVar('qry');
     $this->registerTask('add', 'edit');
     $this->registerTask('new', 'edit');
 }
示例#2
0
文件: edit.php 项目: vanie3/appland
 public function getFields()
 {
     $table = MiwosqlHelper::getVar('tbl');
     if (MiwosqlHelper::is30()) {
         $fields = $this->_db->getTableColumns($table);
     } else {
         $fields = $this->_db->getTableFields(array($table));
     }
     return $fields;
 }
示例#3
0
 public function delete($table)
 {
     $sql = MiwosqlHelper::getVar('qry');
     $key = MRequest::getString('key', null, 'get');
     if (!is_null($sql) && !is_null($key)) {
         $id = MRequest::getCmd('id', null, 'get');
         $this->_db->setQuery("DELETE FROM {$table} WHERE {$key} = '{$id}'");
         $this->_db->query();
         if (!empty($this->_db->_errorMsg)) {
             echo '<small style="color:red;">' . $this->_db->_errorMsg . '</small><br/>';
             return false;
         } else {
             return true;
         }
     }
 }
示例#4
0
 public function display($tpl = null)
 {
     $db = MFactory::getDbo();
     $task = MRequest::getCmd('task');
     $table = MiwosqlHelper::getVar('tbl');
     $query = MiwosqlHelper::getVar('qry');
     $id = MRequest::getInt('id', MRequest::getInt('id', null, 'post'), 'get');
     $key = MRequest::getCmd('key', MRequest::getCmd('key', null, 'post'), 'get');
     $document = MFactory::getDocument();
     $document->addStyleSheet(MURL_MIWOSQL . '/admin/assets/css/miwosql.css');
     // Toolbar
     MToolBarHelper::title(MText::_('MiwoSQL') . ': <small><small> ' . $table . ' [ ' . $key . ' = ' . $id . ' ]' . ' </small></small>', 'miwosql');
     MToolBarHelper::apply();
     MToolBarHelper::save();
     MToolBarHelper::divider();
     MToolBarHelper::cancel();
     if ($task == 'edit') {
         $fld_value = '$value = $this->rows[$this->id][$field];';
     } else {
         $fld_value = '$value = "";';
     }
     list($rows, $last_key_vol) = $this->get('Data');
     $this->task = $task;
     $this->id = $id;
     $this->key = $key;
     $this->table = $table;
     $this->query = $query;
     $this->fld_value = $fld_value;
     $this->last_key_vol = $last_key_vol;
     $this->rows = $rows;
     $fields = $this->get('Fields');
     if (!MiwosqlHelper::is30()) {
         $fields = $fields[$this->table];
     }
     $this->fields = $fields;
     parent::display($tpl);
 }
示例#5
0
?>
				</select>
				&nbsp; &nbsp;
				<?php 
echo MText::_('COM_MIWOSQL_RECORDS') . ': ';
?>
				<input class="text_area" type="text" size="3" id="ja_lim_p" name="ja_lim_p" value="<?php 
echo MRequest::getInt('ja_lim_p', 10, 'post');
?>
" style="width:30px;" onchange="changeQuery(this);">
		   </td>
		</tr>
		<tr>
			<td>
			   <textarea class="text_area" id="ja_qry_p" name="ja_qry_p" style="width:100%;height:70px;"><?php 
echo MiwosqlHelper::getVar('qry');
?>
</textarea>
			</td>
		</tr>
	</table>
	<?php 
echo $this->data;
?>
	
	<input type="hidden" name="option" value="com_miwosql" />
	<input type="hidden" name="controller" value="miwosql" />
	<input type="hidden" name="task" value="">
	
	<?php 
echo MHTML::_('form.token');