Файловый менеджер - Редактировать - /home/lmsyaran/public_html/pusher/reservation.zip
Назад
PK wV�[��_�� � reservation.phpnu �[��� <?php /** * ------------------------------------------------------------------------ * JA Filter Plugin - Reservationcat * ------------------------------------------------------------------------ * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved. * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html * Author: J.O.O.M Solutions Co., Ltd * Websites: http://www.joomlart.com - http://www.joomlancers.com * This file may not be redistributed in whole or significant part. * ------------------------------------------------------------------------ */ // no direct access defined('_JEXEC') or die ('Restricted access'); // Initiate class to hold plugin events class plgJamegafilterReservation extends JPlugin { // Some params var $pluginName = 'jamegafilterreservation'; function __construct( &$subject, $params) { parent::__construct($subject, $params); } function onBeforeSaveReservationItems( &$params ) { require_once __DIR__ . '/helper.php'; $helper = new ReservationFilterHelper($params); $order = $params['filterfields']['filter_order']['order']; foreach ($order as $key => $value) { if (!$helper->checkPublished($key)) { unset($order[$key]); } } $custom_order = $this->getCustomOrdering($helper, $order); $params['filterfields']['filter_order']['custom_order'] = $custom_order; } function onAfterSaveReservationItems($item) { require_once (__DIR__.'/helper.php'); $params = $item->params; $helper = new ReservationFilterHelper($params); $objectList = $helper->getFilterItems($params['reservationcat']); return $objectList; } function onBeforeDisplayReservationItems( $jstemplate, $filter_config, $item ) { $this->jstemplate = $jstemplate; $this->config = $filter_config; $this->item = $item; $input = JFactory::getApplication()->input; $jalayout = $input->get('jalayout', 'default'); $path = JPluginHelper::getLayoutPath('jamegafilter', 'reservation', $jalayout); ob_start(); include $path; $output = ob_get_clean(); echo $output; } function getCustomOrdering($helper, $config ) { $ordering = array(); foreach ($config as $key => $value) { if ($key === 'attr.cat.value') { $catid = $helper->_params->get('reservationcat', 0); $catid = $catid ? $catid : 1; $childOrder = 'rgt ASC'; switch ($value) { case 'name_asc': $childOrder = 'title ASC'; break; case 'name_desc': $childOrder = 'title DESC'; break; case 'ordering_asc': $childOrder = 'rgt ASC'; break; case 'ordering_desc': $childOrder = 'rgt DESC'; break; } $catList = $helper->getCatList($catid, $childOrder); $catList = array_map(function ($id) { return (string) $id; }, $catList); $ordering[$key] = $catList; continue; } // if (!in_array($value, array('ordering_asc', 'ordering_desc'))) { // continue; // } // preg_match('/ct(\d+)/', $key, $matches); // if (!count($matches)) { // continue; // } // $id = +$matches[1]; // $db = JFactory::getDbo(); // $query = "SELECT `fieldparams` // FROM `#__fields` // WHERE id = $id // AND state = 1"; // $row = $db->setQuery($query)->loadResult(); // $params = new JRegistry($row); // $options = (array) $params->get('options'); // $fieldOrder = array(); // foreach ($options as $opt) { // $fieldOrder[] = $opt->value; // } // if ($value === 'ordering_desc') { // $fieldOrder = array_reverse($fieldOrder); // } // $ordering[$key] = $fieldOrder; } return $ordering; } }PK wV�[�#o, , index.htmlnu �[��� <html><body bgcolor="#FFFFFF"></body></html>PK wV�[bkaU�j �j helper.phpnu �[��� <?php /** * ------------------------------------------------------------------------ * JA Filter Plugin - Content * ------------------------------------------------------------------------ * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved. * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html * Author: J.O.O.M Solutions Co., Ltd * Websites: http://www.joomlart.com - http://www.joomlancers.com * This file may not be redistributed in whole or significant part. * ------------------------------------------------------------------------ */ defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\Language\LanguageHelper; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; JLoader::register('BaseFilterHelper', JPATH_ADMINISTRATOR .'/components/com_jamegafilter/base.php'); JLoader::register('ReservationHelperRoute', JPATH_ROOT .'/components/com_reservation/helpers/route.php'); class ReservationFilterHelper extends BaseFilterHelper { public function __construct($params = array()) { $this->_db = JFactory::getDbo(); $this->_params = new JRegistry($params); $this->plugin = JPluginHelper::getPlugin('jamegafilter', 'reservation'); $this->plgParams = new JRegistry($this->plugin); $this->plgParams->loadString($this->plugin->params); return parent::__construct($params); } public function getFilterItems($catid) { $filterItems = array(); $lang_sfx = $this->getLangSuffix(); foreach ($lang_sfx AS $lang) { $filterItems[strtolower(str_replace('-','_',$lang))] = $this->getItemList($catid,$lang); } return $filterItems; } public function getLangSuffix() { # $langs = JFactory::getLanguage()->getKnownLanguages(); $langs = LanguageHelper::getKnownLanguages(); $lang_sfx = array(); foreach ($langs as $lang) { $lang_sfx[] = $lang['tag']; } return $lang_sfx; } public function getCatList($catid, $ordering = 'rgt ASC') { $catid = $catid ? $catid : '1'; $catList = array(); $include_root = $this->_params->get('include_root', self::INCLUDE_ROOT); $subcat = $this->_params->get('subcat', self::ALL); if ($include_root === self::INCLUDE_ROOT && $catid !== '1') { $catList[] = $catid; } if ($subcat !== self::NONE) { $maxLevel = $subcat === self::ALL ? 100 : (int) $subcat; $categories = $this->getChildCategories($catid, $maxLevel, 0, $ordering); foreach ($categories as $category) { $catList[] = $category->id; } } return $catList; } public function getItemList($catid, $lang) { $catList = $this->getCatList($catid); if (!count($catList)) { return array(); } $itemList = new stdCLass(); # wrong data here $itemIdList = $this->getListId($catList, $lang); if ($itemIdList) { foreach ($itemIdList as $id) { $property = 'item_'.$id; $item = $this->getItem($id, $catList, $lang); if( !empty($item)) $itemList->{ $property } = $item; else continue; } } return $itemList; } public function getListId($catids, $lang) { $db = $this->_db; $nullDate = $db->quote($db->getNullDate()); $nowDate = $db->quote(JFactory::getDate()->toSql()); $query = $db->getQuery(true); $query->select('id') ->from('#__reservation_consultant') ->where('state = 1 AND catid IN (' .implode(',', $catids) . ') AND language IN ("*", "'.$lang.'")' ) ->where('(publish_up = ' . $nullDate . ' OR publish_up <= ' . $nowDate . ')') ->order('id desc'); # ->where('(publish_down = ' . $nullDate . ' OR publish_down >= ' . $nowDate . ')') // between where and order # select id from oektv_content where state=1 AND catid IN (2,8,9) AND language IN ("*", "en-GB") # AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= '2022-01-11 04:10:15') # AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= '2022-01-11 04:10:15') ORDER BY id DESC; $db->setQuery($query); $listId = $db->loadColumn(); return $listId; } public function getCategoryListInfo($catList) { if (version_compare(JVERSION, '3.7', '<')) return; $cdata = array(); $cdata['value'] = array(); $cdata['frontend_value'] = array(); $query = $this->_db->getQuery(true); $query ->select('c.*') ->from('#__categories as c') ->where('c.id in (' . implode(',', $catList) . ')') ->where('c.published = 1'); $this->_db->setQuery($query); $categories = $this->_db->loadObjectList(); foreach ($categories as $cat) { $cdata['value'][] = $cat->id; $cdata['frontend_value'][] = $this->getCatNameAsTree($cat); } return $cdata; } public function getItem($id, $catList, $lang) { $app = JFactory::getApplication(); $baseItem = $this->getBaseItem($id); $baseItem->text = $baseItem->introtext . $baseItem->fulltext; // Process the content plugins. JPluginHelper::importPlugin('content'); $dispatcher = JFactory::getApplication(); if (isset($baseItem->params)){ $dispatcher->triggerEvent('onContentPrepare', array ('com_content.article', &$baseItem, &$baseItem->params, 0)); } $images = new JRegistry($baseItem->images); $item = new stdCLass(); if (in_array($baseItem->language, array('*', $lang))) { $item->id = $id; $item->slug = $id; $item->lang = $lang; $item->hits = (int) $baseItem->hits; $item->name = $baseItem->title; $img = $images->get('image_intro', $images->get('image_fulltext', '')); if (strpos($img, '#joomlaImage:')){ $img = explode('#joomlaImage:', $img)[0]; } $item->thumbnail = $this->generateThumb($id, $img, 'content'); $juri = JUri::getInstance(); if (preg_match('/^\/\//', $item->thumbnail)) { $item->thumbnail = $juri->getScheme().':'.$item->thumbnail; } if ($this->checkDisplayOnFO('desc')) { $text = trim($baseItem->text); $item->desc = $text ? $this->getDesc($text) : ''; if (preg_match('/<img src="[^http|\/]/', $item->desc)) { // change to right link with custom field media. basic use. will be update change later. $item->desc = preg_replace('/<img src="([^http|\/].*?)"/', '<img src="'.JUri::root(true).'/$1"', $item->desc); } } //Item link $slug = $baseItem->alias ? ($baseItem->id . ':' . $baseItem->alias) : $baseItem->id; $catslug = isset($baseItem->category_alias) ? ($baseItem->catid . ':' . $baseItem->category_alias) : $baseItem->catid; $route = ContentHelperRoute::getArticleRoute($slug, $catslug, $item->lang); $uriLeng = mb_strlen(JUri::root(true)); $item->url = mb_substr(JRoute::_($route), $uriLeng); $item->attr = array(); if ($this->checkDisplayOnFO('name')) { $item->attr['name']['frontend_value'] = $item->name ?? ''; $fieldconfig = $this->getFieldConfig('name'); $item->attr['name']['title'] = array($fieldconfig['title']); $item->attr['name']['type'] = $fieldconfig['type']; } //Ratings if ($this->checkPublished('rating') || $this->checkDisplayOnFO('rating')) { $item->rating = $this->getRating($id) ? $this->getRating($id) : 0; $item->width_rating = $item->rating * 20; $item->attr['rating']['frontend_value'] = $item->width_rating; $item->attr['rating']['rating'] = floatval($item->rating); $fieldconfig = $this->getFieldConfig('rating'); $item->attr['rating']['title'] = array($fieldconfig['title']); $item->attr['rating']['type'] = $fieldconfig['type']; } if ($this->checkDisplayOnFO('hits')) { $item->attr['hits']['frontend_value'] = $item->hits ?? ''; $fieldconfig = $this->getFieldConfig('hits'); $item->attr['hits']['title'] = array($fieldconfig['title']); $item->attr['hits']['type'] = $fieldconfig['type']; } # print_r($item->desc); if ($this->checkPublished('attr.fulltext.value') || $this->checkDisplayOnFO('attr.fulltext.value')) { $item->attr['fulltext']['frontend_value'] = $item->desc ?? ''; $item->attr['fulltext']['value'] = strip_tags($baseItem->text); $fieldconfig = $this->getFieldConfig('attr.fulltext.value'); $item->attr['fulltext']['title'] = array($fieldconfig['title']); $item->attr['fulltext']['type'] = $fieldconfig['type']; } $featured = $baseItem->featured; $item->featured = $featured; // this value for custom use on FO like icon or something if ($this->checkDisplayOnFO('attr.featured.value') || $this->checkPublished('attr.featured.value')) { $item->attr['featured']['value'] = array($featured); $item->attr['featured']['frontend_value'] = $featured ? array(JText::_('COM_JAMEGAFILTER_ONLY_FEATURED')) : array(JText::_('COM_JAMEGAFILTER_NOT_FEATURED')); $fieldconfig = $this->getFieldConfig('attr.featured.value'); $item->attr['featured']['title'] = array($fieldconfig['title']); $item->attr['featured']['type'] = $fieldconfig['type']; } if ($baseItem->created != '0000-00-00 00:00:00') { if ($this->checkPublished('created_date')) { $item->created_date = array( strtotime($baseItem->created) ); } if ($this->checkDisplayOnFO('created_date')) { $item->attr['created_date']['frontend_value'] = array( strtotime($baseItem->created) ); $fieldconfig = $this->getFieldConfig('created_date'); $item->attr['created_date']['title'] = array($fieldconfig['title']); $item->attr['created_date']['type'] = $fieldconfig['type']; } } if ($baseItem->modified != '0000-00-00 00:00:00') { if ($this->checkPublished('modified_date')) { $item->modified_date = array( strtotime($baseItem->modified) ); } if ($this->checkDisplayOnFO('modified_date')) { $item->attr['modified_date']['frontend_value'] = array( strtotime($baseItem->modified) ); $fieldconfig = $this->getFieldConfig('modified_date'); $item->attr['modified_date']['title'] = array($fieldconfig['title']); $item->attr['modified_date']['type'] = $fieldconfig['type']; } } if ($baseItem->publish_up != '0000-00-00 00:00:00') { if ($this->checkPublished('published_date')) { $item->published_date = array( strtotime($baseItem->publish_up) ); } if ($this->checkDisplayOnFO('published_date')) { $item->attr['published_date']['frontend_value'] = array( strtotime($baseItem->publish_up) ); $fieldconfig = $this->getFieldConfig('published_date'); $item->attr['published_date']['title'] = array($fieldconfig['title']); $item->attr['published_date']['type'] = $fieldconfig['type']; } } //Attributes $this->attr = array(); $this->getAuthorInfo($baseItem); //Category Info $this->getCategoryInfo($id, $catList); //Tag Info if (!empty($baseItem->tags->tags)) $this->getTagInfo($baseItem->tags->tags, $lang); //Custom fields $this->getCustomFieldsInfo($id, $lang); $item->access = $this->getPermission($baseItem); $item->attr = array_merge($item->attr, $this->attr); // support user custom field, only parse to json if template required. if (JFile::exists(JPATH_SITE.'/templates/'.$app->getTemplate().'/etc/jamegafilter-ucf.log')) $item->ucf = $this->getCustomJFields($baseItem->created_by, "user"); // support ja content type if (isset($baseItem->attribs['ctm_reservation_type']) && !empty($baseItem->attribs['ctm_'.$baseItem->attribs['ctm_reservation_type']])) { $item->{"cmt_".$baseItem->attribs['ctm_reservation_type']} = $baseItem->attribs['ctm_'.$baseItem->attribs['ctm_reservation_type']]; } } return $item; } public function getPermission($item) { $sql = 'SELECT rules FROM #__viewlevels WHERE id = '.$this->_db->quote($item->access); $this->_db->setQuery($sql); $access = $this->_db->loadResult(); if (!empty($access)) return str_replace(['[', ']'], ['', ''],$access); } public function getDesc($desc) { $length = 20; $desc = strip_tags($desc); $exp = explode(' ', $desc); $result = ''; foreach ($exp as $key => $value) { if ($key > $length) { break; } $result .= $value . ' '; } return $result; } public function getRating($itemId){ $rateOption = $this->plgParams->get('rating-option', 'com_reservation'); if($rateOption === 'com_content'){ $query = $this->_db->getQuery(true); $query->select('rating_sum, rating_count')->from('#__content_rating')->where('content_id = ' . (int) $itemId); $this->_db->setQuery($query); $rating = $this->_db->loadObject(); if (!$rating){ return false; } return round((int) $rating->rating_sum / (int) $rating->rating_count, 0); } if (!$this->getComponentStatus('com_komento')){ return false; } $query1[] = 'SELECT ax.`component`, ax.`cid`, count(1) AS `count`, sum(ax.`ratings`) AS `totalRating`, ROUND(AVG(ax.`ratings`)/2,2) AS `avgRating`'; $query1[] = 'FROM `#__komento_comments` AS `ax`'; $query1[] = 'WHERE ax.`published` = ' . $this->_db->Quote(1); // display the posts that have ratings given $query1[] = 'AND ax.`ratings` > 0'; $query1[] = 'AND ax.`cid` = ' . $this->_db->Quote($itemId); $query1[] = 'AND ax.`created` = '; $query1[] = '(SELECT MAX(bx.`created`) FROM `#__komento_comments` AS `bx`'; $query1[] = 'WHERE bx.`email` = ax.`email`'; $query1[] = 'AND bx.`component` = ax.`component`'; $query1[] = 'AND bx.`cid` = ax.`cid`'; $query1[] = ')'; $query1[] = "AND ax.`component` = " . $this->_db->quote('com_content'); $query1[] = "GROUP BY ax.`cid`"; $query1 = implode(' ', $query1); $this->_db->setQuery($query1); $data = $this->_db->loadObject(); if (!$data){ return false; } return isset($data) && !is_null($data) ? $data->avgRating : 0; } public function getComponentStatus($component) { $db = JFactory::getDbo(); $q = 'select enabled from #__extensions where type="component" and element = "'.$component.'"'; $db->setQuery($q); $status = $db->loadResult(); if($status) { return true; } else { return false; } } public function getBaseItem($id) { JModelLegacy::addIncludePath(JPATH_ROOT . '/administrator/components/com_content/models', 'ContentModel'); if (version_compare(JVERSION, '4.0', 'ge')) $model = new Joomla\Component\Content\Administrator\Model\ArticleModel(); else $model = JModelLegacy::getInstance('Article', 'ContentModel'); $baseItem = $model->getItem($id); return $baseItem; } public function getAuthorInfo($baseItem) { $data = array(); if ($baseItem->created_by_alias) { $data['value'][] = urlencode($baseItem->created_by_alias); $data['frontend_value'][] = $baseItem->created_by_alias; } else if ($baseItem->created_by) { $query = $this->_db->getQuery(true); $query->select('*') ->from('#__users') ->where('id = ' . $baseItem->created_by); $user = $this->_db->setQuery($query)->loadObject(); if ($user) { $data['value'][] = $baseItem->created_by; $data['frontend_value'][] = $user->name; } } if (!$data) { return; } if ($this->checkPublished('attr.author.value') || $this->checkDisplayOnFO('attr.author.value')) { $this->attr['author'] = $data; $this->attr['author']['frontend_value'] = $data['frontend_value']; $fieldconfig = $this->getFieldConfig('attr.author.value'); $this->attr['author']['title'] = array($fieldconfig['title']); $this->attr['author']['type'] = $fieldconfig['type']; } } public function getCategoryInfo($article_id, $catList) { if (version_compare(JVERSION, '3.7', '<')) return; $query = $this->_db->getQuery(true); $query ->select('c.*') ->from('#__categories as c') ->join('LEFT', '#__content as a ON a.catid = c.id') ->where('a.id = ' . (int) $article_id) ->where('c.id in (' . implode(',', $catList) . ')') ->where('c.published = 1'); $this->_db->setQuery($query); $category = $this->_db->loadObject(); if ($category) { $categories = $this->getParentCategories($category->id, $catList); $cats = array(); foreach ($categories as $key => $cat) { $tmp = new stdClass; $tmp->id = $cat->id; $tmp->title = $cat->title; $rest = array_slice($categories, $key + 1); foreach ($rest as $c) { $tmp->title = $c->title . ' » ' . $tmp->title; } $cats[] = $tmp; } $cdata = array(); $cdata['value'] = array(); $cdata['frontend_value'] = array(); foreach ($cats as $cat) { if (in_array($cat->id, $cdata['value'])) { continue; } $cdata['value'][] = $cat->id; $cdata['frontend_value'][] = $cat->title; } if ($this->checkPublished('attr.cat.value') || $this->checkDisplayOnFO('attr.cat.value')) { $this->attr['cat'] = $cdata; $this->attr['cat']['frontend_value'] = $cdata['frontend_value']; $fieldconfig = $this->getFieldConfig('attr.cat.value'); $this->attr['cat']['title'] = array($fieldconfig['title']); $this->attr['cat']['type'] = $fieldconfig['type']; } } return $this->attr; } public function getParentCategories($catid, $catList) { $db = $this->_db; $parents = array(); while (true) { $query = "SELECT * FROM `#__categories` WHERE id = $catid AND level > 0"; $result = $db->setQuery($query)->loadObject(); if ($result && in_array($result->id, $catList)) { $parents[] = $result; $catid = $result->parent_id; } else { break; } } return $parents; } public function getCatNameAsTree($cat, $catList) { if (!in_array($cat->parent_id, $catList)) { return $cat->title; } $query = $this->_db->getQuery(true); $query->select('*') ->from('#__categories') ->where('id = ' . $cat->parent_id . ' and level > 0'); $this->_db->setQuery($query); $result = $this->_db->loadObject(); if ($result) { $result->title = $result->title . ' » ' . $cat->title; return $this->getCatNameAsTree($result, $catList); } else { return $cat->title; } } public function getCustomJFields($id, $context) { if ($context == 'article') $context = 'com_content.article'; else if ($context == 'contact') $context = 'com_contact.contact'; else if ($context == 'user') $context = 'com_users.user'; $currentLanguage = JFactory::getLanguage(); $currentTag = $currentLanguage->getTag(); $sql = 'SELECT fv.value, fg.title AS gtitle, f.title AS ftitle, f.name FROM #__fields_values fv LEFT JOIN #__fields f ON fv.field_id = f.id LEFT JOIN #__fields_groups fg ON fg.id = f.group_id WHERE fv.item_id = '.$id.' AND f.context = "'.$context.'" AND f.language IN ("*", "'.$currentTag.'") AND f.access = 1 '; // echo $sql; $db = JFactory::getDbo(); $db->setQuery($sql); $result = $db->loadObjectList(); $arr = array(); foreach ($result AS $r) { $arr[$r->name] = $r->value; } return $arr; } public function getCustomFieldsInfo($itemId, $lang) { if (version_compare(JVERSION, '3.7', '<')) return; $query = $this->_db->getQuery(true); $query->select('f.id, f.title , fv.value, f.type, f.fieldparams, f.params') ->from('#__fields as f') ->join('LEFT', '#__fields_values as fv ON fv.field_id = f.id') ->join('LEFT', '#__content as c ON fv.item_id = c.id') ->where('c.id = '. (int) $itemId); $this->_db->setQuery($query); $fields = $this->_db->loadObjectList(); if ($fields) { $fdata = array(); foreach ($fields as $field) { if (empty($field->value)) { continue; } switch ($field->type) { case 'text': case 'editor' : case 'textarea' : if (empty($fdata['ct'.$field->id]['value'])) $fdata['ct'.$field->id]['value'] = ""; $fdata['ct'.$field->id]['value'] .= $field->value; $fdata['ct'.$field->id]['frontend_value'] = $field->value; break; case 'url' : if (empty($fdata['ct'.$field->id]['value'])) $fdata['ct'.$field->id]['value'] = ""; $fdata['ct'.$field->id]['value'] .= $field->value; $fdata['ct'.$field->id]['frontend_value'] = '<a target="_blank" href="'.$field->value.'">'.$field->value.'</a>'; break; case 'calendar' : $fdata['ct'.$field->id]['value'][] = strtotime($field->value); $fdata['ct'.$field->id]['frontend_value'][] = strtotime($field->value); break; case 'integer' : $fdata['ct'.$field->id]['value'][] = $field->value; $fdata['ct'.$field->id]['frontend_value'][] = $field->value; break; case 'checkboxes' : case 'radio' : case 'list' : case 'sql' : $fdata['ct'.$field->id]['value'][] = str_replace('+','%20',urlencode($field->value)); $name = $this->getCustomName($field->id, $field->type, $field->value); $fdata['ct'.$field->id]['frontend_value'][] = $name; break; case 'usergrouplist' : $gname = $this->getUserGroupName($field->value); if ($gname) { $fdata['ct'.$field->id]['value'][] = str_replace('+','%20',urlencode($field->value)); $fdata['ct'.$field->id]['frontend_value'][] = $gname; } break; case 'user' : if (JFactory::getUser($field->value)->id) { $fdata['ct'.$field->id]['value'][] = str_replace('+','%20',urlencode($field->value)); $fdata['ct'.$field->id]['frontend_value'][] = JFactory::getUser($field->value)->get('name'); } break; case 'imagelist' : if ($field->value == '-1') break; $fieldparams = json_decode($field->fieldparams); $path = 'images/' . $fieldparams->directory . '/'; $fdata['ct'.$field->id]['value'][] = str_replace('+','%20',urlencode($path . $field->value)); $fdata['ct'.$field->id]['frontend_value'][] = $path . $field->value; break; case 'media': $fieldparams = json_decode($field->fieldparams); if (version_compare(JVERSION, 4, 'ge')) { $mediaData = new JRegistry($field->value); $urlData = JHtml::cleanImageURL($mediaData->get('imagefile')); $url = $urlData->url; } else { $url = $field->value; } $fdata['ct'.$field->id]['value'][] = str_replace('+','%20',urlencode($url)); $fdata['ct'.$field->id]['frontend_value'][] = $url; break; case 'repeatable': // $fieldparams = json_decode($field->fieldparams); // $values = json_decode($field->value); // die('<pre>'.print_r($values, 1).'</pre>'); break; default : $fdata['ct'.$field->id]['value'][] = str_replace('+','%20',urlencode($field->value)); $fdata['ct'.$field->id]['frontend_value'][] = $field->value; break; } } foreach ($fdata as $k => $f) { if ($this->checkPublished('attr.'.$k.'.value') || $this->checkDisplayOnFO('attr.'.$k.'.value')) { $this->attr[$k] = $f; $this->attr[$k]['frontend_value'] = $f['frontend_value']; $fieldconfig = $this->getFieldConfig('attr.'.$k.'.value'); $this->attr[$k]['title'] = array($fieldconfig['title']); $this->attr[$k]['type'] = $fieldconfig['type']; } } } return $this->attr; } public function getUserGroupName($groupId) { $query = $this->_db->getQuery(true); $query->select('title')->from('#__usergroups')->where('id = '. (int)$groupId); $this->_db->setQuery($query); return $this->_db->loadResult(); } public function getTagInfo($tagId, $lang) { $query = $this->_db->getQuery(true); $query->select('id, title, parent_id') ->from('#__tags') ->where('id IN ('.$tagId. ') AND `language` IN ("*", "'.$lang.'") AND published = 1'); $this->_db->setQuery($query); $tags = $this->_db->loadObjectList(); if ($tags) { $tdata = array(); foreach ($tags as $tag) { $tdata['value'][] = $tag->id; $tdata['frontend_value'][] = $this->getTagTreeName($tag); } if ($this->checkPublished('attr.tag.value') || $this->checkDisplayOnFO('attr.tag.value')) { $this->attr['tag'] = $tdata; $this->attr['tag']['frontend_value'] = $tdata['frontend_value']; $fieldconfig = $this->getFieldConfig('attr.tag.value'); $this->attr['tag']['title'] = array($fieldconfig['title']); $this->attr['tag']['type'] = $fieldconfig['type']; } } return $this->attr; } public function getTagTreeName($tag) { $q = 'SELECT * FROM `#__tags` WHERE id = ' . $tag->parent_id . ' AND id > 1'; $db = JFactory::getDbo()->setQuery($q); $result = $db->loadObject(); if ($result) { $result->title = $result->title . ' » ' . $tag->title; return $this->getTagTreeName($result); } else { return $tag->title; } } public function getCustomFields() { if (version_compare(JVERSION, '3.7', '<')) return; $query = $this->_db->getQuery(true); $query->select('*')->from('#__fields')->where('context = "com_content.article" AND state = 1'); $this->_db->setQuery($query); $fields = $this->_db->loadObjectList(); return $fields; } public function getCustomName($field_id, $field_type, $field_value) { $query = $this->_db->getQuery(true); $query->select('fieldparams') ->from('#__fields') ->where('id = '. (int) $field_id); $this->_db->setQuery($query); $fparams = $this->_db->loadResult(); if ($fparams) { $registry = new Registry; $registry->loadString($fparams); $fparams = $registry->toArray(); switch ($field_type) { case 'sql' : $q = $fparams['query']; if (!empty($q)) { $this->_db->setQuery($q); $results = $this->_db->loadObjectList(); if ($results) { foreach ($results as $r) { if ($r->value == $field_value) return $r->text; } } } break; default : if (!empty($fparams['options'])) { foreach ($fparams['options'] as $option) { if ($option['value'] == $field_value) { return $option['name']; } } } break; } } } // copy from helper.php. if change this need to change there too. public function getChildCategories($catid = 1, $maxLevel = 100, $level = 0, $ordering = 'rgt ASC') { $level++; $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('*') ->from('#__categories') ->where('parent_id = '. (int)$catid) ->where('extension IN ("com_reservation", "system")') ->where('published = 1') ->order($ordering); $db->setQuery($query); $children = $db->loadObjectList(); $cats = array(); foreach ($children as $child) { $cats[] = $child; if ($level < $maxLevel) { foreach ($this->getChildCategories($child->id, $maxLevel, $level, $ordering) as $c) { $cats[] = $c; } } } return $cats; } } PK wV�[���C� � tmpl/default.phpnu �[��� <?php /** * ------------------------------------------------------------------------ * JA Filter Plugin - Reservation * ------------------------------------------------------------------------ * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved. * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html * Author: J.O.O.M Solutions Co., Ltd * Websites: http://www.joomlart.com - http://www.joomlancers.com * This file may not be redistributed in whole or significant part. * ------------------------------------------------------------------------ */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $input = JFactory::getApplication()->input; $direction = !empty($this->config->Moduledirection) ? $this->config->Moduledirection : $this->config->direction; if ($direction == 'vertical') $direction=''; if((!empty($this->config->isComponent) && empty($this->config->isModule)) || (empty($this->config->isComponent) && !empty($this->config->isModule)) ) { $user = JFactory::getUser(); $userID = $user->id; $groups = $user->getAuthorisedGroups(); } ?> <?php if(!empty($this->config->isComponent) && empty($this->config->isModule)): ?> <?php $hasModule = JaMegafilterHelper::hasMegafilterModule(); if($hasModule) { $this->config->sticky = 0; } ?> <?php if (isset($this->item['mparams']) && $this->item['mparams']->get('show_page_heading')) : ?> <div class="page-header"> <h1> <?php echo $this->item['mparams']->get('page_heading'); ?> </h1> </div> <?php endif; ?> <div class="jarow <?php echo $this->item['type'] ?> <?php echo $direction; ?> ja-megafilter-wrap clearfix"> <?php if(!empty($this->config->fullpage) && !$hasModule): ?> <div data-mgfilter="reservation" class="<?php echo $direction ?> ja-mg-sidebar sidebar-main"> <a href="javascript:void(0)" class="sidebar-toggle"> <span class="filter-open"> <i class="fa fa-filter"></i><?php echo JText::_('COM_JAMEGAFILTER_OPEN_FILTER'); ?> </span> <span class="filter-close"> <i class="fa fa-close"></i><?php echo JText::_('COM_JAMEGAFILTER_CLOSE_FILTER'); ?> </span> </a> <div class="block ub-layered-navigation-sidebar sidebar-content"></div> </div> <?php endif; ?> <?php if ($hasModule || (empty($this->config->fullpage) && !$hasModule)) { $full_width = 'full-width'; } else { $full_width = ''; } ?> <div class="main-content <?php echo $full_width ?>"></div> </div> <?php else: ?> <div data-mgfilter="reservation" class="<?php echo $direction ?> ja-mg-sidebar sidebar-main"> <div class="block ub-layered-navigation-sidebar sidebar-content"></div> <?php if(empty($this->config->isComponent)): ?> <a id="jamegafilter-search-btn" class="btn btn-default " href="javascript:void(0)"><?php echo JText::_('COM_JAMEGAFILTER_SEARCH') ?></a> <?php endif;?> </div> <?php endif; ?> <?php if((!empty($this->config->isComponent) && empty($this->config->isModule)) || (empty($this->config->isComponent) && !empty($this->config->isModule)) ): ?> <script type="text/javascript"> <?php if(!empty($this->config->url)): ?> var filter_url = '<?php echo $this->config->url?>'; <?php endif; ?> var JABaseUrl = '<?php echo JUri::base(true); ?>'; var ja_default_sort="<?php echo $this->config->default_sort; ?>"; var ja_sort_by="<?php echo $this->config->sort_by; ?>"; var ja_layout_addition="<?php echo $this->config->layout_addition; ?>"; var ja_layout_columns=<?php echo json_encode($this->config->jacolumn); ?>; var ja_userGroup = <?php echo json_encode($groups); ?>; var p = <?php echo json_encode($this->jstemplate); ?>; for (var key in p) { if (p.hasOwnProperty(key)) { var compiled = dust.compile(p[key], key); dust.loadSource(compiled); } } function bindCallback() { setTimeout(function(){ if (jQuery('.jamegafilter-wrapper').find('.pagination-wrap').length) { jQuery('.jamegafilter-wrapper').removeClass('no-pagination'); } else { jQuery('.jamegafilter-wrapper').addClass('no-pagination'); } if (isMobile.apple.tablet && jQuery('#t3-off-canvas-sidebar').length) { jQuery('select').unbind().off().on('touchstart', function() { formTouch=true; fixedElement.css('position', 'absolute'); fixedElement.css('top', jQuery(document).scrollTop()); }); jQuery('html').unbind().off().on('touchmove', function() { if (formTouch==true) { fixedElement.css('position', 'fixed'); fixedElement.css('top', '0'); formTouch=false; } }); } initScript(); }, 100); if (jQuery('.items.product-items').find('.item').length == 0) { jQuery('.toolbar-amount').each(function(){ jQuery(this).find('.toolbar-number').first().text(0); }); } } function scrolltop() { if (!isMobile.phone) jQuery("html, body").stop().animate({ scrollTop: jQuery('div.ja-megafilter-wrap').offset().top }, 400); } function MegaFilterCallback() { bindCallback(); <?php echo $input->getCmd('scrolltop') ? 'scrolltop();':'' ?> } function afterGetData(item) { if (typeof(item.thumbnail) != 'undefined' && item.thumbnail != '') { thumbnail = item.thumbnail; if (!thumbnail.match(/^http|https:/)) { item.thumbnail = '<?php echo JUri::root(true). '/'?>'+item.thumbnail; } } // owner if (item.created_by == '<?php echo $userID ?>') return false; if (typeof item['access'] !== 'undefined' && item['access'] !== undefined && item['access'] !== null) { let itemAccess = item['access'].split(','); for (let i = 0; i < itemAccess.length; i++) { for (let x in ja_userGroup) { // super admin could see it all, public or guest. if (itemAccess[i] == ja_userGroup[x] || ja_userGroup[x] == 8) { return false; } } } } return true; } jQuery(document).ready(function() { var UBLNConfig = {}; UBLNConfig.dataUrl = "<?php echo JUri::base(true).$this->config->json; ?>"; UBLNConfig.fields = <?php echo json_encode($this->config->fields); ?>; UBLNConfig.sortByOptions = <?php echo str_replace('.value','.frontend_value',json_encode($this->config->sorts)); ?>; UBLNConfig.defaultSortBy = "<?php echo $this->config->default_sort; ?>"; UBLNConfig.productsPerPageAllowed = [<?php echo implode(',', $this->config->paginate); ?>]; UBLNConfig.autopage = <?php echo $this->config->autopage ? 'true':'false' ?>; UBLNConfig.sticky = <?php echo $this->config->sticky ? 'true':'false' ?>; UBLN.main(UBLNConfig); }); </script> <?php endif;PK wV�[ assets/css/style.cssnu �[��� PK wV�[\���H H assets/images/color-stars.pngnu �[��� �PNG IHDR �2j tEXtSoftware Adobe ImageReadyq�e<