Exemple #1
0
 /**
  * print the permission radio boxes
  *
  * @author  Frank Schubert <*****@*****.**>
  * @author  Andreas Gohr <*****@*****.**>
  */
 function _html_checkboxes($setperm, $ispage, $name)
 {
     global $lang;
     static $label = 0;
     //number labels
     $ret = '';
     if ($ispage && $setperm > AUTH_EDIT) {
         $perm = AUTH_EDIT;
     }
     foreach (array(AUTH_NONE, AUTH_READ, AUTH_EDIT, AUTH_CREATE, AUTH_UPLOAD, AUTH_DELETE) as $perm) {
         $label += 1;
         //general checkbox attributes
         $atts = array('type' => 'radio', 'id' => 'pbox' . $label, 'name' => $name, 'value' => $perm);
         //dynamic attributes
         if (!is_null($setperm) && $setperm == $perm) {
             $atts['checked'] = 'checked';
         }
         if ($ispage && $perm > AUTH_EDIT) {
             $atts['disabled'] = 'disabled';
             $class = ' class="disabled"';
         } else {
             $class = '';
         }
         //build code
         $ret .= '<label for="pbox' . $label . '" title="' . $this->getLang('acl_perm' . $perm) . '"' . $class . '>';
         $ret .= '<input ' . html_attbuild($atts) . ' />&nbsp;';
         $ret .= $this->getLang('acl_perm' . $perm);
         $ret .= '</label>' . NL;
     }
     return $ret;
 }
Exemple #2
0
 /**
  * Return the assembled HTML for the form.
  *
  * Each element in the form will be passed to a function named
  * 'form_$type'. The function should return the HTML to be printed.
  *
  * @author  Tom N Harris <*****@*****.**>
  */
 function getForm()
 {
     global $lang;
     $form = '';
     $this->params['accept-charset'] = $lang['encoding'];
     $form .= '<form ' . html_attbuild($this->params) . '><div class="no">' . DOKU_LF;
     if (!empty($this->_hidden)) {
         foreach ($this->_hidden as $name => $value) {
             $form .= form_hidden(array('name' => $name, 'value' => $value));
         }
     }
     foreach ($this->_content as $element) {
         if (is_array($element)) {
             $elem_type = $element['_elem'];
             if (function_exists('form_' . $elem_type)) {
                 $form .= call_user_func('form_' . $elem_type, $element) . DOKU_LF;
             }
         } else {
             $form .= $element;
         }
     }
     if ($this->_infieldset) {
         $form .= form_closefieldset() . DOKU_LF;
     }
     $form .= '</div></form>' . DOKU_LF;
     return $form;
 }
 function getXML($conf, &$w, &$h)
 {
     $this->initColors();
     $xml = '<?xml version="1.0"?>' . "\n";
     // graph node
     $graph = array('type' => 'undirected', 'width' => 725, 'height' => 400, 'title' => $conf['title'], 'bgcolor' => $this->color($conf['bgcolor'], 'ffffff'), 'linecolor' => $this->color($conf['linecolor'], 'cccccc'), 'viewmode' => 'explore', 'hidelabel' => 'false');
     if ((int) $conf['width']) {
         $graph['width'] = (int) $conf['width'];
     }
     if ((int) $conf['height']) {
         $graph['height'] = (int) $conf['height'];
     }
     if ($conf['label']) {
         $graph['title'] = $conf['label'];
     }
     if ($conf['viewmode'] == 'display') {
         $graph['viewmode'] = 'display';
     }
     if ($conf['mode'] == 'directed') {
         $graph['mode'] = 'directed';
     }
     $xml .= '<graph ' . html_attbuild($graph) . ">\n";
     $w = $graph['width'];
     $h = $graph['height'];
     // nodes
     foreach ($this->nodes as $name => $opts) {
         $node = array('id' => $name, 'text' => $opts['label'] ? $opts['label'] : $name, 'color' => $this->color($opts['fillcolor'], 'cccccc'), 'textcolor' => $this->color($opts['fontcolor'], '000000'));
         if ($opts['url']) {
             if (preg_match('/^\\w+:\\/\\//', $opts['url'])) {
                 $node['link'] = $opts['url'];
             } else {
                 $node['link'] = wl($opts['url']);
             }
         }
         if ($opts['image']) {
             $node['image'] = ml($opts['image'], array('w' => 40, 'h' => 40), true, '&');
         }
         if (preg_match('/^(box|rect|rectangle|polygon|diamond|trapezium|parallelogram|Msquare|box3d|component)$/', $opts['shape'])) {
             $node['type'] = 'SquareNode';
         }
         $xml .= '    <node ' . html_attbuild($node) . " />\n";
     }
     $xml .= "\n";
     // edges
     foreach ($this->edges as $edge) {
         $opts = (array) $edge[2];
         $edge = array('sourceNode' => $edge[0], 'targetNode' => $edge[1], 'label' => $opts['label'], 'textcolor' => $this->color($opts['fontcolor'], '000000'));
         $xml .= '    <edge ' . html_attbuild($edge) . " />\n";
     }
     $xml .= '</graph>';
     return $xml;
 }