Beispiel #1
0
 /**
  * Return object's display
  *
  * @param $template          Template
  * @param $display_full_path boolean If object is a property, returns 'the.full.property.path'
  * @return string
  */
 public function getDisplay(Template $template, $display_full_path = false)
 {
     $object = reset($template->objects);
     if ($object instanceof Reflection_Property) {
         return Names::propertyToDisplay($display_full_path ? $object->path : $object->name);
     } elseif ($object instanceof Reflection_Class) {
         return Names::classToDisplay($object->name);
     } elseif ($object instanceof Reflection_Method) {
         return Names::methodToDisplay($object->name);
     } elseif (is_object($object)) {
         return (new Displayable(get_class($object), Displayable::TYPE_CLASS))->display();
     } else {
         return $object;
     }
 }
Beispiel #2
0
 /**
  * @param $value   string
  * @param $caption string
  */
 public function __construct($value = null, $caption = null)
 {
     parent::__construct('option', true);
     if (isset($value)) {
         if (!isset($caption)) {
             $this->setContent(Names::propertyToDisplay($value));
         }
         $this->setAttribute('value', $value);
     }
     if (isset($caption)) {
         if (!isset($value)) {
             $this->setAttribute('value', $value);
         }
         $this->setContent($caption);
     }
 }
 /**
  * @return string
  */
 public function display()
 {
     return $this->display ? $this->display : Names::propertyToDisplay($this->path ? $this->path : $this->name);
 }
 /**
  * @param $multiline boolean keep this value empty, it is not used because the @multiline
  *        annotation is automatically used
  * @param $values    string[] keep this value empty, it is not used because the @values annotation
  *        is automatically used
  * @return Element
  */
 protected function buildString($multiline = false, $values = null)
 {
     $values_captions = [];
     $values = $this->property->getListAnnotation('values')->values();
     foreach ($values as $value) {
         $values_captions[$value] = Names::propertyToDisplay($value);
     }
     if ($values_captions && !in_array($this->value, $values_captions)) {
         $values_captions[$this->value] = $this->value;
     }
     $element = parent::buildString($this->property->getAnnotation('multiline')->value, $values_captions);
     if ($this->property->getAnnotation('mandatory')->value) {
         $element->setAttribute('required', true);
     }
     if ($this->property->getAnnotation('password')->value) {
         $element->setAttribute('type', 'password');
         $element->setAttribute('value', strlen($this->value) ? Password::UNCHANGED : '');
     }
     return $element;
 }
Beispiel #5
0
 /**
  * @return Head
  */
 protected function buildHead()
 {
     $head = new Head();
     $row = new Row();
     foreach ($this->properties as $property) {
         if (!$property->getType()->isMultiple() || $property->getType()->getElementTypeAsString() != $property->getFinalClass()->name) {
             $cell = new Header_Cell(Loc::tr(Names::propertyToDisplay($property->getAnnotation('alias')->value), $this->class_name));
             $row->addCell($cell);
         }
     }
     $head->addRow($row);
     return $head;
 }
Beispiel #6
0
 /**
  * @return Head
  */
 protected function buildHead()
 {
     $head = new Head();
     $row = new Row();
     foreach ($this->properties as $property) {
         $cell = new Header_Cell(Loc::tr(Names::propertyToDisplay($property->getAnnotation('alias')->value), $this->class_name));
         $row->addCell($cell);
     }
     $head->addRow($row);
     return $head;
 }
Beispiel #7
0
 /**
  * @return string
  */
 public function display()
 {
     return Names::propertyToDisplay($this->name);
 }