[ Index ]

krapohl.info

title

Body

[close]

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

   1  <?php
   2  /**
   3   *  $Id: function.pc_view_select.php,v 1.2 2004/02/11 19:16:00 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_view_select($args) 
  28  {
  29      @define('_PC_FORM_TEMPLATE',true);
  30      $Date = postcalendar_getDate();
  31      if(!isset($y)) $y = substr($Date,0,4);
  32      if(!isset($m)) $m = substr($Date,4,2);
  33      if(!isset($d)) $d = substr($Date,6,2);
  34      
  35      $tplview = pnVarCleanFromInput('tplview');
  36      $viewtype = pnVarCleanFromInput('viewtype');
  37      if(!isset($viewtype)) $viewtype = _SETTING_DEFAULT_VIEW;
  38      
  39      $modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
  40      $mdir = pnVarPrepForOS($modinfo['directory']);
  41      unset($modinfo);
  42      $pcTemplate = pnVarPrepForOS(_SETTING_TEMPLATE);
  43      if(empty($pcTemplate)) $pcTemplate = 'default';
  44      $viewlist = array();
  45      $handle = opendir("modules/$mdir/pntemplates/$pcTemplate/views/$viewtype");
  46      
  47      $hide_list = array('.','..','CVS','index.html');
  48      while($f=readdir($handle))
  49      {   if(!in_array($f,$hide_list)) {
  50              $viewlist[] = $f;
  51          }
  52      }
  53      closedir($handle); unset($no_list);
  54      sort($viewlist);
  55      $tcount = count($viewlist);
  56      $options = "<select id=\"tplview\" name=\"tplview\" class=\"$args[class]\">";
  57      $selected = $tplview;
  58      for($t=0;$t<$tcount;$t++) {
  59          $id = str_replace('.html','',$viewlist[$t]);
  60          $sel = $selected == $id ? 'selected' : '';
  61          $options .= "<option value=\"$id\" $sel class=\"$args[class]\">$id</option>";
  62      }
  63      $options .= '</select>';
  64      
  65      if(!isset($args['label'])) $args['label'] = _PC_TPL_VIEW_SUBMIT;
  66      $submit = '<input type="submit" name="submit" value="'.$args['label'].'" class="'.$args['class'].'" />';
  67      // build the form
  68      if($t > 1) {
  69          echo $options,$submit;
  70      } 
  71  }
  72  ?>


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