本文整理汇总了PHP中midcom_helper_datamanager2_schema::translate_schema_string方法的典型用法代码示例。如果您正苦于以下问题:PHP midcom_helper_datamanager2_schema::translate_schema_string方法的具体用法?PHP midcom_helper_datamanager2_schema::translate_schema_string怎么用?PHP midcom_helper_datamanager2_schema::translate_schema_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类midcom_helper_datamanager2_schema
的用法示例。
在下文中一共展示了midcom_helper_datamanager2_schema::translate_schema_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
/**
* This function displays a quick view of the record, using some simple div based layout,
* which can be formatted using CSS.
*
* Be aware that this is only geared for simple administration interfaces, it will provide
* *no* editing capabilities (like AJAX) etc. If you want that to work, you need a formmanger
* instance instead.
*
* @param boolean $skip_empty Should empty fields be rendered or not
*/
function display_view($skip_empty = false)
{
if (is_null($this->formmanager)) {
$this->formmanager = new midcom_helper_datamanager2_formmanager($this->schema, $this->types);
$this->formmanager->initialize();
}
// iterate over all types so that they can add their piece to the form
echo "<div class=\"midcom_helper_datamanager2_view\">\n";
$fieldset_count = 0;
foreach ($this->schema->field_order as $name) {
if ($this->_schema_field_is_broken($name)) {
continue;
}
$config =& $this->schema->fields[$name];
if (!empty($config['hidden'])) {
continue;
}
$field_value = $this->formmanager->widgets[$name]->render_content();
if (trim($field_value) == '' && $skip_empty) {
continue;
}
if (isset($config['start_fieldset'])) {
if (isset($config['start_fieldset']['title'])) {
$fieldsets = array();
$fieldsets[] = $config['start_fieldset'];
} else {
$fieldsets = $config['start_fieldset'];
}
foreach ($fieldsets as $key => $fieldset) {
if (isset($fieldset['css_group'])) {
$class = $fieldset['css_group'];
} else {
$class = $name;
}
}
echo "<div class=\"fieldset {$class}\">\n";
if (isset($fieldset['title'])) {
if (isset($fieldset['css_title'])) {
$class = " class=\"{$fieldset['css_title']}\"";
} else {
$class = " class=\"{$name}\"";
}
echo " <h2{$class}>\n";
echo " " . $this->schema->translate_schema_string($fieldset['title']) . "\n";
echo " </h2>\n";
}
if (isset($fieldset['description'])) {
echo "<p>" . $this->schema->translate_schema_string($fieldset['description']) . "</p>\n";
}
$fieldset_count++;
}
echo "<div class=\"field\">\n";
echo '<div class="title">' . $this->schema->translate_schema_string($this->schema->fields[$name]['title']) . "</div>\n";
echo '<div class="value">';
echo $field_value;
echo "</div>\n";
echo "</div>\n";
if (!isset($config['end_fieldset']) || $fieldset_count <= 0) {
// No more fieldsets to close
continue;
}
if (is_numeric($config['end_fieldset'])) {
for ($i = 0; $i < $config['end_fieldset']; $i++) {
echo "</div>\n";
$fieldset_count--;
if ($fieldset_count <= 0) {
break;
}
}
} else {
echo "</div>\n";
$fieldset_count--;
}
}
echo "</div>\n";
}