29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-06-26 07:13:21 +00:00

Partial com_banners cleanup

git-svn-id: http://joomlacode.org/svn/joomla/development/trunk@11358 6f6e1ebd-4c2b-0410-823f-f34bde69bce9
This commit is contained in:
Andrew Eddie 2008-12-22 11:51:20 +00:00
parent dab37b6110
commit 291935c73f
26 changed files with 536 additions and 563 deletions

View File

@ -13,20 +13,20 @@
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
defined('_JEXEC') or die('Restricted access');
if (!JAcl::authorise('com_banners', 'banners.manage')) {
JFactory::getApplication()->redirect('index.php', JText::_('ALERTNOTAUTH'));
}
$controllerName = JRequest::getCmd( 'c', 'banner' );
$controllerName = JRequest::getCmd('c', 'banner');
if($controllerName == 'client') {
if ($controllerName == 'client') {
JSubMenuHelper::addEntry(JText::_('Banners'), 'index.php?option=com_banners');
JSubMenuHelper::addEntry(JText::_('Clients'), 'index.php?option=com_banners&c=client', true );
JSubMenuHelper::addEntry(JText::_('Clients'), 'index.php?option=com_banners&c=client', true);
JSubMenuHelper::addEntry(JText::_('Categories'), 'index.php?option=com_categories&section=com_banner');
} else {
JSubMenuHelper::addEntry(JText::_('Banners'), 'index.php?option=com_banners', true );
JSubMenuHelper::addEntry(JText::_('Banners'), 'index.php?option=com_banners', true);
JSubMenuHelper::addEntry(JText::_('Clients'), 'index.php?option=com_banners&c=client');
JSubMenuHelper::addEntry(JText::_('Categories'), 'index.php?option=com_categories&section=com_banner');
}
@ -52,7 +52,7 @@ switch ($controllerName)
$controller = new $controllerName();
// Perform the Request task
$controller->execute( JRequest::getCmd('task') );
$controller->execute(JRequest::getCmd('task'));
// Redirect if set by the controller
$controller->redirect();

View File

@ -13,9 +13,9 @@
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
defined('_JEXEC') or die('Restricted access');
jimport( 'joomla.application.component.controller' );
jimport('joomla.application.component.controller');
/**
* @package Joomla
@ -26,15 +26,15 @@ class BannerControllerBanner extends JController
/**
* Constructor
*/
function __construct( $config = array() )
function __construct($config = array())
{
parent::__construct( $config );
parent::__construct($config);
// Register Extra tasks
$this->registerTask( 'add', 'display' );
$this->registerTask( 'edit', 'display' );
$this->registerTask( 'apply', 'save' );
$this->registerTask( 'resethits', 'save' );
$this->registerTask( 'unpublish', 'publish' );
$this->registerTask('add', 'display');
$this->registerTask('edit', 'display');
$this->registerTask('apply', 'save');
$this->registerTask('resethits', 'save');
$this->registerTask('unpublish', 'publish');
}
/**
@ -48,21 +48,19 @@ class BannerControllerBanner extends JController
switch($this->getTask())
{
case 'add':
{
JRequest::setVar( 'hidemainmenu', 1 );
JRequest::setVar( 'view' , 'banner');
JRequest::setVar( 'edit', false );
} break;
JRequest::setVar('hidemainmenu', 1);
JRequest::setVar('view' , 'banner');
JRequest::setVar('edit', false);
break;
case 'edit':
{
JRequest::setVar( 'hidemainmenu', 1 );
JRequest::setVar( 'view' , 'banner');
JRequest::setVar( 'edit', true );
} break;
JRequest::setVar('hidemainmenu', 1);
JRequest::setVar('view' , 'banner');
JRequest::setVar('edit', true);
break;
default:
{
JRequest::setVar( 'view', 'banners');
}
JRequest::setVar('view', 'banners');
}
parent::display();
@ -74,17 +72,17 @@ class BannerControllerBanner extends JController
function save()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
JRequest::checkToken() or jexit('Invalid Token');
$post = JRequest::get('post');
$bid = JRequest::getVar( 'bid', array(0), 'post', 'array' );
$bid = JRequest::getVar('bid', array(0), 'post', 'array');
$post['bid'] = (int) $bid[0];
// fix up special html fields
$post['custombannercode'] = JRequest::getVar( 'custombannercode', '', 'post', 'string', JREQUEST_ALLOWRAW );
$post['custombannercode'] = JRequest::getVar('custombannercode', '', 'post', 'string', JREQUEST_ALLOWRAW);
// Resets clicks when `Reset Clicks` button is used instead of `Save` button
$task = JRequest::getCmd( 'task' );
if ( $task == 'resethits' )
$task = JRequest::getCmd('task');
if ($task == 'resethits')
$post['clicks'] = 0;
// Sets impressions to unlimited when `unlimited` checkbox ticked
@ -96,12 +94,12 @@ class BannerControllerBanner extends JController
$model = $this->getModel('banner');
if ($model->store($post)) {
if ( $task == 'resethits' )
$msg = JText::_( 'Reset Banner clicks' );
if ($task == 'resethits')
$msg = JText::_('Reset Banner clicks');
else
$msg = JText::_( 'Banner Saved' );
$msg = JText::_('Banner Saved');
} else {
$msg = JText::_( 'Error Saving Banner' );
$msg = JText::_('Error Saving Banner');
}
// Check the table in so it can be edited.... we are done with it anyway
@ -119,7 +117,7 @@ class BannerControllerBanner extends JController
break;
}
$this->setRedirect( $link, $msg );
$this->setRedirect($link, $msg);
}
function cancel()
@ -128,7 +126,7 @@ class BannerControllerBanner extends JController
$model = $this->getModel('banner');
$model->checkin();
$this->setRedirect( 'index.php?option=com_banners' );
$this->setRedirect('index.php?option=com_banners');
}
/**
@ -137,88 +135,88 @@ class BannerControllerBanner extends JController
function copy()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
JRequest::checkToken() or jexit('Invalid Token');
// Initialize variables
$bid = JRequest::getVar( 'bid', array(), 'post', 'array' );
$bid = JRequest::getVar('bid', array(), 'post', 'array');
JArrayHelper::toInteger($bid);
if (count( $bid ) < 1) {
JError::raiseError(500, JText::_( 'Select an item to copy' ) );
if (count($bid) < 1) {
JError::raiseError(500, JText::_('Select an item to copy'));
}
$model = $this->getModel('banner');
if(!$model->copy($bid)) {
if (!$model->copy($bid)) {
echo "<script> alert('".$model->getError(true)."'); window.history.go(-1); </script>\n";
}
$this->setRedirect( 'index.php?option=com_banners', JText::sprintf( 'Items copied', count( $cid ) ) );
$this->setRedirect('index.php?option=com_banners', JText::sprintf('Items copied', count($cid)));
}
function publish()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
JRequest::checkToken() or jexit('Invalid Token');
// Initialize variables
$bid = JRequest::getVar( 'bid', array(), 'post', 'array' );
$task = JRequest::getCmd( 'task' );
$bid = JRequest::getVar('bid', array(), 'post', 'array');
$task = JRequest::getCmd('task');
$publish = ($task == 'publish');
JArrayHelper::toInteger($bid);
if (count( $bid ) < 1) {
JError::raiseError(500, JText::_( 'Select an item to publish' ) );
if (count($bid) < 1) {
JError::raiseError(500, JText::_('Select an item to publish'));
}
$model = $this->getModel('banner');
if(!$model->publish($bid, $publish)) {
if (!$model->publish($bid, $publish)) {
echo "<script> alert('".$model->getError(true)."'); window.history.go(-1); </script>\n";
}
$this->setRedirect( 'index.php?option=com_banners' );
$this->setRedirect('index.php?option=com_banners');
}
function remove()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
JRequest::checkToken() or jexit('Invalid Token');
$bid = JRequest::getVar( 'bid', array(), 'post', 'array' );
$bid = JRequest::getVar('bid', array(), 'post', 'array');
JArrayHelper::toInteger($bid);
if (count( $bid ) < 1) {
JError::raiseError(500, JText::_( 'Select an item to delete' ) );
if (count($bid) < 1) {
JError::raiseError(500, JText::_('Select an item to delete'));
}
$model = $this->getModel('banner');
if(!$model->delete($bid)) {
if (!$model->delete($bid)) {
echo "<script> alert('".$model->getError(true)."'); window.history.go(-1); </script>\n";
}
$this->setRedirect( 'index.php?option=com_banners' );
$this->setRedirect('index.php?option=com_banners');
}
function orderup()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
JRequest::checkToken() or jexit('Invalid Token');
$model = $this->getModel('banner');
$model->move(-1);
$this->setRedirect( 'index.php?option=com_banners');
$this->setRedirect('index.php?option=com_banners');
}
function orderdown()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
JRequest::checkToken() or jexit('Invalid Token');
$model = $this->getModel('banner');
$model->move(1);
$this->setRedirect( 'index.php?option=com_banners');
$this->setRedirect('index.php?option=com_banners');
}
/**
@ -227,10 +225,10 @@ class BannerControllerBanner extends JController
function saveorder()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
JRequest::checkToken() or jexit('Invalid Token');
$cid = JRequest::getVar( 'cid', array(), 'post', 'array' );
$order = JRequest::getVar( 'order', array(), 'post', 'array' );
$cid = JRequest::getVar('cid', array(), 'post', 'array');
$order = JRequest::getVar('order', array(), 'post', 'array');
JArrayHelper::toInteger($cid);
JArrayHelper::toInteger($order);
@ -238,6 +236,6 @@ class BannerControllerBanner extends JController
$model->saveorder($cid, $order);
$msg = JText::_('New ordering saved');
$this->setRedirect( 'index.php?option=com_banners', $msg );
$this->setRedirect('index.php?option=com_banners', $msg);
}
}

View File

@ -13,9 +13,9 @@
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
defined('_JEXEC') or die('Restricted access');
jimport( 'joomla.application.component.controller' );
jimport('joomla.application.component.controller');
/**
* @package Joomla
@ -26,12 +26,12 @@ class BannerControllerClient extends JController
/**
* Constructor
*/
function __construct( $config = array() )
function __construct($config = array())
{
parent::__construct( $config );
parent::__construct($config);
// Register Extra tasks
$this->registerTask( 'add', 'edit' );
$this->registerTask( 'apply', 'save' );
$this->registerTask('add', 'edit');
$this->registerTask('apply', 'save');
}
function display()
@ -42,21 +42,20 @@ class BannerControllerClient extends JController
switch($this->getTask())
{
case 'add':
{
JRequest::setVar( 'hidemainmenu', 1 );
JRequest::setVar( 'view' , 'bannerclient');
JRequest::setVar( 'edit', false );
} break;
JRequest::setVar('hidemainmenu', 1);
JRequest::setVar('view' , 'client');
JRequest::setVar('edit', false);
break;
case 'edit':
{
JRequest::setVar( 'hidemainmenu', 1 );
JRequest::setVar( 'view' , 'bannerclient');
JRequest::setVar( 'edit', true );
} break;
JRequest::setVar('hidemainmenu', 1);
JRequest::setVar('view' , 'client');
JRequest::setVar('edit', true);
break;
}
if (JRequest::getVar( 'view', '') == '') {
JRequest::setVar( 'view', 'bannerclients');
if (JRequest::getVar('view', '') == '') {
JRequest::setVar('view', 'clients');
}
parent::display();
}
@ -70,21 +69,21 @@ class BannerControllerClient extends JController
}
$post = JRequest::get('post');
$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' );
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
$post['cid'] = (int) $cid[0];
$model = $this->getModel('bannerclient');
$model = $this->getModel('client');
if ($model->store($post)) {
$msg = JText::_( 'Item Saved' );
$msg = JText::_('Item Saved');
} else {
$msg = JText::_( 'Error Saving Item' );
$msg = JText::_('Error Saving Item');
}
// Check the table in so it can be edited.... we are done with it anyway
$model->checkin();
switch (JRequest::getCmd( 'task' ))
switch (JRequest::getCmd('task'))
{
case 'apply':
$link = 'index.php?option=com_banners&c=client&task=edit&cid[]='. $post['cid'];
@ -100,13 +99,13 @@ class BannerControllerClient extends JController
function cancel()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
JRequest::checkToken() or jexit('Invalid Token');
// Checkin the contact
$model = $this->getModel('bannerclient');
$model = $this->getModel('client');
$model->checkin();
$this->setRedirect( 'index.php?option=com_banners&c=client' );
$this->setRedirect('index.php?option=com_banners&c=client');
}
function remove()
@ -117,18 +116,18 @@ class BannerControllerClient extends JController
JError::raiseError(403, 'Request Forbidden');
}
$cid = JRequest::getVar( 'cid', array(), 'post', 'array' );
$cid = JRequest::getVar('cid', array(), 'post', 'array');
JArrayHelper::toInteger($cid);
if (count( $cid ) < 1) {
JError::raiseError(500, JText::_( 'Select an item to delete' ) );
if (count($cid) < 1) {
JError::raiseError(500, JText::_('Select an item to delete'));
}
$model = $this->getModel('contact');
if(!$model->delete($cid)) {
if (!$model->delete($cid)) {
echo "<script> alert('".$model->getError(true)."'); window.history.go(-1); </script>\n";
}
$this->setRedirect( 'index.php?option=com_banners&c=client', JText::sprintf( 'Items removed', count($cid) ) );
$this->setRedirect('index.php?option=com_banners&c=client', JText::sprintf('Items removed', count($cid)));
}
}

View File

@ -13,7 +13,7 @@
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
defined('_JEXEC') or die('Restricted access');
/**
* Renders a category element
@ -53,6 +53,6 @@ class JElementBannerclient extends JElement
'name',
$value,
$control_name.$name
);
);
}
}

View File

@ -25,27 +25,27 @@ class BannerHelper
* @return array
* @static
*/
function &getKeywords( $keywords )
function &getKeywords($keywords)
{
static $instance;
if (!$instance)
{
$config =& JComponentHelper::getParams( 'com_banners' );
$prefix = $config->get( 'tag_prefix' );
$config =& JComponentHelper::getParams('com_banners');
$prefix = $config->get('tag_prefix');
$instance = array();
if (!is_array( $keywords ))
if (!is_array($keywords))
{
$keywords = explode( ',', $keywords );
$keywords = explode(',', $keywords);
}
foreach ($keywords as $keyword)
{
$keyword = trim( $keyword );
$keyword = trim($keyword);
$regex = '#^' . $prefix . '#';
if (preg_match( $regex, $keyword ))
if (preg_match($regex, $keyword))
{
$instance[] = $keyword;
}
@ -60,9 +60,9 @@ class BannerHelper
* @param string
* @return URL
*/
function isImage( $url )
function isImage($url)
{
$result = preg_match( '#(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$#', $url );
$result = preg_match('#(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$#', $url);
return $result;
}
@ -72,9 +72,9 @@ class BannerHelper
* @param string
* @return URL
*/
function isFlash( $url )
function isFlash($url)
{
$result = preg_match( '#\.swf$#', $url );
$result = preg_match('#\.swf$#', $url);
return $result;
}
}

View File

@ -0,0 +1,43 @@
<?php
/**
* @version $Id$
* @package Joomla.Administrator
* @subpackage com_banners
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
/**
* Banners HTML Helper
*
* @package Joomla.Administrator
* @subpackage com_banners
*/
class JHtmlBanners
{
function clients($name, $attribs, $selected)
{
$db = &JFactory::getDbo();
// Build Client select list
$db->setQuery(
'SELECT cid AS value, name AS text'
.' FROM #__bannerclient'
);
$options = $db->loadObjectList();
array_unshift($options, JHtml::_('select.option', '0', '- ' . JText::_('Select Client') . ' -'));
return JHtml::_(
'select.genericlist',
$options,
$name,
$attribs,
'value',
'text',
$selected
);
}
}

View File

@ -51,7 +51,7 @@ class BannerModelBanner extends JModel
$array = JRequest::getVar('bid', array(0), '', 'array');
$edit = JRequest::getVar('edit',true);
if($edit)
if ($edit)
$this->setId((int)$array[0]);
}
@ -90,7 +90,7 @@ class BannerModelBanner extends JModel
* @return boolean True if checked out
* @since 1.6
*/
function isCheckedOut( $uid=0 )
function isCheckedOut($uid=0)
{
if ($this->_loadData())
{
@ -113,8 +113,8 @@ class BannerModelBanner extends JModel
{
if ($this->_id)
{
$banner = & $this->getTable();
if(! $banner->checkin($this->_id)) {
$table = JTable::getInstance('Banner', 'BannerTable');
if (! $table->checkin($this->_id)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
@ -140,8 +140,8 @@ class BannerModelBanner extends JModel
$uid = $user->get('id');
}
// Lets get to it and checkout the thing...
$banner = & $this->getTable();
if(!$banner->checkout($uid, $this->_id)) {
$table = JTable::getInstance('Banner', 'BannerTable');
if (!$table->checkout($uid, $this->_id)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
@ -160,22 +160,22 @@ class BannerModelBanner extends JModel
*/
function store($data)
{
$row =& $this->getTable();
$table = JTable::getInstance('Banner', 'BannerTable');
// Bind the form fields to the web link table
if (!$row->bind($data)) {
if (!$$table->bind($data)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Make sure the data is valid
if (!$row->check()) {
if (!$table->check()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Store the data to the database
if (!$row->store()) {
if (!$table->store()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
@ -194,14 +194,14 @@ class BannerModelBanner extends JModel
{
$result = false;
if (count( $cid ))
if (count($cid))
{
JArrayHelper::toInteger($cid);
$cids = implode( ',', $cid );
$cids = implode(',', $cid);
$query = 'DELETE FROM #__banner'
. ' WHERE bid IN ( '.$cids.' )';
$this->_db->setQuery( $query );
if(!$this->_db->query()) {
. ' WHERE bid IN ('.$cids.')';
$this->_db->setQuery($query);
if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
@ -221,17 +221,17 @@ class BannerModelBanner extends JModel
{
$user =& JFactory::getUser();
if (count( $cid ))
if (count($cid))
{
JArrayHelper::toInteger($cid);
$cids = implode( ',', $cid );
$cids = implode(',', $cid);
$query = 'UPDATE #__banner'
. ' SET showBanner = '.(int) $publish
. ' WHERE bid IN ( '.$cids.' )'
. ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )'
. ' WHERE bid IN ('.$cids.')'
. ' AND (checked_out = 0 OR (checked_out = '.(int) $user->get('id').'))'
;
$this->_db->setQuery( $query );
$this->_db->setQuery($query);
if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
@ -250,13 +250,13 @@ class BannerModelBanner extends JModel
*/
function move($direction)
{
$row =& $this->getTable();
if (!$row->load($this->_id)) {
$table = JTable::getInstance('Banner', 'BannerTable');
if (!$table->load($this->_id)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
if (!$row->move( $direction, ' catid = '.(int) $row->catid.' AND showBanner >= 0 ' )) {
if (!$$table->move($direction, ' catid = '.(int) $table->catid.' AND showBanner >= 0 ')) {
$this->setError($this->_db->getErrorMsg());
return false;
}
@ -273,20 +273,20 @@ class BannerModelBanner extends JModel
*/
function saveorder($cid = array(), $order)
{
$row =& $this->getTable();
$table = JTable::getInstance('Banner', 'BannerTable');
$groupings = array();
// update ordering values
for( $i=0; $i < count($cid); $i++ )
for ($i=0; $i < count($cid); $i++)
{
$row->load( (int) $cid[$i] );
$table->load((int) $cid[$i]);
// track categories
$groupings[] = $row->catid;
$groupings[] = $table->catid;
if ($row->ordering != $order[$i])
if ($table->ordering != $order[$i])
{
$row->ordering = $order[$i];
if (!$row->store()) {
$table->ordering = $order[$i];
if (!$table->store()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
@ -294,9 +294,9 @@ class BannerModelBanner extends JModel
}
// execute updateOrder for each parent group
$groupings = array_unique( $groupings );
$groupings = array_unique($groupings);
foreach ($groupings as $group){
$row->reorder('catid = '.$this->_db->Quote($group));
$table->reorder('catid = '.$this->_db->Quote($group));
}
return true;
@ -307,24 +307,23 @@ class BannerModelBanner extends JModel
*/
function copy($cid = array())
{
$row =& $this->getTable();
$n = count( $cid );
$table = JTable::getInstance('Banner', 'BannerTable');
$n = count($cid);
// update ordering values
for( $i=0; $i < $n; $i++ )
for ($i=0; $i < $n; $i++)
{
$row->load( (int) $cid[$i] );
$table->load((int) $cid[$i]);
$row->bid = 0;
$row->name = 'Copy of ' . $row->name;
$row->impmade = 0;
$row->clicks = 0;
$row->showBanner = 0;
$row->date = $this->_db->getNullDate();
$table->bid = 0;
$table->name = 'Copy of ' . $table->name;
$table->impmade = 0;
$table->clicks = 0;
$table->showBanner = 0;
$table->date = $this->_db->getNullDate();
if (!$row->store()) {
return JError::raiseWarning( $row->getError() );
if (!$table->store()) {
return JError::raiseWarning($table->getError());
}
}

View File

@ -67,18 +67,18 @@ class BannerModelBanners extends JModel
$context = 'com_banners.banner.list.';
// Get the pagination request variables
$limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
$limitstart = $mainframe->getUserStateFromRequest( $context.'limitstart', 'limitstart', 0, 'int' );
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limitstart = $mainframe->getUserStateFromRequest($context.'limitstart', 'limitstart', 0, 'int');
$this->setState('limit', $limit);
$this->setState('limitstart', $limitstart);
$filter = new stdClass();
$filter->order = $mainframe->getUserStateFromRequest( $context.'filter_order', 'filter_order', 'b.ordering', 'cmd' );
$filter->order_Dir = $mainframe->getUserStateFromRequest( $context.'filter_order_Dir', 'filter_order_Dir', '', 'word' );
$filter->state = $mainframe->getUserStateFromRequest( $context.'filter_state', 'filter_state', '', 'word' );
$filter->catid = $mainframe->getUserStateFromRequest( $context.'filter_catid', 'filter_catid', 0, 'int' );
$filter->search = $mainframe->getUserStateFromRequest( $context.'search', 'search', '', 'string' );
$filter->order = $mainframe->getUserStateFromRequest($context.'filter_order', 'filter_order', 'b.ordering', 'cmd');
$filter->order_Dir = $mainframe->getUserStateFromRequest($context.'filter_order_Dir', 'filter_order_Dir', '', 'word');
$filter->state = $mainframe->getUserStateFromRequest($context.'filter_state', 'filter_state', '', 'word');
$filter->catid = $mainframe->getUserStateFromRequest($context.'filter_catid', 'filter_catid', 0, 'int');
$filter->search = $mainframe->getUserStateFromRequest($context.'search', 'search', '', 'string');
$this->_filter = $filter;
}
@ -130,7 +130,7 @@ class BannerModelBanners extends JModel
if (empty($this->_pagination))
{
jimport('joomla.html.pagination');
$this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') );
$this->_pagination = new JPagination($this->getTotal(), $this->getState('limitstart'), $this->getState('limit'));
}
return $this->_pagination;
@ -180,16 +180,16 @@ class BannerModelBanners extends JModel
{
global $mainframe, $option;
$search = JString::strtolower( $this->_filter->search );
$search = JString::strtolower($this->_filter->search);
$where = array();
if ( $this->_filter->state )
if ($this->_filter->state)
{
if ( $this->_filter->state == 'P' ) {
if ($this->_filter->state == 'P') {
$where[] = 'b.showBanner = 1';
}
else if ($this->_filter->state == 'U' ) {
else if ($this->_filter->state == 'U') {
$where[] = 'b.showBanner = 0';
}
}
@ -197,10 +197,10 @@ class BannerModelBanners extends JModel
$where[] = 'cc.id = ' . (int) $this->_filter->catid;
}
if ($search) {
$where[] = 'LOWER(b.name) LIKE '.$this->_db->Quote('%'.$this->_db->getEscaped( $search, true ).'%', false);
$where[] = 'LOWER(b.name) LIKE '.$this->_db->Quote('%'.$this->_db->getEscaped($search, true).'%', false);
}
$where = count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '';
$where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
return $where;
}

View File

@ -24,7 +24,7 @@ jimport('joomla.application.component.model');
* @subpackage Banners
* @since 1.6
*/
class BannerModelBannerClient extends JModel
class BannerModelClient extends JModel
{
/**
* Banner Client id
@ -51,7 +51,7 @@ class BannerModelBannerClient extends JModel
$array = JRequest::getVar('cid', array(0), '', 'array');
$edit = JRequest::getVar('edit',true);
if($edit)
if ($edit)
$this->setId((int)$array[0]);
}
@ -90,7 +90,7 @@ class BannerModelBannerClient extends JModel
* @return boolean True if checked out
* @since 1.6
*/
function isCheckedOut( $uid=0 )
function isCheckedOut($uid=0)
{
if ($this->_loadData())
{
@ -113,8 +113,8 @@ class BannerModelBannerClient extends JModel
{
if ($this->_id)
{
$bannerclient = & $this->getTable();
if(! $bannerclient->checkin($this->_id)) {
$table = JTable::getInstance('Client', 'BannerTable');
if (!$table->checkin($this->_id)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
@ -140,8 +140,8 @@ class BannerModelBannerClient extends JModel
$uid = $user->get('id');
}
// Lets get to it and checkout the thing...
$bannerclient = & $this->getTable();
if(!$bannerclient->checkout($uid, $this->_id)) {
$table = JTable::getInstance('Client', 'BannerTable');
if (!$table->checkout($uid, $this->_id)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
@ -160,22 +160,22 @@ class BannerModelBannerClient extends JModel
*/
function store($data)
{
$row =& $this->getTable();
$table = JTable::getInstance('Client', 'BannerTable');
// Bind the form fields to the web link table
if (!$row->bind($data)) {
if (!$table->bind($data)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Make sure the data is valid
if (!$row->check()) {
if (!$table->check()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Store the data to the database
if (!$row->store()) {
if (!$table->store()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
@ -194,14 +194,14 @@ class BannerModelBannerClient extends JModel
{
$result = false;
if (count( $cid ))
if (count($cid))
{
JArrayHelper::toInteger($cid);
$cids = implode( ',', $cid );
$cids = implode(',', $cid);
$query = 'DELETE FROM #__bannerclient'
. ' WHERE cid IN ( '.$cids.' )';
$this->_db->setQuery( $query );
if(!$this->_db->query()) {
. ' WHERE cid IN ('.$cids.')';
$this->_db->setQuery($query);
if (!$this->_db->query()) {
$this->setError($this->_db->getErrorMsg());
return false;
}

View File

@ -13,7 +13,7 @@
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.model');
@ -24,7 +24,7 @@ jimport('joomla.application.component.model');
* @subpackage Banners
* @since 1.6
*/
class BannerModelBannerClients extends JModel
class BannerModelClients extends JModel
{
/**
* Category ata array
@ -66,8 +66,8 @@ class BannerModelBannerClients extends JModel
global $mainframe, $option;
// Get the pagination request variables
$limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
$limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' );
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limitstart = $mainframe->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int');
// In case limit has been changed, adjust limitstart accordingly
$limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0);
@ -75,12 +75,12 @@ class BannerModelBannerClients extends JModel
$this->setState('limit', $limit);
$this->setState('limitstart', $limitstart);
$context = 'com_banners.bannerclient.list.';
$context = 'com_banners.client.list.';
$filter = new stdClass();
$filter->order = $mainframe->getUserStateFromRequest( $context.'filter_order', 'filter_order', 'a.name', 'cmd' );
$filter->order_Dir = $mainframe->getUserStateFromRequest( $context.'filter_order_Dir', 'filter_order_Dir', '', 'word' );
$filter->state = $mainframe->getUserStateFromRequest( $context.'filter_state', 'filter_state', '', 'word' );
$filter->search = $mainframe->getUserStateFromRequest( $context.'search', 'search', '', 'string' );
$filter->order = $mainframe->getUserStateFromRequest($context.'filter_order', 'filter_order', 'a.name', 'cmd');
$filter->order_Dir = $mainframe->getUserStateFromRequest($context.'filter_order_Dir', 'filter_order_Dir', '', 'word');
$filter->state = $mainframe->getUserStateFromRequest($context.'filter_state', 'filter_state', '', 'word');
$filter->search = $mainframe->getUserStateFromRequest($context.'search', 'search', '', 'string');
$this->_filter = $filter;
}
@ -132,7 +132,7 @@ class BannerModelBannerClients extends JModel
if (empty($this->_pagination))
{
jimport('joomla.html.pagination');
$this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') );
$this->_pagination = new JPagination($this->getTotal(), $this->getState('limitstart'), $this->getState('limit'));
}
return $this->_pagination;
@ -151,41 +151,21 @@ class BannerModelBannerClients extends JModel
function _buildQuery()
{
// Get the WHERE and ORDER BY clauses for the query
$where = $this->_buildContentWhere();
$orderby = $this->_buildContentOrderBy();
jimport('joomla.database.query');
$query = new JQuery;
$query = 'SELECT a.*, count(b.bid) AS nbanners, u.name AS editor'
. ' FROM #__bannerclient AS a'
. ' LEFT JOIN #__banner AS b ON a.cid = b.cid'
. ' LEFT JOIN #__users AS u ON u.id = a.checked_out'
. $where
. ' GROUP BY a.cid'
. $orderby
;
// Set up query
$query->select('a.*, count(b.bid) AS nbanners, u.name AS editor');
$query->from('#__bannerclient AS a');
$query->join('LEFT', '#__banner AS b ON a.cid = b.cid');
$query->join('LEFT', '#__users AS u ON u.id = a.checked_out');
if ($search = JString::strtolower($this->_filter->search)) {
$query->where('LOWER(a.name) LIKE '.$this->_db->Quote('%'.$this->_db->getEscaped($search, true).'%', false));
}
$query->group('a.cid');
$query->order($this->_filter->order .' '. $this->_filter->order_Dir .', a.cid');
return $query;
}
function _buildContentOrderBy()
{
$orderby = ' ORDER BY '. $this->_filter->order .' '. $this->_filter->order_Dir .', a.cid';
return $orderby;
}
function _buildContentWhere()
{
$search = JString::strtolower( $this->_filter->search );
$where = array();
if ($search) {
$where[] = 'LOWER(a.name) LIKE '.$this->_db->Quote( '%'.$this->_db->getEscaped( $search, true ).'%', false );
}
$where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' );
return $where;
}
}

View File

@ -13,13 +13,13 @@
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
defined('_JEXEC') or die('Restricted access');
/**
* @package Joomla
* @subpackage Banners
*/
class TableBanner extends JTable
class BannerTableBanner extends JTable
{
/** @var int */
var $bid = null;
@ -70,22 +70,22 @@ class TableBanner extends JTable
/** @var string */
var $params = null;
function __construct( &$_db )
function __construct(&$_db)
{
parent::__construct( '#__banner', 'bid', $_db );
parent::__construct('#__banner', 'bid', $_db);
$now =& JFactory::getDate();
$this->set( 'date', $now->toMySQL() );
$this->set('date', $now->toMySQL());
}
function clicks()
{
$query = 'UPDATE #__banner'
. ' SET clicks = ( clicks + 1 )'
. ' SET clicks = (clicks + 1)'
. ' WHERE bid = ' . (int) $this->bid
;
$this->_db->setQuery( $query );
$this->_db->setQuery($query);
$this->_db->query();
}
@ -101,27 +101,27 @@ class TableBanner extends JTable
{
// check for valid client id
if (is_null($this->cid) || $this->cid == 0) {
$this->setError(JText::_( 'BNR_CLIENT' ));
$this->setError(JText::_('BNR_CLIENT'));
return false;
}
// check for valid name
if(trim($this->name) == '') {
$this->setError(JText::_( 'BNR_NAME' ));
if (trim($this->name) == '') {
$this->setError(JText::_('BNR_NAME'));
return false;
}
if(empty($this->alias)) {
if (empty($this->alias)) {
$this->alias = $this->name;
}
$this->alias = JFilterOutput::stringURLSafe($this->alias);
/*if(trim($this->imageurl) == '') {
$this->setError(JText::_( 'BNR_IMAGE' ));
/*if (trim($this->imageurl) == '') {
$this->setError(JText::_('BNR_IMAGE'));
return false;
}
if(trim($this->clickurl) == '' && trim($this->custombannercode) == '') {
$this->setError(JText::_( 'BNR_URL' ));
if (trim($this->clickurl) == '' && trim($this->custombannercode) == '') {
$this->setError(JText::_('BNR_URL'));
return false;
}*/

View File

@ -13,13 +13,13 @@
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
defined('_JEXEC') or die('Restricted access');
/**
* @package Joomla
* @subpackage Banners
*/
class TableBannerClient extends JTable
class BannerTableClient extends JTable
{
var $cid = null;
var $name = '';
@ -30,8 +30,8 @@ class TableBannerClient extends JTable
var $checked_out_time = 0;
var $editor = '';
function __construct( &$_db ) {
parent::__construct( '#__bannerclient', 'cid', $_db );
function __construct(&$_db) {
parent::__construct('#__bannerclient', 'cid', $_db);
}
/**
@ -46,20 +46,20 @@ class TableBannerClient extends JTable
{
// check for valid client name
if (trim($this->name == '')) {
$this->setError(JText::_( 'BNR_CLIENT_NAME' ));
$this->setError(JText::_('BNR_CLIENT_NAME'));
return false;
}
// check for valid client contact
if (trim($this->contact == '')) {
$this->setError(JText::_( 'BNR_CONTACT' ));
$this->setError(JText::_('BNR_CONTACT'));
return false;
}
// check for valid client email
jimport( 'joomla.mail.helper' );
if (!JMailHelper::isEmailAddress( $this->email )) {
$this->setError(JText::_( 'BNR_VALID_EMAIL' ));
jimport('joomla.mail.helper');
if (!JMailHelper::isEmailAddress($this->email)) {
$this->setError(JText::_('BNR_VALID_EMAIL'));
return false;
}

View File

@ -1,7 +1,7 @@
<?php defined( '_JEXEC' ) or die( 'Restricted access' ); ?>
<?php defined('_JEXEC') or die('Restricted access');
<?php
JHtml::_('behavior.tooltip');
JHtml::addIncludePath(JPATH_COMPONENT.DS.'helpers'.DS.'html');
?>
<script language="javascript" type="text/javascript">
@ -16,22 +16,22 @@ function changeDisplayImage() {
function submitbutton(pressbutton) {
var form = document.adminForm;
if (pressbutton == 'cancel') {
submitform( pressbutton );
submitform(pressbutton);
return;
}
// do field validation
if (form.name.value == "") {
alert( "<?php echo JText::_( 'You must provide a banner name.', true ); ?>" );
alert("<?php echo JText::_('You must provide a banner name.', true); ?>");
} else if (getSelectedValue('adminForm','cid') < 1) {
alert( "<?php echo JText::_( 'Please select a client.', true ); ?>" );
alert("<?php echo JText::_('Please select a client.', true); ?>");
/*} else if (!getSelectedValue('adminForm','imageurl')) {
alert( "<?php echo JText::_( 'Please select an image.', true ); ?>" );*/
alert("<?php echo JText::_('Please select an image.', true); ?>");*/
/*} else if (form.clickurl.value == "") {
alert( "<?php echo JText::_( 'Please fill in the URL for the banner.', true ); ?>" );*/
} else if ( getSelectedValue('adminForm','catid') == 0 ) {
alert( "<?php echo JText::_( 'Please select a category.', true ); ?>" );
alert("<?php echo JText::_('Please fill in the URL for the banner.', true); ?>");*/
} else if (getSelectedValue('adminForm','catid') == 0) {
alert("<?php echo JText::_('Please select a category.', true); ?>");
} else {
submitform( pressbutton );
submitform(pressbutton);
}
}
//-->
@ -40,94 +40,94 @@ function submitbutton(pressbutton) {
<div class="col100">
<fieldset class="adminform">
<legend><?php echo JText::_( 'Details' ); ?></legend>
<legend><?php echo JText::_('Details'); ?></legend>
<table class="admintable">
<tbody>
<tr>
<td width="20%" class="key">
<label for="name">
<?php echo JText::_( 'Name' ); ?>:
<?php echo JText::_('Name'); ?>:
</label>
</td>
<td width="80%">
<input class="inputbox" type="text" name="name" id="name" size="50" value="<?php echo $this->row->name;?>" />
<input class="inputbox" type="text" name="name" id="name" size="50" value="<?php echo $this->item->name;?>" />
</td>
</tr>
<tr>
<td width="20%" class="key">
<label for="alias">
<?php echo JText::_( 'Alias' ); ?>:
<?php echo JText::_('Alias'); ?>:
</label>
</td>
<td width="80%">
<input class="inputbox" type="text" name="alias" id="alias" size="50" value="<?php echo $this->row->alias;?>" />
<input class="inputbox" type="text" name="alias" id="alias" size="50" value="<?php echo $this->item->alias;?>" />
</td>
</tr>
<tr>
<td class="key">
<?php echo JText::_( 'Show Banner' ); ?>:
<?php echo JText::_('Show Banner'); ?>:
</td>
<td>
<?php echo $this->lists['showBanner']; ?>
<?php echo JHtml::_('select.booleanlist', 'showBanner', '', $this->item->showBanner); ?>
</td>
</tr>
<tr>
<td class="key">
<?php echo JText::_( 'Sticky' ); ?>:
<?php echo JText::_('Sticky'); ?>:
</td>
<td>
<?php echo $this->lists['sticky']; ?>
<?php echo JHtml::_('select.booleanlist', 'sticky', 'class="inputbox"', $this->item->sticky); ?>
</td>
</tr>
<tr>
<td class="key">
<label for="ordering">
<?php echo JText::_( 'Ordering' ); ?>:
<?php echo JText::_('Ordering'); ?>:
</label>
</td>
<td>
<?php echo JHtml::_('list.specificordering', $this->row, $this->row->bid, $this->order_query, 1 ); ?>
<?php echo JHtml::_('list.specificordering', $this->item, $this->item->bid, $this->order_query, 1); ?>
</td>
</tr>
<tr>
<td valign="top" align="right" class="key">
<label for="catid">
<?php echo JText::_( 'Category' ); ?>:
<?php echo JText::_('Category'); ?>:
</label>
</td>
<td>
<?php echo $this->lists['catid']; ?>
<?php echo JHtml::_('list.category', 'catid', 'com_banner', (int) $this->item->catid); ?>
</td>
</tr>
<tr>
<td class="key">
<label for="cid">
<?php echo JText::_( 'Client Name' ); ?>:
<?php echo JText::_('Client Name'); ?>:
</label>
</td>
<td >
<?php echo $this->lists['cid']; ?>
<?php echo JHtml::_('banners.clients', 'cid', 'class="inputbox" size="1"', $this->item->cid); ?>
</td>
</tr>
<tr>
<td class="key">
<label for="imptotal">
<?php echo JText::_( 'Impressions Purchased' ); ?>:
<?php echo JText::_('Impressions Purchased'); ?>:
</label>
</td>
<?php
$unlimited = '';
if ($this->row->imptotal == 0) {
if ($this->item->imptotal == 0) {
$unlimited = 'checked="checked"';
$this->row->imptotal = '';
$this->item->imptotal = '';
}
?>
<td>
<input class="inputbox" type="text" name="imptotal" id="imptotal" size="12" maxlength="11" value="<?php echo $this->row->imptotal;?>" />
<input class="inputbox" type="text" name="imptotal" id="imptotal" size="12" maxlength="11" value="<?php echo $this->item->imptotal;?>" />
&nbsp;&nbsp;&nbsp;&nbsp;
<label for="unlimited">
<?php echo JText::_( 'Unlimited' ); ?>
<?php echo JText::_('Unlimited'); ?>
</label>
<input type="checkbox" name="unlimited" id="unlimited" <?php echo $unlimited;?> />
</td>
@ -135,41 +135,41 @@ function submitbutton(pressbutton) {
<tr>
<td class="key">
<label for="clickurl">
<?php echo JText::_( 'Click URL' ); ?>:
<?php echo JText::_('Click URL'); ?>:
</label>
</td>
<td>
<input class="inputbox" type="text" name="clickurl" id="clickurl" size="100" maxlength="200" value="<?php echo $this->row->clickurl;?>" />
<input class="inputbox" type="text" name="clickurl" id="clickurl" size="100" maxlength="200" value="<?php echo $this->item->clickurl;?>" />
</td>
</tr>
<tr >
<td valign="top" align="right" class="key">
<?php echo JText::_( 'Clicks' ); ?>:
<?php echo JText::_('Clicks'); ?>:
</td>
<td colspan="2">
<?php echo $this->row->clicks;?>
<?php echo $this->item->clicks;?>
&nbsp;&nbsp;&nbsp;&nbsp;
<input name="reset_hits" type="button" class="button" value="<?php echo JText::_( 'Reset Clicks' ); ?>" onclick="submitbutton('resethits');" />
<input name="reset_hits" type="button" class="button" value="<?php echo JText::_('Reset Clicks'); ?>" onclick="submitbutton('resethits');" />
</td>
</tr>
<tr>
<td valign="top" class="key">
<label for="custombannercode">
<?php echo JText::_( 'Custom banner code' ); ?>:
<?php echo JText::_('Custom banner code'); ?>:
</label>
</td>
<td>
<textarea class="inputbox" cols="70" rows="8" name="custombannercode" id="custombannercode"><?php echo $this->row->custombannercode;?></textarea>
<textarea class="inputbox" cols="70" rows="8" name="custombannercode" id="custombannercode"><?php echo $this->item->custombannercode;?></textarea>
</td>
</tr>
<tr>
<td valign="top" class="key">
<label for="description">
<?php echo JText::_( 'Description/Notes' ); ?>:
<?php echo JText::_('Description/Notes'); ?>:
</label>
</td>
<td>
<textarea class="inputbox" cols="70" rows="3" name="description" id="description"><?php echo $this->row->description;?></textarea>
<textarea class="inputbox" cols="70" rows="3" name="description" id="description"><?php echo $this->item->description;?></textarea>
</td>
</tr>
<tr>
@ -179,26 +179,26 @@ function submitbutton(pressbutton) {
<tr>
<td valign="top" class="key">
<label for="imageurl">
<?php echo JText::_( 'Banner Image Selector' ); ?>:
<?php echo JText::_('Banner Image Selector'); ?>:
</label>
</td>
<td >
<?php echo $this->lists['imageurl']; ?>
<?php echo JHtml::_('list.images', 'imageurl', $this->item->imageurl, 'onchange="changeDisplayImage();"', '/images/banners'); ?>
</td>
</tr>
<tr>
<td valign="top" class="key">
<?php echo JText::_( 'Banner Image' ); ?>:
<?php echo JText::_('Banner Image'); ?>:
</td>
<td valign="top">
<?php
if (eregi("swf", $this->row->imageurl)) {
if (eregi("swf", $this->item->imageurl)) {
?>
<img src="images/blank.png" name="imagelib">
<?php
} elseif (eregi("gif|jpg|png", $this->row->imageurl)) {
} elseif (eregi("gif|jpg|png", $this->item->imageurl)) {
?>
<img src="../images/banners/<?php echo $this->row->imageurl; ?>" name="imagelib" />
<img src="../images/banners/<?php echo $this->item->imageurl; ?>" name="imagelib" />
<?php
} else {
?>
@ -211,11 +211,11 @@ function submitbutton(pressbutton) {
<tr>
<td valign="top" class="key">
<label for="tags">
<?php echo JText::_( 'Tags' ); ?>:
<?php echo JText::_('Tags'); ?>:
</label>
</td>
<td>
<textarea class="inputbox" cols="70" rows="3" name="tags" id="tags"><?php echo $this->row->tags;?></textarea>
<textarea class="inputbox" cols="70" rows="3" name="tags" id="tags"><?php echo $this->item->tags;?></textarea>
</td>
</tr>
</tbody>
@ -226,9 +226,9 @@ function submitbutton(pressbutton) {
<input type="hidden" name="c" value="banner" />
<input type="hidden" name="option" value="com_banners" />
<input type="hidden" name="bid" value="<?php echo $this->row->bid; ?>" />
<input type="hidden" name="clicks" value="<?php echo $this->row->clicks; ?>" />
<input type="hidden" name="bid" value="<?php echo $this->item->bid; ?>" />
<input type="hidden" name="clicks" value="<?php echo $this->item->clicks; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="impmade" value="<?php echo $this->row->impmade; ?>" />
<?php echo JHtml::_( 'form.token' ); ?>
<input type="hidden" name="impmade" value="<?php echo $this->item->impmade; ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>

View File

@ -13,9 +13,9 @@
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
defined('_JEXEC') or die('Restricted access');
jimport( 'joomla.application.component.view');
jimport('joomla.application.component.view');
/**
* @package Joomla
@ -23,93 +23,51 @@ jimport( 'joomla.application.component.view');
*/
class BannerViewBanner extends JView
{
function display( $tpl = null )
function display($tpl = null)
{
global $mainframe, $option;
$db =& JFactory::getDBO();
$uri =& JFactory::getURI();
$user =& JFactory::getUser();
$model =& $this->getModel();
// Set toolbar items for the page
$edit = JRequest::getVar('edit',true);
$text = !$edit ? JText::_( 'New' ) : JText::_( 'Edit' );
JToolBarHelper::title( JText::_( 'Banner' ).': <small><small>[ ' . $text.' ]</small></small>', 'generic.png' );
JToolBarHelper::save( 'save' );
$text = !$edit ? JText::_('New') : JText::_('Edit');
JToolBarHelper::title( JText::_('Banner').': <small><small>[ ' . $text.' ]</small></small>', 'generic.png');
JToolBarHelper::save('save');
JToolBarHelper::apply('apply');
JToolBarHelper::cancel( 'cancel' );
JToolBarHelper::help( 'screen.banners.edit' );
JToolBarHelper::cancel('cancel');
JToolBarHelper::help('screen.banners.edit');
//get the banner
$row =& $this->get('data');
$item =& $this->get('data');
// fail if checked out not by 'me'
if ($model->isCheckedOut( $user->get('id') )) {
$msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The banner' ), $row->name );
$mainframe->redirect( 'index.php?option='. $option, $msg );
if ($model->isCheckedOut($user->get('id'))) {
$msg = JText::sprintf('DESCBEINGEDITTED', JText::_('The banner'), $item->name);
JFactory::getApplication()->redirect('index.php?option=com_banners', $msg);
}
// Edit or Create?
if ($edit)
{
$model->checkout( $user->get('id') );
$model->checkout($user->get('id'));
}
else
{
// initialise new record
$row->showBanner = 1;
$item->showBanner = 1;
}
// Build Client select list
$sql = 'SELECT cid, name'
. ' FROM #__bannerclient'
;
$db->setQuery($sql);
if (!$db->query())
{
$this->setRedirect( 'index.php?option=com_banners' );
return JError::raiseWarning( 500, $db->getErrorMsg() );
}
$clientlist[] = JHtml::_('select.option', '0', '- ' . JText::_( 'Select Client' ) . ' -', 'cid', 'name' );
$clientlist = array_merge( $clientlist, $db->loadObjectList() );
$lists['cid'] = JHtml::_(
'select.genericlist',
$clientlist,
'cid',
'class="inputbox" size="1"',
'cid',
'name',
$row->cid
);
// Imagelist
$javascript = 'onchange="changeDisplayImage();"';
$directory = '/images/banners';
$lists['imageurl'] = JHtml::_('list.images', 'imageurl', $row->imageurl, $javascript, $directory );
// build list of categories
$lists['catid'] = JHtml::_('list.category', 'catid', 'com_banner', intval( $row->catid ) );
// sticky
$lists['sticky'] = JHtml::_('select.booleanlist', 'sticky', 'class="inputbox"', $row->sticky );
// published
$lists['showBanner'] = JHtml::_('select.booleanlist', 'showBanner', '', $row->showBanner );
// build the html select list for ordering
$order_query = 'SELECT ordering AS value, name AS text'
. ' FROM #__banner'
. ' WHERE catid = ' . (int) $row->catid
. ' WHERE catid = ' . (int) $item->catid
. ' ORDER BY ordering';
//clean data
JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'custombannercode' );
JFilterOutput::objectHTMLSafe($item, ENT_QUOTES, 'custombannercode');
$this->assignRef('row', $row);
$this->assignRef('lists', $lists);
$this->assignRef('order_query', $order_query);
$this->assignRef('item', $item);
$this->assignRef('order_query', $order_query);
parent::display($tpl);
}

View File

@ -1,108 +0,0 @@
<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php
JHtml::_('behavior.tooltip');
?>
<form action="<?php echo JRoute::_('index.php'); ?>" method="post" name="adminForm">
<table>
<tr>
<td align="left" width="100%">
<?php echo JText::_( 'Filter' ); ?>:
<input type="text" name="search" id="search" value="<?php echo $this->filter->search;?>" class="text_area" onchange="document.adminForm.submit();" />
<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
<button onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
</td>
<td nowrap="nowrap">
</td>
</tr>
</table>
<table class="adminlist">
<thead>
<tr>
<th width="20">
<?php echo JText::_( 'Num' ); ?>
</th>
<th width="20">
<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" />
</th>
<th nowrap="nowrap" class="title">
<?php echo JHtml::_('grid.sort', 'Client Name', 'a.name', @$this->filter->order_Dir, @$this->filter->order ); ?>
</th>
<th nowrap="nowrap" class="title" width="35%">
<?php echo JHtml::_('grid.sort', 'Contact', 'a.contact', @$this->filter->order_Dir, @$this->filter->order ); ?>
</th>
<th align="center" nowrap="nowrap" width="5%">
<?php echo JHtml::_('grid.sort', 'No. of Active Banners', 'bid', @$this->filter->order_Dir, @$this->filter->order ); ?>
</th>
<th width="1%" nowrap="nowrap">
<?php echo JHtml::_('grid.sort', 'ID', 'a.cid', @$this->filter->order_Dir, @$this->filter->order ); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="6">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php
$k = 0;
for ($i=0, $n=count( $this->items ); $i < $n; $i++) {
$row = &$this->items[$i];
$row->id = $row->cid;
$link = JRoute::_( 'index.php?option=com_banners&c=client&task=edit&cid[]='. $row->id );
$checked = JHtml::_('grid.checkedout', $row, $i );
?>
<tr class="<?php echo "row$k"; ?>">
<td align="center">
<?php echo $this->pagination->getRowOffset( $i ); ?>
</td>
<td>
<?php echo $checked; ?>
</td>
<td>
<?php
if ( JTable::isCheckedOut($this->user->get ('id'), $row->checked_out ) ) {
echo $row->name;
} else {
?>
<span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit' );?>::<?php echo $row->name; ?>">
<a href="<?php echo $link; ?>">
<?php echo $row->name; ?></a>
</span>
<?php
}
?>
</td>
<td>
<?php echo $row->contact; ?>
</td>
<td align="center">
<?php echo $row->nbanners;?>
</td>
<td align="center">
<?php echo $row->cid; ?>
</td>
</tr>
<?php
$k = 1 - $k;
}
?>
</tbody>
</table>
<input type="hidden" name="c" value="client" />
<input type="hidden" name="option" value="com_banners" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->filter->order; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->filter->order_Dir; ?>" />
<?php echo JHtml::_( 'form.token' ); ?>
</form>

View File

@ -1,4 +1,4 @@
<?php defined( '_JEXEC' ) or die( 'Restricted access' ); ?>
<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php
//Ordering allowed ?
@ -6,62 +6,61 @@
JHtml::_('behavior.tooltip');
?>
<form action="<?php echo JRoute::_('index.php');?>" method="post" name="adminForm">
<table>
<tr>
<td align="left" width="100%">
<?php echo JText::_( 'Filter' ); ?>:
<input type="text" name="search" id="search" value="<?php echo $this->filter->search;?>" class="text_area" onchange="document.adminForm.submit();" />
<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_catid').value='0';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Filter Reset' ); ?></button>
</td>
<td nowrap="nowrap">
<?php
echo JHtml::_('list.category', 'filter_catid', 'com_banner', (int) $this->filter->catid, 'onchange="document.adminForm.submit();"' );
echo JHtml::_('grid.state', $this->filter->state );
?>
</td>
</tr>
</table>
<fieldset class="filter">
<div class="left">
<?php echo JText::_('Filter'); ?>:
<input type="text" name="search" id="search" value="<?php echo $this->filter->search;?>" class="text_area" onchange="document.adminForm.submit();" />
<button onclick="this.form.submit();"><?php echo JText::_('Go'); ?></button>
<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_catid').value='0';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_('Filter Reset'); ?></button>
</div>
<div class="right">
<?php
echo JHtml::_('list.category', 'filter_catid', 'com_banner', (int) $this->filter->catid, 'onchange="document.adminForm.submit();"');
echo JHtml::_('grid.state', $this->filter->state);
?>
</div>
</fieldset>
<table class="adminlist">
<thead>
<tr>
<th width="20">
<?php echo JText::_( 'Num' ); ?>
<?php echo JText::_('Num'); ?>
</th>
<th width="20">
<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->rows ); ?>);" />
<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->rows); ?>);" />
</th>
<th nowrap="nowrap" class="title">
<?php echo JHtml::_('grid.sort', 'Name', 'b.name', @$this->filter->order_Dir, @$this->filter->order ); ?>
<?php echo JHtml::_('grid.sort', 'Name', 'b.name', @$this->filter->order_Dir, @$this->filter->order); ?>
</th>
<th width="10%" nowrap="nowrap">
<?php echo JHtml::_('grid.sort', 'Client', 'c.name', @$this->filter->order_Dir, @$this->filter->order ); ?>
<?php echo JHtml::_('grid.sort', 'Client', 'c.name', @$this->filter->order_Dir, @$this->filter->order); ?>
</th>
<th width="10%" nowrap="nowrap">
<?php echo JHtml::_('grid.sort', 'Category', 'cc.title', @$this->filter->order_Dir, @$this->filter->order ); ?>
<?php echo JHtml::_('grid.sort', 'Category', 'cc.title', @$this->filter->order_Dir, @$this->filter->order); ?>
</th>
<th width="5%" nowrap="nowrap">
<?php echo JHtml::_('grid.sort', 'Published', 'b.showBanner', @$this->filter->order_Dir, @$this->filter->order ); ?>
<?php echo JHtml::_('grid.sort', 'Published', 'b.showBanner', @$this->filter->order_Dir, @$this->filter->order); ?>
</th>
<th width="10%" nowrap="nowrap">
<?php echo JHtml::_('grid.sort', 'Order', 'b.ordering', @$this->filter->order_Dir, @$this->filter->order ); ?>
<?php echo JHtml::_('grid.order', $this->rows ); ?>
<?php echo JHtml::_('grid.sort', 'Order', 'b.ordering', @$this->filter->order_Dir, @$this->filter->order); ?>
<?php echo JHtml::_('grid.order', $this->rows); ?>
</th>
<th width="5%" nowrap="nowrap">
<?php echo JHtml::_('grid.sort', 'Sticky', 'b.Sticky', @$this->filter->order_Dir, @$this->filter->order ); ?>
<?php echo JHtml::_('grid.sort', 'Sticky', 'b.Sticky', @$this->filter->order_Dir, @$this->filter->order); ?>
</th>
<th width="5%" nowrap="nowrap">
<?php echo JHtml::_('grid.sort', 'Impressions', 'b.impmade', @$this->filter->order_Dir, @$this->filter->order ); ?>
<?php echo JHtml::_('grid.sort', 'Impressions', 'b.impmade', @$this->filter->order_Dir, @$this->filter->order); ?>
</th>
<th width="80">
<?php echo JHtml::_('grid.sort', 'Clicks', 'b.clicks', @$this->filter->order_Dir, @$this->filter->order ); ?>
<?php echo JHtml::_('grid.sort', 'Clicks', 'b.clicks', @$this->filter->order_Dir, @$this->filter->order); ?>
</th>
<th width="5%" nowrap="nowrap">
<?php echo JText::_( 'Tags' ); ?>
<?php echo JText::_('Tags'); ?>
</th>
<th width="1%" nowrap="nowrap">
<?php echo JHtml::_('grid.sort', 'ID', 'b.bid', @$this->filter->order_Dir, @$this->filter->order ); ?>
<?php echo JHtml::_('grid.sort', 'ID', 'b.bid', @$this->filter->order_Dir, @$this->filter->order); ?>
</th>
</tr>
</thead>
@ -75,24 +74,24 @@
<tbody>
<?php
$k = 0;
for ($i=0, $n=count( $this->rows ); $i < $n; $i++) {
for ($i=0, $n=count($this->rows); $i < $n; $i++) {
$row = &$this->rows[$i];
$link = JRoute::_( 'index.php?option=com_banners&task=edit&bid[]='. $row->bid );
$link = JRoute::_('index.php?option=com_banners&task=edit&bid[]='. $row->bid);
if( $row->imptotal <= 0 ) {
if ($row->imptotal <= 0) {
$row->imptotal = JText::_('unlimited');
}
if ( $row->impmade != 0 ) {
if ($row->impmade != 0) {
$percentClicks = 100 * $row->clicks/$row->impmade;
} else {
$percentClicks = 0;
}
$row->published = $row->showBanner;
$published = JHtml::_('grid.published', $row, $i );
$checked = JHtml::_('grid.checkedout', $row, $i, 'bid' );
$published = JHtml::_('grid.published', $row, $i);
$checked = JHtml::_('grid.checkedout', $row, $i, 'bid');
?>
<tr class="<?php echo "row$k"; ?>">
<td align="center">
@ -102,9 +101,9 @@
<?php echo $checked; ?>
</td>
<td>
<span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit' );?>::<?php echo $row->name; ?>">
<span class="editlinktip hasTip" title="<?php echo JText::_('Edit');?>::<?php echo $row->name; ?>">
<?php
if ( JTable::isCheckedOut($this->user->get ('id'), $row->checked_out ) ) {
if (JTable::isCheckedOut($this->user->get ('id'), $row->checked_out)) {
echo $row->name;
} else {
?>
@ -126,20 +125,20 @@
<?php echo $published;?>
</td>
<td class="order">
<span><?php echo $this->pagination->orderUpIcon( $i, ($row->category_name == @$this->rows[$i-1]->category_name), 'orderup', 'Move Up', $ordering ); ?></span>
<span><?php echo $this->pagination->orderDownIcon( $i, $n, ($row->category_name == @$this->rows[$i+1]->category_name), 'orderdown', 'Move Down', $ordering ); ?></span>
<span><?php echo $this->pagination->orderUpIcon($i, ($row->category_name == @$this->rows[$i-1]->category_name), 'orderup', 'Move Up', $ordering); ?></span>
<span><?php echo $this->pagination->orderDownIcon($i, $n, ($row->category_name == @$this->rows[$i+1]->category_name), 'orderdown', 'Move Down', $ordering); ?></span>
<?php $disabled = $ordering ? '' : 'disabled="disabled"'; ?>
<input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" <?php echo $disabled ?> class="text_area" style="text-align: center" />
</td>
<td align="center">
<?php echo $row->sticky ? JText::_( 'Yes' ) : JText::_( 'No' );?>
<?php echo $row->sticky ? JText::_('Yes') : JText::_('No');?>
</td>
<td align="center">
<?php echo $row->impmade.' '.JText::_('of').' '.$row->imptotal?>
</td>
<td align="center">
<?php echo $row->clicks;?> -
<?php echo sprintf( '%.2f%%', $percentClicks );?>
<?php echo sprintf('%.2f%%', $percentClicks);?>
</td>
<td>
<?php echo $row->tags; ?>
@ -161,5 +160,5 @@
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->filter->order; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->filter->order_Dir; ?>" />
<?php echo JHtml::_( 'form.token' ); ?>
<?php echo JHtml::_('form.token'); ?>
</form>

View File

@ -13,9 +13,9 @@
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
defined('_JEXEC') or die('Restricted access');
jimport( 'joomla.application.component.view');
jimport('joomla.application.component.view');
/**
* @package Joomla
@ -23,23 +23,23 @@ jimport( 'joomla.application.component.view');
*/
class BannerViewBanners extends JView
{
function display( $tpl = null )
function display($tpl = null)
{
JToolBarHelper::title( JText::_( 'Banner Manager' ), 'generic.png' );
JToolBarHelper::title(JText::_('Banner Manager'), 'generic.png');
JToolBarHelper::publishList();
JToolBarHelper::unpublishList();
JToolBarHelper::customX( 'copy', 'copy.png', 'copy_f2.png', 'Copy' );
JToolBarHelper::customX('copy', 'copy.png', 'copy_f2.png', 'Copy');
JToolBarHelper::deleteList();
JToolBarHelper::editListX();
JToolBarHelper::addNewX();
JToolBarHelper::preferences('com_banners', '200');
JToolBarHelper::help( 'screen.banners' );
JToolBarHelper::help('screen.banners');
// Get data from the model
$rows = & $this->get( 'Data');
$total = & $this->get( 'Total');
$pagination = & $this->get( 'Pagination' );
$filter = & $this->get( 'Filter');
$rows = & $this->get('Data');
$total = & $this->get('Total');
$pagination = & $this->get('Pagination');
$filter = & $this->get('Filter');
$this->assignRef('user', JFactory::getUser());
$this->assignRef('rows', $rows);

View File

@ -9,29 +9,29 @@ function submitbutton(pressbutton)
var form = document.adminForm;
if (pressbutton == 'cancel')
{
submitform( pressbutton );
submitform(pressbutton);
return;
}
// do field validation
if (form.name.value == "")
{
alert( "<?php echo JText::_( 'Please fill in the Client Name.', true ); ?>" );
alert("<?php echo JText::_('Please fill in the Client Name.', true); ?>");
}
else if (form.contact.value == "")
{
alert( "<?php echo JText::_( 'Please fill in the Contact Name.', true ); ?>" );
alert("<?php echo JText::_('Please fill in the Contact Name.', true); ?>");
}
else if (form.email.value == "")
{
alert( "<?php echo JText::_( 'Please fill in the Contact Email.', true ); ?>" );
alert("<?php echo JText::_('Please fill in the Contact Email.', true); ?>");
}
else if (!isEmail( form.email.value ))
else if (!isEmail(form.email.value))
{
alert( "<?php echo JText::_( 'Please provide a valid Contact Email.', true ); ?>" );
alert("<?php echo JText::_('Please provide a valid Contact Email.', true); ?>");
}
else
{
submitform( pressbutton );
submitform(pressbutton);
}
}
//-->
@ -41,13 +41,13 @@ function submitbutton(pressbutton)
<div class="col width-50">
<fieldset class="adminform">
<legend><?php echo JText::_( 'Details' ); ?></legend>
<legend><?php echo JText::_('Details'); ?></legend>
<table class="admintable">
<tr>
<td width="20%" nowrap="nowrap">
<label for="name">
<?php echo JText::_( 'Client Name' ); ?>:
<?php echo JText::_('Client Name'); ?>:
</label>
</td>
<td>
@ -57,7 +57,7 @@ function submitbutton(pressbutton)
<tr>
<td nowrap="nowrap">
<label for="contact">
<?php echo JText::_( 'Contact Name' ); ?>:
<?php echo JText::_('Contact Name'); ?>:
</label>
</td>
<td>
@ -67,7 +67,7 @@ function submitbutton(pressbutton)
<tr>
<td nowrap="nowrap">
<label for="email">
<?php echo JText::_( 'Contact Email' ); ?>:
<?php echo JText::_('Contact Email'); ?>:
</label>
</td>
<td>
@ -80,7 +80,7 @@ function submitbutton(pressbutton)
<div class="col width-50">
<fieldset class="adminform">
<legend><?php echo JText::_( 'Extra Info' ); ?></legend>
<legend><?php echo JText::_('Extra Info'); ?></legend>
<table class="admintable" width="100%">
<tr>
@ -98,5 +98,5 @@ function submitbutton(pressbutton)
<input type="hidden" name="cid" value="<?php echo $this->row->cid; ?>" />
<input type="hidden" name="client_id" value="<?php echo $this->row->cid; ?>" />
<input type="hidden" name="task" value="" />
<?php echo JHtml::_( 'form.token' ); ?>
<?php echo JHtml::_('form.token'); ?>
</form>

View File

@ -15,41 +15,41 @@
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();
jimport( 'joomla.application.component.view');
jimport('joomla.application.component.view');
/**
* @package Joomla
* @subpackage Banners
*/
class BannerViewBannerClient extends JView
class BannerViewClient extends JView
{
function display( $tpl = null )
function display($tpl = null)
{
$app =& JFactory::getApplication();
$user =& JFactory::getUser();
$model =& $this->getModel();
$task = JRequest::getVar( 'task', '', 'method', 'string');
$task = JRequest::getVar('task', '', 'method', 'string');
JToolBarHelper::title( $task == 'add' ? JText::_( 'Banner Client' ) . ': <small><small>[ '. JText::_( 'New' ) .' ]</small></small>' : JText::_( 'Banner Client' ) . ': <small><small>[ '. JText::_( 'Edit' ) .' ]</small></small>', 'generic.png' );
JToolBarHelper::save( 'save' );
JToolBarHelper::title($task == 'add' ? JText::_('Banner Client') . ': <small><small>[ '. JText::_('New') .' ]</small></small>' : JText::_('Banner Client') . ': <small><small>[ '. JText::_('Edit') .' ]</small></small>', 'generic.png');
JToolBarHelper::save('save');
JToolBarHelper::apply('apply');
JToolBarHelper::cancel( 'cancel' );
JToolBarHelper::help( 'screen.banners.client.edit' );
JToolBarHelper::cancel('cancel');
JToolBarHelper::help('screen.banners.client.edit');
$row =& $this->get('data');
$isNew = ($row->cid < 1);
// fail if checked out not by 'me'
if ($model->isCheckedOut( $user->get('id') )) {
$msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The banner client' ), $row->name );
$app->redirect( 'index.php?option=com_banners', $msg );
if ($model->isCheckedOut($user->get('id'))) {
$msg = JText::sprintf('DESCBEINGEDITTED', JText::_('The banner client'), $row->name);
$app->redirect('index.php?option=com_banners', $msg);
}
// Edit or Create?
if (!$isNew)
{
$model->checkout( $user->get('id') );
$model->checkout($user->get('id'));
}
else
{
@ -58,7 +58,7 @@ class BannerViewBannerClient extends JView
$row->approved = 0;
}
JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'extrainfo' );
JFilterOutput::objectHTMLSafe($row, ENT_QUOTES, 'extrainfo');
$this->assignRef('row', $row);

View File

@ -0,0 +1,104 @@
<?php defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
?>
<form action="<?php echo JRoute::_('index.php'); ?>" method="post" name="adminForm">
<fieldset class="filter">
<div class="left">
<?php echo JText::_('Filter'); ?>:
<input type="text" name="search" id="search" value="<?php echo $this->filter->search;?>" class="text_area" onchange="document.adminForm.submit();" />
<button onclick="this.form.submit();"><?php echo JText::_('Go'); ?></button>
<button onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_('Reset'); ?></button>
</div>
</fieldset>
<table class="adminlist">
<thead>
<tr>
<th width="20">
<?php echo JText::_('Num'); ?>
</th>
<th width="20">
<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?>);" />
</th>
<th nowrap="nowrap" class="title">
<?php echo JHtml::_('grid.sort', 'Client Name', 'a.name', @$this->filter->order_Dir, @$this->filter->order); ?>
</th>
<th nowrap="nowrap" class="title">
<?php echo JHtml::_('grid.sort', 'Contact', 'a.contact', @$this->filter->order_Dir, @$this->filter->order); ?>
</th>
<th align="center" nowrap="nowrap" width="5%">
<?php echo JHtml::_('grid.sort', 'No. of Active Banners', 'bid', @$this->filter->order_Dir, @$this->filter->order); ?>
</th>
<th width="1%" nowrap="nowrap" width="5%">
<?php echo JHtml::_('grid.sort', 'ID', 'a.cid', @$this->filter->order_Dir, @$this->filter->order); ?>
</th>
<th width="40%">
&nbsp;
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="9">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php
for ($i=0, $n=count($this->items); $i < $n; $i++) :
$row = &$this->items[$i];
$row->id = $row->cid;
$link = JRoute::_('index.php?option=com_banners&c=client&task=edit&cid[]='. $row->id);
$checked = JHtml::_('grid.checkedout', $row, $i);
?>
<tr class="row<?php echo $i % 2; ?>">
<td align="center">
<?php echo $this->pagination->getRowOffset($i); ?>
</td>
<td>
<?php echo $checked; ?>
</td>
<td>
<?php
if ( JTable::isCheckedOut($this->user->get ('id'), $row->checked_out)) {
echo $row->name;
} else {
?>
<span class="editlinktip hasTip" title="<?php echo JText::_('Edit');?>::<?php echo $row->name; ?>">
<a href="<?php echo $link; ?>">
<?php echo $row->name; ?></a>
</span>
<?php
}
?>
</td>
<td>
<?php echo $row->contact; ?>
</td>
<td align="center">
<?php echo $row->nbanners;?>
</td>
<td align="center">
<?php echo $row->cid; ?>
</td>
<td>
&nbsp;
</td>
</tr>
<?php endfor; ?>
</tbody>
</table>
<input type="hidden" name="c" value="client" />
<input type="hidden" name="option" value="com_banners" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->filter->order; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->filter->order_Dir; ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>

View File

@ -0,0 +1 @@
<html><body></body></html>

View File

@ -13,30 +13,30 @@
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
defined('_JEXEC') or die('Restricted access');
jimport( 'joomla.application.component.view');
jimport('joomla.application.component.view');
/**
* @package Joomla
* @subpackage Banners
*/
class BannerViewBannerClients extends JView
class BannerViewClients extends JView
{
function display( $tpl = null )
function display($tpl = null)
{
// Set toolbar items for the page
JToolBarHelper::title( JText::_( 'Banner Client Manager' ), 'generic.png' );
JToolBarHelper::deleteList( '', 'remove' );
JToolBarHelper::editListX( 'edit' );
JToolBarHelper::addNewX( 'add' );
JToolBarHelper::help( 'screen.banners.client' );
JToolBarHelper::title(JText::_('Banner Client Manager'), 'generic.png');
JToolBarHelper::deleteList('', 'remove');
JToolBarHelper::editListX('edit');
JToolBarHelper::addNewX('add');
JToolBarHelper::help('screen.banners.client');
// Get data from the model
$items = & $this->get( 'Data');
$total = & $this->get( 'Total');
$pagination = & $this->get( 'Pagination' );
$filter = & $this->get( 'Filter');
$items = & $this->get('Data');
$total = & $this->get('Total');
$pagination = & $this->get('Pagination');
$filter = & $this->get('Filter');
$this->assignRef('user', JFactory::getUser());
$this->assignRef('items', $items);