Xaraya / Postnuke CVS Notices - Message

Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites

View Statistics - Next Notice - Previous Notice

Directory filter : [ all ] / postnuke_modules / postcalendar [ view in CVS ]

Date Directory [filter] File(s) [view] Author [filter]
07 Sep 2002 15:42:02postnuke_modules/postcalendarsmarty_plugins.php,NONE,1.1Roger Raymond
 template cleanup

Update of /home/cvsroot/postnuke_modules/postcalendar
In directory ns7.hostnuke.net:/tmp/cvs-serv30038

Added Files:
	smarty_plugins.php 
Log Message:
template cleanup


--- NEW FILE: smarty_plugins.php ---
<?php
/**
 *  $Id: smarty_plugins.php,v 1.1 2002/09/07 15:42:00 iansym Exp $
 *
 *  PostCalendar::PostNuke Events Calendar Module
 *  Copyright (C) 2002  The PostCalendar Team
 *  http://pc.bahraini.tv
 *  
 *  This program 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 2 of the License, or
 *  (at your option) any later version.
 *  
 *  This program 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 this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *  To read the license please read the docs/license.txt or visit
 *  http://www.gnu.org/copyleft/gpl.html
 *
 */

//=================================================================
//  PostCalendar Custom Smarty Functions
//=================================================================
function postcalendar_smarty_pcURL($args) 
{
    if(!isset($args['action'])) {
        $args['action'] = 'month';
    }
    $template_view = pnVarCleanFromInput('tplview');
    
    $jumpday    = pnVarCleanFromInput('jumpday');
    $jumpmonth  = pnVarCleanFromInput('jumpmonth');
    $jumpyear   = pnVarCleanFromInput('jumpyear');
    $Date = pnVarCleanFromInput('Date');
    
    if(!isset($Date) || empty($Date)) { 
        // check for the jump vars
        $time = time();
        $time += (pnUserGetVar('timezone_offset') - pnConfigGetVar('timezone_offset')) * 3600;
        if(!empty($jumpday) || !empty($jumpmonth) || !empty($jumpyear)) {
            $Date = "$jumpmonth/$jumpday/$jumpyear";
        } else {
            $time = time();
            $time += (pnUserGetVar('timezone_offset') - pnConfigGetVar('timezone_offset')) * 3600;
            $Date = ml_ftime('%m/%d/%Y',$time);
        }
    }
    switch($args['action']) {
        case 'submit' :
            echo pnModURL('postcalendar','user','submit',array('tplview'=>$template_view,'Date'=>$Date));
            break;
        case 'search' :
            echo pnModURL('postcalendar','user','search');
            break;        
        case 'day' :
            echo pnModURL('postcalendar','user','view',array('tplview'=>$template_view,'viewtype'=>'day','Date'=>$Date));
            break;
        case 'week' :
            echo pnModURL('postcalendar','user','view',array('tplview'=>$template_view,'viewtype'=>'week','Date'=>$Date));
            break;
        case 'month' :
            echo pnModURL('postcalendar','user','view',array('tplview'=>$template_view,'viewtype'=>'month','Date'=>$Date));
            break;
        case 'year' :
            echo pnModURL('postcalendar','user','view',array('tplview'=>$template_view,'viewtype'=>'year','Date'=>$Date));
            break;
        case 'detail' :
            if(!isset($args['eid'])) {
            
            } else {
                echo pnModURL('postcalendar','user','view',array('tplview'=>$template_view,'viewtype'=>'details','eid'=>$args['eid']));
            }
            break;
    }
}
function postcalendar_smarty_pcDateFormat($args) 
{
    extract($args);
    if(!isset($format)) {
        $format = pnModGetVar('postcalendar','pcEventDateFormat');
    }
    if(isset($date)) {
        list($y,$m,$d) = explode('-',$date);
        echo strftime($format,mktime(0,0,0,$m,$d,$y));
    } else {
        echo strftime($format,time());
    }
}

function postcalendar_smarty_pc_date_format($string, $default_date=null)
{   
    $format = pnModGetVar('PostCalendar','pcEventDateFormat');
	if($string != '') {
    	return strftime($format, smarty_make_timestamp($string));
	} elseif (isset($default_date) && $default_date != '') {		
    	return strftime($format, smarty_make_timestamp($default_date));
	} else {
		return;
	}
}

function postcalendar_smarty_pcTimeFormat($args) 
{
}

function postcalendar_smarty_pcEventURL($args) 
{   
    extract($args);
    $modinfo = pnModGetInfo(pnModGetIDFromName('postcalendar'));
    //=================================================================
    //  Find out what Template we're using (n/a)
    //=================================================================
    $template_name = pnModGetVar('postcalendar','pcTemplate');
    if(!isset($template_name)) {
        $template_name ='default';
    }
    //=================================================================
    //  Find out what Template View to use
    //=================================================================
    $template_view = pnVarCleanFromInput('tplview');
    if(!isset($template_view)) {
        $template_view ='default';
    }
    list($y,$m,$d) = explode('-',$date);
    $date = "$m/$d/$y";
    $PostCalendarURL = 'index.php?module='.pnVarPrepForOS($modinfo['name']);
    if($view == 'details') {
        echo $PostCalendarURL.'&func=view&tplview='.$template_view.'&viewtype='.$view.'&eid='.$eid;
    } elseif($view == 'submit') { 
        echo $PostCalendarURL.'&func=submit&tplview='.$template_view.'&Date='.$date;
    } else {
        echo $PostCalendarURL.'&func=view&tplview='.$template_view.'&viewtype='.$view.'&Date='.$date;
    }
}

function postcalendar_smarty_pcDateSelect($args) 
{   
    $useinternationaldate = pnModGetVar('postcalendar','useinternationaldates');
    list($Date,$d,$m,$y) = pnVarCleanFromInput('Date','jumpday','jumpmonth','jumpyear');
    if(isset($Date)) {
        list($m,$d,$y) = explode('/',$Date);
    }    
    if(!isset($args['day']) || strtolower($args['day']) == 'on') {
        $args['day'] = true;
    } else {
        $args['day'] = false;
    }
    if(!isset($args['month']) || strtolower($args['month']) == 'on') {
        $args['month'] = true;
    } else {
        $args['month'] = false;
    }
    if(!isset($args['year']) || strtolower($args['year']) == 'on') {
        $args['year'] = true;
    } else {
        $args['year'] = false;
    }
    if(!isset($args['view']) || strtolower($args['view']) == 'on') {
        $args['view'] = true;
    } else {
        $args['view'] = false;
    }
    if(!isset($args['form']) || strtolower($args['form']) == 'on') {
        $args['form'] = true;
    } else {
        $args['form'] = false;
    }
    
    $tplview = pnVarCleanFromInput('tplview');
    $viewtype = pnVarCleanFromInput('viewtype');
    
    $dayselect=$monthselect=$yearselect=$viewselect=$fstart=$fend='';
    $output = new pnHTML();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
        if($args['day'] === true) {
            $sel_data = pnModAPIFunc('postcalendar','user','buildDaySelect',array('pc_day'=>$d));
            $dayselect = $output->FormSelectMultiple('jumpday', $sel_data);
        }
        
        if($args['month'] === true) {
            $sel_data = pnModAPIFunc('postcalendar','user','buildMonthSelect',array('pc_month'=>$m));
            $monthselect = $output->FormSelectMultiple('jumpmonth', $sel_data);
        }
        
        if($args['year'] === true) {
            $sel_data = pnModAPIFunc('postcalendar','user','buildYearSelect',array('pc_year'=>$y));
            $yearselect = $output->FormSelectMultiple('jumpyear', $sel_data);
        }
        if($args['view'] === true) {
            $sel_data = array();
            $sel_data[0]['id']         = 'day';
            $sel_data[0]['selected']   = $viewtype=='day';
            $sel_data[0]['name']       = _CAL_DAYVIEW;
            $sel_data[1]['id']         = 'week';
            $sel_data[1]['selected']   = $viewtype=='week';
            $sel_data[1]['name']       = _CAL_WEEKVIEW;
            $sel_data[2]['id']         = 'month';
            $sel_data[2]['selected']   = $viewtype=='month';
            $sel_data[2]['name']       = _CAL_MONTHVIEW;
            $sel_data[3]['id']         = 'year';
            $sel_data[3]['selected']   = $viewtype=='year';
            $sel_data[3]['name']       = _CAL_YEARVIEW;
            $viewselect = $output->FormSelectMultiple('viewtype', $sel_data);
        }
        $jumpsubmit = $output->FormSubmit(_PC_JUMP_MENU_SUBMIT);
        if($args['form'] === true) {
            $fstart = $output->FormStart(pnModURL('postcalendar','user','view'));
            $fend = $output->FormEnd();
        }
        $tplview_hidden = $output->FormHidden('tplview',$tplview);
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    echo $fstart;
    if($useinternationaldates) {
        echo $monthselect,$dayselect,$yearselect,$viewselect,$jumpsubmit,$tplview_hidden;
    } else {
        echo $dayselect,$monthselect,$yearselect,$viewselect,$jumpsubmit,$tplview_hidden;
    }
    echo $fend;
}
?>


Directory filter : [ all ] / postnuke_modules / postcalendar [ view in CVS ]

View Statistics - Next Notice - Previous Notice


Visit Developer Site - Browse CVS Repository Syndicate via backend.rss
(max. once per hour please)
Powered by CVSNotice 0.1.3