function parse_modal_layout($layout)
    {
        function parse_modal_layout_styles($width)
        {
            if (preg_match("/(\\d+(\\.\\d+)?)(px)/", $width)) {
                return "class=\"span\" style=\"width: {$width}; margin-left: 0;\"";
            } else {
                return "class=\"span{$width}\"";
            }
        }
        switch ($layout["type"]) {
            case "horizontal":
                $width = explode(":", $layout["width"]);
                $child_counter = 0;
                ?>
				<div class="row-fluid">
					<?php 
                foreach ($layout["sublayouts"] as $sublayout_id => $sublayout) {
                    ?>
						<div <?php 
                    echo parse_modal_layout_styles($width[$child_counter++]);
                    ?>
>
							<?php 
                    parse_modal_layout($sublayout);
                    ?>
						</div>
					<?php 
                }
                ?>
					<?php 
                foreach ($layout["properties"] as $property_id => $property) {
                    ?>
						<div <?php 
                    echo parse_modal_layout_styles($width[$child_counter++]);
                    ?>
>
							<?php 
                    echo aw_modal::parse_properties(array($property_id => $property), ifset($layout, "captionside") === "left");
                    ?>
						</div>
					<?php 
                }
                ?>
				</div>
				<?php 
                break;
            case "vertical":
                echo aw_modal::parse_properties($layout["properties"], false);
                break;
        }
    }
                echo $subgroup_counter++ === 0 ? "active" : "";
                ?>
" id="{VAR:prefix}<?php 
                echo $subgroup["id"];
                ?>
">
						<?php 
                echo aw_modal::parse_group($subgroup);
                ?>
					</div>
					<?php 
            }
            ?>
				</div>
			<?php 
        } else {
            ?>
				<?php 
            echo aw_modal::parse_group($group);
            ?>
			<?php 
        }
        ?>
		</div>
	<?php 
    }
    ?>
	</div>
<?php 
} else {
    ?>
Пример #3
0
        function parse_table_row($row, $table, $content = true, $tag = "td")
        {
            if (!empty($table["content"]["expandable"])) {
                if ($content) {
                    ?>
				<td><a href="javascript:void(0)" class="expander" onclick="AW.UI.table.toggleExpandable(this);"><i class="icon-chevron-down"></a></td>
			<?php 
                } else {
                    echo "<{$tag}></{$tag}>";
                }
            }
            $skip = 0;
            foreach ($table["fields"] as $field_id) {
                if (--$skip > 0) {
                    continue;
                }
                $field = isset($row[$field_id]) ? $row[$field_id] : null;
                if (isset($field["colspan"])) {
                    $skip = $field["colspan"];
                }
                echo "<{$tag} " . (isset($field["align"]) && $field["align"] === "right" ? " class=\"text-right\"" : "") . (isset($field["data"]) ? aw_modal::implode_data_fields($field["data"]) : "") . (isset($field["colspan"]) && $field["colspan"] > 1 ? " colspan=\"{$field["colspan"]}\"" : "") . ">" . (is_array($field) ? isset($field["value"]) ? $field["value"] : "" : $field) . "</{$tag}>";
            }
        }
    function parse_modal_property($property)
    {
        switch ($property["type"]) {
            case "text":
                ?>
				<div id="{VAR:prefix}<?php 
                echo $property["id"];
                ?>
" <?php 
                echo aw_modal::implode_data_fields(ifset($property, "data"));
                ?>
>
					<?php 
                echo ifset($property, "value");
                ?>
				</div>
			<?php 
                break;
            case "hidden":
                ?>
				<input type="hidden" id="{VAR:prefix}<?php 
                echo $property["id"];
                ?>
" <?php 
                echo aw_modal::implode_data_fields(ifset($property, "data"));
                ?>
 />
			<?php 
                break;
            case "table":
                echo aw_modal::parse_table(isset($property["table"]) ? $property["table"] : null);
                break;
            case "checkbox":
                ?>
				<input type="checkbox" id="{VAR:prefix}<?php 
                echo $property["id"];
                ?>
" <?php 
                echo aw_modal::implode_data_fields(ifset($property, "data"));
                ?>
 value="1" /> <?php 
                echo $property["caption"];
                ?>
			<?php 
                break;
            case "textbox":
                ?>
				<input type="text" id="{VAR:prefix}<?php 
                echo $property["id"];
                ?>
" <?php 
                echo aw_modal::implode_data_fields(ifset($property, "data"));
                ?>
 placeholder="<?php 
                echo isset($property["placeholder"]) ? $property["placeholder"] : "";
                ?>
" <?php 
                echo isset($property["class"]) ? "class=\"{$property["class"]}\"" : "";
                ?>
" />
			<?php 
                break;
            case "textarea":
                ?>
				<textarea rows="<?php 
                echo !empty($property["rows"]) ? $property["rows"] : 3;
                ?>
" id="{VAR:prefix}<?php 
                echo $property["id"];
                ?>
" <?php 
                echo aw_modal::implode_data_fields(ifset($property, "data"));
                ?>
 placeholder="<?php 
                echo isset($property["placeholder"]) ? $property["placeholder"] : "";
                ?>
" class="<?php 
                echo isset($property["class"]) ? $property["class"] : "";
                ?>
"></textarea>
			<?php 
                break;
            case "select":
                ?>
				<select id="{VAR:prefix}<?php 
                echo $property["id"];
                ?>
" <?php 
                echo aw_modal::implode_data_fields(ifset($property, "data"));
                ?>
>
					<?php 
                foreach ($property["options"] as $option_value => $option_caption) {
                    ?>
					<option value="<?php 
                    echo $option_value;
                    ?>
"><?php 
                    echo $option_caption;
                    ?>
</option>
					<?php 
                }
                ?>
				</select>
			<?php 
                break;
            case "datepicker":
                ?>
				<input type="text" id="{VAR:prefix}<?php 
                echo $property["id"];
                ?>
" <?php 
                echo aw_modal::implode_data_fields(ifset($property, "data"));
                ?>
 placeholder="<?php 
                echo isset($property["placeholder"]) ? $property["placeholder"] : "";
                ?>
" />
			<?php 
                break;
            case "datetimepicker":
                ?>
				<div id="{VAR:prefix}<?php 
                echo $property["id"];
                ?>
" <?php 
                echo aw_modal::implode_data_fields(ifset($property, "data"));
                ?>
></div>
			<?php 
                break;
            case "button":
                ?>
				<button id="{VAR:prefix}<?php 
                echo $property["id"];
                ?>
" class="btn btn-primary" <?php 
                echo aw_modal::implode_data_fields(ifset($property, "data"));
                ?>
><?php 
                echo $property["button"]["caption"];
                ?>
</button>
			<?php 
                break;
            case "chooser":
                ?>
				<div id="{VAR:prefix}<?php 
                echo $property["id"];
                ?>
" <?php 
                echo aw_modal::implode_data_fields(ifset($property, "data"));
                ?>
></div>
			<?php 
                break;
            case "yui-chooser":
                $chooser = new yui_chooser();
                $processed = $chooser->init_vcl_property(array("property" => $property));
                echo $processed[$property["name"]]["value"];
                break;
            case "fileupload":
                ?>
				<form method="POST" action="orb.aw?class=file&action=upload" enctype="multipart/form-data">
					<input type="file" id="<?php 
                echo $property["id"];
                ?>
" name="file" data-bind="upload: file" />
				</form>
			<?php 
                break;
            case "treeview":
                ?>
				<div id="{VAR:prefix}<?php 
                echo $property["id"];
                ?>
" <?php 
                echo aw_modal::implode_data_fields(ifset($property, "data"));
                ?>
></div>
				<?php 
                break;
        }
    }