function output()
 {
     $group_id = modApiFunc('Request', 'getValueByKey', 'report_group_id');
     $reports = modApiFunc('Reports', 'getReportGroups');
     if ($group_id !== null and isset($reports[$group_id])) {
         $reports = $reports[$group_id]['REPORTS'];
     } else {
         reset($reports);
         $current_group_id = array_keys($reports);
         $reports = $reports[$current_group_id[0]]['REPORTS'];
     }
     $TmplFiller = new TmplFiller(dirname(dirname(__FILE__)) . '/templates_az/report-group-page/');
     $html = '';
     $prev_placeholder = -1;
     foreach ($reports as $report_tag => $placeholder_type) {
         $report_tag = 'get' . $report_tag;
         if ($prev_placeholder === REPORT_PLACEHOLDER_HALF) {
             if ($placeholder_type === REPORT_PLACEHOLDER_HALF) {
                 $report_right = $report_tag();
                 $html .= $TmplFiller->fill("", "row-half.tpl.html", array('ReportLeft' => $report_left, 'ReportRight' => $report_right));
                 $prev_placeholder = -1;
                 $placeholder_type = -1;
                 continue;
             } else {
                 $report_right = ' ';
                 $html .= $TmplFiller->fill("", "row-half.tpl.html", array('ReportLeft' => $report_left, 'ReportRight' => $report_right));
                 $prev_placeholder = -1;
             }
         }
         if ($placeholder_type === REPORT_PLACEHOLDER_FULL) {
             $html .= $TmplFiller->fill("", "row-full.tpl.html", array('Report' => $report_tag()));
             $prev_placeholder = REPORT_PLACEHOLDER_FULL;
         }
         if ($placeholder_type === REPORT_PLACEHOLDER_HALF) {
             $report_left = $report_tag();
             $prev_placeholder = REPORT_PLACEHOLDER_HALF;
         }
     }
     if ($placeholder_type === REPORT_PLACEHOLDER_HALF) {
         $report_right = ' ';
         $html .= $TmplFiller->fill("", "row-half.tpl.html", array('ReportLeft' => $report_left, 'ReportRight' => $report_right));
     }
     return $html;
 }
 function outputMessages()
 {
     if (!empty($this->messages)) {
         $message = "";
         $tf = new TmplFiller();
         foreach ($this->messages as $msg) {
             switch ($msg) {
                 case GC_E_FIELD_TO:
                     $txt = getMsg('GCT', 'GC_E_FIELD_TO');
                     break;
                 case GC_E_FIELD_FROM:
                     $txt = getMsg('GCT', 'GC_E_FIELD_FROM');
                     break;
                 case GC_E_FIELD_AMOUNT:
                     $txt = getMsg('GCT', 'GC_E_FIELD_AMOUNT');
                     break;
                 case GC_E_FIELD_AMOUNT_SEPARATOR:
                     $txt = getMsg('GCT', 'GC_E_FIELD_AMOUNT_SEPARATOR');
                     break;
                 case GC_E_FIELD_ADDRESS:
                     $txt = getMsg('GCT', 'GC_E_FIELD_ADDRESS');
                     break;
                 case GC_E_FIELD_CITY:
                     $txt = getMsg('GCT', 'GC_E_FIELD_CITY');
                     break;
                 case GC_E_FIELD_FNAME:
                     $txt = getMsg('GCT', 'GC_E_FIELD_FNAME');
                     break;
                 case GC_E_FIELD_LNAME:
                     $txt = getMsg('GCT', 'GC_E_FIELD_LNAME');
                     break;
                 case GC_E_FIELD_EMAIL:
                     $txt = getMsg('GCT', 'GC_E_FIELD_EMAIL');
                     break;
                 case GC_E_FIELD_COUNTRYID:
                     $txt = getMsg('GCT', 'GC_E_FIELD_COUNTRYID');
                     break;
                 case GC_E_FIELD_STATEID:
                     $txt = getMsg('GCT', 'GC_E_FIELD_STATEID');
                     break;
                 case GC_E_FIELD_ZIP:
                     $txt = getMsg('GCT', 'GC_E_FIELD_ZIP');
                     break;
                 default:
                     $txt = getMsg('GCT', 'GC_E_FAILED_SAVE');
             }
             $message .= $tf->fill("gift-certificate/create-gc-form/default/", "gc-error.tpl.html", array('ErrorMessage' => $txt), true);
         }
         return $message;
     }
     return "";
 }
 function getHTML($params)
 {
     $html = '';
     $TmplFiller = new TmplFiller(dirname(dirname(__FILE__)) . '/templates_az/report-period-selector/');
     $html_option_list = '';
     //
     //                ,      -                                ,                -
     $options = modApiFunc('Reports', 'getDatetimePeriodLabels', $params['MIN_DISCONTINUITY']);
     foreach ($options as $option_group_label => $option_list) {
         //                    HTML
         $html_group = '';
         foreach ($option_list as $option_label) {
             $is_selected = '';
             if ($option_label == $params['CURRENT_VALUE']) {
                 $is_selected = 'SELECTED';
             }
             //
             $option_human_name = getMsg('RPTS', $option_label);
             $period = modApiFunc('Reports', 'getTimestampPeriodByDatetimeLabel', $option_label);
             if ($period !== null) {
                 list($option_from_timestamp, $option_to_timestamp) = $period;
                 $option_human_from = modApiFunc("Localization", "date_format", $option_from_timestamp, false);
                 $option_human_to = modApiFunc("Localization", "date_format", $option_to_timestamp, false);
                 if ($option_human_from == $option_human_to) {
                     $option_human_name .= ': ' . $option_human_from;
                 } else {
                     $option_human_name .= ': ' . $option_human_from . ' - ' . $option_human_to;
                 }
             }
             $html_group .= $TmplFiller->fill('', 'select-drop-down-option.tpl.html', array('OPTION_VALUE' => $option_label, 'OPTION_NAME' => $option_human_name, 'SELECTED' => $is_selected));
         }
         //
         $group_human_name = getMsg('RPTS', $option_group_label);
         //            HTML
         $html_option_list .= $TmplFiller->fill('', 'select-drop-down-group.tpl.html', array('GROUP_NAME' => $group_human_name, 'OPTIONS' => $html_group));
     }
     $container_tag_values = array('selector_id' => $params['ID'], 'callback-js-function' => $params['CALLBACK_JS_FUNCTION'], 'OPTIONS_LIST' => $html_option_list);
     return $TmplFiller->fill("", "select-drop-down-container.tpl.html", $container_tag_values);
 }
 function __getRefreshButtonHtml()
 {
     $filler = new TmplFiller(dirname(dirname(__FILE__)) . '/templates_az/report-ajax-loader-buttons/');
     $href = 'javascript:' . $this->__render_settings->getReportID() . '_getReportContent();';
     $name = 'Refresh';
     $title = 'Update report';
     $html_link = $filler->fill('', 'link.tpl.html', array('Href' => $href, 'Name' => $name, 'Title' => $title));
     $html_button = $filler->fill('', 'button-container.tpl.html', array('Content' => $html_link));
     return $html_button;
 }