<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<template>
    
    <!-- 
        Meta description of the templates, that anybody
        knows what the template is doing
    -->
    <meta>
        <parameter name="name">Default template for Tactical Overview</parameter>
        <parameter name="description">Displays a Tactical Overview</parameter>
        <parameter name="author">icinga-web developers</parameter>
    </meta>

    <!--
        data sources 
    -->
    <datasources>
    </datasources>
    
    

    <!--
        html template
    -->
    <template_code>
        <MAIN>
            <![CDATA[
                <h3>TO: Howto organize by customvariables</h3>
                <div style="padding: 5px 5px;">
                <?php 
                
                    $records = IcingaDoctrine_Query::create('icinga')
                    ->from('IcingaCustomvariables c')
                    ->distinct(true)
                    ->select('c.varname, c.varvalue')
                    ->orderBy('c.varname ASC')
                    ->appendCustomvarFilter()
                    ->disableAutoIdentifierFields(true)
                    ->execute();
                    
                    foreach ($records as $record) {
                        // echo $record->varname . ":" . $record->varvalue . "<br />";
                        echo $t->renderSub('icinga-tactical-overview-groupstat', 'customvariable', array(
                            'CUSTOMVARIABLE_NAME' => $record->varname,
                            'CUSTOMVARIABLE_VALUE' => $record->varvalue
                        ));
                    }
                
                ?>
                </div>
            ]]>
        </MAIN>
    </template_code>
</template>
