<?
/**
 * VoiceOne Callcenter
 *
 * Frontend to callcenter log service
 * @package callcenter
 * @subpackage callcenter
 */
  include ("../admin/config/cfg.php");
  global $cwBasePath,$cwlang;
  //=============== POST AND GET ===============
  if((!isset($_GET['year']))||(trim($_GET['year'])=='')){
    $_GET['year']=date('Y');
  }
  if((!isset($_GET['month']))||(trim($_GET['month'])=='')){
    $_GET['month']='';
  }
  //================ PAGE LOGIC ================
  if(!_isModuleLoaded('callcenter')) goToMainPage('',"../");
  $ret=$asterisk->getCallCenter(0);
  if(is_array($ret)){
    foreach($ret as $cc){
      $html.="<td style=\"vertical-align: top;\">";
      $html.="<img src=\"$relBasePath/public/img/icon_offices.gif\" /> <a href=\"statistics/?callcenter=".$cc["id"]."\">".$cc["name"]."</a>\n";
      $html.="</td>\n";
      if ((++$count)%2==0) $html.="</tr><tr>\n";
    }
  }
  //================ MAIN PAGE ================
  ob_start();
  ?>
    <div class="SectionHeader">
      <h2 style="float:right;margin:10px 0 5px 0;"><?=$subtitle?></h2>
      <h1><?=T_('Call Center Logs')?></h1>
    </div>
    <table class="todolist">
      <tr>
        <?=$html?>
      </tr>
    </table>
  <?
  $contents=ob_get_contents();
  ob_end_clean();
  //================ SIDEBAR ================
  ob_start();
  ?>
    <div class="Sidebar">
      <h1><?=T_("Informazioni")?></h1>
      <p style="min-height: 300px;">In questa pagina è possibile vedere la lista dei call center attivi. Cliccando sul call center è possibile analizzare le statistiche relative alle chiamate ricevute.</p>
    </div>
  <?
  $sidebar=ob_get_contents();
  ob_end_clean();
  //================ SETTINGS ================
  $smarty->assign("section", "callcenter");
  $smarty->assign("subsection", "");
  $smarty->assign("templateType", "TwoColLeft");  //OneCol, TwoColLeft, TwoColRight
  $smarty->assign("contents", $contents);
  $smarty->assign("sidebar", $sidebar);
  $smarty->display('main.tpl');
?>
