mirror of
https://github.com/e107inc/e107.git
synced 2025-08-30 17:50:12 +02:00
* Tablerender title is now breadcrumb trail
* Added shortcodes for previously hard coded stuff and updated template * Converted shortcodes to shortcode class - real PHP, yay! * Removed 'renderplain' option - nothing else worked like this * admin: first cut of the new maintenance options * admin: started item filter form (unfinished by a long way) * admim: removed a lot of inline css classes/styles in preperation for the new admin way of doing things * Start of code tidy up, including creation of some handler classes * Fixed some bugs found along the way
This commit is contained in:
146
e107_plugins/download/handlers/download_class.php
Normal file
146
e107_plugins/download/handlers/download_class.php
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/download/handlers/download_class.php,v $
|
||||
| $Revision: 1.1 $
|
||||
| $Date: 2009-02-11 21:41:54 $
|
||||
| $Author: bugrain $
|
||||
|
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
require_once("../../class2.php");
|
||||
if (!plugInstalled('download')) { exit(); }
|
||||
|
||||
class download
|
||||
{
|
||||
function download()
|
||||
{
|
||||
}
|
||||
function displayCategoryList() {
|
||||
}
|
||||
function getBreadcrumb($arr)
|
||||
{
|
||||
$dlbreadcrumb = array();
|
||||
$ix = 0;
|
||||
foreach ($arr as $key=>$crumb) {
|
||||
$dlbreadcrumb[$ix]['sep'] = " :: ";
|
||||
$ix++;
|
||||
if (is_int($key))
|
||||
{
|
||||
$dlbreadcrumb[$ix]['value'] = $crumb;
|
||||
}
|
||||
else
|
||||
{
|
||||
$dlbreadcrumb[$ix]['value'] = "<a href='{$crumb}'>".$key."</a>";
|
||||
}
|
||||
}
|
||||
$dlbreadcrumb['fieldlist'] = implode(",", array_keys($dlbreadcrumb));
|
||||
return $dlbreadcrumb;
|
||||
}
|
||||
function getCategorySelectList($currentID=0, $blankText="", $incSubSub=true, $groupOnMain=true)
|
||||
{
|
||||
global $sql,$parm;
|
||||
$boxinfo = "\n";
|
||||
$qry = "
|
||||
SELECT dc.download_category_name, dc.download_category_order, dc.download_category_id, dc.download_category_parent,
|
||||
dc1.download_category_parent AS d_parent1
|
||||
FROM #download_category AS dc
|
||||
LEFT JOIN #download_category as dc1 ON dc1.download_category_id=dc.download_category_parent AND dc1.download_category_class IN (".USERCLASS_LIST.")
|
||||
LEFT JOIN #download_category as dc2 ON dc2.download_category_id=dc1.download_category_parent ";
|
||||
if (ADMIN === FALSE) $qry .= " WHERE dc.download_category_class IN (".USERCLASS_LIST.") ";
|
||||
$qry .= " ORDER by dc2.download_category_order, dc1.download_category_order, dc.download_category_order"; // This puts main categories first, then sub-cats, then sub-sub cats
|
||||
if (!$sql->db_Select_gen($qry))
|
||||
{
|
||||
return "Error reading categories<br />";
|
||||
exit;
|
||||
}
|
||||
$boxinfo .= "<select name='download_category' id='download_category' class='tbox'>
|
||||
<option value=''>{$blankText}</option>\n";
|
||||
// Its a structured display option - need a 2-step process to create a tree
|
||||
$catlist = array();
|
||||
while ($dlrow = $sql->db_Fetch(MYSQL_ASSOC))
|
||||
{
|
||||
$tmp = $dlrow['download_category_parent'];
|
||||
if ($tmp == '0')
|
||||
{
|
||||
$dlrow['subcats'] = array();
|
||||
$catlist[$dlrow['download_category_id']] = $dlrow;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($catlist[$tmp]))
|
||||
{ // Sub-Category
|
||||
$catlist[$tmp]['subcats'][$dlrow['download_category_id']] = $dlrow;
|
||||
$catlist[$tmp]['subcats'][$dlrow['download_category_id']]['subsubcats'] = array();
|
||||
}
|
||||
else
|
||||
{ // Its a sub-sub category
|
||||
if (isset($catlist[$dlrow['d_parent1']]['subcats'][$tmp]))
|
||||
{
|
||||
$catlist[$dlrow['d_parent1']]['subcats'][$tmp]['subsubcats'][$dlrow['download_category_id']] = $dlrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Now generate the options
|
||||
foreach ($catlist as $thiscat)
|
||||
{ // Main categories
|
||||
if (count($thiscat['subcats']) > 0)
|
||||
{
|
||||
if ($groupOnMain)
|
||||
{
|
||||
$boxinfo .= "<optgroup label='".htmlspecialchars($thiscat['download_category_name'])."'>";
|
||||
$scprefix = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$boxinfo .= "<option value='".$thiscat['download_category_id']."'";
|
||||
if ($currentID == $thiscat['download_category_id']) {
|
||||
$boxinfo .= " selected='selected'";
|
||||
}
|
||||
$boxinfo .= ">".htmlspecialchars($thiscat['download_category_name'])."</option>\n";
|
||||
$scprefix = ' ';
|
||||
}
|
||||
foreach ($thiscat['subcats'] as $sc)
|
||||
{ // Sub-categories
|
||||
$sscprefix = '--> ';
|
||||
$boxinfo .= "<option value='".$sc['download_category_id']."'";
|
||||
if ($currentID == $sc['download_category_id']) {
|
||||
$boxinfo .= " selected='selected'";
|
||||
}
|
||||
$boxinfo .= ">".$scprefix.htmlspecialchars($sc['download_category_name'])."</option>\n";
|
||||
if ($incSubSub)
|
||||
{ // Sub-sub categories
|
||||
foreach ($sc['subsubcats'] as $ssc)
|
||||
{
|
||||
$boxinfo .= "<option value='".$ssc['download_category_id']."'";
|
||||
if ($currentID == $ssc['download_category_id']) { $boxinfo .= " selected='selected'"; }
|
||||
$boxinfo .= ">".htmlspecialchars($sscprefix.$ssc['download_category_name'])."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($groupOnMain)
|
||||
{
|
||||
$boxinfo .= "</optgroup>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sel = ($currentID == $thiscat['download_category_id']) ? " selected='selected'" : "";
|
||||
$boxinfo .= "<option value='".$thiscat['download_category_id']."' {$sel}>".htmlspecialchars($thiscat['download_category_name'])."</option>\n";
|
||||
}
|
||||
}
|
||||
$boxinfo .= "</select>\n";
|
||||
return $boxinfo;
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user