Пример #1
0
 function display($tmpl = null)
 {
     $document = JFactory::getDocument();
     $document->addScript(JURI::root() . 'media' . DS . 'com_jmm' . DS . 'js' . DS . 'jquery-1.7.2.min.js');
     $document->addScript(JURI::root() . 'media' . DS . 'com_jmm' . DS . 'js' . DS . 'export.js');
     $action = JRequest::getString('action', '');
     $limit = JRequest::getInt('limit', 15);
     $limitstart = JRequest::getInt('limitstart', 0);
     $pagination = '&limit=' . $limit . '&limitstart=' . $limitstart;
     $filter_order = JRequest::getString('filter_order', null);
     $filter_order_Dir = JRequest::getString('filter_order_Dir', null);
     if (isset($filter_order) && isset($filter_order_Dir)) {
         $pagination .= '&filter_order=' . $filter_order . '&filter_order_Dir=' . $filter_order_Dir;
     }
     $tbl = JRequest::getString('tbl');
     $filter_browsetable = JRequest::getVar('filter_browsetable', '');
     if (isset($_REQUEST['dbname'])) {
         $dbname = JRequest::getVar('dbname');
         $urlString = '&dbname=' . $dbname;
     } else {
         $urlString = '';
     }
     if ($filter_browsetable != '') {
         JFactory::getApplication()->redirect('index.php?option=com_jmm&view=tables&action=browse&tbl=' . $filter_browsetable . $urlString . $pagination, 'Table Data of ' . $filter_browsetable);
     }
     $filter_tablestructure = JRequest::getVar('filter_tablestructure');
     if ($filter_tablestructure != '') {
         JFactory::getApplication()->redirect('index.php?option=com_jmm&view=tables&action=structure&tbl=' . $filter_tablestructure . $urlString, 'Table Structure of ' . $filter_tablestructure);
     }
     $filter_chnagedatabase = JRequest::getVar('filter_chnagedatabase', '');
     if ($filter_chnagedatabase != '') {
         JFactory::getApplication()->redirect('index.php?option=com_jmm&view=tables&dbname=' . $filter_chnagedatabase, 'Database Switched to  ' . $filter_chnagedatabase);
     }
     switch ($action) {
         case 'structure':
             $this->items = JMMCommon::showTableStructure($tbl);
             JFactory::getApplication()->enqueueMessage('Table Structure of ' . $tbl, 'message');
             break;
         case 'browse':
             $this->items = $this->get('Items');
             JFactory::getApplication()->enqueueMessage('Table Data of ' . $tbl, 'message');
             break;
         default:
             $this->items = JMMCommon::showTableLists();
             JFactory::getApplication()->enqueueMessage('Table Lists', 'message');
             break;
     }
     $this->tables = $this->get('Tables');
     $this->databases = $this->get('Databases');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->addToolbar();
     parent::display($tmpl);
 }
Пример #2
0
 public function getInput()
 {
     $table = JRequest::getVar('tbl');
     $dbname = JRequest::getVar('dbname');
     $tableFields = JMMCommon::showTableStructure($table);
     for ($i = 0; $i < count($tableFields); $i++) {
         $field = $tableFields[$i];
         $tmp = explode('(', $field['Type']);
         $name = $field['Field'];
         $type = $tmp[0];
         $length = (int) str_replace(')', '', $tmp[1]);
         $length += 1;
         $id = 'jform_' . $name;
         $label_name = ucwords($name) . ' (' . $type . ')';
         $label_id = 'jform_' . $name . '-lbl';
         $this->drawForm("jform[{$name}]", $type, $id, $label_name, $label_id, $length);
     }
     return $this->formData;
 }