Location: PHPKode > projects > Eventum > eventum-2.2/templates/reports/custom_fields.tpl.html
{include file="header.tpl.html"}
<br />
{literal}
<script language="JavaScript">
<!--
function validateForm(f)
{
    if (getSelectedOption(f, 'custom_field') == -1) {
        selectField(f, 'custom_field');
        alert('{/literal}{t escape=js}Please select the custom field that you would like to generate a report against.{/t}{literal}');
        return false;
    }
    return true;
}
//-->
</script>
{/literal}
<form action="{$smarty.server.PHP_SELF}" name="custom_fields_report" method="get" onSubmit="javascript:return validateForm(this);">
<input type="hidden" name="cat" value="generate">
<table bgcolor="{$cell_color}" border="0" cellspacing="0" cellpadding="1" align="center" width="400">
  <tr>
    <td>
      <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0">
        <tr>
          <td bgcolor="{$cell_color}" colspan="3" class="default_white">
            <b>{t}Custom Fields Report{/t}</b>
          </td>
        </tr>
        <tr>
          <td width="30%" class="default" align="center">
            <b>{t}Field to Graph{/t}</b>
          </td>
          <td width="30%" class="default" align="center">
            <b>{t}Options to Graph{/t}</b>
          </td>
        </tr>
        <tr>
          <td align="center" valign="top" height="10">
            <select name="custom_field" class="default" onChange="setOptions(this.options[this.selectedIndex].value, true)">
                <option value="-1"></option>
                {html_options options=$custom_fields selected=$custom_field}
            </select>
            {include file="error_icon.tpl.html" field="custom_field"}
          </td>
          <td align="center" valign="top" rowspan="5">
            <select name="custom_options[]" size="8" multiple class="default">
            </select>
          </td>
        </tr>
        <tr>
          <td width="30%" class="default" align="center" height="10">
            {if $has_customer_integration}
              <b>{t}Group By{/t}</b>
            {/if}
          </td>
        </tr>
        <tr>
          <td align="left" valign="top" class="default">
            {if $has_customer_integration}
            &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="group_by" value="issue" {if $group_by != 'customer'}CHECKED{/if}>
                <a id="link" class="link" href="javascript:void(null)"
                            onClick="javascript:checkRadio('custom_fields_report', 'group_by', 0);">{t}Issue{/t}</a><br />
            &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="group_by" value="customer" {if $group_by == 'customer'}CHECKED{/if}>
                <a id="link" class="link" href="javascript:void(null)"
                            onClick="javascript:checkRadio('custom_fields_report', 'group_by', 1);">{t}Customer{/t}</a><br />
            {else}
              <input type="hidden" name="group_by" value="issue">
            {/if}
          </td>
        </tr>
    <tr>
      <th align="center" height="10" class="default">
          <b>Interval</b>
      </th>
    </tr>
    <tr>
      <td align="center" valign="top">
        <select name="interval">
            <option value=""></option>
            <option value="day"{if $smarty.request.interval == 'day'} selected{/if}>Day</option>
            <option value="week"{if $smarty.request.interval == 'week'} selected{/if}>Week</option>
            <option value="month"{if $smarty.request.interval == 'month'} selected{/if}>Month</option>
            <option value="year"{if $smarty.request.interval == 'year'} selected{/if}>Year</option>
        </select>
      </td>
    </tr>
    <tr>
      <th colspan="2" class="default">
        <b>{t}Issues Created Between{/t}</b>
      </th>
    </tr>
    <tr id="start_row">
      <td width="120" align="center" class="default">
        <b>{t}Start{/t}</b>
      </td>
      <td width="200">
        {html_select_date time=$start_date prefix="" field_array="start" start_year="-2" end_year="+1" field_order="YMD" month_format="%b" year_empty='YYYY' month_empty='MM' day_empty='DD' all_extra="class='default'"}
      </td>
    </tr>
    <tr id="end_row">
      <td width="120" align="center" class="default">
        <b>{t}End{/t}</b>
      </td>
      <td width="200">
        {html_select_date time=$end_date prefix="" field_array="end" start_year="-2" end_year="+1" field_order="YMD" month_format="%b" year_empty='YYYY' month_empty='MM' day_empty='DD' all_extra="class='default'"}
      </td>
    </tr>
    <tr>
      <th colspan="2" class="default">
        <b>{t}Assignee{/t}</b>
      </th>
    </tr>
    <tr>
      <td colspan="2" align="center">
        <select name="assignee" class="default">
                <option value="-1"></option>
                {html_options options=$assignees selected=$assignee}
            </select>
      </td>
    </tr>
        <tr>
          <td colspan="2" align="center">
            <input type="submit" name="cat" value="{t}Generate{/t}" class="shortcut">
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</form>
<script language="JavaScript">
var options = new Array();
var option_to_fld_id = new Array();
{foreach from=$options key=fld_id item=option_list name=option_list}
    option_to_fld_id[{$smarty.foreach.option_list.iteration-1}] = {$fld_id};
    options[{$smarty.foreach.option_list.iteration-1}] = new Array();
    {foreach from=$option_list key=cfo_id item=cfo_value name=option}
        options[{$smarty.foreach.option_list.iteration-1}][{$smarty.foreach.option.iteration-1}] = new Option('{$cfo_value}', '{$cfo_id}');
    {/foreach}
{/foreach}

{literal}
var options_field = document.forms['custom_fields_report'].elements['custom_options[]'];
function setOptions(fld_id, auto_select)
{
    fld_id_index = '';
    for (i = 0; i < option_to_fld_id.length; i++) {
        if (option_to_fld_id[i] == fld_id) {
            fld_id_index = i;
        }
    }

    options_field.length = 0;
    if (options[fld_id_index]) {
        options_field.length = options[fld_id_index].length;
        for (i = 0; i < options[fld_id_index].length; i++) {
            options_field.options[i] = options[fld_id_index][i];
            options_field.options[i].selected = auto_select;
        }
    }
}
{/literal}

setOptions('{$custom_field}', false);
{if $custom_options|@count > 0}
    {foreach from=$custom_options key=option_index item=option}
      {literal}
      for (i = 0; i < options_field.options.length; i++) {
        if (options_field.options[i].value == '{/literal}{$option}{literal}') {
          options_field.options[i].selected = true;
        }
      }
      {/literal}
    {/foreach}
{/if}
</script>

{if $custom_options|@count > 0}
<div align="center" class="default">
    <img src="custom_fields_graph.php?{$smarty.server.QUERY_STRING}"><br /><br />
    <img src="custom_fields_graph.php?{$smarty.server.QUERY_STRING}&type=pie"><br />
    {t}Percentages may not add up to exactly 100% due to rounding.{/t}<br /><br />
</div>
{/if}

{if $data|@count > 0}
{assign var="colspan" value=3}
<table bgcolor="{$cell_color}" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr>
    <td>
      <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0">
        <tr>
          <td bgcolor="{$cell_color}" colspan="{$colspan}" class="default_white">
            <b>{t}Issues/Customers matching criteria{/t}</b>
          </td>
        </tr>
        <tr>
          {if $has_customer_integration}
          <td bgcolor="{$cell_color}" class="default_white">{t}Customer{/t}</td>
          {/if}
          {if $smarty.request.group_by == 'customer'}
          <td bgcolor="{$cell_color}" class="default_white">{t}Issue Count{/t}</td>
          {else}
          <td bgcolor="{$cell_color}" class="default_white">{t}Issue ID{/t}</td>
          <td bgcolor="{$cell_color}" class="default_white">{t}Summary{/t}</td>
          <td bgcolor="{$cell_color}" class="default_white">{$field_info.fld_title}</td>
          {/if}
        </tr>
        {foreach from=$data item=row}
        {cycle values=$cycle assign="row_color"}
        <tr>
          {if $has_customer_integration}
          <td class="default" bgcolor="{$row_color}">{$row.customer_title}</td>
          {/if}
          {if $smarty.request.group_by == 'customer'}
          <td class="default" bgcolor="{$row_color}" align="center">{$row.row_count}</td>
          {else}
          <td class="default" bgcolor="{$row_color}" align="right">
            <a href="{$app_base_url}view.php?id={$row.iss_id}" class="link">{$row.iss_id}</a>
          </td>
          <td class="default" bgcolor="{$row_color}">{$row.iss_summary}</td>
          <td class="default" bgcolor="{$row_color}">{$row.field_value}</td>
          {/if}
        </tr>
        {foreachelse}
        <tr>
            <td colspan="8" class="default" align="center" bgcolor="{$dark_color}"><i>{t}No data found{/t}</i></td>
        </tr>
        {/foreach}
      </table>
    </td>
  </tr>
</table>
{/if}


{include file="footer.tpl.html"}
Return current item: Eventum