Example #1
0
 public function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication();
     $params = JUDirectoryHelper::getParams();
     $this->setState('params', $params);
     if ($this->context) {
         $commentPagination = $params->get('comment_pagination', 10);
         $limitArray = JUDirectoryFrontHelper::customLimitBox();
         if (is_array($limitArray) && count($limitArray)) {
             $limit = $app->input->getUint('limit', null);
             if (is_null($limit) || in_array($limit, $limitArray)) {
                 $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $commentPagination, 'uint');
             } else {
                 $limit = $commentPagination;
             }
         } else {
             $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $commentPagination, 'uint');
         }
         $this->setState('list.limit', $limit);
         $this->setState('list.start', $app->input->get('limitstart', 0, 'uint'));
         $commentOrdering = $params->get('comment_ordering', 'cm.created');
         $orderCol = $app->getUserStateFromRequest($this->context . '.list.ordering', 'filter_order', $commentOrdering);
         $this->setState('list.ordering', $orderCol);
         $commentDirection = $params->get('comment_direction', 'DESC');
         $listOrder = $app->getUserStateFromRequest($this->context . '.list.direction', 'filter_order_Dir', $commentDirection);
         $this->setState('list.direction', $listOrder);
     } else {
         $this->setState('list.start', 0);
         $this->state->set('list.limit', 0);
     }
 }
Example #2
0
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication();
     $params = JUDirectoryHelper::getParams();
     $this->setState('params', $params);
     if ($this->context) {
         $limitArray = JUDirectoryFrontHelper::customLimitBox();
         if (is_array($limitArray) && count($limitArray)) {
             $limit = $app->input->getUint('limit', null);
             if (is_null($limit) || in_array($limit, $limitArray)) {
                 $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $app->getCfg('list_limit'), 'uint');
             } else {
                 $limit = $app->getCfg('list_limit');
             }
         } else {
             $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $app->getCfg('list_limit'), 'uint');
         }
         $this->setState('list.limit', $limit);
         $this->setState('list.start', $app->input->get('limitstart', 0, 'uint'));
         $orderCol = $app->getUserStateFromRequest($this->context . '.list.ordering', 'filter_order', 'tag.title');
         $this->setState('list.ordering', $orderCol);
         $listOrder = $app->getUserStateFromRequest($this->context . '.list.direction', 'filter_order_Dir', 'ASC');
         $this->setState('list.direction', $listOrder);
     }
 }
Example #3
0
 protected function _prepareDocument()
 {
     $uri = clone JUri::getInstance();
     $domain = $uri->toString(array('scheme', 'host', 'port'));
     $canonicalLink = $domain . JRoute::_(JUDirectoryHelperRoute::getListingsRoute(true), false);
     JUDirectoryFrontHelper::setCanonical($canonicalLink);
     $seoData = array("metatitle" => JText::_('COM_JUDIRECTORY_SEO_TITLE_LISTINGS'), "metadescription" => "", "metakeyword" => "");
     JUDirectoryFrontHelperSeo::seo($this, $seoData);
 }
Example #4
0
 protected function _prepareDocument()
 {
     $uri = clone JUri::getInstance();
     $domain = $uri->toString(array('scheme', 'host', 'port'));
     $linkCanonical = $domain . JRoute::_(JUDirectoryHelperRoute::getTopCommentsRoute(true, $this->_layout), false);
     JUDirectoryFrontHelper::setCanonical($linkCanonical);
     $seoData = array("metatitle" => JText::_('COM_JUDIRECTORY_SEO_TITLE_TOP_COMMENTS'), "metadescription" => "", "metakeyword" => "");
     JUDirectoryFrontHelperSeo::seo($this, $seoData);
 }
Example #5
0
 public function setup(SimpleXMLElement $element, $value, $group = null)
 {
     $return = parent::setup($element, $value, $group);
     if ($return) {
         $directory = JUDirectoryFrontHelper::getDirectory((string) $this->element['rel'], (string) $this->element['defaultRel']) . "default/";
         $this->directory = $directory;
     }
     return $return;
 }
Example #6
0
 public static function getJUAvatar($id)
 {
     $user = JUDirectoryFrontHelper::getUser($id, true);
     if ($user && isset($user->avatar)) {
         $avatar = JUri::root(true) . '/' . JUDirectoryFrontHelper::getDirectory('avatar_directory', 'media/com_judirectory/images/avatar/', true) . $user->avatar;
     } else {
         $avatar = self::getDefaultAvatar();
     }
     return $avatar;
 }
Example #7
0
 public function search()
 {
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $searchWord = $app->input->post->getString('searchword', '');
     $cat_id = $app->input->post->getInt('cat_id', 0);
     $sub_cat = $app->input->post->getInt('sub_cat', 0);
     $searchWord = JUDirectoryFrontHelper::UrlEncode($searchWord);
     $this->setRedirect(JRoute::_(JUDirectoryHelperRoute::getSearchRoute($cat_id, $sub_cat, $searchWord), false));
 }
 protected function getInput()
 {
     $params = JUDirectoryHelper::getParams();
     $max_upload = ini_get('upload_max_filesize');
     $src = JUri::root() . JUDirectoryFrontHelper::getDirectory("collection_icon_directory", "media/com_judirectory/images/collection/", true) . $this->value;
     $html = "<div class=\"avatar\" style=\"float: left;\">";
     if ($this->value) {
         $html .= "<div class=\"clearfix\"><img src=\"" . $src . "\" width=\"" . $params->get('collection_icon_width', 100) . "px\" height=\"" . $params->get('collection_icon_height', 100) . "px\" /></div>";
         $html .= "<label><input type=\"checkbox\" name=\"remove_icon\" value=\"1\" />&nbsp;" . JText::_('COM_JUDIRECTORY_REMOVE_ICON') . "</label>";
     }
     $html .= "<div class=\"clearfix\"><input type=\"file\" name=\"collection_icon\"  id=\"" . $this->id . "\" />";
     $html .= "<input type=\"hidden\" name=\"" . $this->name . "\" value=\"" . $this->value . "\" /></div>";
     $html .= "<div class=\"clearfix\"><i>" . JText::_('COM_JUDIRECTORY_MAX_UPLOAD_FILESIZE') . " <strong>" . JUDirectoryHelper::formatBytes($this->convertBytes($max_upload)) . "</strong></i></div>";
     $html .= "</div>";
     return $html;
 }
Example #9
0
 public function getItems()
 {
     $app = JFactory::getApplication();
     $searchword = $app->input->getString('searchword', '');
     $params = $this->getState('params');
     $minSearchWord = $params->get('searchword_min_length', 3);
     $maxSearchWord = $params->get('searchword_max_length', 30);
     $searchwordLength = strlen($searchword);
     if (!$searchwordLength || $minSearchWord > 0 && $searchwordLength < $minSearchWord || $maxSearchWord > 0 && $searchwordLength > $maxSearchWord) {
         if ($searchwordLength > 0) {
             $app->enqueueMessage(JText::sprintf("COM_JUDIRECTORY_SEARCH_TERM_MUST_BE_A_MINIMUM_OF_X_CHARACTERS_AND_MAXIMUM_OF_X_CHARACTER", $minSearchWord, $maxSearchWord));
         }
         return array();
     } else {
         $listingObjectList = parent::getItems();
         JUDirectoryFrontHelper::appendDataToListingObjList($listingObjectList, $params);
         return $listingObjectList;
     }
 }
Example #10
0
 protected function getInput()
 {
     $params = JUDirectoryHelper::getParams();
     $max_upload = ini_get('upload_max_filesize');
     if ($this->value) {
         $src = JUri::root(true) . "/" . JUDirectoryFrontHelper::getDirectory("avatar_directory", "media/com_judirectory/images/avatar/", true) . $this->value;
     } else {
         $src = JUri::root(true) . "/" . JUDirectoryFrontHelper::getDirectory("avatar_directory", "media/com_judirectory/images/avatar/", true) . "default/" . $params->get('default_avatar', 'default-avatar.png');
     }
     $html = '<div class="avatar" style="float: left;">';
     $html .= '<div class="clearfix"><img src="' . $src . '" alt="Avatar" style="width:' . $params->get("avatar_width", 120) . 'px; height:' . $params->get("avatar_height", 120) . 'px;" /></div>';
     if ($this->value) {
         $html .= '<label for="remove-avatar">' . JText::_("COM_JUDIRECTORY_REMOVE_AVATAR") . '&nbsp;<input id="remove-avatar" type="checkbox" name="remove_avatar" value="1" /></label>';
     }
     $html .= '<div class="clearfix"><input type="file" name="avatar"  id="' . $this->id . '" />';
     $html .= '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '" /></div>';
     $html .= '<div class="clearfix"><i>' . JText::_("COM_JUDIRECTORY_MAX_UPLOAD_FILESIZE") . ' <strong>' . JUDirectoryHelper::formatBytes($this->convertBytes($max_upload)) . '</strong></i></div>';
     $html .= '</div>';
     return $html;
 }
 public function onTagSearch(&$query, &$where, $tag = null)
 {
     if (!$this->params->get("tag_search", 0)) {
         return false;
     }
     if ($tag !== "") {
         $tag = JUDirectoryFrontHelper::UrlDecode($tag);
         $address_id = (int) $tag;
         if ($address_id) {
             $db = JFactory::getDbo();
             $_query = $db->getQuery(true);
             $_query->select('n.id')->from('#__judirectory_addresses AS n, #__judirectory_addresses AS p')->where('n.lft BETWEEN p.lft AND p.rgt')->where('p.id = ' . $address_id)->order('n.lft');
             $db->setQuery($_query);
             $address_ids = $db->loadColumn();
             $query->join('LEFT', '#__judirectory_locations AS location ON location.listing_id = listing.id');
             $where[] = 'location.address_id IN (' . implode(', ', $address_ids) . ')';
             $query->group('listing.id');
         }
     }
 }
Example #12
0
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication();
     $params = JUDirectoryHelper::getParams();
     if ($layout = $app->input->get('layout')) {
         $this->context .= '.' . $layout;
     }
     if ($this->context) {
         $listingPagination = $params->get('listing_pagination', 10);
         $limitArray = JUDirectoryFrontHelper::customLimitBox();
         if (is_array($limitArray) && count($limitArray)) {
             $limit = $app->input->getInt('limit', 0);
             if (in_array($limit, $limitArray)) {
                 $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $listingPagination, 'uint');
             } else {
                 $limit = $listingPagination;
             }
         } else {
             $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $listingPagination, 'uint');
         }
         $this->setState('list.limit', $limit);
         $this->setState('list.start', $app->input->getUint('limitstart', 0));
         $orderCol = $app->getUserStateFromRequest($this->context . '.list.ordering', 'filter_order', '');
         $this->setState('list.ordering', $orderCol);
         $listOrder = $app->getUserStateFromRequest($this->context . '.list.direction', 'filter_order_Dir', 'ASC');
         $this->setState('list.direction', $listOrder);
         $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
         $this->setState('filter.search', $search);
         $category = $this->getUserStateFromRequest($this->context . '.filter.category', 'filter_catid');
         $this->setState('filter.catid', $category);
         $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access');
         $this->setState('filter.access', $access);
         $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published');
         $this->setState('filter.published', $published);
         $featured = $this->getUserStateFromRequest($this->context . '.filter.featured', 'filter_featured');
         $this->setState('filter.featured', $featured);
     } else {
         $this->setState('list.start', 0);
         $this->state->set('list.limit', 0);
     }
 }
 public function getLimitBox()
 {
     $app = JFactory::getApplication();
     $limits = array();
     $limitArray = JUDirectoryFrontHelper::customLimitBox();
     $keyAllLimit = array_search(0, $limitArray);
     if ($keyAllLimit) {
         $limitAll = true;
         unset($limitArray[$keyAllLimit]);
     } else {
         $limitAll = false;
     }
     $limitArray = array_values($limitArray);
     sort($limitArray);
     if (empty($limitArray)) {
         return parent::getLimitBox();
     }
     foreach ($limitArray as $limitValue) {
         $limits[] = JHtml::_('select.option', "{$limitValue}");
     }
     if ($limitAll) {
         $limits[] = JHtml::_('select.option', '0', JText::_('JALL'));
     }
     $jversion_arr = explode(".", JVERSION);
     $priVersion = $jversion_arr[0];
     if ($priVersion == 2) {
         $selected = $this->_viewall ? 0 : $this->limit;
     } elseif ($priVersion == 3) {
         $selected = $this->viewall ? 0 : $this->limit;
     }
     if ($app->isAdmin()) {
         $html = JHtml::_('select.genericlist', $limits, $this->prefix . 'limit', 'class="inputbox" size="1" onchange="Joomla.submitform();"', 'value', 'text', $selected);
     } else {
         $html = JHtml::_('select.genericlist', $limits, $this->prefix . 'limit', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $selected);
     }
     return $html;
 }
Example #14
0
 public function display($tpl = null)
 {
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $app = JFactory::getApplication();
     $this->type = $app->input->get('type', '');
     if (!$this->type || $this->type == 'default') {
         $this->image_url = JUri::root(true) . "/" . JUDirectoryFrontHelper::getDirectory("listing_image_directory", "media/com_judirectory/images/listing/", true) . "default/";
         $this->image_directory = JPath::clean(JPATH_ROOT . "/" . JUDirectoryFrontHelper::getDirectory("listing_image_directory", "media/com_judirectory/images/listing/") . "default/");
     } elseif ($this->type == 'marker') {
         $this->image_url = JUri::root(true) . "/media/com_judirectory/images/marker/";
         $this->image_directory = JPath::clean(JPATH_ROOT . "/media/com_judirectory/images/marker/");
     }
     $this->folders = $this->getFolders();
     $this->folder = $app->input->get('folder', '', 'string');
     if (!in_array($this->folder, $this->folders)) {
         $this->folder = '';
     }
     $this->images = $this->getImages();
     $this->setDocument();
     parent::display($tpl);
 }
        if ($commentObj->website != '') {
            ?>
										<div class="comment-website">
											<?php 
            echo JText::_('COM_JUDIRECTORY_COMMENT_WEBSITE') . " : " . $commentObj->website;
            ?>
										</div>
									<?php 
        }
        ?>

								</div>
								<!-- /.judir-metadata -->

								<?php 
        $commentObj->comment = JUDirectoryFrontHelper::BBCode2Html($commentObj->comment);
        $commentObj->comment = JUDirectoryFrontHelperComment::parseCommentText($commentObj->comment, $this->listing_id);
        ?>

								<div class="see-more" itemprop="description">
									<?php 
        echo $commentObj->comment;
        ?>
								</div>
							</div>
						</div>
						<?php 
        $totalChildComments = $this->getModel()->getTotalChildComments($commentObj->id);
        if ($totalChildComments > 0) {
            $this->comment_parent_id = $commentObj->id;
            echo $this->loadTemplate('comments');
Example #16
0
 public function getLatestCommentTime($listingId = 0)
 {
     $user = JFactory::getUser();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('created')->from('#__judirectory_comments')->order('id DESC');
     if ($listingId > 0) {
         $query->where('listing_id = ' . $listingId);
     }
     if ($user->id > 0) {
         $query->where('user_id =' . $user->id);
     } else {
         $ipAddress = JUDirectoryFrontHelper::getIpAddress();
         $query->where('ip_address = "' . $ipAddress . '"');
     }
     $db->setQuery($query, 0, 1);
     $result = $db->loadResult();
     return $result;
 }
$app = JFactory::getApplication();
$db = JFactory::getDbo();
$user = JFactory::getUser();
$userId = $user->id;
$rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
$cat_id = $app->input->getInt('cat_id', $rootCat->id);
$listOrder_cat = $this->escape($this->state->get('filter.ordering_cat'));
$listDirn_cat = $this->escape($this->state->get('filter.direction_cat'));
$search_cat = $this->escape($this->state->get('filter.search_cat'));
$saveOrder_cat = $listOrder_cat == 'lft' && $this->canDoCat->get('judir.category.edit.state');
$model = $this->getModel();
$list_cat = $model->getListCategory($cat_id, $listOrder_cat, $listDirn_cat);
$ordering = $listOrder_cat == 'lft';
$this->ordering = array();
$intro_image_path = JUri::root(true) . "/" . JUDirectoryFrontHelper::getDirectory("category_intro_image_directory", "media/com_judirectory/images/category/intro/");
$detail_image_path = JUri::root(true) . "/" . JUDirectoryFrontHelper::getDirectory("category_detail_image_directory", "media/com_judirectory/images/category/detail/");
foreach ($list_cat as $cat) {
    $this->ordering[] = $cat->id;
}
$originalOrders = array();
?>
<div class="clearfix">
	<div class="input-append pull-left">
		<label for="filter_search" class="filter-search-lbl element-invisible"><?php 
echo JText::_('JSEARCH_FILTER_LABEL');
?>
</label>
		<input type="text" size="40" name="filter_search_cat" id="filter_search_cat"
			placeholder="<?php 
echo JText::_('COM_JUDIRECTORY_SEARCH_BY_CATEGORY_NAME');
?>
Example #18
0
					<tr>
						<th><?php 
echo JText::_('COM_JUDIRECTORY_DIRECTORIES');
?>
</th>
						<th style="width:100px"><?php 
echo JText::_('COM_JUDIRECTORY_STATUS');
?>
</th>
					</tr>
					</thead>

					<tbody>
					<?php 
foreach ($configs as $config) {
    $value = JUDirectoryFrontHelper::getDirectory($config['name'], $config['default']);
    $status = is_writable(JPATH_ROOT . "/" . $value) ? "<span class='badge badge-success'>" . JText::_('COM_JUDIRECTORY_WRITEABLE') . "</span>" : "<span class='badge badge-important'>" . JText::_('COM_JUDIRECTORY_UNWRITEABLE') . "</span>";
    echo "<tr>";
    echo "<td>" . $value . "</td>";
    echo "<td>" . $status . "</td>";
    echo "</tr>";
}
?>
					</tbody>
				</table>

				<table class="table table-striped table-bordered">
					<thead>
					<tr>
						<th><?php 
echo JText::_('COM_JUDIRECTORY_LIBRARIES');
Example #19
0
    public function getSearchInput($defaultValue = "")
    {
        if (!$this->isPublished()) {
            return "";
        }
        if ($this->params->get("tag_search", 0)) {
            $document = JFactory::getDocument();
            JUDirectoryFrontHelper::loadjQueryUI();
            $document->addStyleSheet(JUri::root() . 'components/com_judirectory/assets/css/tagit-style.css');
            $document->addScript(JUri::root() . "components/com_judirectory/assets/js/tagit.js");
            $tagScript = '
            jQuery(document).ready(function($){
                    $("#' . $this->getId() . '_tags").tagit({
                    tagSource:' . ($this->params->get('auto_suggest') ? $this->getTags() : '[]') . ',
                    initialTags: ' . $this->getInitialTags($defaultValue) . ',
                    tagsChanged: function(){ getTags($("#' . $this->getId() . '_tags").tagit("tags")); },
                    triggerKeys:["enter", "comma", "tab"],
                    minLength: 3,
                    maxLength: 50,
                    maxTags: 50,
                    sortable: "handle",
                    placeholder: " ' . $this->params->get("placeholder", "") . ' "
                });

                function getTags(tags) {
                    var newtags = [];
                    for (var i in tags){
	                    if (tags[i].label != undefined ){
	                        var tagvalue = tags[i].value.replace("|", "");
	                        newtags.push(tagvalue);
	                        $(tags[i].element[0]).find(".tagit-label").text(tagvalue);
	                    }
                    }
                    var newtags_str = newtags.join(",");
                    $("#' . $this->getId() . '").val(newtags_str);
                }
            });
            ';
            $document->addScriptDeclaration($tagScript);
            $this->setVariable('value', $this->value);
            return $this->fetch('searchinput.php', __CLASS__);
        } else {
            return parent::getSearchInput($defaultValue);
        }
    }
 * ------------------------------------------------------------------------
 *
 * @copyright      Copyright (C) 2010-2015 JoomUltra Co., Ltd. All Rights Reserved.
 * @license        GNU General Public License version 2 or later; see LICENSE.txt
 * @author         JoomUltra Co., Ltd
 * @website        http://www.joomultra.com
 * @----------------------------------------------------------------------@
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
//@todo properties has called in view
$user = JFactory::getUser();
$isOwnDashboard = JUDirectoryFrontHelperPermission::isOwnDashboard();
JLoader::register('JUDirectoryAvatarHelper', JPATH_SITE . '/components/com_judirectory/helpers/avatar.php');
$avatar = JUDirectoryAvatarHelper::getJUAvatar($user->id);
$userId = JUDirectoryFrontHelper::getDashboardUserId();
$linkDashboard = JRoute::_(JUDirectoryHelperRoute::getDashboardRoute($userId));
$linkUserProfile = JRoute::_(JUDirectoryHelperRoute::getUserProfileRoute());
$linkCreateListing = JRoute::_(JUDirectoryHelperRoute::getFormRoute());
$linkUserComments = JRoute::_(JUDirectoryHelperRoute::getUserCommentsRoute($userId));
$linkUserCollection = JRoute::_(JUDirectoryHelperRoute::getCollectionsRoute($userId));
$linkUserListings = JRoute::_(JUDirectoryHelperRoute::getUserListingsRoute($userId));
$linkUserSubscriptions = JRoute::_(JUDirectoryHelperRoute::getUserSubscriptionsRoute($userId));
$linkLogOutReturn = JRoute::_('index.php', false);
?>
	<div class="navbar">
		<div class="navbar-inner">
			<ul class="nav">
				<li class="go-home">
					<a class="hasTooltip" title="<?php 
echo JText::_('COM_JUDIRECTORY_DASHBOARD_HOME');
Example #21
0
jimport('joomla.application.component.controller');
$app = JFactory::getApplication();
$task = $app->input->get('task');
$view = $app->input->get('view');
$permission = JUDirectoryHelper::checkGroupPermission($task, $view);
if (!$permission) {
    return JError::raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
}
if (!JFactory::getUser()->authorise('core.manage', 'com_judirectory')) {
    return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
$document = JFactory::getDocument();
$isJoomla3x = JUDirectoryHelper::isJoomla3x();
if ($isJoomla3x) {
    $document->addStyleSheet(JUri::root(true) . '/administrator/components/com_judirectory/assets/css/styles.css');
} else {
    $document->addStyleSheet(JUri::root(true) . '/administrator/components/com_judirectory/assets/css/styles.j25.css');
    $document->addStyleSheet(JUri::root(true) . '/administrator/components/com_judirectory/assets/css/jicomoon.css');
}
JUDirectoryFrontHelper::loadjQuery();
JUDirectoryFrontHelper::loadBootstrap();
$document->addScript(JUri::root() . "components/com_judirectory/assets/js/jquery.dragsort.min.js");
if ($isJoomla3x && $view == 'subscriptions') {
    $document->addScript(JUri::base() . "components/com_judirectory/models/forms/subscriptions.js");
}
if ($isJoomla3x && $view == 'collections') {
    $document->addScript(JUri::base() . "components/com_judirectory/models/forms/collections.js");
}
$controller = JControllerLegacy::getInstance('JUDirectory');
$controller->execute($app->input->get('task'));
$controller->redirect();
Example #22
0
 public function getOutput($options = array())
 {
     if (!$this->isPublished()) {
         return "";
     }
     $_value = $this->value;
     if ($_value == "") {
         return "";
     }
     $value = '';
     if ($_value) {
         $predefined_values = $this->getPredefinedValues();
         foreach ($predefined_values as $option) {
             if ($option->value == $_value) {
                 if ($this->params->get("tag_search", 0)) {
                     $value = "<a href =\"" . JRoute::_("index.php?option=com_judirectory&view=searchby&field_id=" . $this->id . "&value=" . JUDirectoryFrontHelper::UrlEncode($option->value)) . "\">" . $option->text . "</a>";
                 } else {
                     $value = $option->text;
                 }
                 break;
             }
         }
     }
     $this->setVariable('value', $value);
     return $this->fetch('output.php', __CLASS__);
 }
Example #23
0
 public function getItems()
 {
     $params = $this->getState('params');
     $listingObjectList = parent::getItems();
     JUDirectoryFrontHelper::appendDataToListingObjList($listingObjectList, $params);
     return $listingObjectList;
 }
Example #24
0
 public static function generateImageNameByListing($listing_id, $file_name)
 {
     if (!$listing_id || !$file_name) {
         return "";
     }
     $dir_listing_ori = JPATH_ROOT . "/" . JUDirectoryFrontHelper::getDirectory("listing_original_image_directory", "media/com_judirectory/images/gallery/original/") . $listing_id . "/";
     $info = pathinfo($file_name);
     $listing = JUDirectoryHelper::getListingById($listing_id);
     $replace = array('id' => $listing->id, 'category' => '', 'listing' => $listing->title, 'image_name' => $info['filename']);
     $base_file_name = JUDirectoryHelper::parseImageNameByTags($replace, 'listing', null, $listing->id) . "." . $info['extension'];
     $img_file_name = $base_file_name;
     $img_path_ori = $dir_listing_ori . $img_file_name;
     while (JFile::exists($img_path_ori)) {
         $img_file_name = JUDirectoryHelper::generateRandomString(3) . "-" . $base_file_name;
         $img_path_ori = $dir_listing_ori . $img_file_name;
     }
     return $img_file_name;
 }
Example #25
0
     $document->addScript(JUri::root(true) . "/components/com_judirectory/assets/js/view.embedlisting.js");
     break;
 case 'featured':
     $document->addStyleSheet(JUri::root(true) . "/components/com_judirectory/templates/" . $self_template . "/assets/css/view.listing-list.css");
     // Load primary javascript
     $document->addScript(JUri::root(true) . "/components/com_judirectory/assets/js/core.js");
     $document->addScript(JUri::root(true) . "/components/com_judirectory/assets/js/compare.js");
     $JUDIRTemplateDefaultHelper->loadTooltipster();
     // Load switch mode view
     if ($this->allow_user_select_view_mode) {
         $document->addScript(JUri::root(true) . "/components/com_judirectory/assets/js/switch.js");
     }
     break;
 case 'form':
     $document->addStyleSheet(JUri::root(true) . "/components/com_judirectory/templates/" . $self_template . "/assets/css/view.form.css");
     JUDirectoryFrontHelper::loadjQueryUI();
     $document->addScript(JUri::root(true) . "/components/com_judirectory/assets/js/handlebars.min.js");
     $document->addScript(JUri::root(true) . "/components/com_judirectory/assets/js/jquery.dragsort.min.js");
     $document->addStyleSheet(JUri::root(true) . "/components/com_judirectory/assets/plupload/css/jquery.plupload.queue.css");
     $document->addScript(JUri::root(true) . "/components/com_judirectory/assets/plupload/js/plupload.full.min.js");
     $document->addScript(JUri::root(true) . "/components/com_judirectory/assets/plupload/js/jquery.plupload.queue.min.js");
     JUDirectoryHelper::formValidation();
     // JText in forms/listing.js
     JText::script('COM_JUDIRECTORY_INVALID_IMAGE');
     JText::script('COM_JUDIRECTORY_REMOVE');
     JText::script('COM_JUDIRECTORY_CAN_NOT_ADD_IMAGE_BECAUSE_MAX_NUMBER_OF_IMAGE_IS_N');
     JText::script('COM_JUDIRECTORY_TOGGLE_TO_PUBLISH');
     JText::script('COM_JUDIRECTORY_TOGGLE_TO_UNPUBLISH');
     JText::script('COM_JUDIRECTORY_CLICK_TO_REMOVE');
     JText::script('COM_JUDIRECTORY_YOU_MUST_UPLOAD_AT_LEAST_ONE_IMAGE');
     JText::script('COM_JUDIRECTORY_DESCRIPTION');
 public function onSimpleSearch(&$query, &$where, $search)
 {
     if ($search !== "") {
         $search = JUDirectoryFrontHelper::UrlDecode($search);
         $db = JFactory::getDbo();
         $_query = array();
         $query->join('LEFT', '#__judirectory_locations AS location ON location.listing_id = listing.id');
         $_query[] = $db->quoteName('location.address') . " LIKE " . $db->quote("%" . $search . "%");
         $_query[] = $db->quoteName('location.description') . " LIKE " . $db->quote("%" . $search . "%");
         $query->join('LEFT', '#__judirectory_addresses AS address ON address.id = location.address_id');
         $where[] = '(' . implode($_query, ' OR ') . ')';
     }
 }
Example #27
0
 protected function _prepareDocument()
 {
     $document = JFactory::getDocument();
     $uri = clone JUri::getInstance();
     $domain = $uri->toString(array('scheme', 'host', 'port'));
     $canonicalLink = $domain . JRoute::_(JUDirectoryHelperRoute::getListingRoute($this->item->id, $this->_layout), false);
     JUDirectoryFrontHelper::setCanonical($canonicalLink);
     $document->addCustomTag('<meta property="og:title" content="' . htmlspecialchars(strip_tags($this->item->title), ENT_COMPAT, 'UTF-8') . '" />');
     $document->addCustomTag('<meta property="og:type" content="website" />');
     $listingImage = JUDirectoryHelper::getListingImage($this->item->image);
     if ($listingImage) {
         $document->addCustomTag('<meta property="og:image" content="' . $listingImage . '" />');
     }
     $document->addCustomTag('<meta property="og:url" content="' . $canonicalLink . '" />');
     $document->addCustomTag('<meta property="og:description" content="' . htmlspecialchars(strip_tags($this->item->description), ENT_COMPAT, 'UTF-8') . '" />');
     $conf = JFactory::getConfig();
     if (JUDirectoryHelper::isJoomla3x()) {
         $siteName = $conf->get('sitename');
     } else {
         $siteName = $conf->getValue('config.sitename');
     }
     $document->addCustomTag('<meta property="og:site_name" content="' . htmlspecialchars(strip_tags($siteName), ENT_COMPAT, 'UTF-8') . '" />');
     JUDirectoryFrontHelperSeo::seo($this);
 }
Example #28
0

	<?php 
// Total category level 1 (virtual level)
$totalCategoryLevel1 = 0;
foreach ($this->all_categories as $category) {
    if ($category->level == $this->category->level + 1) {
        $totalCategoryLevel1++;
    }
}
// Get total columns
$columns = (int) $this->params->get('all_categories_columns', 2);
if (!is_numeric($columns) || $columns <= 0) {
    $columns = 1;
}
$this->subcategory_bootstrap_columns = JUDirectoryFrontHelper::getBootstrapColumns($columns);
// Row and column class
$rows_class = htmlspecialchars($this->params->get('all_categories_row_class', ''));
$columns_class = htmlspecialchars($this->params->get('all_categories_column_class', ''));
// Index row
$indexRow = 0;
// Index column
$indexColumn = 0;
// Index element in array
$indexElementArray = 0;
?>
                  <h1 style="font-size: 24px; font-weight: bold;color:#2b4d76;font-family:SlabThing; ">Useful Listings for the F&B Industry in Singapore</h1>
<br>
	<div

		class="categories-row <?php 
Example #29
0
    foreach ($images as $key => $image) {
        $description = '';
        if ($image->title) {
            $description .= "<h4 class='img-title'>" . htmlspecialchars($image->title, ENT_QUOTES) . "</h4>";
        }
        if ($image->description) {
            $description .= "<div class='img-description'>" . htmlspecialchars($image->description, ENT_QUOTES) . '</div>';
        }
        ?>
			<div
				data-thumb="<?php 
        echo JUri::root(true) . '/' . JUDirectoryFrontHelper::getDirectory('listing_small_image_directory', 'media/com_judirectory/images/gallery/small/', true) . $this->listing_id . '/' . $image->file_name;
        ?>
"
				data-src="<?php 
        echo JUri::root(true) . '/' . JUDirectoryFrontHelper::getDirectory('listing_big_image_directory', 'media/com_judirectory/images/gallery/big/', true) . $this->listing_id . '/' . $image->file_name;
        ?>
">
				<?php 
        if ($description) {
            ?>
					<div class="camera_caption fadeFromBottom">
						<?php 
            echo $description;
            ?>
					</div>
				<?php 
        }
        ?>
			</div>
		<?php 
Example #30
0
 public static function getListingsSearch($searchword, $state, $cat_id = null)
 {
     $searchword = trim($searchword);
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $levels = $user->getAuthorisedViewLevels();
     $levels_str = implode(',', $levels);
     $db = JFactory::getDbo();
     $nullDate = $db->getNullDate();
     $nowDate = JFactory::getDate()->toSql();
     $query = $db->getQuery(true);
     $listOrder = $state->get('list.ordering');
     $listDirn = $state->get('list.direction');
     if ($app->isAdmin()) {
         $query->SELECT('listing.id, listing.title, listing.alias, listing.published, listing.publish_up, listing.publish_down, listing.checked_out, listing.checked_out_time, listing.featured, listing.access, listing.created_by, listing.language');
         $query->SELECT('c.id AS category_id, c.title AS category_title');
         $where_str = $app->isSite() ? ' AND cm.published = 1' : '';
         $query->SELECT('(SELECT COUNT(*) FROM #__judirectory_comments AS cm WHERE (cm.listing_id = listing.id AND cm.approved = 1' . $where_str . ')) AS comments');
         $query->SELECT('(SELECT COUNT(*) FROM #__judirectory_reports AS r WHERE r.item_id = listing.id AND r.type="listing") AS reports');
         $where_str = $app->isSite() ? ' AND s.published = 1' : '';
         $query->SELECT('(SELECT COUNT(*) FROM #__judirectory_subscriptions AS s WHERE s.item_id = listing.id AND s.type="listing"' . $where_str . ') AS subscriptions');
         $query->SELECT('ua.name AS created_by_name');
         $query->JOIN("LEFT", "#__users AS ua ON listing.created_by = ua.id");
         $query->SELECT('ua3.name AS checked_out_name');
         $query->JOIN("LEFT", "#__users AS ua3 ON listing.checked_out = ua3.id");
         $query->SELECT("vl.title AS access_title");
         $query->JOIN("LEFT", "#__viewlevels AS vl ON listing.access = vl.id");
     } else {
         $query->SELECT('listing.*');
         if ($app->isSite()) {
             JUDirectoryFrontHelper::optimizeListListingQuery($query);
         }
     }
     $query->FROM('#__judirectory_listings AS listing');
     $query->JOIN('', '#__judirectory_listings_xref AS listingxref ON listing.id = listingxref.listing_id');
     $query->JOIN('', '#__judirectory_categories AS c ON (c.id = listingxref.cat_id)');
     $field_query = $db->getQuery(true);
     $field_query->select("field.*");
     $field_query->from("#__judirectory_fields AS field");
     $field_query->select("plg.folder");
     $field_query->join("", "#__judirectory_plugins AS plg ON field.plugin_id = plg.id");
     $field_query->join("", "#__judirectory_fields_groups AS field_group ON field_group.id = field.group_id");
     $field_query->join("", "#__judirectory_categories AS c2 ON (c2.fieldgroup_id = field_group.id OR field.group_id = 1)");
     if ($app->isSite()) {
         if (is_array($cat_id)) {
             $cat_id = (array) $cat_id;
             $field_query->where('(c2.id IN (' . implode(",", $cat_id) . ') OR field.group_id = 1)');
         } elseif ($cat_id) {
             $cat_id = (int) $cat_id;
             $field_query->where('(c2.id = ' . $cat_id . ' OR field.group_id = 1)');
         }
         $field_query->where('c2.published = 1');
         $field_query->where('c2.publish_up <= ' . $db->quote($nowDate));
         $field_query->where('(c2.publish_down = ' . $db->quote($nullDate) . ' OR c2.publish_down > ' . $db->quote($nowDate) . ')');
     }
     $field_query->where('field.simple_search = 1');
     $field_query->where('field.published = 1');
     $field_query->where('field.publish_up <= ' . $db->quote($nowDate));
     $field_query->where('(field.publish_down = ' . $db->quote($nullDate) . ' OR field.publish_down > ' . $db->quote($nowDate) . ')');
     $field_query->where('(field.field_name != "cat_id"');
     $field_query->where("field_group.published = 1)");
     $field_query->group('field.id');
     $db->setQuery($field_query);
     $fields = $db->loadObjectList();
     $where = array();
     if ($fields) {
         foreach ($fields as $field) {
             if ($searchword) {
                 $fieldClass = JUDirectoryFrontHelperField::getField($field);
                 $fieldClass->onSimpleSearch($query, $where, $searchword);
             }
         }
         if (!empty($where)) {
             $query->WHERE("(" . implode(" OR ", $where) . ")");
         }
     }
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         $published = $state->get('filter.state');
         if (is_numeric($published)) {
             $query->WHERE('listing.published = ' . (int) $published);
         }
         $cat_id = $state->get('filter.category');
         if (is_numeric($cat_id)) {
             $query->WHERE('listingxref.cat_id = ' . (int) $cat_id);
         }
         $access_level = $state->get('filter.access');
         if (is_numeric($access_level) && $access_level != 0) {
             $query->WHERE('listing.access = ' . (int) $access_level);
         }
         $language = $state->get('filter.language');
         if ($language) {
             $query->where('listing.language = ' . $db->quote($language));
         }
     } else {
         $query->where('listing.published = 1');
         if ($cat_id) {
             if (is_array($cat_id)) {
                 $cat_id = (array) $cat_id;
                 $query->where('c.id IN (' . implode(",", $cat_id) . ')');
             } elseif ($cat_id) {
                 $cat_id = (int) $cat_id;
                 $query->where('c.id = ' . $cat_id);
             }
         }
         $query->where('listing.publish_up <= ' . $db->quote($nowDate));
         $query->where('(listing.publish_down = ' . $db->quote($nullDate) . ' OR listing.publish_down > ' . $db->quote($nowDate) . ')');
         if ($user->get('guest')) {
             $query->where('listing.access IN (' . $levels_str . ')');
         } else {
             $query->where('(listing.access IN (' . $levels_str . ') OR (listing.created_by = ' . $user->id . '))');
         }
     }
     $query->where('listing.approved = 1');
     JUDirectoryFrontHelperField::appendFieldOrderingPriority($query, null, $listOrder, $listDirn);
     $query->group('listing.id');
     return $query;
 }