| Server IP : 180.180.241.3 / Your IP : 216.73.216.216 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/AppServ/www/news/administrator/components/com_simple_review/classes/ |
Upload File : |
<?php
/**
* $Id$
*
* Copyright (C) 2005-2011 Rowan Youngson
*
* This file is part of Simple Review.
*
* Simple Review is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* Simple Review is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Simple Review. If not, see <http://www.gnu.org/licenses/>.
*/
require_once('SRBridgeControlsBase.php');
class SRHtmlControls extends SRHtmlControlsBase
{
function DropDownList($name, $items, $selected, $displayStrings=null)
{
$ddlItems = array();
$i = 0;
if($displayStrings == null || count($items) != count($displayStrings))
{
$displayStrings = $items;
}
foreach ($items as $item)
{
$ddlItems[] = JHTML::_('select.option', $item, $displayStrings[$i]);
$i++;
}
return JHTML::_('select.genericlist', $ddlItems, "params[$name]", 'class="inputbox"', 'value', 'text', $selected, false, false );
}
function EditorGetContents($editorArea, $hiddenField)
{
jimport( 'joomla.html.editor' );
$editor =& JFactory::getEditor();
echo $editor->save( $hiddenField );
}
function EditorInsertArea($name, $content, $hiddenField, $width, $height, $col, $row)
{
jimport( 'joomla.html.editor' );
$editor =& JFactory::getEditor();
echo $editor->display($hiddenField, $content, $width, $height, $col, $row);
}
function IDBox($rowNum, $recId, $checkedOut=false, $name='cid' )
{
return JHTML::_('grid.id',$rowNum, $recId, $checkedOut, $name );
}
function Option($value, $text='', $value_name='value', $text_name='text', $disable=false)
{
return JHTML::_('select.option', $value, $text, $value_name, $text_name, $disable);
}
function SelectList( &$arr, $tag_name, $tag_attribs, $key, $text, $selected=NULL, $idtag=false, $flag=false )
{
return JHTML::_('select.genericlist', $arr, $tag_name, $tag_attribs, $key, $text, $selected, $idtag, $flag );
}
function YesNoRadio($tag_name, $tag_attribs, $selected, $yes="Yes", $no="No")
{
return JHTML::_('select.booleanlist', $tag_name, $tag_attribs, $selected, $yes, $no, false ) ;
}
}
class SRControls extends SRControlsBase
{
}
jimport('joomla.html.pagination');
class SRJPagination extends JPagination
{
var $_BaseUrl = null;
var $_ExtraParameters = array();
/**
* Create and return the pagination data object
*
* @access public
* @return object Pagination data object
* @since 1.5
*/
function _buildDataObject()
{
$extraParameters = '';
if($this->_BaseUrl != null)
{
$extraParameters = $this->_BaseUrl;
}
foreach(array_keys($this->_ExtraParameters) as $key)
{
$extraParameters.= "&$key=".$this->_ExtraParameters[$key];
}
// Initialize variables
$data = new stdClass();
$data->all = new JPaginationObject(JText::_('View All'));
if (!$this->_viewall) {
$data->all->base = '0';
$data->all->link = JRoute::_("$extraParameters&limitstart=");
}
// Set the start and previous data objects
$data->start = new JPaginationObject(JText::_('Start'));
$data->previous = new JPaginationObject(JText::_('Prev'));
if ($this->get('pages.current') > 1)
{
$page = ($this->get('pages.current') -2) * $this->limit;
$page = $page == 0 ? '' : $page; //set the empty for removal from route
$data->start->base = '0';
$data->start->link = JRoute::_("$extraParameters&limitstart=0");
$data->previous->base = $page;
$data->previous->link = $page ? JRoute::_("$extraParameters&limitstart=".$page) : JRoute::_("$extraParameters&limitstart=0");
}
// Set the next and end data objects
$data->next = new JPaginationObject(JText::_('Next'));
$data->end = new JPaginationObject(JText::_('End'));
if ($this->get('pages.current') < $this->get('pages.total'))
{
$next = $this->get('pages.current') * $this->limit;
$end = ($this->get('pages.total') -1) * $this->limit;
$data->next->base = $next;
$data->next->link = JRoute::_("$extraParameters&limitstart=".$next);
$data->end->base = $end;
$data->end->link = JRoute::_("$extraParameters&limitstart=".$end);
}
$data->pages = array();
$stop = $this->get('pages.stop');
for ($i = $this->get('pages.start'); $i <= $stop; $i ++)
{
$offset = ($i -1) * $this->limit;
$offset = $offset == 0 ? '' : $offset; //set the empty for removal from route
$data->pages[$i] = new JPaginationObject($i);
if ($i != $this->get('pages.current') || $this->_viewall)
{
$data->pages[$i]->base = $offset;
$data->pages[$i]->link = $offset ? JRoute::_("$extraParameters&limitstart=".$offset) : JRoute::_($extraParameters);
}
}
return $data;
}
function AddParameter($name, $value)
{
$this->_ExtraParameters["$name"] = $value;
}
}
class SRPager extends SRPagerBase
{
var $defaultLimit;
function SRPager($total, $defaultLimit=30, $forceIgnoreSeo = false)
{
$bridge =& SRBridgeManager::Get();
$option = $bridge->Option;
$seo = $bridge->UsingSeoLinks && !$forceIgnoreSeo;
$mainframe = JFactory::getApplication();
$this->defaultLimit = $defaultLimit;
$this->total = $total;
$this->limit = $mainframe->getUserStateFromRequest("$option.limit", 'limit', $defaultLimit/*$mainframe->getCfg('list_limit')*/, 0);
$this->limitStart = $seo ? JRequest::getVar('start', 0, '', 'int') : JRequest::getVar('limitstart', 0, '', 'int');
if ( $this->total <= $this->limit )
{
$this->limitStart = 0;
}
$this->pageNav = new SRJPagination($this->total, $this->limitStart, $this->limit);
}
function AddParameter($name, $value)
{
$this->pageNav->AddParameter($name, $value);
}
function GetPagesLinks($link=null)
{
$this->pageNav->_BaseUrl = $link;
return $this->pageNav->getPagesLinks();
}
function GetLimitBox($link=null)
{
$this->pageNav->_BaseUrl = $link;
return $this->pageNav->getLimitBox();
}
function GetOverview()
{
return $this->pageNav->getPagesCounter();
}
function Reset($total)
{
$mainframe =& JFactory::getApplication();
$bridge =& SRBridgeManager::Get();
$option = $bridge->Option;
$this->total = $total;
$this->limitStart = null;
$this->limit = $mainframe->getUserStateFromRequest("$option.limit", 'limit', $this->defaultLimit/*$mainframe->getCfg('list_limit')*/, 0);
$this->pageNav = new SRJPagination($this->total, $this->limitStart, $this->limit);
}
}
class SRBridgeMenuBar extends SRBridgeMenuBarBase
{
function ModuleNew($addonName)
{
$bridge =& SRBridgeManager::Get();
JToolBarHelper::back();
if($bridge->CurrentUser->CanPerformTask($addonName, 'create'))
{
JToolBarHelper::apply('apply');
}
if($bridge->CurrentUser->CanPerformTask($addonName, 'create'))
{
JToolBarHelper::save('save');
}
if($bridge->CurrentUser->CanPerformTask($addonName, 'manage'))
{
JToolBarHelper::cancel( 'list', 'Cancel' );
}
JToolBarHelper::spacer();
}
function ModuleEdit($addonName)
{
$bridge =& SRBridgeManager::Get();
JToolBarHelper::back();
if($bridge->CurrentUser->CanPerformTask($addonName, 'edit'))
{
JToolBarHelper::apply('apply');
}
if($bridge->CurrentUser->CanPerformTask($addonName, 'edit'))
{
JToolBarHelper::save('save');
}
if($bridge->CurrentUser->CanPerformTask($addonName, 'manage'))
{
JToolBarHelper::cancel( 'list', 'Cancel' );
}
JToolBarHelper::spacer();
}
function ModuleList($addonName)
{
$bridge =& SRBridgeManager::Get();
if($bridge->CurrentUser->CanPerformTask($addonName, 'manage'))
{
JToolBarHelper::publishList('publish');
}
if($bridge->CurrentUser->CanPerformTask($addonName, 'manage'))
{
JToolBarHelper::unpublishList('unpublish');
}
JToolBarHelper::divider();
if($bridge->CurrentUser->CanPerformTask($addonName, 'create'))
{
JToolBarHelper::addNew('new');
}
if($bridge->CurrentUser->CanPerformTask($addonName, 'edit'))
{
JToolBarHelper::editList('edit', 'Edit');
}
if($bridge->CurrentUser->CanPerformTask($addonName, 'delete'))
{
JToolBarHelper::deleteList( '', 'delete', 'Remove' );
}
}
}
class SRTabbedContainer extends SRTabbedContainerBase
{
function SRTabbedContainer($useCookies=false)
{
jimport('joomla.html.pane');
//$this->_Tabs =& JPane::getInstance('sliders');
$this->_Tabs =& JPane::getInstance('tabs');
//$this->_Tabs =& JPane::getInstance('tabs', array('startOffset'=>0));
}
function StartPane($name)
{
echo parent::StartPane($name);
}
function EndPane()
{
echo parent::EndPane();
}
function StartTab($title,$id)
{
echo $this->_Tabs->startPanel($title,$id);
}
function EndTab()
{
echo $this->_Tabs->endPanel();
}
}
?>