From: hickert Date: Tue, 3 Nov 2009 14:29:30 +0000 (+0000) Subject: Made asterisk server selectable in phonereports. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a32e7c9f42e7b797eca2f326fa5a5d845d3bef1d;p=gosa.git Made asterisk server selectable in phonereports. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14734 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/gofon/gofon/fonreports/class_fonreport.inc b/gosa-plugins/gofon/gofon/fonreports/class_fonreport.inc index a5e932a3d..926355a19 100644 --- a/gosa-plugins/gofon/gofon/fonreports/class_fonreport.inc +++ b/gosa-plugins/gofon/gofon/fonreports/class_fonreport.inc @@ -22,6 +22,8 @@ class fonreport extends plugin var $range = 20; var $EntryPerPage = 20; + var $selected_server = ""; + /* attribute list for save action */ var $attributes_SO = array("start","search_for","search_base","range","month","sort_direction","sort","year"); var $objectclasses = array(); @@ -65,7 +67,7 @@ class fonreport extends plugin if (isset($_GET['start'])){ $this->start= (int)$_GET['start']; } - foreach( array("year", "month", "search_for", "search_base") as $type){ + foreach( array("year", "month", "search_for", "search_base","selected_server") as $type){ if (isset($_POST[$type])){ $this->$type= $_POST[$type]; } @@ -161,6 +163,14 @@ class fonreport extends plugin Check Database , Table , Connection *****************/ + // Collect servers and allow to select the server in the ui. + $servers = array(); + foreach($this->config->data['SERVERS']['FON'] as $key => $server){ + $servers[$server['SERVER']] = $server['SERVER']; + } + $smarty->assign("servers", $servers); + $smarty->assign("selected_server", $this->selected_server); + /* Connecting, selecting database */ if (!isset($this->config->data['SERVERS']['FON'][0])){ msg_dialog::display(_("Configuration error"), msgPool::noserver(_("GOfon")), WARNING_DIALOG); @@ -170,7 +180,17 @@ class fonreport extends plugin return($smarty->fetch(get_template_path('contents.tpl', TRUE))); }else{ - $cfg= $this->config->data['SERVERS']['FON'][0]; + // Get CFG for the selected server, if empty use first. + if($this->selected_server == ""){ + $cfg= $this->config->data['SERVERS']['FON'][0]; + }else{ + foreach($this->config->data['SERVERS']['FON'] as $server){ + if($server['SERVER'] == $this->selected_server){ + $cfg = $server; + } + } + } + $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']); if ($link === FALSE){ msg_dialog::display(_("Error"), msgPool::dbconnect(_("GOfon"),@mysql_error(),$cfg['SERVER']),ERROR_DIALOG); @@ -188,7 +208,6 @@ class fonreport extends plugin *****************/ $query = $this->CreateQuerySyntax(); - $cfg = $this->config->data['SERVERS']['FON'][0]; $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']); @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query"); diff --git a/gosa-plugins/gofon/gofon/fonreports/contents.tpl b/gosa-plugins/gofon/gofon/fonreports/contents.tpl index d8cf0a47f..ce2ae6508 100644 --- a/gosa-plugins/gofon/gofon/fonreports/contents.tpl +++ b/gosa-plugins/gofon/gofon/fonreports/contents.tpl @@ -9,6 +9,10 @@ + {t}on{/t} + {t}during{/t}