protected function _render_function_callback($row, HTMLTableColumn $column, HTMLTable $table)
 {
     $array = $row;
     $json = HTMLHelper::escape(JSHelper::cast_obj($array));
     $block = new HTMLLongTag('div');
     $block->add_style('white-space', 'nowrap');
     $block->add_style('text-align', 'center');
     $block->add_style('padding', '0 10px');
     $html = "";
     $count_added = 0;
     /**
      *
      * @var $tag HTMLTag
      *
      */
     foreach ($column->_actions_tags as $index => $tag) {
         if ($tag->call_filter_callback($row, $column, $table) === false) {
             continue;
         }
         $tag_html = $tag->to_string();
         $tag_html = str_replace('%7B%7B', '{{', $tag_html);
         $tag_html = str_replace('%7D%7D', '}}', $tag_html);
         if (preg_match(self::$_row_json_pattern, $tag_html, $match)) {
             $tag_html = preg_replace(self::$_row_json_pattern, $json, $tag_html);
         }
         while (preg_match(self::$_row_field_pattern, $tag_html, $match)) {
             if ($match['field'] == self::ROW_ID_FIELD) {
                 $field = $table->get_row_id($row);
             } else {
                 $field = ArrayHelper::get_value($row, $match['field']);
             }
             $tag_html = str_replace($match[0], JSHelper::cast($field), $tag_html);
         }
         if ($count_added > 0) {
             $html .= '   ';
         }
         $html .= $tag_html;
         $count_added++;
     }
     $block->set_content($html);
     return $block;
 }
Exemplo n.º 2
0
 /**
  *
  * @return $this
  *
  */
 public function fill($var, $update = false)
 {
     $values = ArrayHelper::to_array($var);
     foreach ($this->_inputs as $input) {
         $key = $input->get_name();
         if (!$key) {
             continue;
         }
         if (array_key_exists($key, $values)) {
             if ($key == 'id_deposit') {
                 echo $values[$key];
             }
             $input->set_value($values[$key]);
         } else {
             if (!$update) {
                 $input->set_value(null);
             }
         }
     }
     return $this;
 }
Exemplo n.º 3
0
 protected static function _parse_row($row)
 {
     $array = ArrayHelper::to_array($row);
     $array['object'] = $row;
     return $array;
 }