| 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: SRBridgeControlsBase.php 320 2010-11-17 08:44:15Z rowan $
*
* Copyright (C) 2005-2009 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/>.
*/
defined( '_JEXEC' ) or die('Direct Access to this location is not allowed.');
class SRHtmlControlsBase
{
function CheckBox($name, $id, $value, $checked=false)
{
if($checked)
{
$checked = "checked";
}
else
{
$checked = "";
}
return "<input type='checkbox' name='params[$name]' id='$id' value='$value' $checked />";
}
function DropDownList($name, $items, $selected, $displayStrings=null)
{
trigger_error('This class function has not been implemented!',E_USER_ERROR);
}
function EditorGetContents($editorArea, $hiddenField)
{
trigger_error('This class function has not been implemented!',E_USER_ERROR);
}
function EditorInsertArea($name, $content, $hiddenField, $width, $height, $col, $row)
{
trigger_error('This class function has not been implemented!',E_USER_ERROR);
}
function IDBox($rowNum, $recId, $checkedOut=false, $name='cid' )
{
trigger_error('This class function has not been implemented!',E_USER_ERROR);
}
function ImageSearch()
{
$addonManager =& Addon_Manager::Get();
$key = $addonManager->GetSetting('GoogleSearchAPIKey', _SR_ADDON_TYPE_MODULE, 'Configuration_Module');
if($key)
{
$key = '?key=ABQIAAAAKsoyc2ovOrFQsekJiCxTpRThtKp5d-mCVxNDYz4Ye0ImaUdv2hRerDNbKy4yrckGAh-GWKq3AQtslA';
}
$bridge =& SRBridgeManager::Get();
$bridge->IncludeJSLink("http://www.google.com/jsapi$key");
$bridge->AddCustomTag('<script type="text/javascript">SRCore.SearchImage.Init();</script>');
ob_start();
?>
<div id="imageSearchContainer">
Search Images - <small>powered by <img class="gsc-branding-img" style="vertical-align:middle" src="http://www.google.com/uds/css/small-logo.png" /></small>
<div id="imgSearchControl" class="search-control">Loading...</div>
<!--Remove all floating-->
<div class="clear"></div>
<!--Image will be shown here-->
<div id='imageContainer'></div>
</div>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
function Option($value, $text='', $value_name='value', $text_name='text', $disable=false)
{
trigger_error('This class function has not been implemented!',E_USER_ERROR);
}
function SelectList( &$arr, $tag_name, $tag_attribs, $key, $text, $selected=NULL, $idtag=false, $flag=false )
{
trigger_error('This class function has not been implemented!',E_USER_ERROR);
}
//'params[userreview][]',string[], 'MULTIPLE', string[]
function SelectListBasic($listname, $items, $tag_attribs='MULTIPLE', $selected)
{
$html = "<select name='params[$listname][]' class='inputbox' $tag_attribs>";
if(count($items) > 0)
{
foreach ($items as $item)
{
$html .= "<option value='$item'";
if (in_array ($item, $selected))
{
$html.= "selected";
}
$html.= ">$item</option>";
}
}
$html.="</select>";
return $html;
}
function Text( $name, $value, $control_name, $size='25' ) {
return '<input type="text" name="'. $control_name .'['. $name .']" value="'. $value .'" class="text_area" size="'. $size .'"/>';
}
function TextArea( $name, $value, $control_name, $rows='20', $cols='70' ) {
// convert <br /> tags so they are not visible when editing
$value = str_replace( '<br />', "\n", $value );
return '<textarea name="params['. $name .']" cols="'. $cols .'" rows="'. $rows .'" class="text_area">'. $value .'</textarea>';
}
function YesNoRadio($tag_name, $tag_attribs, $selected, $yes="Yes", $no="No")
{
trigger_error('This class function has not been implemented!',E_USER_ERROR);
}
}
class SRControlsBase
{
/*
* Creates an admin listing of objects (reviews, categories etc)
* @param formName : The name of the form
* @param formAction : The form action
* @param columnNames : An array of names/titles of the columns
* @param propertyNames : An array of the properties on the objects
* @param rows : An array of objects to print
* @param task : The forms default task
* @param module : The module object which corresponds to the objects
* Note columnNames[0] and propertyNames[0] must refer to the objects id
* Note to display a link the propertyName[N] should be an array ...
* Example:
$formName = "adminForm";
$formAction = "index.php";
$columnNames = Array();
$columnNames[] = "Review ID";
$columnNames[] = "Title 1";
$columnNames[] = "Title 2";
$columnNames[] = "Title 3";
$columnNames[] = "Published";
$columnNames[] = "Category";
$columnNames[] = "Score";
$columnNames[] = "Created By";
$propertyNames = Array();
$propertyNames[] = "reviewID";
$propertyNames[] = Array('title1');
$propertyNames[] = Array('title2');
$propertyNames[] = Array('title3');
$propertyNames[] = 'published';
$propertyNames[] = 'categoryName';
$propertyNames[] = 'score';
$propertyNames[] = 'createdBy';
*/
function ItemListing($formName, $formAction, &$columnNames, &$propertyNames, &$rows, $task, $module, $pageNav=null)
{
$option = $this->_AddonManager->Bridge->Option;
$bridge =& SRBridgeManager::Get();
?>
<form action="<?php echo $formAction;?>" method="post" name="<?php echo $formName;?>" id="<?php echo $formName;?>">
<table class="adminheading">
<tr>
<th><?php echo $module->friendlyName;?></th>
</tr>
</table>
<table class="adminlist">
<!--header-->
<tr>
<th width="5">
#
</th>
<th align="left">
<input type="checkbox" name="toggle" value="" onClick="checkAll('<?php echo count($rows);?>');" />
</th>
<?php
for ($i=0, $n=count( $columnNames ); $i < $n; $i++)
{
echo '<th align="left">';
echo $columnNames[$i];
echo '</th>';
}
?>
</tr>
<!--contents-->
<?php
$k = 0;
for ($i=0, $n=count( $rows ); $i < $n; $i++)
{
$row = &$rows[$i];
echo "<tr>";
//#
$count = $i+1;
echo "<td>$count</td>";
$id = $propertyNames[0];
echo "<td>".SRHtmlControls::IDBox( $i, $row->{$id}, false, $id )."</td>";
for ($k=0, $m=count( $propertyNames ); $k < $m; $k++)
{
echo '<td>';
$column = $propertyNames[$k];
$islink = false;
if(is_array($column))
{
$column = $column[0];
$islink = true;
}
if($column == 'published')
{
$publishTask = $row->published ? 'unpublish' : 'publish';
$alt = $row->published ? 'Published' : 'Unpublished';
$buttonClass = 'icon'.$bridge->SystemToBridge;
$publishedClass = ($row->published ? 'published' : 'unpublished').$bridge->SystemToBridge;
?>
<button onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $publishTask;?>')"
class="<?php echo $buttonClass.' '.$publishedClass;?>"
title="<?php echo $alt;?>">
</button>
<?php
}
else
{
$stripedCol = Simple_Review_Common::RemoveSlashes($row->{$column});
if($islink)
{
$link = $module->GetURL("edit", "$id=".$row->{$id});
echo "<a href='$link'>$stripedCol</a>";
}
else
{
echo $stripedCol;
}
}
echo '</td>';
}
echo "</tr>";
}
?>
</table>
<?php if($pageNav!=null)
{
echo $pageNav->GetPagesLinks();
echo $pageNav->GetLimitBox();
echo $pageNav->GetOverview();
}
?>
<input type="hidden" name="option" value="<?php echo $option;?>" />
<input type="hidden" name="task" value="<?php echo $task;?>" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="hidemainmenu" value="0">
<input type="hidden" name="module" value="<?php echo $module->addonName;?>" />
<input type="hidden" name="limitstart" value="0" />
</form>
<?php
}
//TODO: rewrite this
function ItemListingTemp($formName, $formAction, &$columnNames, &$propertyNames, &$rows, $task, $module, $pageNav=null)
{
$option = $this->_AddonManager->Bridge->Option;
$bridge =& SRBridgeManager::Get();
?>
<table class="adminheading">
<tr>
<th><?php echo $module->friendlyName;?></th>
</tr>
</table>
<table class="adminlist">
<!--header-->
<tr>
<th width="5">
#
</th>
<th align="left">
<input type="checkbox" name="toggle" value="" onClick="checkAll('<?php echo count($rows);?>');" />
</th>
<?php
for ($i=0, $n=count( $columnNames ); $i < $n; $i++)
{
echo '<th align="left">';
echo $columnNames[$i];
echo '</th>';
}
?>
</tr>
<!--contents-->
<?php
$k = 0;
for ($i=0, $n=count( $rows ); $i < $n; $i++)
{
$row = &$rows[$i];
echo "<tr>";
//#
$count = $i+1;
echo "<td>$count</td>";
$id = $propertyNames[0];
echo "<td>".SRHtmlControls::IDBox( $i, $row->{$id}, false, $id )."</td>";
for ($k=0, $m=count( $propertyNames ); $k < $m; $k++)
{
echo '<td>';
$column = $propertyNames[$k];
$islink = false;
if(is_array($column))
{
$column = $column[0];
$islink = true;
}
if($column == 'published')
{
$publishTask = $row->published ? 'unpublish' : 'publish';
$alt = $row->published ? 'Published' : 'Unpublished';
$buttonClass = 'icon'.$bridge->SystemToBridge;
$publishedClass = ($row->published ? 'published' : 'unpublished').$bridge->SystemToBridge;
?>
<button onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $publishTask;?>')"
class="<?php echo $buttonClass.' '.$publishedClass;?>"
title="<?php echo $alt;?>">
</button>
<?php
}
else
{
$stripedCol = Simple_Review_Common::RemoveSlashes($row->{$column});
if($islink)
{
$link = $module->GetURL("edit", "$id=".$row->{$id});
echo "<a href='$link'>$stripedCol</a>";
}
else
{
echo $stripedCol;
}
}
echo '</td>';
}
echo "</tr>";
}
?>
</table>
<?php if($pageNav!=null)
{
echo $pageNav->GetPagesLinks();
echo $pageNav->GetLimitBox();
echo $pageNav->GetOverview();
}
?>
<input type="hidden" name="option" value="<?php echo $option;?>" />
<input type="hidden" name="task" value="<?php echo $task;?>" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="hidemainmenu" value="0">
<input type="hidden" name="module" value="<?php echo $module->addonName;?>" />
<input type="hidden" name="limitstart" value="0" />
<?php
}
}
class SRPagerBase
{
var $limit;
var $limitStart;
var $total;
var $pageNav;
function SRPagerBase($total, $defaultLimit=30, $forceIgnoreSeo = false)
{
if(strtolower(get_class($this))=='srpagerbase' || !is_subclass_of ($this,'SRPagerBase'))
{
trigger_error('This class is abstract. It cannot be instantiated!',E_USER_ERROR);
}
}
function AddParameter($name, $value){}
function GetPagesLinks($link=null){}
function GetLimitBox($link=null){}
function GetOverview(){}
function Reset($total){}
}
class SRBridgeMenuBarBase
{
function SRBridgeMenuBarBase()
{
if(strtolower(get_class($this))=='srbridgemenubarbase' || !is_subclass_of ($this,'SRBridgeMenuBarBase'))
{
trigger_error('This class is abstract. It cannot be instantiated!',E_USER_ERROR);
}
}
function Config(){}
function ModuleNew(){}
function ModuleEdit(){}
function ModuleList(){}
}
class SRTabbedContainerBase
{
var $_Tabs = null;
function SRTabbedContainerBase($useCookies=false)
{
if(strtolower(get_class($this))=='srtabbedcontainerbase' || !is_subclass_of ($this,'SRTabbedContainerBase'))
{
trigger_error('This class is abstract. It cannot be instantiated!',E_USER_ERROR);
}
}
function StartPane($name)
{
return $this->_Tabs->startPane($name);
}
function EndPane()
{
return $this->_Tabs->endPane();
}
function StartTab($title,$id){}
function EndTab(){}
}
?>