public function getInput() { $app = JFactory::getApplication(); $model = JModelLegacy::getInstance('Form', 'CobaltModel'); $type = $model->getRecordType($app->input->getInt('type_id')); if (!$this->value) { $value = array(); } else { $value = json_decode($this->value, 1); if (empty($value)) { $value = $this->value; } } if (!is_array($value) && !empty($value)) { $value = explode(',', $this->value); } ArrayHelper::clean_r($value); $default = array(); foreach ($value as $tag) { $default[$tag] = $tag; } /*$query = $db->getQuery(true); $query->select('tag'); $query->from('#__js_res_tags'); $query->order('tag ASC'); $db->setQuery($query); $list = $db->loadColumn(); */ $this->params = new JRegistry(); $options['coma_separate'] = 0; $options['only_values'] = 0; $options['min_length'] = 1; $options['max_result'] = 10; $options['case_sensitive'] = 0; $options['unique'] = 1; $options['highlight'] = 1; $options['max_width'] = $this->params->get('params.max_width', 500); $options['min_width'] = $this->params->get('params.min_width', 400); $options['max_items'] = $type->params->get('general.item_tags_max', 25); $options['ajax_url'] = 'index.php?option=com_cobalt&task=ajax.tags_list&tmpl=component'; $options['ajax_data'] = ''; return JHtml::_('mrelements.listautocomplete', "jform[tags]", "tags", $default, NULL, $options); }
protected function getGroups() { static $groups = array(); static $nums = 0; if (empty($groups)) { $db = JFactory::getDBO(); $query = "SELECT sp.id AS value,\n\t\t\t\t\t\t sp.name AS text,\n\t\t\t\t\t\t sp.group_id,\n\t\t\t\t\t\t g.name AS cat_title\n\t\t\t\t FROM #__jcs_plans AS sp\n\t\t\t LEFT JOIN #__jcs_groups AS g ON g.id = sp.group_id\n\t\t\t \t WHERE sp.published = 1\n\t\t\t\tORDER BY g.id, sp.name"; $db->setQuery($query); $plans = $db->loadObjectList(); ArrayHelper::clean_r($plans); foreach ($plans as $plan) { $groups[$plan->cat_title][] = JHtml::_('select.option', $plan->value, $plan->text, 'value', 'text'); $nums++; } $nums += count($groups); $groups = array_merge(parent::getGroups(), $groups); } $this->num = $nums; ArrayHelper::clean_r($groups); return $groups; }
/** * Cobalt by MintJoomla * a component for Joomla! 1.7 - 2.5 CMS (http://www.joomla.org) * Author Website: http://www.mintjoomla.com/ * @copyright Copyright (C) 2012 MintJoomla (http://www.mintjoomla.com). All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html */ defined('_JEXEC') or die('Restricted access'); $document = JFactory::getDocument(); $document->addStyleDeclaration(' .catselect{ width:' . $params->get('select_width') . 'px; } '); $levels = explode("\r\n", $params->get('levels')); ArrayHelper::clean_r($levels); $max_level = count($levels); ?> <script type="text/javascript"> var max_level = <?php echo $max_level; ?> ; !(function($){ }).jQuery; function redirectToCategory(cat_id) {
function onContentSearch($text, $phrase = '', $ordering = '', $areas = null) { $out = array(); $text = trim($text); if ($text == '') { return $out; } $db = JFactory::getDbo(); $app = JFactory::getApplication(); $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); $tag = JFactory::getLanguage()->getTag(); require_once JPATH_SITE . '/components/com_cobalt/library/php/helpers/helper.php'; require_once JPATH_SITE . '/components/com_content/helpers/route.php'; require_once JPATH_SITE . '/administrator/components/com_search/helpers/search.php'; $searchText = $text; $intersect = array_keys($this->onContentSearchAreas()); if (is_array($areas)) { $intersect = array_intersect($areas, array_keys($this->onContentSearchAreas())); } if (!$intersect) { return $out; } JArrayHelper::toInteger($intersect); $sArchived = $this->params->get('search_archived', 1); $limit = $this->params->def('search_limit', 50); $nullDate = $db->getNullDate(); $date = JFactory::getDate(); $now = $date->toSql(); $query = $db->getQuery(TRUE); $query->select('*'); $query->from('#__js_res_record'); $query->where('published = 1'); $query->where('section_id IN (' . implode(',', $intersect) . ')'); $search_mode = NULL; $scount = explode(" ", $text); ArrayHelper::clean_r($scount); $search = $db->quote($db->escape($text)); if (count($scount) > 2) { $search_mode = ' IN NATURAL LANGUAGE MODE'; foreach ($scount as $word) { if (in_array(substr($word, 0, 1), array('+', '-'))) { $search_mode = ' IN BOOLEAN MODE'; break; } } $query->where("MATCH (fieldsdata) AGAINST ({$search}{$search_mode})"); } elseif (count($scount) == 1) { $query->where("fieldsdata LIKE '%{$text}%'"); } //$query->select("MATCH (fieldsdata) AGAINST ({$search}{$search_mode}) AS searchresult"); if ($app->isSite() && $app->getLanguageFilter()) { $query->where('langs IN (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')'); } switch ($ordering) { case 'oldest': $order = 'ctime ASC'; break; case 'popular': $order = 'hits DESC'; break; case 'alpha': $order = 'title ASC'; break; case 'category': $order = 'title ASC'; break; case 'newest': default: $order = 'ctime DESC'; } $query->order($order); //echo $query; $db->setQuery($query, 0, $limit); $result = $db->loadObjectList(); settype($result, 'array'); $out = array(); foreach ($result as $key => $record) { $out[$key] = new stdClass(); $out[$key]->title = $record->title; $out[$key]->text = $record->fieldsdata; $out[$key]->created = $record->ctime; $out[$key]->href = Url::record($record); $areas = $this->onContentSearchAreas(); $out[$key]->section = $areas[$record->section_id . '_section']; $out[$key]->browsernav = 0; } return $out; }