/** * Check pictures of category and evtl. subcategories * call Joom_CheckNew() to decide if NEW * recursion call, premature terminate if 'NEW' applies to * * @param string $catids_values id's of cats 'x,y' * @return string.....$isnew */ function Joom_CheckNewCatg($catids_values) { $config = Joom_getConfig(); $database =& JFactory::getDBO(); $user =& JFactory::getUser(); $isnewcat = ""; //search in db the categories in $catids_values $database->setQuery("SELECT MAX(imgdate)\n FROM #__joomgallery AS a\n LEFT JOIN #__joomgallery_catg AS c ON c.cid=a.catid\n WHERE a.catid in ({$catids_values})\n AND a.published = '1' AND a.approved='1'\n AND c.access <= " . $user->get('aid') . " AND c.published = '1'"); $maxdate = $database->loadResult(); if ($database->getErrorNum()) { //TODO error handling echo $database->stderr(true); } //if maxdate = NULL no picture found //otherwise check the date to 'new' if ($maxdate != NULL) { $isnewcat = Joom_CheckNew($maxdate, $config->jg_catdaysnew); //terminate if 'new' found if ($isnewcat != "") { return $isnewcat; } } //no picture found in cat marked as new //check subcategories with $parent=cid $database->setQuery("SELECT cid\n FROM #__joomgallery_catg\n WHERE parent in ({$catids_values})\n AND access <= " . $user->get('aid') . " AND published = '1' "); //if 0 rows no existent subcategories //terminate with return of new="" $catids = $database->loadResultArray(); if ($database->getErrorNum()) { echo $database->stderr(true); } if (count($catids) == 0) { return ""; } //split array in comma separated string $catids_values = implode(",", $catids); //call function again and check 'new' $isnewcat = Joom_CheckNewCatg($catids_values); //if no new found at all //return empty string return $isnewcat; }
function Joom_ShowCategoryBody_HTML(&$rows, &$rowcounter, &$colum, $order_by, &$order_dir) { global $id; $config = Joom_getConfig(); $document =& JFactory::getDocument(); $mainframe =& JFactory::getApplication('site'); $database =& JFactory::getDBO(); $user =& JFactory::getUser(); //wenn jg_cooliris = true, dann zusaetzlich XML im head aufbauen if ($config->jg_cooliris && count($rows) > 0) { $href = _JOOM_LIVE_SITE . $this->viewcategory_url . $this->catid . '&startpage=' . $this->catstartpage . '&cooliris=1' . _JOOM_ITEMID; $attribs = array('id' => 'joomgallery', 'type' => 'application/rss+xml', 'title' => 'Cooliris'); $document->addHeadLink($href, 'alternate', 'rel', $attribs); if ($config->jg_coolirislink) { $document->addScript('http://lite.piclens.com/current/piclens.js'); echo '<a id="jg_cooliris" href="javascript:PicLensLite.start({feedUrl:\'' . _JOOM_LIVE_SITE . $this->viewcategory_url . $this->catid . '&startpage=' . $this->catstartpage . _JOOM_ITEMID . '&cooliris=1\'});">' . JText::_('JGS_COOLIRISLINK_TEXT') . '</a>'; } } if (!$config->jg_showtitle && !$config->jg_showhits && !$config->jg_showauthor && !$config->jg_showowner && !$config->jg_showcatrate && !$config->jg_showcatcom && !$config->jg_showcatdescription) { $show_text = false; } else { $show_text = true; } $num_rows = ceil(count($rows) / $colum); $index = 0; $count_pics = count($rows); ?> <a name="category"></a> <?php if ($count_pics > 0) { for ($row_count = 0; $row_count < $num_rows; $row_count++) { $linecolor = ($row_count + 1) % 2 + 1; ?> <div class="jg_row <?php if ($linecolor == 1) { echo "sectiontableentry1"; } else { echo "sectiontableentry2"; } ?> "> <?php for ($col_count = 0; $col_count < $colum && $index < $count_pics; $col_count++) { $ii = 1; $row1 = $rows[$index]; if ($config->jg_showpicasnew) { $isnew = Joom_CheckNew($row1->imgdate, $config->jg_daysnew); } $catpath = Joom_GetCatPath($row1->cid); if ($config->jg_showdetailpage == 0 && $user->get('aid') != 0 || $config->jg_showdetailpage == 1) { $link = Joom_OpenImage($config->jg_detailpic_open, $row1->id, $catpath, $row1->cid, $row1->imgfilename, $row1->imgtitle, $row1->imgtext); } else { $link = "javascript:alert('" . JText::_('JGS_ALERT_NO_DETAILVIEW_FOR_GUESTS', true) . "')"; } ?> <div class="jg_element_cat"> <a href="<?php echo $link; ?> " class="jg_catelem_photo"> <img src="<?php echo _JOOM_LIVE_SITE . $config->jg_paththumbs . $catpath . $row1->imgthumbname; ?> " class="jg_photo" alt="<?php echo $row1->imgtitle; ?> " /> </a> <?php if ($show_text) { ?> <div class="jg_catelem_txt"> <ul> <?php if ($config->jg_showtitle || $config->jg_showpicasnew) { ?> <li> <?php if ($config->jg_showtitle) { ?> <b><?php echo $row1->imgtitle; ?> </b> <?php } if ($config->jg_showpicasnew) { ?> <?php echo $isnew; ?> <?php } ?> </li> <?php } if ($config->jg_showauthor) { if ($row1->imgauthor) { $authorowner = $row1->imgauthor; } elseif ($config->jg_showowner) { $authorowner = Joom_GetDisplayName($row1->owner); } else { $authorowner = JText::_('JGS_NO_DATA'); } ?> <li> <?php echo JText::_('JGS_AUTHOR') . ": " . $authorowner; ?> </li> <?php } if ($config->jg_showhits) { ?> <li> <?php echo JText::_('JGS_HITS') . ": " . $row1->imgcounter; ?> </li> <?php } if ($config->jg_showcatrate) { if ($row1->imgvotes > 0) { $fimgvotesum = number_format($row1->imgvotesum / $row1->imgvotes, 2, ',', '.'); if ($row1->imgvotes == 1) { $frating = $fimgvotesum . ' (' . $row1->imgvotes . ' ' . JText::_('JGS_ONE_VOTE') . ')'; } else { $frating = $fimgvotesum . ' (' . $row1->imgvotes . ' ' . JText::_('JGS_VOTES') . ')'; } } else { $frating = JText::_('JGS_NO_VOTES'); } ?> <li> <?php echo JText::_('JGS_RATING') . ": " . $frating; ?> </li> <?php } if ($config->jg_showcatcom) { # Check how many comments exist $database->setQuery(" SELECT \n COUNT(cmtid)\n FROM \n #__joomgallery_comments\n WHERE \n cmtpic = '{$row1->id}' \n AND published ='1' \n AND approved = '1'\n "); $comments = $database->LoadResult(); ?> <li> <?php echo JText::_('JGS_COMMENTS') . ": " . $comments; ?> </li> <?php } if ($config->jg_showcatdescription == 1 && $row1->imgtext) { ?> <li> <?php echo JText::_('JGS_DESCRIPTION') . ": " . $row1->imgtext; ?> </li> <?php } $mainframe->triggerEvent('onAfterDisplayJoomThumb', array($row1->id)); $li_tag_set = false; if (is_file(JPath::clean(JPATH_ROOT . DS . $config->jg_pathoriginalimages . $catpath . $row1->imgfilename)) || $config->jg_downloadfile != 1) { if ($config->jg_showcategorydownload == 1 && $user->get('aid') >= 1 || $config->jg_showcategorydownload == 2 && $user->get('aid') == 2 || $config->jg_showcategorydownload == 3) { ?> <li> <a href="<?php echo JRoute::_('index.php?option=com_joomgallery&func=download&catid=' . $row1->catid . '&id=' . $row1->id . _JOOM_ITEMID); ?> " onMouseOver="return overlib('<?php echo JText::_('JGS_DOWNLOAD_TOOLTIP_TEXT', true); ?> ', CAPTION, '<?php echo JText::_('JGS_DOWNLOAD_TOOLTIP_CAPTION', true); ?> ', BELOW, RIGHT);" onmouseout="return nd();"> <img src="<?php echo _JOOM_LIVE_SITE . 'components/com_joomgallery/assets/images/download.png'; ?> " alt="<?php echo JText::_('JGS_DOWNLOAD_TOOLTIP_CAPTION'); ?> " class="pngfile jg_icon" /> </a> <?php $li_tag_set = true; } elseif ($config->jg_showcategorydownload == 1 && $user->get('aid') < 1) { ?> <li> <span onMouseOver="return overlib('<?php echo JText::_('JGS_DOWNLOAD_TOOLTIP_TEXT_LOGIN', true); ?> ', CAPTION, '<?php echo JText::_('JGS_DOWNLOAD_TOOLTIP_CAPTION', true); ?> ', BELOW, RIGHT);" onmouseout="return nd();" > <img src="<?php echo _JOOM_LIVE_SITE . 'components/com_joomgallery/assets/images/download_gr.png'; ?> " alt="<?php echo JText::_('JGS_DOWNLOAD_TOOLTIP_CAPTION'); ?> " class="pngfile jg_icon" /> </span> <?php $li_tag_set = true; } } if ($config->jg_favourites == 1 && $config->jg_showcategoryfavourite) { if ($config->jg_showdetailfavourite == 0 && $user->get('aid') >= 1 || $config->jg_showdetailfavourite == 1 && $user->get('aid') == 2 || $config->jg_usefavouritesforpubliczip == 1 && $user->get('aid') < 1) { if ($config->jg_usefavouritesforzip == 1 || $config->jg_usefavouritesforpubliczip == 1 && $user->get('aid') < 1) { if (!$li_tag_set) { $li_tag_set = true; ?> <li> <?php } ?> <a href="<?php echo JRoute::_('index.php?option=com_joomgallery&func=addpicture&id=' . $row1->id . '&catid=' . $row1->catid . _JOOM_ITEMID); ?> " onMouseOver="return overlib('<?php echo JText::_('JGS_ZIP_ADD_PICTURE_TOOLTIP_TEXT', true); ?> ', CAPTION, '<?php echo JText::_('JGS_ZIP_ADD_PICTURE_TOOLTIP_CAPTION', true); ?> ', BELOW, RIGHT);" onmouseout="return nd();" > <img src="<?php echo _JOOM_LIVE_SITE . 'components/com_joomgallery/assets/images/basket_put.png'; ?> " alt="<?php echo JText::_('JGS_ZIP_ADD_PICTURE_TOOLTIP_CAPTION'); ?> " class="pngfile jg_icon" /> </a> <?php } else { if (!$li_tag_set) { $li_tag_set = true; ?> <li> <?php } ?> <a href="<?php echo JRoute::_('index.php?option=com_joomgallery&func=addpicture&id=' . $row1->id . '&catid=' . $row1->catid . _JOOM_ITEMID); ?> " onMouseOver="return overlib('<?php echo JText::_('JGS_FAV_ADD_PICTURE_TOOLTIP_TEXT', true); ?> ', CAPTION, '<?php echo JText::_('JGS_FAV_ADD_PICTURE_TOOLTIP_CAPTION', true); ?> ', BELOW, RIGHT);" onmouseout="return nd();"> <img src="<?php echo $this->assetsimages_url . 'star.png'; ?> " alt="<?php echo JText::_('JGS_FAV_ADD_PICTURE_TOOLTIP_CAPTION'); ?> " class="pngfile jg_icon" /> </a> <?php } } elseif ($config->jg_favouritesshownotauth == 1) { if ($config->jg_usefavouritesforzip == 1) { if (!$li_tag_set) { $li_tag_set = true; ?> <li> <?php } ?> <span onMouseOver="return overlib('<?php echo JText::_('JGS_ZIP_ADD_PICTURE_NOT_ALLOWED_TOOLTIP_TEXT', true); ?> ', CAPTION, '<?php echo JText::_('JGS_ZIP_ADD_PICTURE_TOOLTIP_CAPTION', true); ?> ', BELOW, RIGHT);" onmouseout="return nd();" > <img src="<?php echo $this->assetsimages_url . 'basket_put_gr.png'; ?> " alt="<?php echo JText::_('JGS_ZIP_ADD_PICTURE_TOOLTIP_CAPTION'); ?> " class="pngfile jg_icon" /> </span> <?php } else { if (!$li_tag_set) { $li_tag_set = true; ?> <li> <?php } ?> <span onMouseOver="return overlib('<?php echo JText::_('JGS_FAV_ADD_PICTURE_NOT_ALLOWED_TOOLTIP_TEXT', true); ?> ', CAPTION, '<?php echo JText::_('JGS_FAV_ADD_PICTURE_TOOLTIP_CAPTION', true); ?> ', BELOW, RIGHT);" onmouseout="return nd();" > <img src="<?php echo $this->assetsimages_url . 'star_gr.png'; ?> " alt="<?php echo JText::_('JGS_FAV_ADD_PICTURE_TOOLTIP_CAPTION'); ?> " class="pngfile jg_icon" /> </span> <?php } } } if ($li_tag_set) { ?> </li> <?php } ?> </ul> </div> <?php } ?> </div> <?php $index++; } // for loop over cols in row ?> <div class="jg_clearboth"></div> </div> <?php $ii++; } // for loop over rows if ($config->jg_showcathead) { ?> <div class="sectiontableheader"> </div> <?php } } // if count($pics) > 0 }
/** * Creates HTML for description of one picture-$obj, * with display options & style just like in JG. * Adjustments are possible via the interface options * * @param db-obj $obj DB-row coming from this interface, e.g. getPicsByCategory * * @return string HTML of thumb description (like configured in JG or in the interface) */ function displayDesc($obj) { $output = "<ul>\n"; if ($this->getConfig('showtitle') || $this->getConfig('showpicasnew')) { $output .= " <li>"; if ($this->getConfig('showtitle')) { $output .= "<b>{$obj->imgtitle}</b>"; } if ($this->getConfig('showpicasnew')) { $output .= Joom_CheckNew($obj->imgdate, $this->_jg_config->jg_daysnew); } $output .= " </li>\n"; } if ($this->getConfig('showauthor')) { if ($obj->imgauthor) { $authorowner = $obj->imgauthor; } else { $authorowner = Joom_GetDisplayName($obj->owner); } $output .= " <li>" . JText::_('JGS_AUTHOR') . ": " . $authorowner; $output .= "</li>\n"; } if ($this->getConfig('showcategory')) { $catpath = $output .= " <li>" . JText::_('JGS_CATEGORY') . ": "; if ($this->getConfig('showcatlink')) { $output .= "<a href=\"" . JRoute::_('index.php?option=com_joomgallery&func=viewcategory&catid=' . $obj->catid) . $this->getJoomId() . "\">"; } $output .= $obj->cattitle; if ($this->getConfig('showcatlink')) { $output .= "</a>"; } $output .= " </li>"; } if ($this->getConfig('showhits')) { $output .= " <li>" . JText::_('JGS_HITS') . ": " . $obj->imgcounter . "</li>"; } if ($this->getConfig('showrate')) { if ($obj->imgvotes > 0) { $fimgvotesum = number_format($obj->vote, 2, ',', '.'); $frating = $fimgvotesum . ' (' . $obj->imgvotes . JText::_('JGS_VOTES') . ')'; } else { $frating = JText::_('JGS_NO_VOTES'); } $output .= ' <li>' . JText::_('JGS_RATING') . ': ' . $frating . '</li>'; } if ($this->getConfig('shownumcomments')) { $output .= ' <li>' . JText::_('JGS_COMMENTS') . ': ' . $obj->cmtcount . '</li>'; } if ($this->getConfig('showdescription') && $obj->imgtext) { $output .= ' <li>' . JText::_('JGS_DESCRIPTION') . ': ' . $obj->imgtext . '</li>'; } $output .= '</ul>'; return $output; }