mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
recode list_new plugin + e_list.php files
This commit is contained in:
@@ -1,87 +1,101 @@
|
||||
<?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/calendar_menu/e_list.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2007-08-28 19:05:02 $
|
||||
| $Author: e107steved $
|
||||
|
|
||||
+----------------------------------------------------------------------------+
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2001-2008 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* Calendar e_list Handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/e_list.php,v $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 2009-01-27 21:33:52 $
|
||||
* $Author: lisa_ $
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
if (isset($pref['plug_installed']))
|
||||
class list_calendar_menu
|
||||
{
|
||||
if (!isset($pref['plug_installed']['calendar_menu'])) return;
|
||||
}
|
||||
else
|
||||
{ // Support 'legacy' method as well for now
|
||||
if(!$calendar_install = $sql -> db_Select("plugin", "*", "plugin_path = 'calendar_menu' AND plugin_installflag = '1' "))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$LIST_CAPTION = $arr[0];
|
||||
$LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none");
|
||||
|
||||
require_once('ecal_class.php');
|
||||
$ecal_class = new ecal_class;
|
||||
|
||||
$current_day = $ecal_class->cal_date['mday'];
|
||||
$current_month = $ecal_class->cal_date['mon'];
|
||||
$current_year = $ecal_class->cal_date['year'];
|
||||
|
||||
$current = mktime(0,0,0,$current_month, $current_day, $current_year);
|
||||
|
||||
if($mode == "new_page" || $mode == "new_menu" ){
|
||||
$lvisit = $this -> getlvisit();
|
||||
$qry = " event_datestamp>".intval($lvisit)." AND ";
|
||||
}else{
|
||||
$qry = "";
|
||||
function list_calendar_menu($parent)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
$bullet = $this -> getBullet($arr[6], $mode);
|
||||
function getListData()
|
||||
{
|
||||
$list_caption = $this->parent->settings['caption'];
|
||||
$list_display = ($this->parent->settings['open'] ? "" : "none");
|
||||
|
||||
$qry = "
|
||||
SELECT e.*, c.event_cat_name
|
||||
FROM #event AS e
|
||||
LEFT JOIN #event_cat AS c ON c.event_cat_id = e.event_category
|
||||
WHERE ".$qry." e.event_start>='$current' AND c.event_cat_class REGEXP '".e_CLASS_REGEXP."'
|
||||
ORDER BY e.event_start ASC LIMIT 0,".intval($arr[7]);
|
||||
require_once('ecal_class.php');
|
||||
$ecal_class = new ecal_class;
|
||||
|
||||
if(!$event_items = $sql->db_Select_gen($qry)){
|
||||
$LIST_DATA = LIST_CALENDAR_2;
|
||||
}else{
|
||||
while($row = $sql -> db_Fetch()){
|
||||
$current_day = $ecal_class->cal_date['mday'];
|
||||
$current_month = $ecal_class->cal_date['mon'];
|
||||
$current_year = $ecal_class->cal_date['year'];
|
||||
|
||||
$tmp = explode(".", $row['event_author']);
|
||||
if($tmp[0] == "0"){
|
||||
$AUTHOR = $tmp[1];
|
||||
}elseif(is_numeric($tmp[0]) && $tmp[0] != "0"){
|
||||
$AUTHOR = (USER ? "<a href='".e_BASE."user.php?id.".$tmp[0]."'>".$tmp[1]."</a>" : $tmp[1]);
|
||||
}else{
|
||||
$AUTHOR = "";
|
||||
}
|
||||
$current = mktime(0,0,0,$current_month, $current_day, $current_year);
|
||||
|
||||
$rowheading = $this -> parse_heading($row['event_title'], $mode);
|
||||
$ICON = $bullet;
|
||||
$HEADING = "<a href='".e_PLUGIN."calendar_menu/event.php?".$row['event_start'].".event.".$row['event_id']."' title='".$row['event_title']."'>".$rowheading."</a>";
|
||||
$CATEGORY = $row['event_cat_name'];
|
||||
$DATE = ($arr[5] ? ($row['event_start'] ? $this -> getListDate($row['event_start'], $mode) : "") : "");
|
||||
$INFO = "";
|
||||
$LIST_DATA[$mode][] = array( $ICON, $HEADING, $AUTHOR, $CATEGORY, $DATE, $INFO );
|
||||
if($this->parent->mode == "new_page" || $this->parent->mode == "new_menu" )
|
||||
{
|
||||
$lvisit = $this->parent->getlvisit();
|
||||
$qry = " event_datestamp>".intval($lvisit)." AND ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = "";
|
||||
}
|
||||
|
||||
$bullet = $this->parent->getBullet($this->parent->settings['icon']);
|
||||
|
||||
$qry = "
|
||||
SELECT e.*, c.event_cat_name
|
||||
FROM #event AS e
|
||||
LEFT JOIN #event_cat AS c ON c.event_cat_id = e.event_category
|
||||
WHERE ".$qry." e.event_start>='$current' AND c.event_cat_class REGEXP '".e_CLASS_REGEXP."'
|
||||
ORDER BY e.event_start ASC LIMIT 0,".intval($this->parent->settings['amount']);
|
||||
|
||||
if(!$event_items = $this->parent->e107->sql->db_Select_gen($qry))
|
||||
{
|
||||
$list_data = LIST_CALENDAR_2;
|
||||
}
|
||||
else
|
||||
{
|
||||
while($row = $this->parent->e107->sql->db_Fetch())
|
||||
{
|
||||
$record = array();
|
||||
$tmp = explode(".", $row['event_author']);
|
||||
if($tmp[0] == "0")
|
||||
{
|
||||
$record['author'] = $tmp[1];
|
||||
}
|
||||
elseif(is_numeric($tmp[0]) && $tmp[0] != "0")
|
||||
{
|
||||
$record['author'] = (USER ? "<a href='".e_BASE."user.php?id.".$tmp[0]."'>".$tmp[1]."</a>" : $tmp[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$record['author'] = "";
|
||||
}
|
||||
|
||||
$rowheading = $this->parent->parse_heading($row['event_title']);
|
||||
$record['icon'] = $bullet;
|
||||
$record['heading'] = "<a href='".e_PLUGIN."calendar_menu/event.php?".$row['event_start'].".event.".$row['event_id']."' title='".$row['event_title']."'>".$rowheading."</a>";
|
||||
$record['category'] = $row['event_cat_name'];
|
||||
$record['date'] = ($this->parent->settings['date'] ? ($row['event_start'] ? $this->parent->getListDate($row['event_start']) : "") : "");
|
||||
$record['info'] = '';
|
||||
|
||||
$list_data[] = $record;
|
||||
}
|
||||
}
|
||||
//return array with 'records', (global)'caption', 'display'
|
||||
return array(
|
||||
'records'=>$list_data,
|
||||
'caption'=>$list_caption,
|
||||
'display'=>$list_display
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user