Пример #1
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;
 }
Пример #2
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;
 }
Пример #3
0
 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;
 }
Пример #4
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;
 }
Пример #5
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);
 }
Пример #6
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');
Пример #7
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;
 }
Пример #8
0
 public function onImport($value, &$message = '')
 {
     $imageDir = JPATH_ROOT . '/' . JUDirectoryFrontHelper::getDirectory('listing_image_directory', 'media/com_judirectory/images/listing/');
     $originalDir = $imageDir . 'original/';
     $imagePath = JUDirectoryHelper::getPhysicalPath($value);
     $oldImagePath = '';
     if (!$this->is_new && $this->listing->image) {
         $oldImagePath = JPath::clean($originalDir . $this->listing->image);
     }
     if ($imagePath != $oldImagePath) {
         if ($imagePath && JFile::exists($imagePath)) {
             if (JFile::exists($oldImagePath)) {
                 JFile::delete($imageDir . $this->listing->image);
                 JFile::delete($originalDir . $this->listing->image);
             }
             $imageName = basename($imagePath);
             $imageName = $this->listing_id . "_" . JUDirectoryHelper::fileNameFilter($imageName);
             JFile::copy($imagePath, $originalDir . $imageName);
             JUDirectoryHelper::renderImages($originalDir . $imageName, $imageDir . $imageName, 'listing_image', true, null, $this->listing_id);
             $value = $imageName;
             return basename($value);
         } else {
             $message = $value . JText::_(' does not exist');
         }
     }
     return false;
 }
 * @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');
?>
<script type="text/javascript">
	var default_image = "<?php 
echo JUDirectoryHelper::getDefaultListingImage();
?>
";
	var listing_image_url = "<?php 
echo JUri::root(true) . "/" . JUDirectoryFrontHelper::getDirectory("listing_image_directory", "media/com_judirectory/images/listing/", true);
?>
";
	function jSelectListing_related() {
		var $ul = jQuery(".related-listing-list").find(".related-listings");
		var $listing = $ul.find("li#listing-" + arguments[0]);
		if (!$listing.length && arguments[0] != <?php 
echo (int) $this->item->id;
?>
) {
			var $li = '<li id="listing-' + arguments[0] + '">';
			$li += '<div class="listing-inner">';
			var image_src = arguments[2] ? listing_image_url + arguments[2] : default_image;
			if (image_src) {
				$li += '<img class="image" src="' + image_src + '" title="' + arguments[1] + '" width="<?php 
echo $this->params->get('listing_image_width', 150);
Пример #10
0
 public static function getFeed($feedListings, &$document)
 {
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     $params = JUDirectoryHelper::getParams();
     $image = $params->get('rss_thumbnail_source', 'image');
     $feedEmail = $params->get('rss_email', 'none');
     $siteEmail = $app->get('mailfrom');
     foreach ($feedListings as $listing) {
         $title = $listing->title;
         $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
         $categoryId = JUDirectoryFrontHelperCategory::getMainCategoryId($listing->id);
         $category = JUDirectoryFrontHelperCategory::getCategory($categoryId);
         $feedItem = new JFeedItem();
         $feedItem->title = $title;
         $feedItem->link = JRoute::_(JUDirectoryHelperRoute::getListingRoute($listing->id));
         if ($feedEmail != 'none') {
             $user = JFactory::getUser($listing->created_by);
             $feedItem->author = $listing->created_by_alias ? $listing->created_by_alias : $user->name;
             if ($feedEmail == 'site') {
                 $feedItem->authorEmail = $siteEmail;
             } elseif ($feedEmail === 'author') {
                 $feedItem->authorEmail = $listing->email ? $listing->email : $user->email;
             }
         }
         $feedItem->category = $category->title;
         @($date = $listing->publish_up ? date('r', strtotime($listing->publish_up)) : '');
         $feedItem->date = $date;
         $feedItem->description = "";
         if ($params->get('rss_show_thumbnail', 1)) {
             if ($image == 'image' && $listing->image) {
                 $imageUrl = JUDirectoryHelper::getListingImage($listing->image);
             } else {
                 $query = "SELECT file_name FROM #__judirectory_images WHERE listing_id = " . $listing->id . " ORDER BY ordering ASC LIMIT 1";
                 $db->setQuery($query);
                 $firstImage = $db->loadResult();
                 $imageUrl = JUri::root() . JUDirectoryFrontHelper::getDirectory("listing_small_image_directory", "media/com_judirectory/images/gallery/small/", true) . $firstImage;
             }
             $feedItem->description = "<img src='" . $imageUrl . "' align=\"" . $params->get('rss_thumbnail_alignment', 'left') . "\" />";
         }
         $feedItem->description .= $listing->introtext;
         $document->addItem($feedItem);
     }
 }
Пример #11
0
 public function delete(&$pks)
 {
     $dispatcher = JDispatcher::getInstance();
     $pks = (array) $pks;
     $table = $this->getTable();
     JPluginHelper::importPlugin('content');
     $modelListing = JModelLegacy::getInstance('Listing', 'JUDirectoryModel');
     $listingTable = JTable::getInstance("Listing", "JUDirectoryTable");
     $canDeleteCatIds = $canNotDeleteCatIds = $canDeleteListingIds = $canNotDeleteListingIds = array();
     $db = JFactory::getDbo();
     while (!empty($pks)) {
         $pk = array_shift($pks);
         $table->reset();
         if ($table->load($pk)) {
             $deleteCurrentCat = true;
             if ($this->canDelete($table)) {
                 $query = $db->getQuery(true);
                 $query->SELECT('listing_id');
                 $query->FROM('#__judirectory_listings_xref');
                 $query->WHERE('cat_id=' . $pk . ' AND main=1');
                 $db->setQuery($query);
                 $listingIds = $db->loadColumn();
                 if ($listingIds) {
                     foreach ($listingIds as $listingId) {
                         $listingTable->reset();
                         if ($listingTable->load($listingId)) {
                             if ($modelListing->canDelete($listingTable)) {
                                 $canDeleteListingIds[] = $listingId;
                             } else {
                                 $canNotDeleteListingIds[] = $listingId;
                                 $deleteCurrentCat = false;
                             }
                         }
                     }
                 }
             } else {
                 $deleteCurrentCat = false;
             }
             if (!$deleteCurrentCat) {
                 $canNotDeleteCatIds[] = $pk;
             } else {
                 $canDeleteCatIds[] = $pk;
             }
             $query = $db->getQuery(true);
             $query->select('id');
             $query->from('#__judirectory_categories');
             $query->where('lft > ' . (int) $table->lft);
             $query->where('rgt < ' . (int) $table->rgt);
             $query->order('lft');
             $db->setQuery($query);
             $childIds = $db->loadColumn();
             foreach ($childIds as $childId) {
                 if (!in_array($childId, $pks)) {
                     array_push($pks, $childId);
                 }
             }
         }
     }
     if ($canNotDeleteCatIds) {
         foreach ($canNotDeleteCatIds as $caNotDeleteCatId) {
             $categories = $table->getPath($caNotDeleteCatId);
             if ($categories) {
                 foreach ($categories as $category) {
                     $canDeleteCatIdIndex = array_search($category->id, $canDeleteCatIds);
                     if ($canDeleteCatIdIndex !== false) {
                         unset($canDeleteCatIds[$canDeleteCatIdIndex]);
                         $canNotDeleteCatIds[] = $category->id;
                     }
                 }
             }
         }
     }
     $canDeleteListingIds = array_unique($canDeleteListingIds);
     if ($canDeleteListingIds) {
         foreach ($canDeleteListingIds as $listingId) {
             if (!$listingTable->delete($listingId)) {
                 $this->setError($listingTable->getError());
                 return false;
             }
         }
     }
     $canDeleteCatIds = array_unique($canDeleteCatIds);
     if ($canDeleteCatIds) {
         foreach ($canDeleteCatIds as $pk) {
             if ($table->load($pk)) {
                 $context = $this->option . '.' . $this->name;
                 $result = $dispatcher->trigger($this->event_before_delete, array($context, $table));
                 if (in_array(false, $result, true)) {
                     $this->setError($table->getError());
                     return false;
                 }
                 if (!$table->delete($pk, false)) {
                     $this->setError($table->getError());
                     return false;
                 } else {
                     $query = "DELETE FROM #__judirectory_categories_relations WHERE cat_id=" . $pk;
                     $db->setQuery($query);
                     $db->execute();
                     $query = "DELETE FROM #__judirectory_listings_xref WHERE main=0 AND cat_id=" . $pk;
                     $db->setQuery($query);
                     $db->execute();
                     $query = "SELECT mod_id FROM #__judirectory_moderators_xref WHERE cat_id = " . $pk;
                     $db->setQuery($query);
                     $moderatorIds = $db->loadColumn();
                     $query = "DELETE FROM #__judirectory_moderators_xref WHERE cat_id=" . $pk;
                     $db->setQuery($query);
                     $db->execute();
                     if ($moderatorIds) {
                         $modTable = JTable::getInstance("Moderator", "JUDirectoryTable");
                         foreach ($moderatorIds as $moderatorId) {
                             $query = $db->getQuery(true);
                             $query->select('COUNT(*)');
                             $query->from('#__judirectory_moderators AS m');
                             $query->join('', '#__judirectory_moderators_xref AS mxref ON m.id = mxref.mod_id');
                             $query->where('m.id =' . $moderatorId);
                             $db->setQuery($query);
                             $totalModeratedCats = $db->loadResult();
                             if ($totalModeratedCats <= 0) {
                                 $modTable->reset();
                                 if ($modTable->load(array($moderatorId))) {
                                     $modTable->delete();
                                 }
                             }
                         }
                     }
                     $images = json_decode($table->images);
                     if (is_object($images)) {
                         if ($images->intro_image) {
                             $intro_image = JUDirectoryFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judirectory/images/category/intro/') . $images->intro_image;
                             $ori_intro_image = JUDirectoryFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judirectory/images/category/intro/') . "original/" . $images->intro_image;
                             if (JFile::exists(JPATH_ROOT . "/" . $ori_intro_image)) {
                                 JFile::delete(JPATH_ROOT . "/" . $ori_intro_image);
                             }
                             if (JFile::exists(JPATH_ROOT . "/" . $intro_image)) {
                                 JFile::delete(JPATH_ROOT . "/" . $intro_image);
                             }
                         }
                         if ($images->detail_image) {
                             $detail_image = JUDirectoryFrontHelper::getDirectory('category_detail_image_directory', 'media/com_judirectory/images/category/detail/') . $images->detail_image;
                             $ori_detail_image = JUDirectoryFrontHelper::getDirectory('category_detail_image_directory', 'media/com_judirectory/images/category/detail/') . "original/" . $images->detail_image;
                             if (JFile::exists(JPATH_ROOT . "/" . $detail_image)) {
                                 JFile::delete(JPATH_ROOT . "/" . $detail_image);
                             }
                             if (JFile::exists(JPATH_ROOT . "/" . $ori_detail_image)) {
                                 JFile::delete(JPATH_ROOT . "/" . $ori_detail_image);
                             }
                         }
                     }
                     if ($table->level == 0 || $table->level == 1) {
                         $query = "DELETE FROM #__judirectory_emails_xref WHERE cat_id = " . $table->id;
                         $db->setQuery($query);
                         $db->execute();
                     }
                     JUDirectoryHelper::deleteLogs('category', $pk);
                     $query = "DELETE FROM #__judirectory_fields_ordering WHERE `item_id` = " . $table->id . " AND `type` = 'category'";
                     $db->setQuery($query);
                     $db->execute();
                     $dispatcher->trigger($this->event_after_delete, array($context, $table));
                 }
             }
         }
     }
     if ($canDeleteCatIds) {
         $app = JFactory::getApplication();
         $app->enqueueMessage(JText::plural('COM_JUDIRECTORY_CATEGORIES_N_ITEMS_DELETED', count($canDeleteCatIds)));
     }
     $canNotDeleteCatIds = array_unique($canNotDeleteCatIds);
     if ($canNotDeleteCatIds) {
         JError::raiseWarning(500, JText::plural('COM_JUDIRECTORY_CATEGORIES_N_ITEMS_NOT_DELETED', count($canNotDeleteCatIds)));
     }
     $this->cleanCache();
     return true;
 }
Пример #12
0
[{{key}}][published]" />
			<input type="hidden" class="file-remove" value="0" name="<?php 
echo $this->getName();
?>
[{{key}}][remove]" />
			<input type="hidden" class="file-isnew" value="1" name="<?php 
echo $this->getName();
?>
[{{key}}][is_new]" />
		</li>
	</script>
<?php 
$html = "<div id=\"" . $this->getId() . "_wrap\" " . $this->getAttribute(null, null, "input") . " class=\"field-media\">";
$html .= "<ul class=\"file-list\">";
if ($files) {
    $imageUrl = JUri::root(true) . "/" . JUDirectoryFrontHelper::getDirectory("field_attachment_directory", "media/com_judirectory/field_attachments/", true) . "media/" . $this->id . "_" . $this->listing_id . "/";
    $imageTmp = JUri::root(true) . "/media/com_judirectory/tmp_img/";
    foreach ($files as $key => $file) {
        if (isset($file['target']) && !$file['target']) {
            continue;
        }
        $isNewFile = isset($file['is_new']) ? true : false;
        $class = array();
        // Fail to save listing
        if ($isNewFile) {
            $state = JText::_('COM_JUDIRECTORY_UPLOADED');
            $class[] = 'uploaded';
        } else {
            $state = JText::_('COM_JUDIRECTORY_COMPLETED');
            $class[] = 'completed';
        }
Пример #13
0
 public function display($tpl = null)
 {
     $model = $this->getModel();
     $this->model = $model;
     $this->state = $this->get('State');
     $params = $this->state->params;
     $this->params = $params;
     $this->token = JSession::getFormToken();
     $this->root_category = JUDirectoryFrontHelperCategory::getRootCategory();
     $categoryId = $this->state->get('category.id', $this->root_category->id);
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $error = array();
     if (!JUDirectoryFrontHelperPermission::canDoCategory($categoryId, true, $error)) {
         $user = JFactory::getUser();
         if ($user->id) {
             return JError::raiseError($error['code'], $error['message']);
         } else {
             $uri = JUri::getInstance();
             $loginUrl = JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode($uri), false);
             $app = JFactory::getApplication();
             $app->redirect($loginUrl, JText::_('COM_JUDIRECTORY_YOU_ARE_NOT_AUTHORIZED_TO_ACCESS_THIS_PAGE'), 'warning');
             return false;
         }
     }
     $topLevelCats = JUDirectoryHelper::getCatsByLevel(1, $categoryId);
     if (is_array($topLevelCats) && count($topLevelCats) > 0) {
         $this->tl_catid = $topLevelCats[0]->id;
     }
     $this->category = JUDirectoryFrontHelperCategory::getCategory($categoryId);
     $this->show_feed = JUDIRPROVERSION ? $this->params->get('rss_display_icon', 1) : 0;
     $this->rss_link = JRoute::_(JUDirectoryHelperRoute::getCategoryRoute($this->category->id, null, true));
     if (isset($this->category->images) && !empty($this->category->images) && !empty($this->category->images->detail_image)) {
         $this->category->images->detail_image_src = JUri::root(true) . '/' . JUDirectoryFrontHelper::getDirectory('category_detail_image_directory', 'media/com_judirectory/images/category/detail/', true) . $this->category->images->detail_image;
     }
     $this->category->images->detail_image_width = (int) $this->params->get('category_image_width', 200);
     $this->category->images->detail_image_height = (int) $this->params->get('category_image_height', 200);
     if ($this->params->get('category_show_description', 1)) {
         $this->category->description = $this->category->introtext . $this->category->fulltext;
     } else {
         $this->category->description = $this->category->fulltext;
     }
     $categoryDescLimit = (int) $this->params->get('category_desc_limit', 0);
     if ($categoryDescLimit > 0) {
         $this->category->description = JUDirectoryFrontHelperString::truncateHtml($this->category->description, $categoryDescLimit);
     }
     if ($this->params->get('plugin_support', 0)) {
         $this->category->description = JHtml::_('content.prepare', $this->category->description, '', 'com_judirectory.category');
     }
     $this->category->class_sfx = htmlspecialchars($this->category->class_sfx);
     $relatedCatOrdering = $this->params->get('related_category_ordering', 'crel.ordering');
     $relatedCatDirection = $this->params->get('related_category_direction', 'ASC');
     $this->related_cats = $model->getRelatedCategories($this->category->id, $relatedCatOrdering, $relatedCatDirection);
     if (is_array($this->related_cats) && count($this->related_cats) > 0) {
         foreach ($this->related_cats as $relatedCategory) {
             if (isset($relatedCategory->images->intro_image) && !empty($relatedCategory->images->intro_image)) {
                 $relatedCategory->images->intro_image_src = JUri::root(true) . '/' . JUDirectoryFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judirectory/images/category/intro/', true) . $relatedCategory->images->intro_image;
             }
             $relatedCategory->images->intro_image_width = (int) $this->params->get('related_category_intro_image_width', 200);
             $relatedCategory->images->intro_image_height = (int) $this->params->get('related_category_intro_image_height', 200);
             if ($this->params->get('related_category_show_introtext', 1)) {
                 $relatedCategoryDescLimit = (int) $this->params->get('related_category_introtext_character_limit', 500);
                 if ($relatedCategoryDescLimit > 0) {
                     $relatedCategory->introtext = JUDirectoryFrontHelperString::truncateHtml($relatedCategory->introtext, $relatedCategoryDescLimit);
                 }
                 if ($params->get('plugin_support', 0)) {
                     $relatedCategory->introtext = JHtml::_('content.prepare', $relatedCategory->introtext, '', 'com_judirectory.category');
                 }
             } else {
                 $relatedCategory->introtext = '';
             }
         }
     }
     $subCatOrdering = $this->params->get('subcategory_ordering', 'title');
     $subCatDirection = $this->params->get('subcategory_direction', 'ASC');
     $this->subcategories = $model->getSubCategories($this->category->id, $subCatOrdering, $subCatDirection);
     if (is_array($this->subcategories) && count($this->subcategories) > 0) {
         foreach ($this->subcategories as $subCategory) {
             if (isset($subCategory->images->intro_image) && !empty($subCategory->images->intro_image)) {
                 $subCategory->images->intro_image_src = JUri::root(true) . '/' . JUDirectoryFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judirectory/images/category/intro/', true) . $subCategory->images->intro_image;
             }
             $subCategory->images->intro_image_width = (int) $this->params->get('subcategory_intro_image_width', 200);
             $subCategory->images->intro_image_height = (int) $this->params->get('subcategory_intro_image_height', 200);
             if ($this->params->get('subcategory_show_introtext', 1)) {
                 $subCategoryDescLimit = (int) $this->params->get('subcategory_introtext_character_limit', 500);
                 if ($subCategoryDescLimit > 0) {
                     $subCategory->introtext = JUDirectoryFrontHelperString::truncateHtml($subCategory->introtext, $subCategoryDescLimit);
                 }
                 if ($this->params->get('plugin_support', 0)) {
                     $subCategory->introtext = JHtml::_('content.prepare', $subCategory->introtext, '', 'com_judirectory.category');
                 }
             } else {
                 $subCategory->introtext = '';
             }
         }
     }
     $this->category->can_submit_listing = JUDirectoryFrontHelperPermission::canSubmitListing($this->category->id);
     if ($this->category->can_submit_listing && $this->params->get('show_submit_listing_btn_in_category', 1)) {
         $this->category->submit_listing_link = JUDirectoryFrontHelperListing::getAddListingLink($this->category->id);
     }
     $this->items = array();
     if ($this->category->show_item) {
         $user = JFactory::getUser();
         $uri = JUri::getInstance();
         $this->items = $this->get('Items');
         foreach ($this->items as $item) {
             $item->report_link = JRoute::_(JUDirectoryHelperRoute::getReportListingRoute($item->id));
             $item->claim_link = JRoute::_(JUDirectoryHelperRoute::getClaimListingRoute($item->id));
             if ($item->checked_out > 0 && $item->checked_out != $user->get('id')) {
                 if (JUDirectoryFrontHelperPermission::canCheckInListing($item->id)) {
                     $item->checkin_link = JRoute::_('index.php?option=com_judirectory&task=forms.checkin&id=' . $item->id . '&' . JSession::getFormToken() . '=1' . '&return=' . base64_encode(urlencode($uri)));
                 }
             } else {
                 $item->edit_link = JRoute::_('index.php?option=com_judirectory&task=form.edit&id=' . $item->id . '&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
                 if ($item->published == 1) {
                     $item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.unpublish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
                 } else {
                     $item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.publish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
                 }
             }
             $item->delete_link = JRoute::_('index.php?option=com_judirectory&task=forms.delete&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
             $dispatcher = JDispatcher::getInstance();
             JPluginHelper::importPlugin('content');
             $item->event = new stdClass();
             $context = 'com_judirectory.listing_list';
             $results = $dispatcher->trigger('onContentAfterTitle', array($context, &$item, &$item->params, 0));
             $item->event->afterDisplayTitle = trim(implode("\n", $results));
             $results = $dispatcher->trigger('onContentBeforeDisplay', array($context, &$item, &$item->params, 0));
             $item->event->beforeDisplayContent = trim(implode("\n", $results));
             $results = $dispatcher->trigger('onContentAfterDisplay', array($context, &$item, &$item->params, 0));
             $item->event->afterDisplayContent = trim(implode("\n", $results));
         }
         $this->pagination = $this->get('Pagination');
         //print_r($this->pagination);
     }
     $this->locations = JUDirectoryFrontHelper::getLocations($this->items);
     //print_r($this->locations);
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->_prepareData();
     $this->_prepareDocument();
     $this->_setBreadcrumb();
     parent::display($tpl);
 }
Пример #14
0
<?php

/**
 * ------------------------------------------------------------------------
 * JUDirectory for Joomla 2.5, 3.x
 * ------------------------------------------------------------------------
 *
 * @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');
$small_image_dir = JUDirectoryFrontHelper::getDirectory("listing_small_image_directory", "media/com_judirectory/images/gallery/small/", true) . $this->listing_id . "/";
$params = JUDirectoryHelper::getParams();
$requiredImage = $this->isRequired();
?>

<!-- New gallery image template -->
<script id="gallery-template" type="text/x-handlebars-template">
	<li>
		<input type="file" name="field_<?php 
echo $this->id;
?>
[]" class="validate-images" {{multiple}}/>
		<a href="#" class="btn btn-mini btn-xs btn-danger remove_image" onclick="return false;"><i
				class="icon-minus"></i> <?php 
echo JText::_('COM_JUDIRECTORY_REMOVE');
?>
$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');
?>
Пример #16
0
 public function resizeCollectionIcons($limitStart, $limit)
 {
     $db = JFactory::getDbo();
     $query = "SELECT icon FROM #__judirectory_collections WHERE icon != ''";
     $db->setQuery($query, $limitStart, $limit);
     $images = $db->loadObjectList();
     if (count($images)) {
         $collection_icon_path = JPATH_ROOT . "/" . JUDirectoryFrontHelper::getDirectory("collection_icon_directory", "media/com_judirectory/images/collection/");
         foreach ($images as $image) {
             $ori_image_path = $collection_icon_path . "original/" . $image->icon;
             if (JFile::exists($ori_image_path)) {
                 $image_path = $collection_icon_path . $image->icon;
                 if (JFile::exists($image_path)) {
                     JFile::delete($image_path);
                 }
                 JUDirectoryHelper::renderImages($ori_image_path, $image_path, 'collection');
             }
         }
     }
 }
Пример #17
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 
Пример #18
0
    public function loadDefaultAssets($loadJS = true, $loadCSS = true)
    {
        static $loaded = array();
        if ($this->folder && !isset($loaded[$this->folder])) {
            $document = JFactory::getDocument();
            if ($loadJS) {
                $document->addScript(JUri::root() . "components/com_judirectory/fields/" . $this->folder . "/judirgallery.js");
                $big_image_dir = JUDirectoryFrontHelper::getDirectory("listing_big_image_directory", "media/com_judirectory/images/gallery/big/", true) . $this->listing_id . "/";
                $params = JUDirectoryHelper::getParams(null, $this->listing_id);
                $requiredImage = $this->isRequired() ? 1 : 0;
                $maxImages = 4;
                $script = '
					jQuery(document).ready(function($){
						options = {
							juri_root    : "' . JUri::root() . '",
							requiredImage:  ' . (int) $requiredImage . ',
							maxImages    :  ' . (int) $maxImages . ',
							big_image_dir: "' . $big_image_dir . '",
							is_site      : 0
						};
						$("#image-gallery").judirgallery(options);
					});
				';
                $document->addScriptDeclaration($script);
            }
            if ($loadCSS) {
                $document->addStyleSheet(JUri::root() . "components/com_judirectory/fields/" . $this->folder . "/style.css");
            }
            $loaded[$this->folder] = true;
        }
    }