/**
  * @param $result Table
  */
 public function afterHtmlBuilderMultipleBuild(Table $result)
 {
     if ($this->in_multiple == 'build') {
         $table = $result;
         $length = count($table->body->rows) - 1;
         if ($this->count->count > $length) {
             // vertical scrollbar
             $vertical_scroll_bar = new Standard_Cell();
             $vertical_scroll_bar->addClass('vertical');
             $vertical_scroll_bar->addClass('scrollbar');
             $vertical_scroll_bar->setAttribute('rowspan', 1000000);
             $vertical_scroll_bar->setData('start', 0);
             $vertical_scroll_bar->setData('length', $length);
             $vertical_scroll_bar->setData('total', $this->count->count);
             $link = '/Html_Edit_Multiple/output/' . Namespaces::shortClassName($this->property->getDeclaringClass()) . SL . Dao::getObjectIdentifier($this->property->getObject()) . SL . $this->property->name . SL . '?move=';
             $up = new Anchor($link . 'up');
             $up->addClass('up');
             $position = new Anchor($link . 1);
             $position->addClass('position');
             $down = new Anchor($link . 'down');
             $down->addClass('down');
             $vertical_scroll_bar->setContent($up . $position . $down);
             // add vertical scrollbar cells to multiple (collection or map) table
             $table->head->rows[0]->addCell(new Header_Cell(), 0);
             $table->body->rows[0]->addCell($vertical_scroll_bar, 0);
         }
         $this->in_multiple = '';
     }
 }
 /**
  * @param $format boolean
  * @return Element
  */
 protected function buildFloat($format = true)
 {
     if ($format) {
         $property = $this->property;
         if (!$property instanceof Reflection_Property_Value) {
             $property = new Reflection_Property_Value($property->class, $property->name, $this->value, true);
         }
         $value = $this->value;
         $this->value = $property->format();
     }
     $result = parent::buildFloat(false);
     if (isset($value)) {
         $this->value = $value;
     }
     return $result;
 }
Example #3
0
 /**
  * @param $list_settings Data_List_Settings
  * @return Reflection_Property_Value[] key is the property path
  */
 public function getSearchValues(Data_List_Settings $list_settings)
 {
     $search = array_combine($list_settings->properties_path, $list_settings->properties_path);
     foreach ($list_settings->search as $property_path => $search_value) {
         if (isset($search[$property_path])) {
             $property = new Reflection_Property_Value($list_settings->class_name, $property_path, $search_value, true);
             if ($property->getType()->isClass()) {
                 $property->value(Dao::read($search_value, $property->getType()->asString()));
             } else {
                 $property->value($search_value);
             }
             $search[$property_path] = $property;
         }
     }
     return $search;
 }
 /**
  * @param $properties_list Reflection_Property[] new indices will be 'property.sub_property'
  * @param $property        Reflection_Property
  * @param $object          object
  * @param $property_name   string
  * @param $display_prefix  string
  * @param $blocks          string[]
  * @return Reflection_Property[] added properties list (empty if none applies) indices are
  *         'property.sub_property'
  * @todo probably things to clean up (was patched for 'all properties as values' without controls)
  */
 private static function expandUsingPropertyInternal(&$properties_list, $property, $object, $property_name, $display_prefix = '', $blocks = [])
 {
     $expanded = [];
     /** @var $integrated Integrated_Annotation */
     $integrated = $property->getListAnnotation('integrated');
     if ($integrated->value && !$property->isStatic()) {
         if ($integrated->has('block')) {
             $blocks[$property->path ?: $property->name] = $property->path ?: $property->name;
         }
         $integrated_simple = $integrated->has('simple');
         $sub_properties_class = $property->getType()->asReflectionClass();
         $expand_properties = $sub_properties_class->getProperties([T_EXTENDS, T_USE]);
         $value = $property->getValue($object) ?: Builder::create($property->getType()->asString());
         foreach ($expand_properties as $sub_property_name => $sub_property) {
             if (!$sub_property->getListAnnotation('user')->has(User_Annotation::INVISIBLE)) {
                 $display = $display_prefix . ($display_prefix ? DOT : '') . $property->name . DOT . $sub_property_name;
                 $sub_prefix = $integrated_simple ? $display_prefix : $display;
                 if ($more_expanded = self::expandUsingPropertyInternal($properties_list, $sub_property, $value, $property_name . DOT . $sub_property_name, $sub_prefix, $blocks)) {
                     $expanded = array_merge($expanded, $more_expanded);
                 } else {
                     $sub_property = new Reflection_Property_Value($sub_property->class, $sub_property->name, $value, false, true);
                     $sub_property->final_class = $sub_properties_class->name;
                     $sub_property->display = $integrated_simple ? $integrated->has('alias') ? $sub_property->getAnnotation('alias')->value : $sub_property_name : $display;
                     /** @var $block_annotation List_Annotation */
                     $block_annotation = $sub_property->setAnnotationLocal('block');
                     foreach ($blocks as $block) {
                         $block_annotation->add($block);
                     }
                     $sub_property->path = $property_name . DOT . $sub_property_name;
                     $properties_list[$property_name . DOT . $sub_property_name] = $sub_property;
                     $expanded[$property_name . DOT . $sub_property_name] = $sub_property;
                 }
             }
         }
     }
     return $expanded;
 }