/** * Build an SQL query to load the list data. * * @return JDatabaseQuery * @since 1.6 */ protected function getListQuery() { // Create a new query object. $db = $this->getDbo(); $input = jFactory::getApplication()->input; $query = $db->getQuery(true); // Select the required fields from the table. $query->select($this->getState('list.select', 'a.*')); $query->from('`#__tjfields_fields` AS a'); // Join over the user field 'created_by' $query->select('created_by.name AS created_by'); $query->join('LEFT', '#__users AS created_by ON created_by.id = a.created_by'); $query->where('a.client="' . $input->get('client', '', 'STRING') . '"'); // Filter by published state $published = $this->getState('filter.state'); if (is_numeric($published)) { $query->where('a.state = ' . (int) $published); } else { if ($published === '') { $query->where('(a.state IN (0, 1))'); } } // Filter by search in title $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('a.id = ' . (int) substr($search, 3)); } else { $search = $db->Quote('%' . $db->escape($search, true) . '%'); $query->where('( a.type LIKE ' . $search . ' )'); } } //Filtering field_type $filter_field_type = $this->state->get("filter.type"); if ($filter_field_type) { $query->where("a.type = '" . $db->escape($filter_field_type) . "'"); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering'); $orderDirn = $this->state->get('list.direction'); if ($orderCol && $orderDirn) { $query->order($db->escape($orderCol . ' ' . $orderDirn)); } //print $query; die; return $query; }
<?php /** * * @package Bookpro * @author Ngo Van Quan * @link http://joombooking.com * @copyright Copyright (C) 2011 - 2012 Ngo Van Quan * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html * @version $Id$ **/ /** * Display agent menu in front end */ defined('_JEXEC') or die('Direct Access to this location is not allowed.'); $input = jFactory::getApplication()->input; $menuItem = $input->getString('view'); if ($menuItem == 'mypage') { $menuItem = $input->getString('form'); } $customer = JBFactory::getAccount(); ?> <div class="row-fluid"> <div class="span12"> <div class="lead span4"> <i class="icon-cogs" style="padding-top: 2px;"></i>   <?php switch ($menuItem) { case 'agentorders': echo JText::_('COM_BOOKPRO_ORDER'); break;
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/tjfields.php'; $state = $this->get('State'); $canDo = TjfieldsHelper::getActions($state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_TJFIELDS_TITLE_FIELDS'), 'fields.png'); //Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/field'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('field.add', 'JTOOLBAR_NEW'); } /* if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('field.edit','JTOOLBAR_EDIT'); }*/ } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('fields.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('fields.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } else { if (isset($this->items[0])) { //If this component does not use state then show a direct delete button as we can not trash JToolBarHelper::deleteList('', 'fields.delete', 'JTOOLBAR_DELETE'); } } /* if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::archiveList('fields.archive','JTOOLBAR_ARCHIVE'); }*/ if (isset($this->items[0]->checked_out)) { JToolBarHelper::custom('fields.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true); } } //Show trash and delete for components that uses the state field if (isset($this->items[0]->state)) { if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'fields.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } else { if ($canDo->get('core.edit.state')) { JToolBarHelper::trash('fields.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_tjfields'); } $input = jFactory::getApplication()->input; $this->extra_sidebar = ''; //Filter for the field field_type $select_label = JText::sprintf('COM_TJFIELDS_FILTER_SELECT_LABEL', 'Field Type'); $options = array(); $options[0] = new stdClass(); $options[0]->value = "text"; $options[0]->text = "Text"; $options[1] = new stdClass(); $options[1]->value = "radio"; $options[1]->text = "Radio"; $options[2] = new stdClass(); $options[2]->value = "single_select"; $options[2]->text = "Single select"; $options[3] = new stdClass(); $options[3]->value = "multi_select"; $options[3]->text = "Multiple select"; $options[4] = new stdClass(); $options[4]->value = "hidden"; $options[4]->text = "Hidden"; $options[5] = new stdClass(); $options[5]->value = "textarea"; $options[5]->text = "Textarea"; $options[6] = new stdClass(); $options[6]->value = "checkbox"; $options[6]->text = "Checkbox"; $options[7] = new stdClass(); $options[7]->value = "calender"; $options[7]->text = "Calender"; $options[8] = new stdClass(); $options[8]->value = "editor"; $options[8]->text = "Editor"; $options[9] = new stdClass(); $options[9]->value = "email_field"; $options[9]->text = "Email"; $options[10] = new stdClass(); $options[10]->value = "password"; $options[10]->text = "Password"; $options[11] = new stdClass(); $options[11]->value = "file"; $options[11]->text = "File"; if (JVERSION >= '3.0') { //Set sidebar action - New in 3.0 JHtmlSidebar::setAction('index.php?option=com_tjfields&view=fields&client="' . $input->get('client', '', 'STRING') . '"'); JHtmlSidebar::addFilter($select_label, 'filter_field_type', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.type'), true)); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true)); } }
public function runScript() { $this->checkDemo(); $input = jFactory::getApplication()->input; $script = $_POST['script']; JFactory::getApplication()->enqueueMessage($script, 'Script'); $result = eval($script); if ($result === false) { JFactory::getApplication()->enqueueMessage('error', 'error'); } else { JFactory::getApplication()->enqueueMessage('success'); $this->write_log(JPATH_ROOT . '/logs/jb_script.txt', PHP_EOL . $script); } $this->debugScript($script); }