'."\n";
} else {
$_buffer .= 'element_value.'" '.$this->element_attr.''.$_disabled.' />'."\n";
}
return $_buffer;
}
}
/* Drop Down Select List object */
class simbio_fe_select extends abs_simbio_form_element
{
public function out()
{
// check for $array_option param
if (!is_array($this->element_options)) {
return '';
}
// check if disabled
if ($this->element_disabled) {
$_disabled = ' disabled="disabled"';
} else { $_disabled = ''; }
if ($this->element_helptext) {
$this->element_attr .= ' title="'.$this->element_helptext.'"';
}
$_buffer = ''."\n";
return $_buffer;
}
}
/* AJAX drop down select list object */
class simbio_fe_AJAX_select extends abs_simbio_form_element
{
/**
* AJAX drop down special properties
*/
public $handler_URL = 'about:blank';
public $element_dd_list_class = 'ajaxDDlist';
public $element_dd_list_default_text = 'SEARCHING...';
public $additional_params = '';
public function out()
{
$_buffer = '';
$_buffer .= '
'.$this->element_dd_list_default_text.'
';
return $_buffer;
}
}
/* Checkbox button groups object */
class simbio_fe_checkbox extends abs_simbio_form_element
{
public function out()
{
// check for $this->element_options param
if (!is_array($this->element_options)) {
return 'The radio button options list must be an array';
} else {
foreach ($this->element_options as $cbox) {
// if the $cbox is not an array
if (!is_array($cbox)) {
return 'The radio button options list must be a 2 multi-dimensional array';
}
}
}
$_elmnt_num = count($this->element_options);
$_row_column = 5;
$_helptext = '';
// check if disabled
if ($this->element_disabled) {
$_disabled = ' disabled="disabled"';
} else { $_disabled = ''; }
if ($this->element_helptext) {
$_helptext .= ' title="'.$this->element_helptext.'"';
}
$_buffer = '';
if ($_elmnt_num <= $_row_column) {
foreach ($this->element_options as $_cbox) {
if (is_array($this->element_value)) {
$_buffer .= '
'."\n";
}
return $_buffer;
}
}
/* Radio button groups object */
class simbio_fe_radio extends abs_simbio_form_element
{
public function out()
{
// check for $this->element_options param
if (!is_array($this->element_options)) {
return 'The third argument must be an array';
}
$_buffer = '';
// number of element in each column
if (count($this->element_options) > 10) {
$_elmnt_each_column = 4;
} else {
$_elmnt_each_column = 2;
}
$_helptext = '';
if ($this->element_helptext) {
$_helptext .= ' title="'.$this->element_helptext.'"';
}
// chunk the array into pieces of array
$_chunked_array = array_chunk($this->element_options, $_elmnt_each_column, true);
$_buffer .= '
'."\n";
$_buffer .= '
'."\n";
foreach ($_chunked_array as $_chunk) {
$_buffer .= '
';
foreach ($_chunk as $_radio) {
if ($_radio[0] == $this->element_value) {
$_buffer .= '
'
.' '.$_radio[1]."
\n";
} else {
$_buffer .= '
'
.' '.$_radio[1]."
\n";
}
}
$_buffer .= '
';
}
$_buffer .= '
'."\n";
$_buffer .= '
'."\n";
return $_buffer;
}
}
/* Date field */
/* Global vars containing date and month array */
$simbio_fe_date_array = array( array('01', strtoupper(__('Date')), '01', '02', '03', '04', '05', '06', '07', '08', '09', '10',
'11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
'21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'));
$simbio_fe_date_month_array = array( array('01', strtoupper(__('Month')), array('01', 'January'), array('02', 'February'), array('03', 'March'),
array('04', 'April'), array('05', 'May'), array('06', 'June'),
array('07', 'July'), array('08', 'August'), array('09', 'September'),
array('10', 'October'), array('11', 'November'), array('12', 'December')));
/* Depecrated class for compability with older code */
class simbio_form_element
{
/**
* Static Method to create input field form element
*
* @param string $str_elmnt_type
* @param string $str_elmnt_name
* @param string $str_elmnt_value
* @param string $str_elmnt_attr
*/
public static function textField($str_elmnt_type, $str_elmnt_name, $str_elmnt_value = '', $str_elmnt_attr = '')
{
$_textField = new simbio_fe_text();
$_textField->element_type = $str_elmnt_type;
$_textField->element_name = $str_elmnt_name;
$_textField->element_value = $str_elmnt_value;
$_textField->element_attr = $str_elmnt_attr;
return $_textField->out();
}
/**
* Static Method to create form element
*
* @param string $str_elmnt_name
* @param array $array_option
* @param string $str_default_selected
* @param string $str_elmnt_attr
* @return string
*/
public static function selectList($str_elmnt_name, $array_option, $str_default_selected = '', $str_elmnt_attr = '')
{
$_selectList = new simbio_fe_select();
$_selectList->element_name = $str_elmnt_name;
$_selectList->element_value = $str_default_selected;
$_selectList->element_attr = $str_elmnt_attr;
$_selectList->element_options = $array_option;
return $_selectList->out();
}
/**
* Static Method to create form element
*
* @param string $str_elmnt_name
* @param string $str_elmnt_label
* @param array $array_chbox
* @return string
*/
public static function checkBox($str_elmnt_name, $array_chbox, $default_checked = '')
{
$_checkBox = new simbio_fe_checkbox();
$_checkBox->element_name = $str_elmnt_name;
$_checkBox->element_value = $default_checked;
$_checkBox->element_options = $array_chbox;
return $_checkBox->out();
}
/**
* Static Method to create form element
*
* @param string $str_elmnt_name
* @param array $array_option
* @param string $str_default_selected
* @return string
*/
public static function radioButton($str_elmnt_name, $array_option, $default_checked = '')
{
$_radio = new simbio_fe_select();
$_radio->element_name = $str_elmnt_name;
$_radio->element_value = $default_checked;
$_radio->element_options = $array_option;
return $_radio->out();
}
/**
* Static Method to create date input field form element
*
* @param string $str_date_elmnt_name
* @param string $str_month_elmnt_name
* @param string $str_year_elmnt_name
* @param string $str_date
* @return string
*/
public static function dateField($str_elmnt_name, $str_elmnt_value = '', $str_elmnt_attr = '')
{
return self::textField('date', $str_elmnt_name, $str_elmnt_value, $str_elmnt_attr);
}
/**
* Static Method to create form element
*
* @param string $str_date_elmnt_name
* @param string $str_elmnt_value
* @return string
*/
public static function hiddenField($str_elmnt_name, $str_elmnt_value)
{
$_textField = new simbio_fe_text();
$_textField->element_type = 'hidden';
$_textField->element_name = $str_elmnt_name;
$_textField->element_value = $str_elmnt_value;
return $_textField->out();
}
}