web/wp-content/plugins/ajax-calendar/models/widget.php
changeset 136 bde1974c263b
equal deleted inserted replaced
135:53cff4b4a802 136:bde1974c263b
       
     1 <?php
       
     2 
       
     3 class AJAX_Calendar_Widget extends Widget_AJAX_Calendar
       
     4 {
       
     5 	var $title = '';
       
     6 	var $category_ids = '';
       
     7 
       
     8 	function has_config () { return true; }
       
     9 
       
    10 	function load ($config)
       
    11 	{
       
    12 		if (isset ($config['title']))
       
    13 			$this->title = $config['title'];
       
    14 		if (isset ($config['category_id']))
       
    15 			$this->category_ids = $config['category_id'];
       
    16 	}
       
    17 
       
    18 	function display ($args)
       
    19 	{
       
    20 		extract ($args);
       
    21 
       
    22 		echo $before_widget;
       
    23 
       
    24 		if ($this->title)
       
    25 			echo $before_title.$this->title.$after_title;
       
    26 
       
    27 		ajax_calendar ($this->category_ids);
       
    28 
       
    29 		echo $after_widget;
       
    30 	}
       
    31 
       
    32 	function description ()
       
    33 	{
       
    34 		return 'AJAX-powered calendar';
       
    35 	}
       
    36 
       
    37 	function config ($config, $pos)
       
    38 	{
       
    39 		?>
       
    40 		<table>
       
    41 			<tr>
       
    42 				<th>Title:</th>
       
    43 				<td><input type="text" name="<?php echo $this->config_name ('title', $pos) ?>" value="<?php echo htmlspecialchars ($config['title']) ?>"/></td>
       
    44 			</tr>
       
    45 			<tr>
       
    46 				<th>Category ID:</th>
       
    47 				<td><input type="text" name="<?php echo $this->config_name ('category_id', $pos) ?>" value="<?php echo htmlspecialchars ($config['category_id']) ?>"/></td>
       
    48 			</tr>
       
    49 		</table>
       
    50 		<?php
       
    51 	}
       
    52 
       
    53 	function save ($data)
       
    54 	{
       
    55 		return array ('title' => $data['title'], 'category_id' => $data['category_id']);
       
    56 	}
       
    57 }
       
    58 
       
    59 ?>