1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00
php-e107/e107_plugins/list_new/list_class.php

878 lines
21 KiB
PHP
Raw Normal View History

2006-12-02 04:36:16 +00:00
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* List Class
*
*
2006-12-02 04:36:16 +00:00
*/
if (!defined('e107_INIT')) { exit; }
/**
2010-01-10 12:19:53 +00:00
* Base class for list_new plugin
*
* @package e107_plugins
* @subpackage list_new
*/
2010-01-10 12:19:53 +00:00
/**
* class listclass
* The base class
*/
class listclass
{
var $defaultArray;
var $sections;
var $titles;
var $content_types;
var $content_name;
var $list_pref;
var $mode;
var $shortcodes = FALSE;
/**
* constructor
*
* @param string $mode the mode of the caller (default, admin)
* @return void
*
*/
2016-12-17 10:15:10 -08:00
function __construct($mode='')
{
global $TEMPLATE_LIST_NEW, $list_shortcodes;
2006-12-02 04:36:16 +00:00
$this->plugin_dir = e_PLUGIN."list_new/";
$this->e107 = e107::getInstance();
2006-12-02 04:36:16 +00:00
//language
2017-01-23 09:41:23 -08:00
e107::includeLan($this->plugin_dir."languages/".e_LANGUAGE.".php");
//template
if (is_readable(THEME."list_template.php"))
{
require_once(THEME."list_template.php");
}
else
{
require_once($this->plugin_dir."list_template.php");
}
$this->template = $TEMPLATE_LIST_NEW;
2006-12-02 04:36:16 +00:00
//shortcodes
require_once($this->plugin_dir."list_shortcodes.php");
// $this->shortcodes = $list_shortcodes;
$this->shortcodes = new list_shortcodes();
$this->shortcodes->rc = $this;
2006-12-02 04:36:16 +00:00
2016-12-03 13:07:14 -08:00
if($mode=='admin')
{
require_once($this->plugin_dir."list_admin_class.php");
$this->admin = new list_admin($this);
}
2006-12-02 04:36:16 +00:00
//default sections (present in this list plugin)
$this->defaultArray = array("news", "comment", "members");
}
2006-12-02 04:36:16 +00:00
/**
* helper method, parse the template
*
* @param string $template the template to parse
* @return string
*
*/
function parseTemplate($template)
{
//for each call to the template, provide the correct data set through load_globals
//list_shortcodes::load_globals();
return e107::getParser()->parseTemplate($this->template[$template], true, $this->shortcodes);
}
2006-12-02 04:36:16 +00:00
/**
* get preferences, retrieve all preferences from core table
*
* @return array
*
*/
2006-12-02 04:36:16 +00:00
function getListPrefs()
{
$listPrefs = e107::pref('list_new'); //TODO Convert from old format to new.
//insert default preferences
if (empty( $listPrefs))
{
$listPrefs = $this->list_pref = $this->getDefaultPrefs();
e107::getPlugConfig('list_new')->reset()->setPref($listPrefs)->save(true);
}
return $listPrefs;
/*
$sql = e107::getDb();
2006-12-02 04:36:16 +00:00
//check preferences from database
$num_rows = $sql->gen("SELECT * FROM #core WHERE e107_name='list' ");
$row = $sql->fetch();
2006-12-02 04:36:16 +00:00
//insert default preferences
if (empty($row['e107_value']))
{
$this->getSections();
$this->list_pref = $this->getDefaultPrefs();
$tmp = $this->e107->arrayStorage->WriteArray($this->list_pref);
2006-12-02 04:36:16 +00:00
$sql->insert("core", "'list', '$tmp' ");
$sql->gen("SELECT * FROM #core WHERE e107_name='list' ");
2006-12-02 04:36:16 +00:00
}
$this->list_pref = $this->e107->arrayStorage->ReadArray($row['e107_value']);
return $this->list_pref;
*/
2006-12-02 04:36:16 +00:00
}
/**
* prepareSection checks if the sections should be displayed
*
* @param string $mode the mode of the area (menu/page - new/recent)
* @return array
*
*/
function prepareSection($mode)
{
2006-12-02 04:36:16 +00:00
$len = strlen($mode) + 9;
$sections = array();
2006-12-02 04:36:16 +00:00
//get all sections to use
foreach($this->list_pref as $key=>$value)
{
if(substr($key,-$len) == "_{$mode}_display" && $value == "1")
{
2006-12-02 04:36:16 +00:00
$sections[] = substr($key,0,-$len);
}
}
return $sections;
}
/**
* prepareSectionArray parses the preferences for each section
*
* @param string $mode the mode of the area (menu/page - new/recent)
* @return array
*
*/
function prepareSectionArray($mode)
{
2006-12-02 04:36:16 +00:00
//section reference
for($i=0, $iMax = count($this->sections); $i< $iMax; $i++)
{
$s = $this->sections[$i];
if(vartrue($this->list_pref[$s."_".$mode."_display"]) == '1')
{
$arr[$s]['caption'] = vartrue($this->list_pref[$s."_".$mode."_caption"]);
$arr[$s]['display'] = vartrue($this->list_pref[$s."_".$mode."_display"]);
$arr[$s]['open'] = vartrue($this->list_pref[$s."_".$mode."_open"]);
$arr[$s]['author'] = vartrue($this->list_pref[$s."_".$mode."_author"]);
$arr[$s]['category'] = vartrue($this->list_pref[$s."_".$mode."_category"]);
$arr[$s]['date'] = vartrue($this->list_pref[$s."_".$mode."_date"]);
$arr[$s]['icon'] = vartrue($this->list_pref[$s."_".$mode."_icon"]);
$arr[$s]['amount'] = vartrue($this->list_pref[$s."_".$mode."_amount"]);
$arr[$s]['order'] = vartrue($this->list_pref[$s."_".$mode."_order"]);
$arr[$s]['section'] = $s;
2006-12-02 04:36:16 +00:00
}
}
//sort array on order values set in preferences
2020-12-08 12:21:12 -08:00
usort($arr, function($e, $f)
{
return $e["order"]==$f["order"] ? 0 : ($e["order"] > $f["order"] ? 1 : -1);
});
2006-12-02 04:36:16 +00:00
return $arr;
}
/**
* getDefaultSections loads all default 'core' sections from the constructor
*
* @return void
*
*/
function getDefaultSections()
{
2006-12-02 04:36:16 +00:00
//default always present sections
for($i=0, $iMax = count($this->defaultArray); $i< $iMax; $i++)
{
$this->sections[] = $this->defaultArray[$i];
$this->titles[] = $this->defaultArray[$i];
2006-12-02 04:36:16 +00:00
}
return;
}
//content needs this to split each main parent into separate sections
/**
* getContentSections loads all top level content categories
*
* @param string $mode (default, add)
* @return void
*
*/
function getContentSections($mode='')
2006-12-02 04:36:16 +00:00
{
$sql = e107::getDb();
global $pref;
2006-12-02 04:36:16 +00:00
if (!$content_install = isset($pref['plug_installed']['content']))
2007-08-08 19:34:52 +00:00
{
return;
2006-12-02 04:36:16 +00:00
}
$content_types = array();
//get top level categories
if($mainparents = $sql->gen("SELECT content_id, content_heading FROM #pcontent WHERE content_parent = '0' AND (content_datestamp=0 || content_datestamp < ".time().") AND (content_enddate=0 || content_enddate>".time().") ORDER BY content_heading"))
2006-12-02 04:36:16 +00:00
{
$content_name = 'content';
while($row = $sql->fetch())
2006-12-02 04:36:16 +00:00
{
$content_types[] = "content_".$row['content_id'];
if(vartrue($mode) == "add")
2006-12-02 04:36:16 +00:00
{
$this->sections[] = "content_".$row['content_id'];
$this->titles[] = $content_name." : ".$row['content_heading'];
2006-12-02 04:36:16 +00:00
}
}
}
$this->content_types = array_unique($content_types);
$this->content_name = $content_name;
2006-12-02 04:36:16 +00:00
return;
}
/**
* getSections loads all sections
*
* @return void
*
*/
2006-12-02 04:36:16 +00:00
function getSections()
{
global $pref;
2006-12-02 04:36:16 +00:00
$this->getDefaultSections();
2006-12-02 04:36:16 +00:00
if(is_array($pref['e_list_list']))
2006-12-02 04:36:16 +00:00
{
foreach($pref['e_list_list'] as $file)
2006-12-02 04:36:16 +00:00
{
if ($plugin_installed = isset($pref['plug_installed'][$file]))
2006-12-02 04:36:16 +00:00
{
if($file == "content")
{
$this->getContentSections("add");
}
else
{
$this->sections[] = $file;
$this->titles[] = $file;
}
2006-12-02 04:36:16 +00:00
}
}
}
return;
}
/**
* getDefaultPrefs retrieve all default preferences (if none present)
*
* @return array
*
*/
2006-12-02 04:36:16 +00:00
function getDefaultPrefs()
{
global $pref;
2006-12-02 04:36:16 +00:00
$prf = array();
2006-12-02 04:36:16 +00:00
//section preferences
for($i=0, $iMax = count($this->sections); $i< $iMax; $i++)
2006-12-02 04:36:16 +00:00
{
$s = $this->sections[$i];
if(!in_array($this->sections[$i], $this->defaultArray))
2006-12-02 04:36:16 +00:00
{
if(!in_array($s, $this->content_types))
2006-12-02 04:36:16 +00:00
{
if ($plugin_installed = isset($pref['plug_installed'][e107::getParser()->toDB($s, true)]))
2006-12-02 04:36:16 +00:00
{
$prf["$s_recent_menu_caption"] = $s;
$prf["$s_recent_page_caption"] = $s;
$prf["$s_new_menu_caption"] = $s;
$prf["$s_new_page_caption"] = $s;
2006-12-02 04:36:16 +00:00
}
}
else
{
$prf["$s_recent_menu_caption"] = $this->titles[$i];
$prf["$s_recent_page_caption"] = $this->titles[$i];
$prf["$s_new_menu_caption"] = $this->titles[$i];
$prf["$s_new_page_caption"] = $this->titles[$i];
2006-12-02 04:36:16 +00:00
}
}
else
{
$prf["$s_recent_menu_caption"] = $s;
$prf["$s_recent_page_caption"] = $s;
$prf["$s_new_menu_caption"] = $s;
$prf["$s_new_page_caption"] = $s;
2006-12-02 04:36:16 +00:00
}
$prf["$s_recent_menu_display"] = "1";
$prf["$s_recent_menu_open"] = "0";
$prf["$s_recent_menu_author"] = "0";
$prf["$s_recent_menu_category"] = "0";
$prf["$s_recent_menu_date"] = "1";
$prf["$s_recent_menu_amount"] = "5";
$prf["$s_recent_menu_order"] = ($i+1);
$prf["$s_recent_menu_icon"] = '';
$prf["$s_recent_page_display"] = "1";
$prf["$s_recent_page_open"] = "1";
$prf["$s_recent_page_author"] = "1";
$prf["$s_recent_page_category"] = "1";
$prf["$s_recent_page_date"] = "1";
$prf["$s_recent_page_amount"] = "10";
$prf["$s_recent_page_order"] = ($i+1);
$prf["$s_recent_page_icon"] = "1";
$prf["$s_new_menu_display"] = "1";
$prf["$s_new_menu_open"] = "0";
$prf["$s_new_menu_author"] = "0";
$prf["$s_new_menu_category"] = "0";
$prf["$s_new_menu_date"] = "1";
$prf["$s_new_menu_amount"] = "5";
$prf["$s_new_menu_order"] = ($i+1);
$prf["$s_new_menu_icon"] = "1";
$prf["$s_new_page_display"] = "1";
$prf["$s_new_page_open"] = "1";
$prf["$s_new_page_author"] = "1";
$prf["$s_new_page_category"] = "1";
$prf["$s_new_page_date"] = "1";
$prf["$s_new_page_amount"] = "10";
$prf["$s_new_page_order"] = ($i+1);
$prf["$s_new_page_icon"] = "1";
2006-12-02 04:36:16 +00:00
}
2006-12-02 04:36:16 +00:00
//new menu preferences
$prf['new_menu_caption'] = LIST_ADMIN_15;
$prf['new_menu_icon_use'] = "1";
$prf['new_menu_icon_default'] = "1";
$prf['new_menu_char_heading'] = "20";
$prf['new_menu_char_postfix'] = "...";
$prf['new_menu_datestyle'] = "%d %b";
$prf['new_menu_datestyletoday'] = "%H:%M";
$prf['new_menu_showempty'] = "1";
$prf['new_menu_openifrecords'] = '';
2006-12-02 04:36:16 +00:00
//new page preferences
$prf['new_page_caption'] = LIST_ADMIN_15;
$prf['new_page_icon_use'] = "1";
$prf['new_page_icon_default'] = "1";
$prf['new_page_char_heading'] = '';
$prf['new_page_char_postfix'] = '';
$prf['new_page_datestyle'] = "%d %b";
$prf['new_page_datestyletoday'] = "%H:%M";
$prf['new_page_showempty'] = "1";
$prf['new_page_colomn'] = "1";
$prf['new_page_welcometext'] = LIST_ADMIN_16;
$prf['new_page_timelapse'] = "1";
$prf['new_page_timelapse_days'] = "30";
$prf['new_page_openifrecords'] = '';
2006-12-02 04:36:16 +00:00
//recent menu preferences
$prf['recent_menu_caption'] = LIST_ADMIN_14;
$prf['recent_menu_icon_use'] = "1";
$prf['recent_menu_icon_default'] = "1";
$prf['recent_menu_char_heading'] = "20";
$prf['recent_menu_char_postfix'] = "...";
$prf['recent_menu_datestyle'] = "%d %b";
$prf['recent_menu_datestyletoday'] = "%H:%M";
$prf['recent_menu_showempty'] = '';
$prf['recent_menu_openifrecords'] = '';
2006-12-02 04:36:16 +00:00
//recent page preferences
$prf['recent_page_caption'] = LIST_ADMIN_14;
$prf['recent_page_icon_use'] = "1";
$prf['recent_page_icon_default'] = "1";
$prf['recent_page_char_heading'] = '';
$prf['recent_page_char_postfix'] = '';
$prf['recent_page_datestyle'] = "%d %b";
$prf['recent_page_datestyletoday'] = "%H:%M";
$prf['recent_page_showempty'] = '';
$prf['recent_page_colomn'] = "1";
$prf['recent_page_welcometext'] = LIST_ADMIN_13;
$prf['recent_page_openifrecords'] = '';
return $prf;
2006-12-02 04:36:16 +00:00
}
/**
* displaySection, prepare and render a section
*
* @param array $arr the array of preferences for this section
* @return string
*
*/
function displaySection($arr)
2006-12-02 04:36:16 +00:00
{
//set settings
$this->settings = $arr;
2006-12-02 04:36:16 +00:00
//get content sections
$this->getContentSections();
2006-12-02 04:36:16 +00:00
//load e_list file
$this->data = $this->load_elist();
//$this->shortcodes->rc->data = $this->data;
2006-12-02 04:36:16 +00:00
2016-12-03 13:07:14 -08:00
//set record variables
$this->row = array();
$this->row['caption'] = '';
$this->row['icon'] = '';
$this->row['date'] = '';
$this->row['heading'] = '';
$this->row['author'] = '';
$this->row['category'] = '';
$this->row['info'] = '';
$text = '';
switch($this->mode)
2006-12-02 04:36:16 +00:00
{
case 'recent_menu':
$text .= $this->parseRecord('MENU_RECENT');
break;
case 'new_menu':
$text .= $this->parseRecord('MENU_NEW');
break;
case 'recent_page':
$text .= $this->parseRecord('PAGE_RECENT');
break;
case 'new_page':
$text .= $this->parseRecord('PAGE_NEW');
break;
}
return $text;
}
/**
* parseRecord renders the items within a section
*
* @param string $area the area for display
* @return string
*
*/
function parseRecord($area)
{
if(!in_array($area, array('MENU_RECENT', 'MENU_NEW', 'PAGE_RECENT', 'PAGE_NEW')))
{
return;
}
//echo "parse: ".$area."_START<br />";
$text = $this->parseTemplate($area.'_START');
if(is_array($this->data['records']))
{
foreach($this->data['records'] as $this->row)
2006-12-02 04:36:16 +00:00
{
$this->shortcodes->row = $this->row;
//echo "parse: ".$area."<br />";
$text .= $this->parseTemplate($area);
2006-12-02 04:36:16 +00:00
}
}
elseif(!is_array($this->data['records']) && $this->data['records'] != "")
2006-12-02 04:36:16 +00:00
{
if($this->list_pref[$this->mode."_showempty"])
2006-12-02 04:36:16 +00:00
{
// $this->row['heading'] = $this->data['records'];
$this->shortcodes->row['heading'] = $this->data['records'];
//echo "parse: ".$area."<br />";
$text .= $this->parseTemplate($area);
2006-12-02 04:36:16 +00:00
}
}
//echo "parse: ".$area."_END<br />";
$text .= $this->parseTemplate($area.'_END');
return $text;
}
/**
* load_elist loads and checks all e_list.php files
*
* @return array
*
*/
function load_elist()
{
$listArray = '';
//require is needed here instead of require_once, since both the menu and the page could be visible at the same time
if(is_array($this->content_types) && in_array($this->settings['section'], $this->content_types))
{
$file = $this->content_name;
if(is_readable(e_PLUGIN.$file."/e_list.php"))
2006-12-02 04:36:16 +00:00
{
$this->mode_content = $this->settings['section'];
//echo "require: ".e_PLUGIN.$file."/e_list.php<br />";
require_once(e_PLUGIN.$file."/e_list.php");
$listArray = $this->load_data($file);
2006-12-02 04:36:16 +00:00
}
}
else
{
$file = $this->settings['section'];
if(in_array($file, $this->defaultArray))
{
//echo "require: ".$this->plugin_dir."section/list_".$file.".php<br />";
require_once($this->plugin_dir."section/list_".$file.".php");
$listArray = $this->load_data($file);
2006-12-02 04:36:16 +00:00
}
else
{
if (e107::isInstalled($file))
{
if(is_readable(e_PLUGIN.$file."/e_list.php"))
{
//echo "require: ".e_PLUGIN.$file."/e_list.php<br />";
require_once(e_PLUGIN.$file."/e_list.php");
$listArray = $this->load_data($file);
}
2006-12-02 04:36:16 +00:00
}
}
}
return $listArray;
}
2006-12-02 04:36:16 +00:00
/**
* load_data calls the class from the e_list file and retrieves the data
*
* @param string $file the section to load (class name)
* @return array
*
*/
function load_data($file)
{
$name = "list_".$file;
2020-12-18 19:55:12 -08:00
$listArray = array();
2006-12-02 04:36:16 +00:00
//instantiate the class with this as parm
2020-12-18 19:55:12 -08:00
if(class_exists($name))
{
$class = new $name($this);
//call method
if(!method_exists($class, 'getListData'))
{
2020-12-18 19:55:12 -08:00
return $listArray;
//echo "method getListData doesn't exist in class $class<br />";
}
else
{
$listArray = $class->getListData();
if (e107::getPref('profanity_filter'))
{
$tp = e107::getParser();
if (!is_object($parser->e_pf))
{
// require_once(e_HANDLER.'profanity_filter.php');
$parser->e_pf = new e_profanityFilter;
}
foreach ($listArray as $k => $v)
{
if (isset($v['heading']))
{
$listArray[$k]['heading'] = $tp->e_pf->filterProfanities($v['heading']);
}
}
}
2006-12-02 04:36:16 +00:00
}
}
2020-12-18 19:55:12 -08:00
return $listArray;
2006-12-02 04:36:16 +00:00
}
/**
* get datestamp last visit
*
* @return int datestamp
*
*/
function getlvisit()
{
global $qs;
2006-12-02 04:36:16 +00:00
2010-11-01 22:10:42 +00:00
$lvisit = defined('USERLV') ? USERLV : time() + 1000; // Set default value
2017-01-11 13:30:26 -08:00
if(!empty($qs[0]) && $qs[0] === "new")
{
2017-01-11 13:30:26 -08:00
if(!empty($this->list_pref['new_page_timelapse']))
{
2017-01-11 13:30:26 -08:00
if(!empty($this->list_pref['new_page_timelapse_days']) && is_numeric($this->list_pref['new_page_timelapse_days']))
{
$days = $this->list_pref['new_page_timelapse_days'];
}
else
{
2006-12-02 04:36:16 +00:00
$days = "30";
}
if(isset($qs[1]) && is_numeric($qs[1]) && $qs[1] <= $days)
{
2006-12-02 04:36:16 +00:00
$lvisit = time()-$qs[1]*86400;
}
}
}
return $lvisit;
}
/**
* get bullet icon, either use the icon set in admin or the default theme bullet
*
* @param string $icon the icon to use as set in admin
* @return string $bullet
*
*/
function getBullet($icon)
2006-12-02 04:36:16 +00:00
{
$default_bullet = '';
2006-12-02 04:36:16 +00:00
if($this->list_pref[$this->mode."_icon_default"])
2006-12-02 04:36:16 +00:00
{
2009-08-23 10:57:51 +00:00
if(defined('BULLET'))
2006-12-02 04:36:16 +00:00
{
2009-08-23 10:57:51 +00:00
$default_bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" class="icon" />';
}
elseif(file_exists(THEME.'images/bullet2.gif'))
{
$default_bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" class="icon" />';
2006-12-02 04:36:16 +00:00
}
}
$icon_width = '8';
$icon_height = '8';
$style_pre = '';
2006-12-02 04:36:16 +00:00
if($this->list_pref[$this->mode."_icon_use"])
{
if($icon)
{
if(is_readable($this->plugin_dir."images/".$icon))
{
2009-01-27 23:46:12 +00:00
$bullet = "<img src='".$this->plugin_dir."images/".$icon."' alt='' />";
2006-12-02 04:36:16 +00:00
}
}
}
$bullet = vartrue($bullet, $default_bullet);
2006-12-02 04:36:16 +00:00
return $bullet;
}
/**
* helper method, parse heading to specific length with postfix
*
* @param string $heading the heading from the item record
* @return string $heading the parsed heading
*
*/
function parse_heading($heading)
{
if($this->list_pref[$this->mode."_char_heading"] && strlen($heading) > $this->list_pref[$this->mode."_char_heading"])
{
$heading = substr($heading, 0, $this->list_pref[$this->mode."_char_heading"]).$this->list_pref[$this->mode."_char_postfix"];
2006-12-02 04:36:16 +00:00
}
return $heading;
}
/**
* helper method, format the date
*
* @param int $datestamp the datestamp of the item record
* @return string the formatted date
*
*/
function getListDate($datestamp)
{
2006-12-02 04:36:16 +00:00
$datestamp += TIMEOFFSET;
$todayarray = getdate();
$current_day = $todayarray['mday'];
$current_month = $todayarray['mon'];
$current_year = $todayarray['year'];
$thisday = date("d", $datestamp);
$thismonth = date("m", $datestamp);
$thisyear = date("Y", $datestamp);
//check and use the today date style if day is today
if($thisyear == $current_year)
{
if($thismonth == $current_month)
{
if($thisday == $current_day)
{
$datepreftoday = $this->list_pref[$this->mode."_datestyletoday"];
return strftime($datepreftoday, $datestamp);
2006-12-02 04:36:16 +00:00
}
}
}
//else use default date style
$datepref = $this->list_pref[$this->mode."_datestyle"];
return strftime($datepref, $datestamp);
2006-12-02 04:36:16 +00:00
}
/**
* display timelapse element (on newpage)
*
* @return string the timelapse element
*
*/
function displayTimelapse()
{
global $rs; //FIXME $frm
2006-12-02 04:36:16 +00:00
if(isset($this->list_pref['new_page_timelapse']) && $this->list_pref['new_page_timelapse'])
{
if(isset($this->list_pref['new_page_timelapse_days']) && is_numeric($this->list_pref['new_page_timelapse_days']))
{
$days = $this->list_pref['new_page_timelapse_days'];
}
else
{
$days = '30';
}
$timelapse = 0;
if(isset($qs[1]) && is_numeric($qs[1]) && $qs[1] <= $days)
{
$timelapse = $qs[1];
}
$url = $this->plugin_dir."list.php?new";
$selectjs = "onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\"";
$this->row['timelapse'] = LIST_MENU_6;
$this->row['timelapse'] .= $rs->form_select_open("timelapse", $selectjs).$rs->form_option(LIST_MENU_5, 0, $url);
for($a=1; $a<=$days; $a++)
{
$this->row['timelapse'] .= $rs->form_option($a, ($timelapse == $a ? '1' : '0'), $url.".".$a);
}
$this->row['timelapse'] .= $rs->form_select_close();
return $this->parseTemplate('TIMELAPSE_TABLE');
}
return;
}
/**
* display the page (either recent or new)
*
* @return string
*
*/
function displayPage()
{
global $qs;
2006-12-02 04:36:16 +00:00
//get preferences
if(!isset($this->list_pref))
{
$this->list_pref = $this->getListPrefs();
$this->shortcodes->list_pref = $this->list_pref;
}
//get sections
$this->sections = $this->prepareSection($this->mode);
$arr = $this->prepareSectionArray($this->mode);
//timelapse
if(vartrue($qs[0]) == "new")
{
$text .= $this->displayTimelapse();
}
2006-12-02 04:36:16 +00:00
$text .= $this->parseTemplate('COL_START');
2006-12-02 04:36:16 +00:00
//welcometext
if($this->list_pref[$this->mode."_welcometext"])
{
$text .= $this->parseTemplate('COL_WELCOME');
}
//display the sections
$k=0;
2016-12-03 13:07:14 -08:00
// print_a($arr);
foreach($arr as $sect)
{
2016-12-03 13:07:14 -08:00
$this->shortcodes->plugin = $sect['section'];
if($sect['display'] == '1')
{
$sectiontext = $this->displaySection($sect);
if($sectiontext != '')
{
$v = $k/$this->list_pref[$this->mode."_colomn"];
if( intval($v) == $v )
{
$text .= $this->parseTemplate('COL_ROWSWITCH');
}
$text .= $this->parseTemplate('COL_CELL_START');
$text .= $sectiontext;
$text .= $this->parseTemplate('COL_CELL_END');
$k++;
}
}
}
$text .= $this->parseTemplate('COL_END');
2006-12-02 04:36:16 +00:00
return $text;
}
/**
* display the menu (either recent or new)
*
* @return string
*
*/
function displayMenu()
{
//get preferences
if(!isset($this->list_pref))
{
$this->list_pref = $this->getListPrefs();
$this->shortcodes->list_pref = $this->list_pref;
}
//get sections
$this->sections = $this->prepareSection($this->mode);
$arr = $this->prepareSectionArray($this->mode);
//display the sections
$text = '';
foreach($arr as $sect)
{
if($sect['display'] == '1')
{
$sectiontext = $this->displaySection($sect);
if($sectiontext != '')
{
$text .= $sectiontext;
}
}
}
return $text;
}
2006-12-02 04:36:16 +00:00
}
2020-08-10 15:49:44 -07:00