Exemple #1
0
 function display($tpl = null)
 {
     $config = $this->get('Data');
     $db = JFactory::getDbo();
     $lists['allow_public_user_submit_ticket'] = JHTML::_('select.booleanlist', 'allow_public_user_submit_ticket', '', $config->allow_public_user_submit_ticket);
     $lists['enable_attachment'] = JHTML::_('select.booleanlist', 'enable_attachment', '', $config->enable_attachment);
     $lists['send_ticket_attachments_to_email'] = JHTML::_('select.booleanlist', 'send_ticket_attachments_to_email', '', $config->send_ticket_attachments_to_email);
     $sql = 'SELECT id, title FROM #__helpdeskpro_statuses WHERE published=1 ORDER BY ordering';
     $db->setQuery($sql);
     $rowStatuses = $db->loadObjectList();
     $options = array();
     $options[] = JHtml::_('select.option', 0, JText::_('HDP_SELECT'), 'id', 'title');
     $options = array_merge($options, $db->loadObjectList());
     $lists['new_ticket_status_id'] = JHTML::_('select.genericlist', $options, 'new_ticket_status_id', array('option.text.toHtml' => false, 'option.text' => 'title', 'option.key' => 'id', 'list.attr' => 'class="inputbox" ', 'list.select' => $config->new_ticket_status_id));
     $options = array();
     $options[] = JHtml::_('select.option', 0, JText::_('HDP_DONOT_CHANGE'), 'id', 'title');
     $options = array_merge($options, $db->loadObjectList());
     $lists['ticket_status_when_customer_add_comment'] = JHTML::_('select.genericlist', $options, 'ticket_status_when_customer_add_comment', array('option.text.toHtml' => false, 'option.text' => 'title', 'option.key' => 'id', 'list.attr' => 'class="inputbox" ', 'list.select' => $config->ticket_status_when_customer_add_comment));
     $lists['ticket_status_when_admin_add_comment'] = JHTML::_('select.genericlist', $options, 'ticket_status_when_admin_add_comment', array('option.text.toHtml' => false, 'option.text' => 'title', 'option.key' => 'id', 'list.attr' => 'class="inputbox" ', 'list.select' => $config->ticket_status_when_admin_add_comment));
     $lists['closed_ticket_status'] = JHTML::_('select.genericlist', $options, 'closed_ticket_status', array('option.text.toHtml' => false, 'option.text' => 'title', 'option.key' => 'id', 'list.attr' => 'class="inputbox" ', 'list.select' => $config->closed_ticket_status));
     $options = array();
     $options[] = JHtml::_('select.option', 0, JText::_('HDP_SELECT'), 'id', 'title');
     $sql = 'SELECT id, title FROM #__helpdeskpro_priorities WHERE published=1 ORDER BY ordering';
     $db->setQuery($sql);
     $rowPriorities = $db->loadObjectList();
     $options = array_merge($options, $rowPriorities);
     $lists['default_ticket_priority_id'] = JHTML::_('select.genericlist', $options, 'default_ticket_priority_id', array('option.text.toHtml' => false, 'option.text' => 'title', 'option.key' => 'id', 'list.attr' => 'class="inputbox"" ', 'list.select' => $config->default_ticket_priority_id));
     $this->assignRef('lists', $lists);
     $this->assignRef('config', $config);
     parent::display($tpl);
 }
Exemple #2
0
 function display($tpl = null)
 {
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     $pathway = $app->getPathway();
     $state = $this->get('State');
     $items =& $this->get('Data');
     $pagination =& $this->get('Pagination');
     $this->state = $state;
     $lists = array();
     $lists['order_Dir'] = $state->filter_order_Dir;
     $lists['order'] = $state->filter_order;
     $lists['filter_state'] = JHTML::_('grid.state', $state->filter_state);
     $this->_buildListArray($lists, $state);
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $db =& JFactory::getDbo();
     $sql = 'SELECT title FROM #__helpdeskpro_categories WHERE id=' . $state->category_id;
     $db->setQuery($sql);
     $categoryTitle = $db->loadResult();
     if (isset($_GET['category_id'])) {
         $pathway->addItem($categoryTitle, '');
     }
     parent::display($tpl);
 }
Exemple #3
0
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $option = 'com_helpdeskpro';
     $lang = $mainframe->getUserStateFromRequest($option . 'language.lang', 'lang', 'en-GB', 'string');
     if (!$lang) {
         $lang = 'en-GB';
     }
     $search = $mainframe->getUserStateFromRequest($option . 'language.search', 'search', '', 'string');
     $search = JString::strtolower($search);
     $lists['search'] = $search;
     $item = JRequest::getVar('item', '');
     if (!$item) {
         $item = 'com_helpdeskpro';
     }
     $model =& $this->getModel('language');
     $trans = $model->getTrans($lang, $item);
     $languages = $model->getSiteLanguages();
     $options = array();
     $options[] = JHTML::_('select.option', '', JText::_('Select Language'));
     foreach ($languages as $language) {
         $options[] = JHTML::_('select.option', $language, $language);
     }
     $lists['lang'] = JHTML::_('select.genericlist', $options, 'lang', ' class="inputbox"  onchange="submit();" ', 'value', 'text', $lang);
     $options = array();
     $options[] = JHTML::_('select.option', '', JText::_('--Select Item--'));
     $options[] = JHTML::_('select.option', 'com_helpdeskpro', JText::_('Helpdesk Pro'));
     $lists['item'] = JHTML::_('select.genericlist', $options, 'item', ' class="inputbox"  onchange="submit();" ', 'value', 'text', $item);
     $this->assignRef('trans', $trans);
     $this->assignRef('lists', $lists);
     $this->assignRef('lang', $lang);
     $this->assignRef('item', $item);
     parent::display($tpl);
 }
Exemple #4
0
 function display($tpl = null)
 {
     $state = $this->get('State');
     $items =& $this->get('Data');
     $pagination =& $this->get('Pagination');
     $this->state = $state;
     $lists = array();
     $lists['order_Dir'] = $state->filter_order_Dir;
     $lists['order'] = $state->filter_order;
     $lists['filter_state'] = JHTML::_('grid.state', $state->filter_state);
     $this->_buildListArray($lists, $state);
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->_buildToolbar();
     parent::display($tpl);
 }
Exemple #5
0
 public function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $document->addStyleSheet(JURI::base() . 'components/com_falang/assets/css/falang.css');
     // Get data from the model
     $this->state = $this->get('State');
     // Are there messages to display ?
     $showMessage = false;
     $message = $this->get('message');
     if (is_object($this->state)) {
         $message1 = $this->state->get('message') == null ? $message : $this->state->get('message');
         $this->state->set('message', $message1);
         $message2 = $this->state->get('extension.message');
         $showMessage = $message1 || $message2;
     }
     $this->assign('showMessage', $showMessage);
     $this->assignRef('state', $this->state);
     JHTML::_('behavior.tooltip');
     parent::display($tpl);
     $this->versionInfo();
 }
Exemple #6
0
 function display($tpl = null)
 {
     $db =& JFactory::getDbo();
     $item = $this->get('Data');
     $lists = array();
     $lists['published'] = JHTML::_('select.booleanlist', 'published', ' class="inputbox" ', $item->published);
     if (isset($item->access)) {
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $lists['access'] = JHtml::_('access.level', 'access', $item->access, 'class="inputbox"', false);
         } else {
             $sql = 'SELECT id AS value, name AS text' . ' FROM #__groups' . ' ORDER BY id';
             $db->setQuery($sql);
             $groups = $db->loadObjectList();
             $lists['access'] = JHTML::_('select.genericlist', $groups, 'access', 'class="inputbox" ', 'value', 'text', $item->access);
         }
     }
     $this->_buildListArray($lists, $item);
     $this->assignRef('item', $item);
     $this->assignRef('lists', $lists);
     $this->_buildToolbar();
     parent::display($tpl);
 }
Exemple #7
0
 function _displayForm($tpl)
 {
     $db =& JFactory::getDbo();
     $user = JFactory::getUser();
     $config = HelpdeskProHelper::getConfig();
     $userId = $user->get('id');
     $Itemid = JRequest::getInt('Itemid', 0);
     if (!$userId && !$config->allow_public_user_submit_ticket) {
         //Redirect user to login page
         $return = JRoute::_('index.php?option=com_helpdeskpro&task=ticket.add&Itemid=' . $Itemid);
         JFactory::getApplication()->redirect('index.php?option=com_users&view=login&return=' . base64_encode($return), JText::_('HDP_LOGIN_TO_SUBMIT_TICKET'));
     }
     $db =& JFactory::getDBO();
     $sql = "SELECT id, parent_id, title FROM #__helpdeskpro_categories WHERE published=1 AND access IN (" . implode(',', $user->getAuthorisedViewLevels()) . ')';
     $db->setQuery($sql);
     $rows = $db->loadObjectList();
     $children = array();
     if ($rows) {
         // first pass - collect children
         foreach ($rows as $v) {
             $pt = $v->parent_id;
             $list = @$children[$pt] ? $children[$pt] : array();
             array_push($list, $v);
             $children[$pt] = $list;
         }
     }
     $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
     $options = array();
     $options[] = JHtml::_('select.option', 0, JText::_('HDP_CHOOSE_CATEGORY'));
     foreach ($list as $listItem) {
         $options[] = JHTML::_('select.option', $listItem->id, '   ' . $listItem->treename);
     }
     $options = array();
     $options[] = JHtml::_('select.option', 0, JText::_('HDP_CHOOSE_PRIORITY'), 'id', 'title');
     $sql = 'SELECT id, title FROM #__helpdeskpro_priorities WHERE published=1 ORDER BY ordering';
     $db->setQuery($sql);
     $rowPriorities = $db->loadObjectList();
     $options = array_merge($options, $rowPriorities);
     $lists['category_id'] = JHTML::_('select.genericlist', $options, 'category_id', array('option.text.toHtml' => false, 'option.text' => 'text', 'option.value' => 'value', 'list.attr' => 'class="inputbox" onchange="showFields(this.form);" ', 'list.select' => 0));
     $lists['priority_id'] = JHTML::_('select.genericlist', $options, 'priority_id', array('option.text.toHtml' => false, 'option.text' => 'title', 'option.key' => 'id', 'list.attr' => 'class="inputbox" ', 'list.select' => $config->default_ticket_priority_id));
     $categoryId = 0;
     $jcFields = new JCFields();
     if ($jcFields->getTotal()) {
         $customField = true;
         $fieldArray = JCFields::getAssoc();
         $fieldJs = "fields = new Array();\n";
         foreach ($fieldArray as $catId => $fieldList) {
             $fieldJs .= ' fields[' . $catId . '] = new Array("' . implode('","', $fieldList) . '");' . "\n";
         }
         $this->assign('fieldJs', $fieldJs);
         $fields = $jcFields->renderCustomFields($categoryId, $fieldArray);
         $validations = $jcFields->renderJSValidation();
         $this->assign('fields', $fields);
         $this->assign('validations', $validations);
     } else {
         $customField = false;
     }
     $this->assign('customField', $customField);
     $this->lists = $lists;
     $this->Itemid = $Itemid;
     $this->config = $config;
     $this->userId = $userId;
     $this->lists['category_id'] = $lists['category_id'];
     parent::display($tpl);
 }
Exemple #8
0
 /**
  * Replace callback function
  * 
  * @param array $matches
  */
 function _displayForm($matches)
 {
     $document = JFactory::getDocument();
     require_once JPATH_ROOT . '/components/com_helpdeskpro/helper/helper.php';
     require_once JPATH_ROOT . '/components/com_helpdeskpro/helper/fields.php';
     $db =& JFactory::getDbo();
     $user = JFactory::getUser();
     HelpdeskProHelper::loadLanguage();
     $document->addStyleSheet(JURI::base(true) . '/components/com_helpdeskpro/assets/css/style.css');
     if (version_compare(JVERSION, '3.0', 'lt')) {
         HelpdeskProHelper::loadBootstrap();
     }
     $config = HelpdeskProHelper::getConfig();
     $userId = $user->get('id');
     $Itemid = JRequest::getInt('Itemid', 0);
     if (!$userId && !$config->allow_public_user_submit_ticket) {
         //Redirect user to login page
         $return = JRoute::_('index.php?option=com_helpdeskpro&task=ticket.add&Itemid=' . $Itemid);
         JFactory::getApplication()->redirect('index.php?option=com_users&view=login&return=' . base64_encode($return), JText::_('HDP_LOGIN_TO_SUBMIT_TICKET'));
     }
     //Initialize the view object
     $viewConfig = array();
     $viewConfig['name'] = 'form';
     $viewConfig['base_path'] = JPATH_ROOT . '/plugins/content/helpdeskpro';
     $viewConfig['template_path'] = JPATH_ROOT . '/plugins/content/helpdeskpro/tmpl';
     $viewConfig['layout'] = 'form';
     require_once JPATH_ROOT . '/administrator/components/com_helpdeskpro/legacy/view.php';
     $jView = new LegacyView($viewConfig);
     $db =& JFactory::getDBO();
     $sql = "SELECT id, parent_id, title FROM #__helpdeskpro_categories WHERE published=1 AND access IN (" . implode(',', $user->getAuthorisedViewLevels()) . ')';
     $db->setQuery($sql);
     $rows = $db->loadObjectList();
     $children = array();
     if ($rows) {
         // first pass - collect children
         foreach ($rows as $v) {
             $pt = $v->parent_id;
             $list = @$children[$pt] ? $children[$pt] : array();
             array_push($list, $v);
             $children[$pt] = $list;
         }
     }
     $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
     $options = array();
     $options[] = JHtml::_('select.option', 0, JText::_('HDP_CHOOSE_CATEGORY'));
     foreach ($list as $listItem) {
         $options[] = JHTML::_('select.option', $listItem->id, '   ' . $listItem->treename);
     }
     $lists['category_id'] = JHTML::_('select.genericlist', $options, 'category_id', array('option.text.toHtml' => false, 'option.text' => 'text', 'option.value' => 'value', 'list.attr' => 'class="inputbox" onchange="showFields(this.form);" ', 'list.select' => 0));
     $options = array();
     $options[] = JHtml::_('select.option', 0, JText::_('HDP_CHOOSE_PRIORITY'), 'id', 'title');
     $sql = 'SELECT id, title FROM #__helpdeskpro_priorities WHERE published=1 ORDER BY ordering';
     $db->setQuery($sql);
     $rowPriorities = $db->loadObjectList();
     $options = array_merge($options, $rowPriorities);
     $lists['priority_id'] = JHTML::_('select.genericlist', $options, 'priority_id', array('option.text.toHtml' => false, 'option.text' => 'title', 'option.key' => 'id', 'list.attr' => 'class="inputbox" ', 'list.select' => $config->default_ticket_priority_id));
     $categoryId = 0;
     $jcFields = new JCFields();
     if ($jcFields->getTotal()) {
         $customField = true;
         $fieldArray = JCFields::getAssoc();
         $fieldJs = "fields = new Array();\n";
         foreach ($fieldArray as $catId => $fieldList) {
             $fieldJs .= ' fields[' . $catId . '] = new Array("' . implode('","', $fieldList) . '");' . "\n";
         }
         $jView->fieldJs = $fieldJs;
         $fields = $jcFields->renderCustomFields($categoryId, $fieldArray);
         $validations = $jcFields->renderJSValidation();
         $jView->fields = $fields;
         $jView->validations = $validations;
     } else {
         $customField = false;
     }
     $jView->assign('customField', $customField);
     $jView->lists = $lists;
     $jView->Itemid = $Itemid;
     $jView->config = $config;
     $jView->userId = $userId;
     ob_start();
     $jView->display();
     $text = ob_get_contents();
     ob_end_clean();
     return $text;
 }