public function display($tpl = null) { $document = MFactory::getDocument(); $document->addStyleSheet(MURL_MIWOSQL . '/admin/assets/css/miwosql.css'); // Toolbar MToolBarHelper::title(MText::_('MiwoSQL') . ' - ' . MText::_('COM_MIWOSQL_RUN_QUERY'), 'miwosql'); if (MiwosqlHelper::is30()) { MToolBarHelper::custom('run', 'play.png', 'play.png', MText::_('COM_MIWOSQL_RUN_QUERY'), false); MToolBarHelper::divider(); MToolBarHelper::custom('savequery', 'folder-close.png', 'folder-close.png', MText::_('COM_MIWOSQL_SAVE_QUERY'), false); MToolBarHelper::divider(); MToolBarHelper::custom('csv', 'upload.png', 'upload.png', MText::_('COM_MIWOSQL_EXPORT_CSV'), false); } else { MToolBarHelper::custom('run', 'run.png', 'run.png', MText::_('COM_MIWOSQL_RUN_QUERY'), false); MToolBarHelper::divider(); MToolBarHelper::custom('savequery', 'savequery.png', 'savequery.png', MText::_('COM_MIWOSQL_SAVE_QUERY'), false); MToolBarHelper::divider(); MToolBarHelper::custom('csv', 'csv.png', 'csv.png', MText::_('COM_MIWOSQL_EXPORT_CSV'), false); } // ACL if (version_compare(MVERSION, '1.6.0', 'ge') && MFactory::getUser()->authorise('core.admin', 'com_miwosql')) { MToolBarHelper::divider(); MToolBarHelper::preferences('com_miwosql', '550'); } $this->data = $this->get('Data'); $this->tables = $this->get('Tables'); $this->prefix = $this->get('Prefix'); parent::display($tpl); }
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'); }
public function getFields() { $table = MiwosqlHelper::getVar('tbl'); if (MiwosqlHelper::is30()) { $fields = $this->_db->getTableColumns($table); } else { $fields = $this->_db->getTableFields(array($table)); } return $fields; }
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; } } }
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); }
?> </select> <?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');
<?php /** * @package MiwoSQL * @copyright 2009-2012 Mijosoft LLC, www.mijosoft.com * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html */ // No Permission defined('MIWI') or die('Restricted access'); $views = array('&controller=miwosql' => MText::_('COM_MIWOSQL_RUN_QUERY'), '&controller=queries' => MText::_('COM_MIWOSQL_SAVED_QUERIES')); if (!class_exists('JSubMenuHelper')) { return; } require_once MPATH_COMPONENT . '/helpers/helper.php'; MHTML::_('behavior.switcher'); if (MRequest::getInt('hidemainmenu') != 1) { JSubMenuHelper::addEntry(MText::_('COM_MIWOSQL_RUN_QUERY'), 'index.php?option=com_miwosql', MiwosqlHelper::isActiveSubMenu('query')); JSubMenuHelper::addEntry(MText::_('COM_MIWOSQL_SAVED_QUERIES'), 'index.php?option=com_miwosql&controller=queries', MiwosqlHelper::isActiveSubMenu('queries')); }
</td> <td width="80%"> <?php if ($this->key == $field && $this->task == 'edit') { echo $this->id . MiwosqlHelper::renderHtml($field, 'hidden', $this->id) . ' [ ' . $type . ' ]'; } else { if ($this->key == $field && $this->task == 'new') { if (is_numeric($this->last_key_vol)) { $value = $this->last_key_vol + 1; } else { $value = $this->last_key_vol . '_1'; } } else { eval($this->fld_value); } echo MiwosqlHelper::renderHtml($field, $type, $value) . ' [ ' . $type . ' ]'; } ?> </td> </tr> <?php $k = 1 - $k; } ?> </table> <input type="hidden" name="option" value="com_miwosql" /> <input type="hidden" name="controller" value="edit" /> <input type="hidden" name="task" value=""> <input type="hidden" name="id" value="<?php echo $this->id;