<?php

/**
 * 
 *
 * @version $Id$
 * @copyright 2003 
 **/

class rhceib_options {
	function rhceib_options($plugin_id='rhceib',$capability='manage_options',$open=false){
		$this->id = $plugin_id;
		$this->open = $open;
		$this->capability = $capability;
		
		if(current_user_can($this->capability)){
			add_filter("pop-options_{$this->id}",array(&$this,'options'),99999,1);						
		}	
	}
	
	function options($t){
		$i = count($t);
		//----
		
		$t[$i]=(object)array();
		$t[$i]->id 			= 'rhceib-setup'; 
		$t[$i]->open 			= $this->open; 
		$t[$i]->label 		= __('Events in blogroll','rhceib');
		$t[$i]->right_label	= __('Events in blogroll','rhceib');
		$t[$i]->page_title	= __('Events in blogroll','rhceib');
		$t[$i]->theme_option = true;
		$t[$i]->plugin_option = true;		
		$t[$i]->options = array(
			(object)array(
				'id'		=> 'enable_events_in_blogroll',
				'label'		=> __('Enable events in blogroll','rhceib'),
				'type'		=> 'yesno',
				'default'	=> '1',
				'hidegroup'	=> '#rhc_eib_group',
				'description'=> __('Choose yes to display events in the blogroll.','rhceib'),
				'el_properties'	=> array(),
				'save_option'=>true,
				'load_option'=>true
			),		
			(object)array('type'	=> 'clear'),
			(object)array(
				'id'	=> 'rhc_eib_group',
				'type'=>'div_start'
			),	
/*
			(object)array(
				'id'		=> 'rhc_eib_template',
				'label'		=> __('Template','rhceib'),
				'type'		=> 'textarea',
				'default'	=> $this->default_template(),
				'description'=> __('Leave blank for no template.  Use {content} for the event content.','rhceib'),
				'el_properties'	=> array('rows'=>7),
				'save_option'=>true,
				'load_option'=>true
			),
				*/
			(object)array(
				'type'=>'div_end'
			),
			(object)array(
				'type'=>'clear'
			)							
		);
		
	
		
		$t[$i]->options[]=(object)array(
				'type'=>'clear'
			);
		$t[$i]->options[]=(object)array(
				'type'	=> 'submit',
				'label'	=> __('Save','rhcss'),
				'class' => 'button-primary'
			);
		return $t;
	}
	
	function default_template(){
		ob_start();
?>
{content}
[postinfo meta_key='enable_postinfo' meta_value='1' default='1' class="se-dbox"]
[postinfo meta_key='enable_venuebox' meta_value='1' default='1' id="venuebox" class="se-vbox"]
<?php
		$content = ob_get_contents();
		ob_end_clean();
		return $content;
	}
}

?>