<?php
/**
* @version $Id: view.html.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @subpackage Contact
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant to the
* GNU General Public License, and as distributed it includes or is derivative
* of works licensed under the GNU General Public License or other free or open
* source software licenses. See COPYRIGHT.php for copyright notices and
* details.
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
jimport('joomla.application.component.view');
require_once(JPATH_BASE."/components/com_adsmanager/helpers/field.php");
require_once(JPATH_BASE."/components/com_adsmanager/helpers/general.php");
/**
* @package Joomla
* @subpackage Contacts
*/
class AdsmanagerViewList extends JView
{
function display($tpl = null)
{
global $mainframe;
$user = JFactory::getUser();
$pathway = $mainframe->getPathway();
$document = JFactory::getDocument();
$contentmodel = &$this->getModel( "content" );
$catmodel = &$this->getModel( "category" );
$positionmodel = &$this->getModel( "position" );
$columnmodel = &$this->getModel( "column" );
$fieldmodel = &$this->getModel( "field" );
$usermodel = &$this->getModel( "user" );
$configurationmodel = &$this->getModel( "configuration" );
$uri =& JFactory::getURI();
$this->requestURL =& $uri->toString();
// Get the parameters of the active menu item
$menus = JSite::getMenu();
$menu = $menus->getActive();
$pparams = $mainframe->getParams('com_adsmanager');
$conf = $configurationmodel->getConfiguration();
$catid = JRequest::getInt( 'catid', 0 );
if ($catid != "0") {
$category = $catmodel->getCategory($catid);
$category->img = $this->get('baseurl').'/images/com_adsmanager/categories/'.$catid.'cat_t.jpg';
}
else
{
$category->name = JTEXT::_("ADSMANAGER_ALL_ADS");
$category->description = "";
$category->img = "";
}
$filters = array();
$filters['publish'] = 1;
if ($catid != 0)
$filters['category'] = $catid;
$listuser = JRequest::getInt( 'user', -1 );
if (($listuser == 0)&&($user->id != 0))
$listuser = $user->id;
if ($listuser != -1) {
$filters['user'] = $listuser;
$username = $usermodel->getUserName($listuser);
$category->name = JTEXT::_('ADSMANAGER_LIST_USER_TEXT')." ".$username;
}
$tsearch = $mainframe->getUserStateFromRequest('com_adsmanager.front_content.tsearch','tsearch',"");
if ($tsearch != "")
{
$filters['search'] = $tsearch;
$this->assignRef('tsearch',$tsearch);
}
if ($listuser == -1) {
$subcats = $catmodel->getSubCats($catid);
$pathlist = $catmodel->getPathList($catid,$this->get("Itemid"));
}
else
{
$subcats = array();
$pathlist = array();
}
$orderfields = $fieldmodel->getOrderFields($catid);
$this->assignRef('orders',$orderfields);
$this->assignRef('subcats',$subcats);
$this->assignRef('pathlist',$pathlist);
$limit = $mainframe->getUserStateFromRequest('com_adsmanager.front_ads_per_page','limit',$conf->ads_per_page, 'int');
$limitstart = JRequest::getInt("limitstart",0);
$order = $mainframe->getUserStateFromRequest('com_adsmanager.front_content.order','order',0,'int');
$contentmodel->getListOrder($order,$filter_order,$filter_order_Dir);
$this->assignRef('order',$order);
$this->assignRef('lists',$lists);
$total = $contentmodel->getNbContents($filters);
$contents = $contentmodel->getContents($filters,$limitstart, $limit,$filter_order,$filter_order_Dir);
jimport('joomla.html.pagination');
$pagination = new JPagination($total, $limitstart, $limit);
$this->assignRef('pagination',$pagination);
$this->assignRef('list_name',$category->name);
$this->assignRef('list_img',$category->img);
$this->assignRef('list_description',$category->description);
$this->assignRef('contents',$contents);
$mode = $mainframe->getUserStateFromRequest('com_adsmanager.front_content.mode','mode',$conf->display_expand);
if ($mode == 2)
$mode = 0;
$this->assignRef('mode',$mode);
if ($mode == 0) {
$columns = $columnmodel->getColumns($catid);
$fcolumns = $fieldmodel->getFieldsbyColumns();
$this->assignRef('columns',$columns);
$this->assignRef('fColumns',$fcolumns);
}
else {
$positions = $positionmodel->getPositions();
$fDisplay = $fieldmodel->getFieldsbyPositions();
$this->assignRef('positions',$positions);
$this->assignRef('fDisplay',$fDisplay);
}
$this->assignRef('conf',$conf);
$this->assignRef('userid',$user->id);
$this->assignRef('requestURL',$requestURL);
$document->setTitle( JText::_('ADSMANAGER_PAGE_TITLE'). $category->name );
$field_values = $fieldmodel->getFieldValues();
$plugins = $fieldmodel->getPlugins();
$field = new JHTMLAdsmanagerField($conf,$field_values,"1",$plugins,$this->get("Itemid"),$this->get("baseurl"));
$this->assignRef('field',$field);
//set breadcrumbs
$nb = count($pathlist);
for ($i = $nb - 1 ; $i >=0;$i--)
{
$pathway->addItem($pathlist[$i]->text, $pathlist[$i]->link);
}
$general = new JHTMLAdsmanagerGeneral($catid,$conf->comprofiler,$user,$this->get("Itemid"));
$this->assignRef('general',$general);
parent::display($tpl);
}
function isNewContent($date,$nbdays) {
$time = strtotime($date);
if ($time >= (mktime()-($nbdays*24*3600)))
return true;
else
return false;
}
function reorderDate( $date ){
$format = JText::_('ADSMANAGER_DATE_FORMAT_LC');
if ($date && (preg_match("/([0-9]{4})-([0-9]{2})-([0-9]{2})/",$date,$regs))) {
$date = mktime( 0, 0, 0, $regs[2], $regs[3], $regs[1] );
$date = $date > -1 ? strftime( $format, $date) : '-';
}
return $date;
}
function loadScriptImage($image_display)
{
global $mainframe;
switch($image_display)
{
case 'popup':
$mainframe->addCustomHeadTag('
<script language="JavaScript" type="text/javascript">
<!--
function popup(img) {
titre="Popup Image";
titre="Agrandissement";
w=open("","image","width=400,height=400,toolbar=no,scrollbars=no,resizable=no");
w.document.write("<html><head><title>"+titre+"</title></head>");
w.document.write("<script language=\"javascript\">function checksize() { if (document.images[0].complete) { window.resizeTo(document.images[0].width+10,document.images[0].height+50); window.focus();} else { setTimeout(\'checksize()\',250) }}</"+"script>");
w.document.write("<body onload=\"checksize()\" leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
w.document.write("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"100%\"><tr>");
w.document.write("<td valign=\"middle\" align=\"center\"><img src=\""+img+"\" border=0 alt=\"Mon image\">");
w.document.write("</td></tr></table>");
w.document.write("</body></html>");
w.document.close();
}
-->
</script>');
break;
case 'lightbox':
$mainframe->addCustomHeadTag('<script type="text/javascript" src="'.$this->get("baseurl").'/components/com_adsmanager/lightbox/js/prototype.js"></script>');
$mainframe->addCustomHeadTag('<script type="text/javascript" src="'.$this->get("baseurl").'/components/com_adsmanager/lightbox/js/scriptaculous.js?load=effects"></script>');
$mainframe->addCustomHeadTag('<script type="text/javascript" src="'.$this->get("baseurl").'/components/com_adsmanager/lightbox/js/lightbox.js"></script>');
$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$this->get("baseurl").'/components/com_adsmanager/lightbox/css/lightbox.css" type="text/css" media="screen" />');
break;
case 'lytebox':
$mainframe->addCustomHeadTag('<script type="text/javascript" src="'.$this->get("baseurl").'/components/com_adsmanager/lytebox/js/lytebox_322cmod1.3.js"></script>');
$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$this->get("baseurl").'/components/com_adsmanager/lytebox/css/lytebox_322cmod1.3.css" type="text/css" media="screen" />');
break;
case 'highslide':
$mainframe->addCustomHeadTag('<script type="text/javascript" src="'.$this->get("baseurl").'/components/com_adsmanager/highslide/js/highslide-full.js"></script>');
$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$this->get("baseurl").'/components/com_adsmanager/highslide/css/highslide-styles.css" type="text/css" media="screen" />');
break;
default:
break;
}
}
}
Выше упомянутого кода не нашёл в файле, выложил оригинал, подскажите где поправить,,,
Да, пасле исправления глюка могу показать что получилось.