コード例 #1
0
 /**
  * empty values should not render
  */
 public function test_blankrender()
 {
     $R = new \Doku_Renderer_xhtml();
     $val = new Value($this->makeColumn(false), '');
     $val->render($R, 'xhtml');
     $this->assertEquals('', $R->doc);
     $val = new Value($this->makeColumn(true), array());
     $val->render($R, 'xhtml');
     $this->assertEquals('', $R->doc);
 }
コード例 #2
0
 /**
  * Create the input field
  *
  * @param Value $field
  * @param String $name field's name
  * @return string
  */
 public function makeField(Value $field, $name)
 {
     $trans = hsc($field->getColumn()->getTranslatedLabel());
     $hint = hsc($field->getColumn()->getTranslatedHint());
     $class = $hint ? 'hashint' : '';
     $colname = $field->getColumn()->getFullQualifiedLabel();
     $input = $field->getValueEditor($name);
     // we keep all the custom form stuff the field might produce, but hide it
     if (!$field->getColumn()->isVisibleInEditor()) {
         $hide = 'style="display:none"';
     } else {
         $hide = '';
     }
     $html = '';
     $html .= "<label {$hide} data-column=\"{$colname}\">";
     $html .= "<span class=\"label {$class}\" title=\"{$hint}\">{$trans}</span>";
     $html .= "<span class=\"input\">{$input}</span>";
     $html .= '</label>';
     return $html;
 }
コード例 #3
0
 /**
  * Check if the given row is empty or references our own row
  *
  * @param Value $value
  * @return bool
  */
 protected function isEmptyValue(Value $value)
 {
     if ($value->isEmpty()) {
         return true;
     }
     if ($value->getColumn()->getTid() == 0) {
         return true;
     }
     return false;
 }
コード例 #4
0
 /**
  * Create the input field
  *
  * @param Value $field
  * @param String $name field's name
  * @return string
  */
 protected function makeField(Value $field, $name)
 {
     $trans = hsc($field->getColumn()->getTranslatedLabel());
     $hint = hsc($field->getColumn()->getTranslatedHint());
     $class = $hint ? 'hashint' : '';
     $lclass = $this->error ? 'bureaucracy_error' : '';
     $colname = $field->getColumn()->getFullQualifiedLabel();
     $required = $this->opt['optional'] ? '' : ' <sup>*</sup>';
     $input = $field->getValueEditor($name);
     $html = '';
     $html .= "<label class=\"{$lclass}\" data-column=\"{$colname}\">";
     $html .= "<span class=\"label {$class}\" title=\"{$hint}\">{$trans}{$required}</span>";
     $html .= "<span class=\"input\">{$input}</span>";
     $html .= '</label>';
     return $html;
 }