function getObjectInfo($id, $language = null) { $info = new JCommentsObjectInfo(); $routerHelper = JPATH_ROOT . '/components/com_djcatalog2/helpers/route.php'; if (is_file($routerHelper)) { require_once $routerHelper; $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('a.id, a.alias, a.name, a.created_by'); $query->from('#__djc2_items AS a'); $query->select('c.id AS category_id, c.alias AS category_alias'); $query->join('LEFT', '#__djc2_categories AS c ON c.id = a.cat_id'); $query->where('a.id = ' . (int) $id); $db->setQuery($query); $row = $db->loadObject(); if (!empty($row)) { $slug = $row->alias ? $row->id . ':' . $row->alias : $row->id; $catslug = $row->category_alias ? $row->category_id . ':' . $row->category_alias : $row->category_id; $info->title = $row->name; $info->category_id = $article->category_id; $info->userid = $row->created_by; $info->link = JRoute::_(DJCatalogHelperRoute::getItemRoute($slug, $catslug)); } } return $info; }
function getObjectInfo($id, $language = null) { $info = new JCommentsObjectInfo(); $routerHelper = JPATH_ROOT . '/components/com_djcatalog/helpers/route.php'; if (is_file($routerHelper)) { require_once $routerHelper; $db = JFactory::getDBO(); $db->setQuery('SELECT id, cat_id, name FROM #__djcat_items WHERE id = ' . $id); $row = $db->loadObject(); if (!empty($row)) { $info->title = $row->name; $info->link = JRoute::_(DJCatalogHelperRoute::getItemRoute($row->id, $row->cat_id)); } } return $info; }
* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with DJ-Catalog2. If not, see <http://www.gnu.org/licenses/>. * */ defined('_JEXEC') or die('Restricted access'); ?> <div class="djc_items mod_djc_items djc_clearfix" id="mod_djc_items-<?php echo $module_id; ?> "> <?php $categories = Djc2Categories::getInstance(array('state' => '1')); foreach ($items as $item) { $product_url = JRoute::_(DJCatalogHelperRoute::getItemRoute($item->slug, $item->catslug)); ?> <div class="djc_item mod_djc_item"> <?php if ($item->item_image && $params->get('showimage', '1') == '1' && ((int) $params->get('imagewidth', '120') > 0 || (int) $params->get('imageheight', '120') > 0)) { ?> <div class="djc_image"> <?php if ($params->get('linkimage', '1') == '1') { ?> <a href="<?php echo $product_url; ?> "> <?php }
protected function _prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $pathway = $app->getPathway(); $title = null; $heading = null; $document = JFactory::getDocument(); $menu = $menus->getActive(); $id = (int) @$menu->query['id']; $cid = (int) @$menu->query['cid']; if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } $title = $this->params->get('page_title', ''); $metakeys = null; $metadesc = null; if ($menu && ($menu->query['option'] != 'com_djcatalog2' || $menu->query['view'] == 'items' || $id != $this->item->id)) { if ($this->item->metatitle) { $title = $this->item->metatitle; } else { if ($this->item->name) { $title = $this->item->name; } } $category = $this->categories->get($this->item->cat_id); $path = array(array('title' => $this->item->name, 'link' => '')); while (($menu->query['option'] != 'com_djcatalog2' || $menu->query['view'] == 'items' && $cid != $category->id) && $category->id > 0) { $path[] = array('title' => $category->name, 'link' => DJCatalogHelperRoute::getCategoryRoute($category->catslug)); $category = $this->categories->get($category->parent_id); } $path = array_reverse($path); foreach ($path as $item) { $pathway->addItem($item['title'], $item['link']); } } else { if (!empty($menu)) { if ($this->params->get('menu-meta_description')) { $metadesc = $this->params->get('menu-meta_description'); } if ($this->params->get('menu-meta_keywords')) { $metakeys = $this->params->get('menu-meta_keywords'); } } } if (empty($title)) { $title = $app->getCfg('sitename'); } elseif ($app->getCfg('sitename_pagetitles', 0)) { if ($app->getCfg('sitename_pagetitles', 0) == '2') { $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename')); } else { $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title); } } $this->document->setTitle($title); if (!empty($this->item->metadesc)) { $this->document->setDescription($this->item->metadesc); } elseif (!empty($metadesc)) { $this->document->setDescription($metadesc); } if (!empty($this->item->metakey)) { $this->document->setMetadata('keywords', $this->item->metakey); } elseif (!empty($metakeys)) { $this->document->setMetadata('keywords', $metakeys); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } $this->document->addCustomTag('<meta property="og:title" content="' . trim($title) . '" />'); $this->document->addCustomTag('<meta property="twitter:title" content="' . trim($title) . '" />'); if ($metadesc) { $this->document->addCustomTag('<meta property="og:description" content="' . trim($metadesc) . '" />'); $this->document->addCustomTag('<meta property="twitter:description" content="' . trim($metadesc) . '" />'); } $this->document->addCustomTag('<meta property="og:url" content="' . JRoute::_(DJCatalogHelperRoute::getItemRoute($this->item->slug, $this->item->catslug), true, -1) . '" />'); if ($item_images = DJCatalog2ImageHelper::getImages('item', $this->item->id)) { if (isset($item_images[0])) { $this->document->addCustomTag('<meta property="og:image" content="' . $item_images[0]->large . '" />'); $this->document->addCustomTag('<meta property="twitter:image:src" content="' . $item_images[0]->large . '" />'); } } }
function getXml() { $app = JFactory::getApplication(); $jinput = $app->input; $this->_cparams = $app->getParams('com_djcatalog2'); $moduleclass_sfx = $jinput->get('moduleclass_sfx', null, 'string'); $mid = (int) $jinput->get('moduleId', null, 'int'); $stitle = $jinput->get('stitle', '1', 'string'); $ltitle = $jinput->get('ltitle', '1', 'string'); $modal = $jinput->get('modal', 1, 'int'); $scattitle = $jinput->get('scattitle', null, 'string'); $sproducer = $jinput->get('sproducer', '0', 'string'); $sprice = $jinput->get('sprice', '0', 'string'); $spag = $jinput->get('spag', null, 'int'); //$orderby = $jinput->get( 'orderby', null, 'get', 'int', 0); //$orderdir = $jinput->get( 'orderdir', 0, 'get', 'int', 0); //$featured_only = $jinput->get( 'featured_only', 0, 'get', 'int', 0); //$featured_first = $jinput->get( 'featured_first', 0, 'get', 'int', 0); $cols = (int) $jinput->get('cols', null, 'int'); $rows = (int) $jinput->get('rows', null, 'int'); //$mainimage = $jinput->get( 'mainimg', 'large', 'get', 'string', 0); $trunc = (int) $jinput->get('trunc', '0', 'int'); $trunclimit = (int) $jinput->get('trunclimit', '0', 'int'); $showreadmore = (int) $jinput->get('showreadmore', '1', 'int'); $readmoretext = $jinput->get('readmoretext', '', 'string'); $readmoretext = $readmoretext != '' ? urldecode($readmoretext) : JText::_('COM_DJCATALOG2_READMORE'); $paginationStart = (int) $jinput->get('pagstart', null, 'int'); $categories = $jinput->get('categories', null, 'string'); $catsw = $jinput->get('catsw', 0, 'int'); $categories = explode('|', $categories); $largewidth = $jinput->get('largewidth', '400', 'int'); $largeheight = $jinput->get('largeheight', '240', 'int'); $largecrop = $jinput->get('largecrop', 1, 'int') ? true : false; $smallwidth = $jinput->get('smallwidth', '90', 'int'); $smallheight = $jinput->get('smallheight', '70', 'int'); $smallcrop = $jinput->get('smallcrop', 1, 'int') ? true : false; $Itemid = $jinput->get('Itemid', 0, 'int'); $path = JURI::base(); $itemsCount = $this->getTotal(); $itemsPerPage = $rows * $cols; $paginationBar = null; //if ($spag == 1) { $paginationBar = '<pagination><![CDATA['; if ($itemsCount > $itemsPerPage && $itemsPerPage > 0) { if ((int) $spag == 1) { for ($i = 0; $i < $itemsCount; $i = $i + $itemsPerPage) { $counter = (int) (($i + $itemsPerPage) / $itemsPerPage); if ($paginationStart == $i) { $active = ' active'; } else { $active = ''; } $paginationBar .= '<span class="btn' . $active . ' button" style="cursor: pointer;" onclick="DJFrontpage_' . $mid . '.loadPage(' . $i . '); return false;">' . $counter . '</span> '; } } else { $prevPage = $paginationStart - $itemsPerPage; $nextPage = $paginationStart + $itemsPerPage; $firstPage = 0; $lastPage = $itemsPerPage * (ceil($itemsCount / $itemsPerPage) - 1); if ($paginationStart == 0) { $prevPage = $lastPage; } if ($paginationStart == $lastPage) { $nextPage = $firstPage; } $paginationBar .= '<span class="djcf_prev_button" style="cursor: pointer;" onclick="DJFrontpage_' . $mid . '.loadPage(' . $prevPage . '); return false;"></span> '; $paginationBar .= '<span class="djcf_next_button" style="cursor: pointer;" onclick="DJFrontpage_' . $mid . '.loadPage(' . $nextPage . '); return false;"></span>'; } } $paginationBar .= ']]></pagination>'; //} $items = $this->getList($paginationStart, $itemsPerPage); $output = '<?xml version="1.0" encoding="utf-8" ?><contents>'; $gallery = ''; for ($i = 0; $i < count($items); $i++) { $title = ''; $readmore = JRoute::_(DJCatalogHelperRoute::getItemRoute($items[$i]->slug, $items[$i]->catslug)); if ($stitle == '1') { if ($ltitle) { $title = '<h3><a href="' . $readmore . '">' . $items[$i]->name . '</a></h3>'; } else { $title = '<h3>' . $items[$i]->name . '</h3>'; } } $cattitle = ''; if ($scattitle == 1) { $cattitle = '<h2>' . $items[$i]->category . '</h2>'; } $producer = ''; if ($sproducer == 1 && $items[$i]->producer) { $producer = '<div class="djc_producer">' . JText::_('COM_DJCATALOG2_PRODUCER') . ': ' . $items[$i]->producer . '</div>'; } $price = ''; if ($sprice == 1 && $items[$i]->price > 0) { if ($items[$i]->special_price) { $price = JText::_('COM_DJCATALOG2_PRICE') . ': <span class="djc_price_old">' . $items[$i]->price . '</span> <span class="djc_price_new">' . $items[$i]->special_price . '</span>'; } else { $price = JText::_('COM_DJCATALOG2_PRICE') . ': <span class="djc_price">' . $items[$i]->price . '</span>'; } $price = '<div class="djc_price">' . $price . '</div>'; } if ($trunc > 0 && $trunclimit > 0) { $items[$i]->intro_desc = DJCatalog2HtmlHelper::trimText($items[$i]->intro_desc, $trunclimit); } else { if ($trunc > 0 && $trunclimit == -1) { $items[$i]->intro_desc = ''; } } $items[$i]->intro_desc = $producer . $price . $items[$i]->intro_desc; $output .= '<content>'; if ($scattitle == 1) { $output .= '<category><![CDATA[' . $cattitle . ']]></category>'; } $output .= '<text><![CDATA[' . $title . '<div class="djf_desc">' . $items[$i]->intro_desc . '</div>'; if ($showreadmore == '1') { $output .= '<a class="btn btn-primary btn-large" href="' . $readmore . '">' . $readmoretext . '</a>'; } $output .= ']]></text>'; $output .= '<image><![CDATA[' . DJCatalog2ImageHelper::getProcessedImage($items[$i]->item_image, $largewidth, $largeheight, !$largecrop, $items[$i]->image_path) . ']]></image>'; if ($modal == 1) { $output .= '<src><![CDATA[' . DJCatalog2ImageHelper::getImageUrl($items[$i]->image_fullpath, 'fullscreen') . ']]></src>'; } else { $output .= '<src><![CDATA[' . $readmore . ']]></src>'; } $output .= '</content>'; if ($items[$i]->item_image) { $gallery .= '<thumb><![CDATA[<div class="djf_cell img-polaroid"><a href="' . $readmore . '" onclick="DJFrontpage_' . $mid . '.loadItem(' . $i . '); return false;"><img src="' . DJCatalog2ImageHelper::getProcessedImage($items[$i]->item_image, $smallwidth, $smallheight, !$smallcrop, $items[$i]->image_path) . '" alt="' . $items[$i]->image_caption . '" /></a></div>]]></thumb>'; } else { $gallery .= '<thumb><![CDATA[]]></thumb>'; } } $all = $output . $gallery . $paginationBar; $all .= '</contents>'; return $all; }
} else { echo $item->intro_desc; } ?> </div> <?php } ?> </div> <div class="djc_clear"></div> <?php if ($params->get('showreadmore_item')) { ?> <p class="djc_readon"> <a class="btn readmore" href="<?php echo JRoute::_(DJCatalogHelperRoute::getItemRoute($item->slug, $item->catslug)); ?> "><?php echo JText::sprintf('MOD_DJC2_ITEM_READMORE'); ?> </a> </p> <?php } ?> </div> <?php } ?> </div>
/** * Plugin that returns the object list for DJ-Mediatools album * * Each object must contain following properties (mandatory): title, description, image * Optional properties: link, target (_blank or _self), alt (alt attribute for image) * * @param object The album params */ public function onAlbumPrepare(&$source, &$params) { // Lets check the requirements $check = $this->onCheckRequirements($source); if (is_null($check) || is_string($check)) { return null; } $app = JFactory::getApplication(); require_once JPATH_BASE . DS . 'components' . DS . 'com_djcatalog2' . DS . 'helpers' . DS . 'route.php'; JModelLegacy::addIncludePath(JPATH_BASE . DS . 'components' . DS . 'com_djcatalog2' . DS . 'models'); $model = JModelLegacy::getInstance('Items', 'Djcatalog2Model', array('ignore_request' => true)); $order = $params->get('plg_catalog2_orderby', 'i.ordering'); $order_Dir = $params->get('plg_catalog2_orderdir', 'asc'); $order_featured = $params->get('plg_catalog2_featured_first', 0); $filter_catid = $params->get('plg_catalog2_catid', array()); $filter_itemids = $params->get('plg_catalog2_item_ids', null); $filter_featured = $params->get('plg_catalog2_featured_only', 0); $limit = $params->get('max_images'); $default_image = $params->get('plg_catalog2_image'); $cparams = $app->getParams('com_djcatalog2'); $cparams->set('product_catalogue', 0); $model->setState('params', $cparams); $model->setState('list.start', 0); $model->setState('list.limit', $limit); $model->setState('filter.category', $filter_catid); $model->setState('filter.catalogue', false); $model->setState('filter.featured', $filter_featured); $model->setState('list.ordering_featured', $order_featured); $model->setState('list.ordering', $order); $model->setState('list.direction', $order_Dir); if ($filter_itemids) { $filter_itemids = explode(',', $filter_itemids); JArrayHelper::toInteger($filter_itemids); $model->setState('filter.item_ids', $filter_itemids); } $items = $model->getItems(); $slides = array(); foreach ($items as $item) { $slide = (object) array(); if (!empty($item->image_fullpath)) { $slide->image = 'media/djcatalog2/images/' . $item->image_fullpath; } else { if (!empty($item->item_image)) { $slide->image = 'media/djcatalog2/images/' . $item->item_image; } else { if (!empty($default_image)) { $slide->image = $default_image; } else { continue; } } } $slide->title = $item->name; $slide->description = $item->intro_desc; $slide->link = JRoute::_(DJCatalogHelperRoute::getItemRoute($item->slug, $item->catslug)); $slide->alt = $item->image_caption; $slides[] = $slide; } return $slides; }
} ?> </div> <?php if ((int) $item->available == 1 && $this->params->get('items_show_cart_button', '1') == 1 && ($this->params->get('cart_enabled', false) || $this->params->get('cart_query_enabled', 1))) { echo $this->loadTemplate('addtocart'); } ?> <?php if ($this->params->get('showreadmore_item')) { ?> <div class="clear"></div> <div class="djc_readon"> <a class="btn button readmore" href="<?php echo JRoute::_(DJCatalogHelperRoute::getItemRoute($item->slug, !isset($this->item) || empty($this->item->catslug) ? $item->catslug : $this->item->catslug)); ?> " class="readmore"><?php echo JText::sprintf('COM_DJCATALOG2_READMORE'); ?> </a> </div> <?php } ?> </div> </div> <div class="djc_clear"></div> </div> <?php if ($newrow_close) {
/** * Plugin that returns the object list for DJ-Mediatools album * * Each object must contain following properties (mandatory): title, description, image * Optional properties: link, target (_blank or _self), alt (alt attribute for image) * * @param object The album params */ public function onAlbumPrepare(&$source, &$params) { // Lets check the requirements $check = $this->onCheckRequirements($source); if (is_null($check) || is_string($check)) { return null; } $app = JFactory::getApplication(); require_once JPATH_BASE . DS . 'components' . DS . 'com_djcatalog2' . DS . 'helpers' . DS . 'route.php'; require_once JPATH_BASE . DS . 'components' . DS . 'com_djcatalog2' . DS . 'helpers' . DS . 'djcatalog2.php'; JModelLegacy::addIncludePath(JPATH_BASE . DS . 'components' . DS . 'com_djcatalog2' . DS . 'models'); $model = JModelLegacy::getInstance('Items', 'Djcatalog2Model', array('ignore_request' => true)); $order = $params->get('plg_catalog2_orderby', 'i.ordering'); $order_Dir = $params->get('plg_catalog2_orderdir', 'asc'); $order_featured = $params->get('plg_catalog2_featured_first', 0); $filter_catid = $params->get('plg_catalog2_catid', array()); $filter_itemids = $params->get('plg_catalog2_item_ids', null); $filter_featured = $params->get('plg_catalog2_featured_only', 0); $limit = $params->get('max_images'); $default_image = $params->get('plg_catalog2_image'); $cparams = $app->getParams('com_djcatalog2'); $cparams->set('product_catalogue', 0); $model->setState('params', $cparams); $model->setState('list.start', 0); $model->setState('list.limit', $limit); $model->setState('filter.category', $filter_catid); $model->setState('filter.catalogue', false); $model->setState('filter.featured', $filter_featured); $model->setState('list.ordering_featured', $order_featured); $model->setState('list.ordering', $order); $model->setState('list.direction', $order_Dir); if ($filter_itemids) { $filter_itemids = explode(',', $filter_itemids); JArrayHelper::toInteger($filter_itemids); $model->setState('filter.item_ids', $filter_itemids); } $items = $model->getItems(); $slides = array(); foreach ($items as $item) { $slide = (object) array(); if (!empty($item->image_fullpath)) { $slide->image = 'media/djcatalog2/images/' . $item->image_fullpath; } else { if (!empty($item->item_image)) { $slide->image = 'media/djcatalog2/images/' . $item->item_image; } else { if (!empty($default_image)) { $slide->image = $default_image; } else { continue; } } } $slide->title = $item->name; $slide->description = $item->intro_desc; $slide->canonical = $slide->link = JRoute::_(DJCatalogHelperRoute::getItemRoute($item->slug, $item->catslug)); $slide->alt = $item->image_caption; $slide->id = $item->slug; if ($comments = $params->get('commnets', 0)) { $host = str_replace(JURI::root(true), '', JURI::root()); $host = preg_replace('/\\/$/', '', $host); switch ($comments) { case 1: // jcomments $slide->comments = array('id' => $item->id, 'group' => 'com_djcatalog2'); break; case 2: // disqus $disqus_shortname = $params->get('disqus_shortname', ''); if (!empty($disqus_shortname)) { $slide->comments = array(); $slide->comments['url'] = $host . $slide->link; $slide->comments['identifier'] = $disqus_shortname . '-djc2-' . $item->id; } break; case 3: // facebook $slide->comments = $host . $slide->link; break; case 4: //komento // not implemented break; } } $slides[] = $slide; } return $slides; }
?> " src="<?php echo DJCatalog2ImageHelper::getImageUrl($item->image_fullpath, 'small'); ?> "/></a> </div> <?php } ?> </td> <td class="djc_td_title"> <?php if ((int) $item->published != 1) { echo $item->name; } else { echo JHTML::link(JRoute::_(DJCatalogHelperRoute::getItemRoute($item->slug, $item->catslug)), $item->name); } ?> <?php if ($item->featured == 1) { echo '<img class="djc_featured_image" alt="' . JText::_('COM_DJCATALOG2_FEATURED_ITEM') . '" title="' . JText::_('COM_DJCATALOG2_FEATURED_ITEM') . '" src="' . DJCatalog2ThemeHelper::getThemeImage('featured.png') . '" />'; } ?> </td> <?php if ($this->params->get('fed_show_category_name', 1) > 0) { ?> <td class="djc_category"> <?php if ($this->params->get('fed_show_category_name', 1) == 2) { ?>
if ($this->params->get('show_print_button_item', false) == '1' || $this->params->get('show_pdf_button_item', false) == '1') { ?> <?php if ($this->params->get('show_print_button_item', false) == '1') { ?> <a rel="nofollow" class="djc_printable_version" href="<?php echo JRoute::_(DJCatalogHelperRoute::getItemRoute($this->item->id, $this->item->cat_id) . '&tmpl=component&print=1&layout=print'); ?> "><?php echo JText::_('COM_DJCATALOG2_PRINTABLE_BUTTON'); ?> </a> <?php } ?> <?php if ($this->params->get('show_pdf_button_item', false) == '1') { ?> <a rel="nofollow" class="djc_print_pdf_button" href="<?php echo JRoute::_(DJCatalogHelperRoute::getItemRoute($this->item->id, $this->item->cat_id) . '&tmpl=component&print=1&layout=print&pdf=1'); ?> "><?php echo JText::_('COM_DJCATALOG2_PRINT_PDF_BUTTON'); ?> </a> <?php } } ?> </div>
/** * Method to get Product * @param unknown_type $product */ function onJ2StoreAfterGetProduct(&$product) { if (isset($product->product_source) && $product->product_source == 'com_djcatalog2') { static $sets; if (!is_array($sets)) { $sets = array(); } require_once JPATH_SITE . '/components/com_djcatalog2/helpers/route.php'; $item = $this->getItem($product->product_source_id); if ($item) { //assign $product->source = $item; $product->product_name = $item->name; $product->product_edit_url = 'index.php?option=com_djcatalog2&task=item.edit&id=' . $item->id; $product->product_view_url = JRoute::_(DJCatalogHelperRoute::getItemRoute($item->id, $item->cat_id, $item->name)); if ($item->state == 1) { $product->exists = 1; } else { $product->exists = 0; } $sets[$product->product_source][$product->product_source_id] = $item; } else { $product->exists = 0; } } }
static function getDJCatalog2Item(&$xmap, &$parent, &$params, &$itemid) { $database = JFactory::getDBO(); $query = " SELECT a.name, a.alias, a.id, a.cat_id, c.alias as cat_alias, UNIX_TIMESTAMP(a.created) as `created` \n" . " FROM #__djc2_items AS a \n" . " INNER JOIN #__djc2_categories as c on c.id = a.cat_id" . " WHERE a.id = " . (int) $itemid . " AND a.published=1"; $database->setQuery($query); $row = $database->loadObject(); $node = new stdclass(); $node->name = $row->name; $node->link = DJCatalogHelperRoute::getItemRoute($row->id . ':' . $row->alias, $row->cat_id . ':' . $row->cat_alias); $node->id = $parent->id; $node->uid = 'com_djcatalog2i' . $row->id; $node->browserNav = $parent->browserNav; $node->modified = $row->created; $node->priority = $params['link_priority']; $node->changefreq = $params['link_changefreq']; $node->expandible = false; $node->secure = $parent->secure; $xmap->printNode($node); return true; }
public function getContentPermalink() { $link = ''; if (JFactory::getApplication()->isSite()) { $link = DJCatalogHelperRoute::getItemRoute($this->_item->id . ':' . urlencode($this->_item->alias), $this->_item->cat_id . ':' . urlencode($this->_item->category_alias)); $link = urldecode(JRoute::_($link)); } else { $link = DJCatalogHelperRoute::getItemRoute($this->_item->id . ':' . urlencode($this->_item->alias), $this->_item->cat_id . ':' . urlencode($this->_item->category_alias)); } $link = $this->prepareLink($link); return $link; }
<?php } ?> </td> <?php } ?> <?php if ((int) $this->params->get('show_item_name', '1') > 0) { ?> <td class="djc_td_title"> <?php if ((int) $this->params->get('show_item_name', '1') == 2) { echo $item->name; } else { echo JHTML::link(JRoute::_(DJCatalogHelperRoute::getItemRoute($item->slug, !isset($this->item) || empty($this->item->catslug) ? $item->catslug : $this->item->catslug)), $item->name); } ?> <?php if ($item->featured == 1) { echo '<img class="djc_featured_image" alt="' . JText::_('COM_DJCATALOG2_FEATURED_ITEM') . '" title="' . JText::_('COM_DJCATALOG2_FEATURED_ITEM') . '" src="' . DJCatalog2ThemeHelper::getThemeImage('featured.png') . '" />'; } ?> <?php if (!empty($item->event->afterDJCatalog2DisplayTitle)) { ?> <div class="djc_post_title"> <?php echo $item->event->afterDJCatalog2DisplayTitle; ?>
private function _sendEmail($data, $item) { $app = JFactory::getApplication(); $params = JComponentHelper::getParams('com_djcatalog2'); /*if ($contact->email_to == '' && $contact->user_id != 0) { $contact_user = JUser::getInstance($contact->user_id); $contact->email_to = $contact_user->get('email'); }*/ $mailfrom = $app->getCfg('mailfrom'); $fromname = $app->getCfg('fromname'); $sitename = $app->getCfg('sitename'); $copytext = JText::sprintf('COM_DJCATALOG2_COPYTEXT_OF', $item->name, $sitename); $contact_list = $params->get('contact_list', false); $recipient_list = array(); if ($contact_list !== false) { $recipient_list = explode(PHP_EOL, $params->get('contact_list', '')); } $list_is_empty = true; foreach ($recipient_list as $r) { if (strpos($r, '@') !== false) { $list_is_empty = false; break; } } if ($list_is_empty) { $recipient_list[] = $mailfrom; } $recipient_settings = $params->get('fed_contact', 0); $owner = JFactory::getUser($item->created_by); $owner_email = null; if ($owner && $owner->email) { $owner_email = $owner->email; } if ((int) $recipient_settings == 1 && $owner_email) { $recipient_list = array($owner_email); } else { if ((int) $recipient_settings == 2) { $recipient_list[] = $owner_email; } } $recipient_list = array_unique($recipient_list); $name = $data['contact_name']; $email = $data['contact_email']; $subject = $data['contact_subject']; $body = $data['contact_message']; $additional_data = array(); if (!empty($data['contact_company_name'])) { $additional_data[] = array('label' => JText::_('COM_DJCATALOG2_CONTACT_COMPANY_NAME_LABEL'), 'value' => $data['contact_company_name']); } if (!empty($data['contact_phone'])) { $additional_data[] = array('label' => JText::_('COM_DJCATALOG2_CONTACT_PHONE_LABEL'), 'value' => $data['contact_phone']); } if (!empty($data['contact_street'])) { $additional_data[] = array('label' => JText::_('COM_DJCATALOG2_CONTACT_STREET_LABEL'), 'value' => $data['contact_street']); } if (!empty($data['contact_city'])) { $additional_data[] = array('label' => JText::_('COM_DJCATALOG2_CONTACT_CITY_LABEL'), 'value' => $data['contact_city']); } if (!empty($data['contact_zip'])) { $additional_data[] = array('label' => JText::_('COM_DJCATALOG2_CONTACT_ZIP_LABEL'), 'value' => $data['contact_zip']); } if (!empty($data['contact_country'])) { $additional_data[] = array('label' => JText::_('COM_DJCATALOG2_CONTACT_COUNTRY_LABEL'), 'value' => $data['contact_country']); } if (count($additional_data) > 0) { $body .= "\r\n\r\n" . JText::_('COM_DJCATALOG2_CONTACT_ADDITIONAL_DATA'); foreach ($additional_data as $k => $v) { $body .= "\r\n" . $v['label'] . ': ' . $v['value']; } } // Prepare email body $prefix = JText::sprintf('COM_DJCATALOG2_ENQUIRY_TEXT', JURI::base(), $item->name); $body = $prefix . "\n" . $name . ' <' . $email . '>' . "\r\n\r\n" . stripslashes($body) . "\r\n\r\n" . JRoute::_(DJCatalogHelperRoute::getItemRoute($item->slug, $item->cat_slug), false, -1); $mail = JFactory::getMailer(); //$mail->addRecipient($mailfrom); foreach ($recipient_list as $recipient) { $mail->addBCC(trim($recipient)); } $mail->addReplyTo(array($email, $name)); if ((int) $params->get('contact_sender', 0) == 1) { $mail->setSender(array($email, $name)); } else { $mail->setSender(array($mailfrom, $fromname)); } $mail->setSubject($sitename . ': ' . $subject); $mail->setBody($body); $sent = $mail->Send(); //If we are supposed to copy the sender, do so. // check whether email copy function activated if (array_key_exists('contact_email_copy', $data)) { $copytext = JText::sprintf('COM_DJCATALOG2_COPYTEXT_OF', $item->name, $sitename); $copytext .= "\r\n\r\n" . $body; $copysubject = JText::sprintf('COM_DJCATALOG2_COPYSUBJECT_OF', $subject); $mail = JFactory::getMailer(); $mail->addRecipient($email); $mail->addReplyTo(array($email, $name)); $mail->setSender(array($mailfrom, $fromname)); $mail->setSubject($copysubject); $mail->setBody($copytext); $sent = $mail->Send(); } return $sent; }
function onContentSearch($text, $phrase = '', $ordering = '', $areas = null) { $app = JFactory::getApplication(); $db = JFactory::getDBO(); $searchText = $text; require_once JPATH_SITE . DS . 'components' . DS . 'com_djcatalog2' . DS . 'helpers' . DS . 'route.php'; if (is_array($areas)) { if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) { return array(); } } // load plugin params info $plugin = JPluginHelper::getPlugin('search', 'djcatalog2'); $pluginParams = $this->params; $limit = $pluginParams->def('search_limit', 50); $text = trim($text); if ($text == '') { return array(); } $query = $db->getQuery(true); $query->select('image.fullpath AS image, i.id AS id, i.alias as alias, i.name AS title, i.intro_desc AS intro, i.created as created, c.id AS catid, c.name AS category, c.alias as catalias, i.description as text, i.metakey as metakey, i.metadesc as metadesc, p.name as producer_name, "2" as browsernav'); $query->from('#__djc2_items AS i'); $where = ''; $textSearch = array(); switch ($phrase) { case 'exact': $textSearch[] = 'LOWER(i.name) LIKE ' . $db->quote('%' . $db->escape($text, true) . '%', false); $textSearch[] = 'LOWER(i.description) LIKE ' . $db->quote('%' . $db->escape($text, true) . '%', false); $textSearch[] = 'LOWER(i.intro_desc) LIKE ' . $db->quote('%' . $db->escape($text, true) . '%', false); $textSearch[] = 'LOWER(i.metadesc) LIKE ' . $db->quote('%' . $db->escape($text, true) . '%', false); $textSearch[] = 'LOWER(i.metakey) LIKE ' . $db->quote('%' . $db->escape($text, true) . '%', false); $textSearch[] = 'LOWER(c.name) LIKE ' . $db->quote('%' . $db->escape($text, true) . '%', false); $textSearch[] = 'LOWER(p.name) LIKE ' . $db->quote('%' . $db->escape($text, true) . '%', false); $optionsSearch = ' select i.id ' . ' from #__djc2_items as i ' . ' inner join #__djc2_items_extra_fields_values_int as efv on efv.item_id = i.id' . ' inner join #__djc2_items_extra_fields as ef on ef.id = efv.field_id and ef.searchable = 1 ' . ' inner join #__djc2_items_extra_fields_options as efo on efo.id = efv.value and lower(efo.value) like ' . $db->quote('%' . $db->escape($text, true) . '%', false) . ' union ' . 'select i.id ' . ' from #__djc2_items as i ' . ' inner join #__djc2_items_extra_fields_values_text as efv on efv.item_id = i.id' . ' inner join #__djc2_items_extra_fields as ef on ef.id = efv.field_id and ef.searchable = 1 and lower(efv.value) like ' . $db->quote('%' . $db->escape($text, true) . '%', false); $query->join('LEFT', '(' . $optionsSearch . ') AS customattribute_search ON customattribute_search.id = i.id'); $textSearch[] = 'i.id = customattribute_search.id'; $where = ' ( ' . implode(' OR ', $textSearch) . ' ) '; break; case 'all': case 'any': default: $words = explode(' ', $text); $textSearches = array(); foreach ($words as $k => $word) { $textSearch = array(); $textSearch[] = 'LOWER(i.name) LIKE ' . $db->quote('%' . $db->escape($word, true) . '%', false); $textSearch[] = 'LOWER(i.description) LIKE ' . $db->quote('%' . $db->escape($word, true) . '%', false); $textSearch[] = 'LOWER(i.intro_desc) LIKE ' . $db->quote('%' . $db->escape($word, true) . '%', false); $textSearch[] = 'LOWER(i.metadesc) LIKE ' . $db->quote('%' . $db->escape($word, true) . '%', false); $textSearch[] = 'LOWER(i.metakey) LIKE ' . $db->quote('%' . $db->escape($word, true) . '%', false); $textSearch[] = 'LOWER(c.name) LIKE ' . $db->quote('%' . $db->escape($word, true) . '%', false); $textSearch[] = 'LOWER(p.name) LIKE ' . $db->quote('%' . $db->escape($word, true) . '%', false); $optionsSearch = ' select i.id ' . ' from #__djc2_items as i ' . ' inner join #__djc2_items_extra_fields_values_int as efv on efv.item_id = i.id' . ' inner join #__djc2_items_extra_fields as ef on ef.id = efv.field_id and ef.searchable = 1 ' . ' inner join #__djc2_items_extra_fields_options as efo on efo.id = efv.value and lower(efo.value) like ' . $db->quote('%' . $db->escape($word, true) . '%', false) . ' union ' . 'select i.id ' . ' from #__djc2_items as i ' . ' inner join #__djc2_items_extra_fields_values_text as efv on efv.item_id = i.id' . ' inner join #__djc2_items_extra_fields as ef on ef.id = efv.field_id and ef.searchable = 1 and lower(efv.value) like ' . $db->quote('%' . $db->escape($word, true) . '%', false); $query->join('LEFT', '(' . $optionsSearch . ') AS customattribute_search_' . $k . ' ON customattribute_search_' . $k . '.id = i.id'); $textSearch[] = 'i.id = customattribute_search_' . $k . '.id'; $textSearches[] = implode(' OR ', $textSearch); } $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $textSearches) . ')'; break; } $query->join('left', '#__djc2_categories AS c ON c.id = i.cat_id'); $query->join('left', '#__djc2_producers AS p ON p.id = i.producer_id'); $query->join('left', '#__djc2_images AS image ON image.item_id = i.id'); $lang = JFactory::getLanguage(); $query->where($where . " AND i.published=1 AND c.published=1 AND image.ordering = 1 AND i.language = '{$lang->getTag()}'"); $query->group('i.id'); switch ($ordering) { case 'alpha': $order = 'i.name ASC'; break; case 'category': case 'popular': case 'newest': case 'oldest': default: $order = 'i.name DESC'; } $query->order($order); $db->setQuery($query, 0, $limit); //echo str_replace('#_','jos',$query); $rows = $db->loadObjectList(); $count = count($rows); for ($i = 0; $i < $count; $i++) { $rows[$i]->href = JRoute::_(DJCatalogHelperRoute::getItemRoute($rows[$i]->id . ':' . $rows[$i]->alias, $rows[$i]->catid . ':' . $rows[$i]->catalias)); $rows[$i]->section = JText::_('PLG_SEARCH_DJCATALOG2_DJCATALOGITEMS') . ': ' . $rows[$i]->category; // because extra attributes are also taken into accout, we have to trick checkNoHTML function $rows[$i]->__term = $searchText; } $return = array(); foreach ($rows as $key => $section) { if (searchHelper::checkNoHTML($section, $searchText, array('title', 'text', 'intro', 'metadesc', 'metakey', 'producer_name', '__term'))) { $return[] = $section; } } return $return; }
</td> <td> <a class="pointer" onclick="if (window.parent) window.parent.<?php echo $this->escape($function); ?> ('<?php echo $item->id; ?> ', '<?php echo $this->escape(addslashes($item->name)); ?> ', '<?php echo $this->escape($item->cat_id); ?> ', null, '<?php echo $this->escape(DJCatalogHelperRoute::getItemRoute($item->id, $item->cat_id)); ?> ', null);"> <?php echo $this->escape($item->name); ?> </a> <p class="smallsub"><?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?> </p> </td> <td> <?php echo $this->escape($item->category_name); ?>
?> <a class="djc_prev_btn" href="<?php echo JRoute::_(DJCatalogHelperRoute::getItemRoute($this->navigation['prev']->slug, $this->navigation['prev']->catslug)); ?> "><span class="button btn"><?php echo JText::_('COM_DJCATALOG2_PREVIOUS'); ?> </span></a> <?php } ?> <?php if (!empty($this->navigation['next'])) { ?> <a class="djc_next_btn" href="<?php echo JRoute::_(DJCatalogHelperRoute::getItemRoute($this->navigation['next']->slug, $this->navigation['next']->catslug)); ?> "><span class="button btn"><?php echo JText::_('COM_DJCATALOG2_NEXT'); ?> </span></a> <?php } ?> </div> <?php } ?> <?php if (in_array('item', $this->params->get('social_code_views', array())) && $this->params->get('social_code_position', 'top') == 'aft_desc' && $this->params->get('social_code', '') != '') {
stylers:[{ visibility:"off" }] }] }; djc2_map = new google.maps.Map(document.getElementById("djc2_map"), mapOpts); var size = new google.maps.Size(32,32); var start_point = new google.maps.Point(0,0); var anchor_point = new google.maps.Point(0,16); <?php foreach ($this->items as $item) { ?> var icon = ''; <?php $marker_link = JRoute::_(DJCatalogHelperRoute::getItemRoute($item->slug, $item->catslug)); $marker_title = addslashes(htmlspecialchars($item->name)); $address = array(); $marker_address = ''; if ($item->address) { $address[] = addslashes($item->address); } if ($item->postcode) { $address[] = addslashes($item->postcode); } if ($item->city) { $address[] = addslashes($item->city); } if ($item->country_name) { $address[] = addslashes($item->country_name); }
/** * Should return everything - Full rating, list of reviews and add review form * * @param object $row DJ-Catalog2 Object * @param JRegistry $params * @param int $page * @return boolean|Ambigous <boolean, string> */ public function onAfterDJCatalog2DisplayContent(&$row, &$params, $page = 0, $context = 'item') { $app = JFactory::getApplication(); $view = $app->input->get('view'); if ($view != 'item') { return false; } $excluded_categories = $this->params->get('exclude_categories', array()); if (in_array($row->cat_id, $excluded_categories)) { return false; } $excluded_products = explode(',', $this->params->get('exclude_items', '')); if (in_array($row->id, $excluded_products)) { return false; } $group_id = $this->params->get('rating_group', false); if (!$group_id) { return false; } require_once JPath::clean(JPATH_ROOT . '/components/com_djreviews/lib/api.php'); require_once JPath::clean(JPATH_ROOT . '/components/com_djcatalog2/helpers/route.php'); $review = DJReviewsAPI::getInstance(array('group' => $group_id, 'type' => 'com_djcatalog2.item', 'name' => $row->name, 'link' => DJCatalogHelperRoute::getItemRoute($row->slug, $row->catslug), 'id' => $row->id)); return $review->getFullReview(); }
function display($tpl = null) { $app = JFactory::getApplication(); $document = JFactory::getDocument(); $model = $this->getModel(); $config = JFactory::getConfig(); $siteEmail = $config->get('mailfrom'); $fromName = $config->get('fromname'); $feedEmail = $config->get('feed_email', 'author'); $document->editor = $fromName; if ($feedEmail != 'none') { $document->editorEmail = $siteEmail; } $menus = $app->getMenu('site'); $menu = $menus->getActive(); $mOption = empty($menu->query['option']) ? null : $menu->query['option']; $mCatid = empty($menu->query['cid']) ? null : (int) $menu->query['cid']; $mProdid = empty($menu->query['pid']) ? null : (int) $menu->query['pid']; $filter_catid = $app->input->get('cid', null, 'int'); if ($filter_catid === null && $mOption == 'com_djcatalog2' && $mCatid) { $filter_catid = $mCatid; $app->input->set('cid', $filter_catid); } $filter_producerid = $app->input->get('pid', null, 'string'); if ($filter_producerid === null && $mOption == 'com_djcatalog2' && $mProdid) { $filter_producerid = $mProdid; $app->input->set('pid', $filter_producerid); } $params = Djcatalog2Helper::getParams(); $params->set('product_catalogue', false); $filter_order = $params->get('rss_items_default_order', 'i.date'); $filter_order_Dir = $params->get('rss_items_default_order_dir', 'desc'); $limitstart = $app->input->get('limitstart', 0, 'int'); $limit_items_show = $params->get('rss_limit_items_show', $config->get('feed_limit', 10)); $app->input->set('limit', $limit_items_show); $dispatcher = JDispatcher::getInstance(); $categories = Djc2Categories::getInstance(array('state' => '1')); // current category $category = $categories->get((int) $app->input->get('cid', 0, 'default')); $subcategories = null; if (!empty($category)) { $subcategories = $category->getChildren(); } /* If Cateogory not published set 404 */ if ($category && $category->id > 0 && $category->published == 0 || empty($category)) { throw new Exception(JText::_('COM_DJCATALOG2_PRODUCT_NOT_FOUND'), 404); } $title = $params->get('page_title', ''); if ($menu && ($menu->query['option'] != 'com_djcatalog2' || $menu->query['view'] != 'items' || $id != $category->id)) { if (!empty($category->metatitle)) { $title = $category->metatitle; } else { if ($category->name && $category->id > 0) { $title = $category->name; } } } if (empty($title)) { $title = $config->get('sitename'); } $document->setTitle($title); $rows = $model->getItems(); $document->link = JRoute::_(DJCatalogHelperRoute::getCategoryRoute($category->catslug)); foreach ($rows as $row) { // Strip html from feed item title $title = $this->escape($row->name); $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8'); // Compute the article slug $row->slug = $row->alias ? $row->id . ':' . $row->alias : $row->id; // Url link to article $link = JRoute::_(DJCatalogHelperRoute::getItemRoute($row->slug, $category->id == 0 ? $row->catslug : $category->catslug)); // Get description, author and date $date = $row->created; // Load individual item creator class $item = new JFeedItem(); $item->title = $title; $item->link = $link; $item->date = $date; $item->author = $row->author; $item->category = $category->id == 0 ? $row->category : $category->name; //$item->authorEmail = $siteEmail; if ($feedEmail == 'site') { $item->authorEmail = $siteEmail; } else { if ($feedEmail === 'author') { $item->authorEmail = $row->author_email; } } $description = ''; if ($row->item_image && (int) $params->get('rss_image_link_item', '1')) { //$item->image = new JFeedImage(); //$item->image->url = DJCatalog2ImageHelper::getImageUrl($row->item_image,'small'); //$item->image->link = $item->link; //$item->image->title = $row->image_caption; $description .= '<img src="' . DJCatalog2ImageHelper::getImageUrl($row->image_fullpath, 'small') . '" alt="' . $row->image_caption . '"/>'; } if ($params->get('rss_description_type', '1') != '0') { $description .= $params->get('rss_description_type', '1') == '1' && $row->intro_desc ? $row->intro_desc : $row->description; if ($params->get('rss_showreadmore_item', '1')) { $description .= '<p class="feed-readmore"><a target="_blank" href ="' . $item->link . '">' . JText::_('COM_DJCATALOG2_READMORE') . '</a></p>'; } } // Load item description and add div $item->description = '<div class="feed-description">' . $description . '</div>'; // Loads item info into rss array $document->addItem($item); } }