Spade

Mini Shell

Directory:~$ /home/lmsyaran/public_html/joomla4/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ /home/lmsyaran/public_html/joomla4/reservation.zip

PKT4�[��_���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;
	}
}PKT4�[�L^���reservation.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<extension version="1.0" type="plugin"
group="extension" method="upgrade">
	<name>plg_extension_as_reservation</name>
	<author>farhad shahbazi</author>
	<creationDate>esf 99</creationDate>
	<copyright>Copyright (C) 2005 - 2020 Open Source Matters. All rights
reserved.</copyright>
	<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
	<authorEmail>farhad.shahbazi0010@gmail.com</authorEmail>
	<authorUrl>www.lmskaran.ir</authorUrl>
	<version>1.0.0</version>
	<description>PLG_EXTENSION_AS_RESERVATION_XML_DESCRIPTION</description>
	<files>
		<filename
plugin="reservation">reservation.php</filename>
	</files>
</extension>
PK�[�#o,,
index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�[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 . ' &raquo; ' .
$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 . ' &raquo; ' .
$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 . ' &raquo; ' .
$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�[���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�[assets/css/style.cssnu�[���PK�[\���HHassets/images/color-stars.pngnu�[����PNG


IHDR�2jtEXtSoftwareAdobe
ImageReadyq�e<siTXtXML:com.adobe.xmp<?xpacket
begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP
Core 5.6-c067 79.157747, 2015/03/30-23:40:42        "> <rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmpMM:OriginalDocumentID="xmp.did:c8cdb5f6-2b33-4f95-a2bb-ed05efbb05d3"
xmpMM:DocumentID="xmp.did:84B04A70166611E68195C6716F520107"
xmpMM:InstanceID="xmp.iid:84B04A6F166611E68195C6716F520107"
xmp:CreatorTool="Adobe Photoshop CC (Macintosh)">
<xmpMM:DerivedFrom
stRef:instanceID="xmp.iid:e8f10950-e434-4bf0-860b-dd041bea606f"
stRef:documentID="xmp.did:e8f10950-e434-4bf0-860b-dd041bea606f"/>
</rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket
end="r"?>r��kIDATxڜ��JA�7*q1Sh���JIi��o�#XY���o!
���'P��T*ha���BH���pV�I4���d�=3�Ξ$�
p�<����i���`����>ѯyDW���0O��Š��PG\�,,�4L�F����6�(AF��M4!-J�|w���Ny���,�����t�cG�0��l�2L��T�-4��`Jc�[��k8�UR��w�`
g�z[Z�D�}K����_:�5�
��ꮍ��
���^/��'/!���߼���%�^*+1ۑ�h�U��Sr���H[���g��>�P�s�Ŝn�����K
����P��(j-�ϭ�-��P��TI�[�K�65�V�u�QIEND�B`�PK�[�#o,,forms/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�[v��l��forms/reservation.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<form>
	<!--root category to generate thumbnail-->
	<fieldset name="base">
		<field 
			name="reservationcat" 
			type="reservationcat" 
			label="COM_JAMEGAFILTER_ROOT_CATEGORY" 
		/>
		<field
			name="include_root"
			type="radio"
			label="COM_JAMEGAFILTER_INCLUDE_ROOT"
			description="COM_JAMEGAFILTER_INCLUDE_ROOT_DESC"
			class="btn-group btn-group-yesno"
			default="1"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>
		<field
			name="subcat"
			type="list"
			label="COM_JAMEGAFILTER_SUBCAT"
			description="COM_JAMEGAFILTER_SUBCAT_DESC"
			default="-1"
			>
			<option value="0">JNONE</option>
			<option value="-1">JALL</option>
			<option value="1">J1</option>
			<option value="2">J2</option>
			<option value="3">J3</option>
			<option value="4">J4</option>
			<option value="5">J5</option>
			<option value="6">J6</option>
			<option value="7">J7</option>
			<option value="8">J8</option>
			<option value="9">J9</option>
			<option value="10">J10</option>
		</field>

		<field
			name="generate_thumb"
			type="radio"
			label="COM_JAMEGAFILTER_GENERATE_THUMB"
			description="COM_JAMEGAFILTER_GENERATE_THUMB_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field name="thumb_width"
			type="text"
			label="COM_JAMEGAFILTER_THUMB_WIDTH"
			description="COM_JAMEGAFILTER_THUMB_WIDTH_DESC"
			default="300"
			showon="generate_thumb:1" />

		<field name="thumb_height"
			type="text"
			label="COM_JAMEGAFILTER_THUMB_HEIGHT"
			description="COM_JAMEGAFILTER_THUMB_HEIGHT_DESC"
			default="300"
			showon="generate_thumb:1" />
	</fieldset>

	<!--filter config-->
	<fieldset name="filterfields">
		<field 
			name="filterfields" 
			type="filterfields"  
		/>
	</fieldset>
</form>PK�['�j��fields/filterfields.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');

class JFormFieldFilterfields extends JFormFieldJaMegafilter_filterfields {

	protected $type = 'filterfields';
	protected $catOrdering = true;

	function getFieldGroups()
	{
		$class_methods = get_class_methods($this);
		$fl_array	  = preg_grep('/getJaMegafilterField(.*?)/',
$class_methods);

		$fieldgroups = array();
		foreach ($fl_array as $value) {
			$array_key			   = strtolower(substr($value, 20));
			$fieldgroups[$array_key] = $this->{$value}();
		}
		return $fieldgroups;
	}

	function getJaMegafilterFieldBaseField()
	{
		$basefield = array(
			array(
				"published" => 0,
				"sort" => 0,
				"field" => "name",
				"title" => JText::_("COM_JAMEGAFILTER_TITLE"),
				"name" => JText::_("COM_JAMEGAFILTER_TITLE"),
				"filter_type" => array(
					"value"
				)
			),

			array(
				"published" => 0,
				"sort" => 0,
				"field" => "attr.cat.value",
				"title" =>
JText::_("COM_JAMEGAFILTER_CATEGORY"),
				"name" =>
JText::_("COM_JAMEGAFILTER_CATEGORY"),
				"filter_type" => array(
					"single",
					"dropdown", "select",
					"multiple"
				)
			),

			array(
				"published" => 0,
				"sort" => 0,
				"field" => "hits",
				"title" => JText::_("COM_JAMEGAFILTER_HITS"),
				"name" => JText::_("COM_JAMEGAFILTER_HITS"),
				"filter_type" => array(
					"range"
				)
			),

			array(
				"published" => 0,
				"sort" => 0,
				"field" => "rating",
				"title" => JText::_("COM_JAMEGAFILTER_RATING"),
				"name" => JText::_("COM_JAMEGAFILTER_RATING"),
				"filter_type" => array(
					'rating', 'range'
				)
			),

			array(
				"published" => 0,
				"sort" => 0,
				"field" => "attr.tag.value",
				"title" => JText::_("COM_JAMEGAFILTER_TAG"),
				"name" => JText::_("COM_JAMEGAFILTER_TAG"),
				"filter_type" => array(
					"single",
					"dropdown", "select",
					"multiple"
				)
			),

			array(
				"published" => 0,
				"sort" => 0,
				"field" => "published_date",
				"title" =>
JText::_("COM_JAMEGAFILTER_PUBLISHED_DATE"),
				"name" =>
JText::_("COM_JAMEGAFILTER_PUBLISHED_DATE"),
				"filter_type" => array(
					"date"
				)
			),

			array(
				"published"=>0,
				"sort" => 0,
				"field"=> "created_date",
				"title"=>JText::_("COM_JAMEGAFILTER_CREATED_DATE"),
				"name"=>JText::_("COM_JAMEGAFILTER_CREATED_DATE"),
				"filter_type"=>array("date")
			),
			array(
				"published" => 0,
				"sort" => 0,
				"field" => "attr.author.value",
				"title" => JText::_("COM_JAMEGAFILTER_AUTHOR"),
				"name" => JText::_("COM_JAMEGAFILTER_AUTHOR"),
				"filter_type" => array(
					"single",
					"dropdown", "select",
					"multiple"
				)
			),
			array(
				"published"=>0,
				"sort" => 0,
				"field"=> "modified_date",
				"title"=>JText::_("COM_JAMEGAFILTER_MODIFIED_DATE"),
				"name"=>JText::_("COM_JAMEGAFILTER_MODIFIED_DATE"),
				"filter_type"=>array("date")
			),
			array(
				"published" => 0,
				"sort" => 0,
				"field" => "attr.featured.value",
				"title" =>
JText::_("COM_JAMEGAFILTER_FEATURED"),
				"name" =>
JText::_("COM_JAMEGAFILTER_FEATURED"),
				"filter_type" => array("single",
"dropdown", "select", "multiple")
			),
			array(
				"published" => 0,
				"sort" => 0,
				"field" => "attr.fulltext.value",
				"title" =>
JText::_('COM_JAMEGAFILTER_FULLTEXT'),
				"name" =>
JText::_('COM_JAMEGAFILTER_FULLTEXT'),
				"filter_type" => array("value")
			),
		);

		return $basefield;
	}

	function getJaMegafilterFieldCustomFields() {
		if (version_compare(JVERSION, '3.7', '<'))
			return;
		$customFields = array();
		require_once(JPATH_PLUGINS .
'/jamegafilter/reservation/helper.php');
		$helper = new ReservationFilterHelper();
		$fields = $helper->getCustomFields();
		if ($fields) {
			foreach ($fields as $field) {
				if ($field->type === 'repeatable') {

				} else {
					$customField = array(
						"published" => 0,
						"sort" => 0,
						"field" =>
'attr.ct'.$field->id.'.value',
						"title" => $field->title,
						"name" => $field->title,
					);

					switch ($field->type) {
						case 'text':
							$customField['filter_type'] = array('value',
'range', 'latlong', 'numberrange');
							break;
						case 'editor' :
						case 'textarea' :
						case 'url' :
							$customField['filter_type'] = array('value',
'range');
							break;
						case 'color' :
							$customField['filter_type'] = array('color');
							break;
						case 'calendar' :
							$customField['filter_type'] = array('date');
							break;
						case 'integer' :
							$customField['filter_type'] = array(
								'range',
								'single',
								'dropdown',
								'multiple',
								"size"
							);
							break;
						case 'media':
						case 'imagelist':
							$customField['filter_type'] = array('media');
							break;
						default :
							$customField['filter_type'] = array(
								"single",
								"dropdown",
								"select",
								"multiple",
								"size"
							);
							break;
					}
					$customFields[] = $customField;
				}
			}
		}

		return $customFields;
	}

	function hasCustomOrdering($field) {
		if ($field['field'] === 'attr.cat.value') {
			return true;
		}

		preg_match('/\d+/', $field['field'], $matches);
		if (!count($matches)) {
			return false;
		}

		$id = $matches[0];
		$db = JFactory::getDbo();
		$query = "SELECT `id` 
				FROM `#__fields` 
				WHERE `id` = $id
				AND `type` IN ('list', 'checkboxes')
				AND `state` = 1";
		$result = $db->setQuery($query)->loadResult();
		return !!$result;
	}
}
PK�[�#o,,fields/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�[3}�PPfields/reservationcat.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.
 *
------------------------------------------------------------------------
 */
 
defined('_JEXEC') or die();
JLoader::register('ReservationFilterHelper', JPATH_PLUGINS .
'/jamegafilter/reservation/helper.php');

class JFormFieldreservationcat extends JFormField
{
    protected $type = 'reservationcat';

    protected function getInput()
    {
        $value = 0;
		if (!empty($this->value)) {
			$value = $this->value;
		}

		$helper = new ReservationFilterHelper;
		$items = $helper->getChildCategories();
		
		$html = '';
		$html = '<select class="form-select form-select-color-state
form-select-success valid form-control-success" name="'
      .$this->name.'">';
		$html .= '<option
value="0">'.JText::_('COM_JAMEGAFILTER_ALL_CATEGORIES').'</option>';
		foreach ($items as $item) {
			if ($item->published != '1')
				continue;
			$html .= '<option '.($value == $item->id ? '
selected="selected" ' : '').'
value="'.$item->id.'">'.str_repeat('.&nbsp;&nbsp;',
($item->level)).'|_.&nbsp;'.$item->title.'</option>';
		}
		$html.='</select>';
		return $html;
    }
}
PK�[m-���layouts/default/filter-list.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;

?>
<div class="ja-filter-wrapper block filter
filter-wrapper">
	<div class="block-content filter-content">
		<div class="filter-current filter-values"></div>
		<h3 role="heading" aria-level="2"
class="block-subtitle filter-subtitle"><?php echo
JText::_('COM_JAMEGAFILTER_SHOP_BY'); ?></h3>
	  <dl class="filter-options filter-list"
id="narrow-by-list">
	  </dl>
	</div> 
</div>PK�[�o5�ll#layouts/default/filter-selected.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;
?>
<div class="filter-selected filter-current filter-values">
  <h3 class="block-subtitle filter-current-subtitle"
role="heading" aria-level="2"
data-count="1"><?php echo
JText::_('COM_JAMEGAFILTER_SELECTED_FILTERS'); ?></h3>
  
  <ol class="items">
    {@iter:values}
    {#value}<li class="item">
      <label data-lnprop="{prop}" class="clear-filter
action remove">
        <span class="filter-label">{name}</span>
        <span class="filter-value">{value|s}</span>
      </label>
    </li>{/value}
    {/iter}
  </ol>

</div>
{@showClearAll:values}
<div class="block-actions filter-actions">
  <div class="btn btn-default clear-all-filter action
filter-clear"><?php echo
JText::_('COM_JAMEGAFILTER_CLEAR_ALL'); ?></div>
</div>
{/showClearAll}PK�[�#o,,layouts/default/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�[��-��
layouts/default/product-item.phpnu�[���<?php
/*
 *
------------------------------------------------------------------------
 * JA Filter Plugin - Docman
 *
------------------------------------------------------------------------
 * 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;
?>
{#data}
<div class="item product product-item">
  <div data-container="product-grid"
class="product-item-info {?thumbnail}{:else} no-image
{/thumbnail}">
    <div class="product-item-details">
      {@info:data}
      <div class="item-field {._class} {render_class}">
        {?.key}<div class="item-field-label
{label_render_class}">{.key}</div>{/.key}
          {@select key=._class}
          {@eq value="name"}
          <h4 class="product-item-name">
            <a href="{url}"
class="product-item-link">
              <span class="k-icon-document-{icon|s}">
</span>
              {name|s}
            </a>
          </h4>
          {/eq}
          {@eq value="thumb"}
          {?thumbnail}
          <a tabindex="-1"
class="product-item-photo" href="{url}">
							<span class="product-image-container">
								<img alt="{name|s}" src="{thumbnail}"
class="product-image-photo">
							</span>
          </a>
          {/thumbnail}
          {/eq}
          {@eq value="desc"}
          {desc|s}
          {/eq}
          {@none}
          {.value|s}
          {/none}
          {/select}
      </div>
      {/info}
    </div>
    <div class="product-item-actions">
      <a class="btn btn-default"
href="{url}"><?php echo
JText::_('COM_JAMEGAFILTER_VIEW_DETAIL'); ?></a>
    </div>
  </div>
</div>
{/data}PK�[P�
xx
layouts/default/product-list.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.
 *
------------------------------------------------------------------------
 */
 
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

$jinput = JFactory::getApplication()->input;
$itc     = $jinput->get('itempercol', 5, 'INT');
?>
<div class="ja-toolbar-wrapper toolbar-products toolbar-wrapper
toolbar-top">

</div>

<div class="ja-products-wrapper products wrapper grid products-grid
cols-<?php echo $itc; ?>">
	<div class="products list items product-items cols-<?php echo
$itc; ?>"></div>
</div>

<div class="ja-toolbar-wrapper toolbar-products toolbar-wrapper
toolbar-bottom">
</div>PK�[�X�C99#layouts/default/product-toolbar.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;
?>
<div class="pages pagination-wrap">
	{^autopage}
	<ul aria-labelledby="paging-label" class="items
pages-items pagination">
		<li class="item pages-item-first button{@if value=startPage
is=curPage} disabled{/if}">
			<a title="Go to First page"
href="#page={startPage}" class="page action start"
data-action="page" data-value="{startPage}">
				<span><?php echo JText::_('COM_JAMEGAFILTER_FIRST');
?></span>
			</a>
		</li>

		<li class="item pages-item-prev{@if value=prevPage is=curPage}
disabled{/if}">
			<a title="Prev" href="#page={prevPage}"
class="page action previous" data-action="page"
data-value="{prevPage}">
				<span><?php echo JText::_('JPREV');
?></span>
			</a>
		</li>

		{#pages}
		<li class='item {@if value=. is=curPage} active  {/if}'>
			<a class="page" href="#page={.}" title="Go
to page {.}" data-action="page"
data-value="{.}">
				<span>{.}</span>
			</a>
		</li>
		{/pages}

		<li class="item pages-item-next{@if value=nextPage is=curPage}
disabled{/if}">
			<a title="Next" href="#page={nextPage}"
class="page action next" data-action="page"
data-value="{nextPage}">
				<span><?php echo JText::_('JNEXT');
?></span>
			</a>
		</li>

		<li class="item pages-item-last{@if value=endPage is=curPage}
disabled{/if}">
			<a title="Go to Last page" href="#page={endPage}"
class="page action last" data-action="page"
data-value="{endPage}">
				<span><?php echo JText::_('COM_JAMEGAFILTER_LAST');
?></span>
			</a>
		</li>
	</ul>
	{/autopage}

	<div id="toolbar-amount" class="counter
toolbar-amount">
		<?php echo JText::_('COM_JAMEGAFILTER_ITEMS'); ?>
<span class="toolbar-number"
data-lnstate="startIdx">0</span>-<span
class="toolbar-number"
data-lnstate="endIdx">0</span> <?php echo
JText::_('COM_JAMEGAFILTER_OF'); ?> <span
class="toolbar-number"
data-lnstate="totalItems">0</span>
	</div>
</div>

<div class="orderby-displaynumber">
	<div class="toolbar-sorter sorter">
		<label for="sorter"
class="sorter-label"><?php echo
JText::_('COM_JAMEGAFILTER_SORT_BY'); ?></label>
		<select class="sorter-options" data-role="sorter"
id="sorter">
			{#sortByOptions}
			<option{@if value=sortField is=field}
selected="selected"{/if} value="{field}"
data-action="sort"
data-value="{field}">{title}</option>
			{/sortByOptions}
		</select>
		<a data-value="{sortDir}"
data-role="direction-switcher" class="action sorter-action
sort-{sortDir}" href="#" title="Set Descending
Direction" data-action="sortdir">
			<i class="fa fa-long-arrow-up"
aria-hidden="true"></i>
		</a>
	</div>

	<div class="field limiter">
	{^autopage}
		<label for="limiter" class="limiter-label">
			<span><?php echo JText::_('JSHOW');
?></span>
		</label>
		<select class="limiter-options"
data-role="limiter" id="limiter">
			{#productsPerPageAllowed}
			<option{@if value=itemPerPage is=.}
selected="selected"{/if} value="{.}"
data-action="limiter"
data-value="{.}">{.}</option>
			{/productsPerPageAllowed}
		</select>
		<span class="limiter-text"><?php echo
JText::_('COM_JAMEGAFILTER_PER_PAGE'); ?></span>
	{/autopage}
	</div>

	<div class="field jamg-layout-chooser">
		<span data-layout="grid"><i class="fa
fa-th"></i></span>
		<span data-layout="list"><i class="fa
fa-list"></i></span>
	</div>

</div>PK�[�#o,,layouts/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�[���
script.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.
 *
------------------------------------------------------------------------
 */

defined('_JEXEC') or die;

class plgJamegafilterReservationInstallerScript
{
	function postflight($type, $parent) 
	{
    	$db    = JFactory::getDBO();
        $query = $db->getQuery(true);
        $array = array (
            $db->quoteName('enabled').'= 1',
           
$db->quoteName('params').'='.$db->quote('{}')
        );
        $query
            ->update('#__extensions')
            ->set($array)
            ->where("type='plugin'")
            ->where("folder='jamegafilter'")
           
->where("element='".'reservation'."'");
            //
->where("element='".$parent->get('element')."'");
        $db->setQuery($query);
        $db->execute();
	}
}PK�[1EyZ{{content.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin"
group="jamegafilter" method="upgrade">
	<name>JA Megafilter - Joomla extra fields plugin</name>
	<author>Joomlart</author>
	<creationDate>June 09th,2022</creationDate>
	<copyright>Copyright (C), J.O.O.M Solutions Co., Ltd. All Rights
Reserved.</copyright>
	<license>license GNU/GPLv3
http://www.gnu.org/licenses/gpl-3.0.html</license>
	<authorEmail>webmaster@joomlart.com</authorEmail>
	<authorUrl>www.joomla.org</authorUrl>
	<version>1.1.7</version>
	<description>This plugin is used to indexing data of Joomla
Reservation Extra Fields</description>
	<updateservers>
		<server type="extension" priority="2"
name="JA Megafilter Joomla extra fields
plugin">http://update.joomlart.com/service/tracking/j31/plg_jamegafilter_reservation.xml</server>
	</updateservers>
	<files>
		<filename
plugin="reservation">reservation.php</filename>
		<filename>index.html</filename>
		<filename>helper.php</filename>
		<folder>tmpl</folder>
		<folder>assets</folder>
		<folder>forms</folder>
		<folder>fields</folder>
		<folder>layouts</folder>
	</files>
	
	<languages>
		<language
tag="en-GB">en-GB.plg_jamegafilter_reservation.ini</language>
		<language
tag="en-GB">en-GB.plg_jamegafilter_reservation.sys.ini</language>
	</languages>

	<config>
		<fields name="params">
			<fieldset name="basic">
				<field name="rating-option"
					   type="list" default="com_reservation"
					   label="COM_JAMEGAFILTER_RATING_OPTION"
description="COM_JAMEGAFILTER_RATING_OPTION_DESC">
					<option
value="com_reservation">RATING_OPTION_COM_RESERVATION</option>
					<option
value="com_komento">RATING_OPTION_COM_KOMENTO</option>
				</field>
			</fieldset>
		</fields>
	</config>

	<params>
	</params>
	<scriptfile>script.php</scriptfile>
	<config>
		<fields name="params">
		</fields>
	</config>

</extension>
PK�0�[�d�:

'commentPreProcess/commentPreProcess.phpnu�[���<?php

defined('_JEXEC') or die;
define('DS', DIRECTORY_SEPARATOR);

class PlgReservationCommentPreProcess extends JEvent
{

    public function onBeforeSaveComment($uid,$userid,$seid)
    {

        $app= JFactory::getApplication();
        $db= JFactory::getDbo();
        $query= $db->getQuery(true)
           
->select($db->quoteName(array('s.id'),array('id')))
           
->from($db->quoteName('#__reservation_sick','s'))
            ->where($db->quoteName('s.userid').
'='. $db->quote($userid));

        $db->setQuery($query);
        $result = $db->loadObject();

        if(empty($result))
        {
            $app->enqueueMessage('تنها کاربرانی که
مشاوره گرفته اند قادر به ثبت نظر
میباشند','warning');
            $app->redirect(JUri::root());
        }

      
       $query= $db->getQuery(true)
          
->select($db->quoteName(array('c.id'),array('id')))
          
->from($db->quoteName('#__reservation_session','se'))
          
->join('inner',$db->quoteName('#__reservation_plan','p').'on'.$db->quoteName('se.planid').'='.$db->quoteName('p.id'))
          
->join('inner',$db->quoteName('#__reservation_consultant','c').'on'.$db->quoteName('c.id').'='.$db->quoteName('p.consultantid'))
          
->join('inner',$db->quoteName('#__reservation_sick','s').'on'.$db->quoteName('s.id').'='.$db->quoteName('se.sickid'))
          
->where($db->quoteName('c.userid').'='.$db->quote($uid))
          
->where($db->quoteName('s.userid').'='.$db->quote($userid))
           ->where($db->quoteName('se.finish').'=
1')
          
->where($db->quoteName('se.id').'='.$seid);

       $db->setQuery($query);
       $result2 = $db->loadObject();

       if (empty($result2))
       {
           $app->enqueueMessage('در حال حاضر
نمیتوانید برای این دکتر نظر ثبت
نمایید','warning');
           $app->redirect(JUri::root());
       }

        $query= $db->getQuery(true)
            ->select($db->quoteName(array('id')))
           
->from($db->quoteName('#__reservation_comment','cm'))
           
->where($db->quoteName('seid').'='.$seid);


        $db->setQuery($query);
        $finalResult = $db->loadObject();

        if (!empty($finalResult))
        {
            $app->enqueueMessage('شما قبلا نظر خود
را برای این جلسه ثبت کرده
اید','warning');
            $app->redirect(JUri::root());
        }

        return ['sickid'=> $result->id,
'consultantid'=> $result2->id];
    }


}
PK�0�[��v'commentPreProcess/commentPreProcess.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<extension version="1.0" type="plugin"
group="reservation" method="upgrade">
    <name>commentPreProcess</name>
    <author>farhad shahbazi</author>
    <creationDate>December 2020</creationDate>
    <copyright>Copyright (C) 2005 - 2019 Open Source Matters. All
rights reserved.</copyright>
    <license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
    <authorEmail>info@lmskaran.com</authorEmail>
    <authorUrl>www.lmskaran.com</authorUrl>
    <version>1.0.0</version>
    <description>commentPreProcess</description>
    <files>
        <filename
plugin="commentPreProcess">commentPreProcess.php</filename>
        <filename>index.html</filename>
    </files>

    <config>

    </config>

</extension>
PK�0�[commentPreProcess/index.htmlnu�[���PK�0�[儙_"_"hikashopplans/hikashopplans.phpnu�[���<?php
/*----------------------------------------------------------------------------------|
 www.vdm.io  |----/
				fdsh 
/-------------------------------------------------------------------------------------------------------/

	@version		1.0.36
	@build			28th March, 2023
	@created		17th December, 2020
	@package		Reservation
	@subpackage		hikashopplans.php
	@author			farhad shahbazi <http://farhad.com>	
	@copyright		Copyright (C) 2015. All Rights Reserved
	@license		GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
  ____  _____  _____  __  __  __      __       ___  _____  __  __  ____ 
_____  _  _  ____  _  _  ____ 
 (_  _)(  _  )(  _  )(  \/  )(  )    /__\     / __)(  _  )(  \/  )(  _ \( 
_  )( \( )( ___)( \( )(_  _)
.-_)(   )(_)(  )(_)(  )    (  )(__  /(__)\   ( (__  )(_)(  )    (  )___/
)(_)(  )  (  )__)  )  (   )(  
\____) (_____)(_____)(_/\/\_)(____)(__)(__)   \___)(_____)(_/\/\_)(__) 
(_____)(_)\_)(____)(_)\_) (__) 

/------------------------------------------------------------------------------------------------------*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');


/***[JCBGUI.class_extends.head.5.$$$$]***/
jimport( 'joomla.plugin.plugin' );/***[/JCBGUI$$$$]***/


class PlgReservationHikashopplans extends JEvent
{

/***[JCBGUI.joomla_plugin.main_class_code.66.$$$$]***/
    public function onReservationPlanCreated($data)
    {
        $filename = __DIR__ . '/testlog.txt';
        // file_put_contents($filename, 'data = ' .
print_r($data, true) . "\n" , FILE_APPEND);
        
        require_once(
JPATH_ADMINISTRATOR.'/components/com_hikashop/helpers/helper.php'
);
        $config = hikashop_config();
        $allowed = $config->get('allowedfiles');
        $imageHelper = hikashop_get('helper.image');
        
        $file_class = hikashop_get('class.file');
        $uploadPath =
$file_class->getPath('product','');
        $category = 2;
        
        $product_code = "reserve".$data['id'];

        // SELECT rc.id, rc.userid, u.name, c.title FROM
`#__reservation_consultant` AS rc INNER JOIN `#__users` AS u ON u.id =
rc.userid INNER JOIN `#__categories` AS c ON c.id = rc.catid WHERE rc.id =
consultantid
        
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query
            ->select(array('rc.id', 'rc.userid',
'u.name', 'c.title'))
           
->from($db->quoteName('#__reservation_consultant',
'rc'))
            ->join('INNER',
$db->quoteName('#__users', 'u') . ' ON ' .
$db->quoteName('rc.userid') . ' = ' .
$db->quoteName('u.id'))
            ->join('INNER',
$db->quoteName('#__categories', 'c') . ' ON
' . $db->quoteName('c.id') . ' = ' .
$db->quoteName('rc.catid'))
            ->where($db->quoteName('rc.id') . ' =
' . $db->quote($data['consultantid']));;
        $db->setQuery($query);
        $results = $db->loadObjectList();

        switch($data['plantype'])
        {
            case 1:
                $consultanttype =
JText::_('COM_RESERVATION_PLAN_TEL');
                break;
            case 2:
                $consultanttype =
JText::_('COM_RESERVATION_PLAN_CHAT');
                break;
            
            
            default:
                $consultanttype = $data['plantype'];
        }

        $consultantname = $results[0]->name;
        $consultantcat  = $results[0]->title;
        $name = "مشاوره $consultanttype دکتر $consultantname
($consultantcat)";

        $cost = $data["price"];
        $desc = "";
        
        
        
        $product_class = hikashop_get('class.product');
        $element = new JObject ();
        $element->categories = array ($category);
        $element->related = array();
        $element->options = array();
        $element->product_name = $name;
        $element->product_description = $desc;
        $element->product_code = $product_code;
        $element->product_published = $data['published'];

        // $db = JFactory::getDbo();
        // $query = $db->getQuery(true);
        //
$query->select($db->quoteName(array('category_id')));
        //
$query->from($db->quoteName('#__hikashop_category'));
        // $query->where($db->quoteName('category_namekey')
. ' = ' . $db->quote('default_tax'));

        // $db->setQuery($query);
        // $tax_id = $db->loadResult();

        // if ($tax_id)
        // {
          // $element->product_tax_id = $tax_id;

          // $db = JFactory::getDbo();
          // $query = $db->getQuery(true);
          //
$query->select($db->quoteName(array('tax_namekey')));
          //
$query->from($db->quoteName('#__hikashop_taxation'));
          //
$query->where($db->quoteName('category_namekey') . ' =
' . $db->quote('default_tax'));
          // $db->setQuery($query);
          // $tax_namekey = $db->loadResult();

          // $db = JFactory::getDbo();
          // $query = $db->getQuery(true);
          //
$query->select($db->quoteName(array('tax_rate')));
          //
$query->from($db->quoteName('#__hikashop_tax'));
          // $query->where($db->quoteName('tax_namekey') .
' = ' . $db->quote($tax_namekey));
          // $db->setQuery($query);
          // $tax_rate = $db->loadResult();

          // $div = $tax_rate + 1;
          // /*$price_without_tax = $cost / $div;*/
          // $price_without_tax = $cost;
          // $cost = $price_without_tax;
        // }

        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
       
$query->select($db->quoteName(array('product_id')));
       
$query->from($db->quoteName('#__hikashop_product'));
        $query->where($db->quoteName('product_code') .
' = ' . $db->quote($product_code));
        $db->setQuery($query);
        $products = $db->loadObjectList();

        if (count ($products))
        {
          $element->product_id = current($products)->product_id;
        }
        
        $element->prices[0] = new JObject ();
        $element->prices[0]->price_value = $cost;

        // $db = JFactory::getDbo();
        // $query = $db->getQuery(true);
        //
$query->select($db->quoteName(array('currency_id')));
        //
$query->from($db->quoteName('#__hikashop_currency'));
        // $query->where($db->quoteName('currency_code') .
' = ' . $db->quote($currency));
        // $db->setQuery($query);
        // $currency_id = $db->loadResult();
        // $element->prices[0]->price_currency_id = $currency_id;
        
        $element->product_type = "main";
        // $quantity = intval($enrol_json['customint3']);
        // if($quantity > 0)
          // $element->product_quantity = $quantity;
        // else
          // $element->product_quantity = -1;

        // if($enrol_json['enrolstartdate'])
          // $element->product_sale_start 	=
$enrol_json['enrolstartdate'];
        // else
          // $element->product_sale_start = '';
        // if($enrol_json['enrolenddate'])
          // $element->product_sale_end 		=
$enrol_json['enrolenddate'];
        // else
          // $element->product_sale_end  = '';

        // $element->product_min_per_order = 0;
        // $element->product_max_per_order = 1;

        $status = $product_class->save($element);
        
        if ($status)
        {
          $product_class->updateCategories($element, $status);
          $product_class->updatePrices($element, $status);
        }
        
        
        
    }
    public function onReservationPlanStateChanged($pks, $value)
    {
        $filename = __DIR__ .
'/onReservationPlanStateChanged.txt';
        // file_put_contents($filename, 'pk = ' . print_r($pk,
true) . "\n" , FILE_APPEND);
        // file_put_contents($filename, 'value = ' .
print_r($value, true) . "\n" , FILE_APPEND);
        
        foreach($pks as $pk)
        {
            $product_code = "reserve".$pk;
            $db = JFactory::getDbo();
            $query = $db->getQuery(true);
           
$query->select($db->quoteName(array('product_id')));
           
$query->from($db->quoteName('#__hikashop_product'));
            $query->where($db->quoteName('product_code') .
' = ' . $db->quote($product_code));
            $db->setQuery($query);
            $products = $db->loadObjectList();
            if(!empty($products))
            {
                $product = current($products);
                JLoader::register('ReservationModelPlan',
JPATH_ADMINISTRATOR .
'/components/com_reservation/models/plan.php');
                $plan_model = new ReservationModelPlan();
                $data = (array)$plan_model->getItem($pk);
                $this->onReservationPlanCreated($data);
            }
        }
    }/***[/JCBGUI$$$$]***/

}
PK�0�[k�6m��hikashopplans/hikashopplans.xmlnu�[���<?xml
version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.8"
group="reservation" method="upgrade">
	<name>PLG_RESERVATION_HIKASHOPPLANS</name>
	<creationDate>28th March, 2023</creationDate>
	<author>farhad shahbazi</author>
	<authorEmail>farhad.shahbazi0010@gmail.com</authorEmail>
	<authorUrl>http://farhad.com</authorUrl>
	<copyright>Copyright (C) 2015. All Rights Reserved</copyright>
	<license>GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html</license>
	<version>1.0.0</version>
	<description>PLG_RESERVATION_HIKASHOPPLANS_XML_DESCRIPTION</description>

	<!-- Language files -->
	<languages folder="language">
		<language
tag="en-GB">en-GB/en-GB.plg_reservation_hikashopplans.ini</language>
		<language
tag="en-GB">en-GB/en-GB.plg_reservation_hikashopplans.sys.ini</language>
	</languages>

	<!-- Plugin files -->
	<files>
		<filename
plugin="hikashopplans">hikashopplans.php</filename>
		<filename>index.html</filename>
		<folder>language</folder>
	</files>
</extension>PK�0�[�#o,,hikashopplans/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�0�[�/KDDDhikashopplans/language/en-GB/en-GB.plg_reservation_hikashopplans.ininu�[���PLG_RESERVATION_HIKASHOPPLANS="Reservation
- Hikashopplans"
PLG_RESERVATION_HIKASHOPPLANS_XML_DESCRIPTION="<h1>Reservation -
Hikashopplans (v.1.0.0)</h1> <div style='clear:
both;'></div><p>Created by <a
href='http://farhad.com' target='_blank'>farhad
shahbazi</a><br /><small>Development started 1st March,
2023</small></p>"PK�0�[�/KDDHhikashopplans/language/en-GB/en-GB.plg_reservation_hikashopplans.sys.ininu�[���PLG_RESERVATION_HIKASHOPPLANS="Reservation
- Hikashopplans"
PLG_RESERVATION_HIKASHOPPLANS_XML_DESCRIPTION="<h1>Reservation -
Hikashopplans (v.1.0.0)</h1> <div style='clear:
both;'></div><p>Created by <a
href='http://farhad.com' target='_blank'>farhad
shahbazi</a><br /><small>Development started 1st March,
2023</small></p>"PK�0�[�#o,,'hikashopplans/language/en-GB/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PK�0�[�#o,,!hikashopplans/language/index.htmlnu�[���<html><body
bgcolor="#FFFFFF"></body></html>PKT4�[��_���reservation.phpnu�[���PKT4�[�L^����reservation.xmlnu�[���PK�[�#o,,
�index.htmlnu�[���PK�[bkaU�j�j
Bhelper.phpnu�[���PK�[���C��}tmpl/default.phpnu�[���PK�[$�assets/css/style.cssnu�[���PK�[\���HHh�assets/images/color-stars.pngnu�[���PK�[�#o,,��forms/index.htmlnu�[���PK�[v��l��i�forms/reservation.xmlnu�[���PK�['�j��E�fields/filterfields.phpnu�[���PK�[�#o,,7�fields/index.htmlnu�[���PK�[3}�PP��fields/reservationcat.phpnu�[���PK�[m-���=�layouts/default/filter-list.phpnu�[���PK�[�o5�ll#}�layouts/default/filter-selected.phpnu�[���PK�[�#o,,<�layouts/default/index.htmlnu�[���PK�[��-��
��layouts/default/product-item.phpnu�[���PK�[P�
xx
��layouts/default/product-list.phpnu�[���PK�[�X�C99#��layouts/default/product-toolbar.phpnu�[���PK�[�#o,,�layouts/index.htmlnu�[���PK�[���
}�script.phpnu�[���PK�[1EyZ{{��content.xmlnu�[���PK�0�[�d�:

'r�commentPreProcess/commentPreProcess.phpnu�[���PK�0�[��v'�commentPreProcess/commentPreProcess.xmlnu�[���PK�0�[UcommentPreProcess/index.htmlnu�[���PK�0�[儙_"_"�hikashopplans/hikashopplans.phpnu�[���PK�0�[k�6m��O*hikashopplans/hikashopplans.xmlnu�[���PK�0�[�#o,,�.hikashopplans/index.htmlnu�[���PK�0�[�/KDDD/hikashopplans/language/en-GB/en-GB.plg_reservation_hikashopplans.ininu�[���PK�0�[�/KDDH�0hikashopplans/language/en-GB/en-GB.plg_reservation_hikashopplans.sys.ininu�[���PK�0�[�#o,,'{2hikashopplans/language/en-GB/index.htmlnu�[���PK�0�[�#o,,!�2hikashopplans/language/index.htmlnu�[���PK{3