function file_tag(moojon_base_model $model, moojon_base_column $column, $attributes = array()) { $column_name = $column->get_name(); $value = $column->get_value(); $return = div_tag(); $return->add_child(hidden_input_tag(array('name' => model_control_name($model, $column_name), 'value' => $value))); $return->add_child(label_tag(title_text($column_name) . ':', $column_name)); $attributes = try_set_name_and_id_attributes($attributes, $model, $column); $attributes['class'] = 'file'; $return->add_child(file_input_tag($attributes)); if (!$column->get_null() && $value) { $return->add_child(uploaded_file_tag($model, $column_name)); $attributes['id'] = "clear_{$column_name}"; $attributes['name'] = model_control_name($model, "clear_{$column_name}"); $attributes['class'] = 'checkbox'; $attributes['value'] = 1; $return->add_child(label_tag(title_text("Clear {$column_name}") . ':', "clear_{$column_name}")); $return->add_child(checkbox_input_tag($attributes)); } return $return; }
function rest_breadcrumb($attributes = array()) { $attributes = try_set_attribute($attributes, 'class', 'breadcrumb'); $segments = explode('/', moojon_uri::get_match_pattern()); if ($segments[0] == APP) { array_shift($segments); } $count = count($segments); $ul = ul_tag(); $href = '/'; for ($i = 0; $i < $count; $i++) { $segment = $segments[$i]; $attributes = $i == $count - 1 ? array('class' => 'last') : array(); $link = true; if (moojon_base::is_symbol($segment)) { $symbol_name = moojon_base::get_symbol_name($segment); $href .= moojon_request::get($symbol_name) . '/'; if ($symbol_name != moojon_primary_key::NAME) { if (moojon_paths::get_model_path($segment)) { $content = model_from_symbol($segment); } } else { $content = model_from_id($segments[$i - 1]); } } else { if ($i == $count - 1) { $link = true; } $content = title_text($segment); $href .= $segment . '/'; } if ($content) { if ($i == $count - 1) { $ul->add_child(li_tag($content, $attributes)); } else { $ul->add_child(li_tag(a_tag($content, $href), $attributes)); } } } return div_tag($ul, $attributes); }