예제 #1
0
function print_heading($options)
{
    // we've moved this function to the theme module.
    // all future updates to this function will be done there, not in this main file.
    if (is_callable('module_theme::print_heading')) {
        module_theme::print_heading($options);
        return;
    }
    if (!is_array($options)) {
        $options = array('type' => 'h2', 'title' => $options);
    }
    $buttons = array();
    if (isset($options['button']) && is_array($options['button']) && count($options['button'])) {
        $buttons = $options['button'];
        if (isset($buttons['url'])) {
            $buttons = array($buttons);
        }
    }
    ?>
	<<?php 
    echo $options['type'];
    ?>
>
		<?php 
    foreach ($buttons as $button) {
        ?>
		<span class="button">
			<a href="<?php 
        echo $button['url'];
        ?>
" class="uibutton"<?php 
        if (isset($button['id'])) {
            echo ' id="' . $button['id'] . '"';
        }
        if (isset($button['onclick'])) {
            echo ' onclick="' . $button['onclick'] . '"';
        }
        ?>
>
                <?php 
        if (isset($button['type']) && $button['type'] == 'add') {
            ?>
 <img src="<?php 
            echo _BASE_HREF;
            ?>
images/add.png" width="10" height="10" alt="add" border="0" /> <?php 
        }
        ?>
				<span><?php 
        echo _l($button['title']);
        ?>
</span>
			</a>
		</span>
		<?php 
    }
    ?>
        <?php 
    if (isset($options['help'])) {
        ?>
            <span class="button">
                <?php 
        _h($options['help']);
        ?>
            </span>
        <?php 
    }
    ?>
		<span class="title">
			<?php 
    echo _l($options['title']);
    ?>
		</span>
	</<?php 
    echo $options['type'];
    ?>
>
	<?php 
}