web/wp-content/plugins/event-calendar/K2/ec3_sidebar_module.php
branchwordpress
changeset 109 03b0d1493584
equal deleted inserted replaced
-1:000000000000 109:03b0d1493584
       
     1 <?php
       
     2 /*
       
     3 Copyright (c) 2006, Darrell Schulte.  $Revision: 240 $
       
     4 
       
     5 This program is free software; you can redistribute it and/or
       
     6 modify it under the terms of the GNU General Public License
       
     7 as published by the Free Software Foundation; either version 2
       
     8 of the License, or (at your option) any later version.
       
     9 
       
    10 This program is distributed in the hope that it will be useful,
       
    11 but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    13 GNU General Public License for more details.
       
    14 
       
    15 You should have received a copy of the GNU General Public License
       
    16 along with this program; if not, write to the Free Software
       
    17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
       
    18 */
       
    19 
       
    20 
       
    21 /** Event Calendar module. */
       
    22 function ec3_k2mod_cal($args)
       
    23 {
       
    24   extract($args);
       
    25   echo $before_module . $before_title . $title . $after_title;
       
    26   ec3_get_calendar();
       
    27   echo $after_module;
       
    28 }
       
    29 
       
    30 register_sidebar_module(
       
    31   __('Event Calendar','ec3'),
       
    32   'ec3_k2mod_cal', // callback
       
    33   'sb-calendar' // class
       
    34 );
       
    35 
       
    36 
       
    37 /** Upcoming events module. */
       
    38 function ec3_k2mod_list($args)
       
    39 {
       
    40   extract($args);
       
    41   echo $before_module . $before_title . $title . $after_title;
       
    42   ec3_get_events(sbm_get_option('limit'));
       
    43   echo $after_module;
       
    44 }
       
    45 
       
    46 function ec3_k2mod_list_control()
       
    47 {
       
    48   if(isset($_POST['ec3_module_limit']))
       
    49   {
       
    50     sbm_update_option('limit', $_POST['ec3_module_limit']);
       
    51   }
       
    52 
       
    53   ?>
       
    54   <p>
       
    55    <label for="ec3-module-num-events">
       
    56     <?php _e('Number of events:', 'ec3'); ?>
       
    57    </label>
       
    58    <input id="ec3-module-num-events" name="ec3_module_limit"
       
    59     type="text" value="<?php
       
    60     echo(sbm_get_option('limit')); ?>" size="4" />
       
    61   </p>
       
    62   <p>
       
    63    <a href="options-general.php?page=ec3_admin">
       
    64     <?php _e('Go to Event Calendar Options','ec3') ?>.
       
    65    </a>
       
    66   </p>
       
    67   <?php
       
    68 }
       
    69 
       
    70 register_sidebar_module(
       
    71   __('Upcoming Events','ec3'),
       
    72   'ec3_k2mod_list', // callback
       
    73   '', // class
       
    74   array('limit' => 5)
       
    75 );
       
    76 register_sidebar_module_control(
       
    77   __('Upcoming Events','ec3'),
       
    78   'ec3_k2mod_list_control'
       
    79 );
       
    80 
       
    81 ?>