[ Index ]

krapohl.info

title

Body

[close]

/plugins/ -> function.pc_url.php (source)

   1  <?php
   2  /**
   3   *  $Id: function.pc_url.php,v 1.2 2004/02/11 19:15:13 larsneo Exp $
   4   *
   5   *  PostCalendar::PostNuke Events Calendar Module
   6   *  Copyright (C) 2002  The PostCalendar Team
   7   *  http://postcalendar.tv
   8   *  
   9   *  This program is free software; you can redistribute it and/or modify
  10   *  it under the terms of the GNU General Public License as published by
  11   *  the Free Software Foundation; either version 2 of the License, or
  12   *  (at your option) any later version.
  13   *  
  14   *  This program is distributed in the hope that it will be useful,
  15   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17   *  GNU General Public License for more details.
  18   *  
  19   *  You should have received a copy of the GNU General Public License
  20   *  along with this program; if not, write to the Free Software
  21   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  22   *
  23   *  To read the license please read the docs/license.txt or visit
  24   *  http://www.gnu.org/copyleft/gpl.html
  25   *
  26   */
  27  function smarty_function_pc_url($args) 
  28  {
  29      extract($args); unset($args);
  30      if(!isset($action)) $action = _SETTING_DEFAULT_VIEW;
  31      if(empty($print)) {
  32          $print = false;
  33      } else {
  34          $print = true;
  35      }
  36      $template_view = pnVarCleanFromInput('tplview');
  37      $viewtype = strtolower(pnVarCleanFromInput('viewtype'));
  38      $pc_username = pnVarCleanFromInput('pc_username');
  39      $category = pnVarCleanFromInput('pc_category');
  40      $topic = pnVarCleanFromInput('pc_topic');
  41      $popup = pnVarCleanFromInput('popup');
  42      if(!isset($date)) {
  43          $Date = postcalendar_getDate();
  44      } else {
  45          $Date = $date;
  46      }
  47      // some extra cleanup if necessary
  48      $Date = str_replace('-','',$Date);
  49      
  50      $pcModInfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
  51      $pcDir = pnVarPrepForOS($pcModInfo['directory']);
  52      
  53      switch($action) {
  54          case 'submit' :
  55              $link = pnVarPrepForDisplay(pnModURL(__POSTCALENDAR__,'user','submit',array('tplview'=>$template_view,'Date'=>$Date)));
  56              break;
  57          
  58          case 'submit-admin' :
  59              $link = pnVarPrepForDisplay(pnModURL(__POSTCALENDAR__,'admin','submit',array('tplview'=>$template_view,'Date'=>$Date)));
  60              break;
  61          
  62          case 'search' :
  63              $link = pnVarPrepForDisplay(pnModURL(__POSTCALENDAR__,'user','search'));
  64              break;        
  65          
  66          case 'day' :
  67              $link = pnVarPrepForDisplay(pnModURL(__POSTCALENDAR__,'user','view',array('tplview'=>$template_view,
  68                                                                    'viewtype'=>'day',
  69                                                                    'Date'=>$Date,
  70                                                                    'pc_username'=>$pc_username,
  71                                                                    'pc_category'=>$category,
  72                                                                    'pc_topic'=>$topic,
  73                                                                    'print'=>$print)));
  74              break;
  75          
  76          case 'week' :
  77              $link = pnVarPrepForDisplay(pnModURL(__POSTCALENDAR__,'user','view',array('tplview'=>$template_view,
  78                                                                    'viewtype'=>'week',
  79                                                                    'Date'=>$Date,
  80                                                                    'pc_username'=>$pc_username,
  81                                                                    'pc_category'=>$category,
  82                                                                    'pc_topic'=>$topic,
  83                                                                    'print'=>$print)));
  84              break;
  85          
  86          case 'month' :
  87              $link = pnVarPrepForDisplay(pnModURL(__POSTCALENDAR__,'user','view',array('tplview'=>$template_view,
  88                                                                    'viewtype'=>'month',
  89                                                                    'Date'=>$Date,
  90                                                                    'pc_username'=>$pc_username,
  91                                                                    'pc_category'=>$category,
  92                                                                    'pc_topic'=>$topic,
  93                                                                    'print'=>$print)));
  94              break;
  95          
  96          case 'year' :
  97              $link = pnVarPrepForDisplay(pnModURL(__POSTCALENDAR__,'user','view',array('tplview'=>$template_view,
  98                                                                    'viewtype'=>'year',
  99                                                                    'Date'=>$Date,
 100                                                                    'pc_username'=>$pc_username,
 101                                                                    'pc_category'=>$category,
 102                                                                    'pc_topic'=>$topic,
 103                                                                    'print'=>$print)));
 104              break;
 105          
 106          case 'detail' :
 107              if(isset($eid)) {
 108                  if(_SETTING_OPEN_NEW_WINDOW && !$popup) {
 109                      $link = "javascript:opencal($eid,'$Date');";
 110                  } else {
 111                      $link = pnVarPrepForDisplay(pnModURL(__POSTCALENDAR__,'user','view',array('Date'=>$Date,
 112                                                                            'tplview'=>$template_view,
 113                                                                            'viewtype'=>'details',
 114                                                                            'eid'=>$eid,
 115                                                                              'print'=>$print)));
 116                  }
 117              } else {
 118                  $link = '';
 119              }
 120              break;
 121      }
 122      if($print) {
 123          $link .= '" target="_blank';
 124      } elseif(_SETTING_OPEN_NEW_WINDOW && $viewtype == 'details') {
 125          $link .= '" target="csCalendar"';
 126      } 
 127      echo $link;
 128  }
 129  ?>


Generated: Wed Feb 16 22:40:07 2005 Cross-referenced by PHPXref 0.6