95 lines
3.1 KiB
PHP
95 lines
3.1 KiB
PHP
|
<?php
|
|||
|
/**
|
|||
|
* HTML-Helfer f<EFBFBD>r die baseContent-Buttons
|
|||
|
*
|
|||
|
* Alle Buttons sind entsprechend ihrer Funktion <EFBFBD>ber einen deutschen Namen
|
|||
|
* verf<EFBFBD>gbar. Umlaute sind ggf. als ue, oe, ss, ... geschrieben.
|
|||
|
*
|
|||
|
* @author Matthias Viehweger <kronn@kronn.de>
|
|||
|
* @version 0.1
|
|||
|
* @license All Rights Reserved
|
|||
|
*/
|
|||
|
class buttons {
|
|||
|
var $javascript = '';
|
|||
|
|
|||
|
function buttons() {
|
|||
|
}
|
|||
|
|
|||
|
function get_js() {
|
|||
|
if ( $this->javascript == '' ) return '';
|
|||
|
|
|||
|
$js = '';
|
|||
|
|
|||
|
$js .= '<script type="text/javascript">' . PHP_EOL . '// <[CDATA[' . PHP_EOL;
|
|||
|
$js .= $this->javascript;
|
|||
|
$js .= '// ]]>' . PHP_EOL . '</script>';
|
|||
|
|
|||
|
$this->javascript = '';
|
|||
|
return $js;
|
|||
|
}
|
|||
|
|
|||
|
function add_js($js) {
|
|||
|
$this->javascript .= $js . PHP_EOL;
|
|||
|
}
|
|||
|
|
|||
|
function weiter($next) {
|
|||
|
$html = '<a href="#'.$next.'" id="weiter-'.$next.'"><img src="/public/img/admin/button_weiter.gif" alt="weiter" /></a>';
|
|||
|
$this->add_js("var field = $('weiter-".$next."'); field.href = \"javascript:Bereiche.toggle('" . $next . "');\";");
|
|||
|
return $html;
|
|||
|
}
|
|||
|
|
|||
|
function zurueck($prev) {
|
|||
|
$html = '<a href="#'.$prev.'" id="zurueck-'.$prev.'"><img src="/public/img/admin/button_zurueck.gif" alt="zurück" /></a>';
|
|||
|
$this->add_js("var field = $('zurueck-".$prev."'); field.href = \"javascript:Bereiche.toggle('" . $prev . "');\";");
|
|||
|
return $html;
|
|||
|
}
|
|||
|
|
|||
|
function speichern() {
|
|||
|
$html = '<input type="image" src="/public/img/admin/button_speichern.gif" alt="speichern" />';
|
|||
|
return $html;
|
|||
|
}
|
|||
|
|
|||
|
function zuordnen() {
|
|||
|
$html = '<input type="image" src="/public/img/admin/button_zuordnen.gif" alt="Zuordnen" />';
|
|||
|
return $html;
|
|||
|
}
|
|||
|
|
|||
|
function abbrechen($target='/') {
|
|||
|
$html = '<a href="'.$target.'" id="abbrechen-button"><img src="/public/img/admin/button_abbrechen.gif" width="69" height="20" alt="Abbrechen" /></a>';
|
|||
|
$this->add_js("var field = $('abbrechen-button'); field.href = \"javascript:window.history.back();\";");
|
|||
|
return $html;
|
|||
|
}
|
|||
|
|
|||
|
function hinzufuegen($target='/') {
|
|||
|
$html = '<a href="'.$target.'"><img src="/public/img/admin/button_hinzufuegen.gif" width="69" height="20" alt="hinzufügen" /></a>';
|
|||
|
return $html;
|
|||
|
}
|
|||
|
|
|||
|
function loeschen($target='/') {
|
|||
|
$html = '<a href="'.$target.'"><img src="/public/img/admin/button_loeschen.gif" width="69" height="20" alt="löschen" /></a>';
|
|||
|
return $html;
|
|||
|
}
|
|||
|
|
|||
|
function uebernehmen($target='/') {
|
|||
|
$html = '<a href="'.$target.'"><img src="/public/img/admin/button_uebernehmen.gif" width="90" height="20" alt="löschen" /></a>';
|
|||
|
return $html;
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* Reine JavaScript-Buttons hinzuf<EFBFBD>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).'\']);');
|
|||
|
}
|
|||
|
}
|
|||
|
?>
|