1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108:
<?php
abstract class AbstractFormButton implements FormButton
{
private $form_id = '';
private $name = '';
private $label = '';
private $type = '';
private $onclick_action = '';
private $css_class;
private $data_confirmation;
public function __construct($type, $label, $name, $onclick_action = '', $css_class = '', $data_confirmation = '', $form_id = '')
{
$this->type = $type;
$this->label = $label;
$this->name = $name;
$this->onclick_action = $onclick_action;
$this->css_class = $css_class;
$this->data_confirmation = $data_confirmation;
$this->form_id = $form_id;
}
public function display()
{
$template = $this->get_template();
$template->put_all(array(
'LABEL' => $this->label,
'HTML_NAME' => $this->get_html_name(),
'CSS_CLASS' => $this->css_class,
'C_DATA_CONFIRMATION' => $this->data_confirmation != '',
'DATA_CONFIRMATION' => $this->data_confirmation,
'TYPE' => $this->type,
'ONCLICK_ACTION' => $this->onclick_action
));
return $template;
}
public function get_name()
{
return $this->name;
}
public function get_html_name()
{
return ($this->form_id ? $this->form_id . '_' : '') . $this->name;
}
public function set_name($name)
{
$this->name = $name;
}
public function get_label()
{
return $this->label;
}
public function set_label($label)
{
$this->label = $label;
}
protected function get_template()
{
return new FileTemplate('framework/builder/form/button/DefaultFormButton.tpl');
}
public function set_css_class($css_class)
{
$this->css_class = $css_class;
}
public function get_css_class()
{
return $this->css_class;
}
public function set_data_confirmation($data_confirmation)
{
$this->data_confirmation = $data_confirmation;
}
public function get_data_confirmation()
{
return $this->data_confirmation;
}
public function set_form_id($form_id)
{
$this->form_id = $form_id;
}
}
?>