* @version 0.1
* @license All Rights Reserved
*/
class buttons {
var $javascript = '';
function buttons() {
}
function get_js() {
if ( $this->javascript == '' ) return '';
$js = '';
$js .= '';
$this->javascript = '';
return $js;
}
function add_js($js) {
$this->javascript .= $js . PHP_EOL;
}
function weiter($next) {
$html = '';
$this->add_js("var field = $('weiter-".$next."'); field.href = \"javascript:Bereiche.toggle('" . $next . "');\";");
return $html;
}
function zurueck($prev) {
$html = '';
$this->add_js("var field = $('zurueck-".$prev."'); field.href = \"javascript:Bereiche.toggle('" . $prev . "');\";");
return $html;
}
function speichern() {
$html = '';
return $html;
}
function zuordnen() {
$html = '';
return $html;
}
function abbrechen($target='/') {
$html = '';
$this->add_js("var field = $('abbrechen-button'); field.href = \"javascript:window.history.back();\";");
return $html;
}
function hinzufuegen($target='/') {
$html = '';
return $html;
}
function loeschen($target='/') {
$html = '';
return $html;
}
function uebernehmen($target='/') {
$html = '';
return $html;
}
/**
* Reine JavaScript-Buttons hinzufügen
*
* @param string $params Die Parameter werden wie folgt erwartet:
* modulname-bereichid-jsname-buttons
*
* Die Buttons werden dabei wie folgt erwartet:
* button1/button2/button3
*/
function js($params) {
list($modul, $bereich, $js_name, $buttons) = explode('-', $params);
$buttons = explode('/', $buttons);
$this->add_js($js_name . ' = new Buttons(\''.$modul.'\', \''.$bereich.'\');');
$this->add_js($js_name . '.write(\''.$js_name.'\', [\''.implode('\',\'', $buttons).'\']);');
}
}
?>