当前位置: 首页>>代码示例>>PHP>>正文


PHP Operator::getGraphInfo方法代码示例

本文整理汇总了PHP中Operator::getGraphInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Operator::getGraphInfo方法的具体用法?PHP Operator::getGraphInfo怎么用?PHP Operator::getGraphInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Operator的用法示例。


在下文中一共展示了Operator::getGraphInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($title, &$vars)
 {
     parent::__construct($title, $vars);
     $graphtypes = Operator::getGraphInfo();
     $graphs = array();
     foreach ($graphtypes as $type => $info) {
         $graphs[$type] = $info['title'];
     }
     $this->addVariable(_("Graph"), 'graph', 'enum', true, false, null, array($graphs));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:10,代码来源:SearchCDR.php

示例2: catch

        }
    } catch (Horde_Exception $e) {
        //$notification->push(_("Invalid dates requested."));
        $notification->push($e);
        $stats = array();
    }
} else {
    foreach ($session->get('operator', 'lastsearch/params', Horde_Session::TYPE_ARRAY) as $var => $val) {
        $vars->set($var, $val);
    }
    $data = $session->get('operator', 'lastsearch/data', Horde_Session::TYPE_ARRAY);
}
$graphs = array();
if (!empty($stats)) {
    $url = Horde::url('graphgen.php');
    $graphtypes = Operator::getGraphInfo();
    foreach ($graphtypes as $type => $info) {
        $graphs[$type] = $url->add(array('graph' => $type, 'key' => $cachekey));
    }
}
$curgraph = $vars->get('graph');
$page_output->header(array('title' => _("Call Detail Records Graph")));
$notification->notify(array('listeners' => 'status'));
$form->renderActive($renderer, $vars, Horde::url('viewgraph.php'), 'post');
if (!empty($stats) && !empty($graphs[$curgraph])) {
    echo '<br />';
    echo '<img src="' . $graphs[$curgraph] . '"/><br />';
}
$page_output->footer();
// Don't leave stale stats lying about
$session->remove('operator', 'stats');
开发者ID:raz0rsdge,项目名称:horde,代码行数:31,代码来源:viewgraph.php

示例3: _getMonthlyCallStats


//.........这里部分代码省略.........
     $failed_query = 'SELECT MONTH(calldate) AS month, ' . 'YEAR(calldate) AS year, ' . 'COUNT(disposition) AS failed FROM ' . $this->_params['table'] . ' ' . 'WHERE disposition="failed" AND %s ' . 'GROUP BY year, month';
     // Shared SQL filter
     $filter = array();
     $values = array();
     // Filter by account code
     if ($accountcode !== null) {
         $filter[] = 'accountcode LIKE ?';
         $values[] = $accountcode;
     } else {
         $filter[] = 'accountcode = ""';
     }
     // Filter by destination context
     if ($dcontext !== null) {
         $filter[] = 'dcontext LIKE ?';
         $values[] = $dcontext;
     } else {
         $filter[] = 'dcontext = ""';
     }
     // Filter by the date range (filled in below)
     $filter[] = 'calldate >= ?';
     $values[] = $start->strftime('%Y-%m-%d %T');
     $filter[] = 'calldate < ?';
     $values[] = $end->strftime('%Y-%m-%d %T');
     $filterstring = implode(' AND ', $filter);
     $stats = array();
     /* Log the query at a DEBUG log level. */
     $sql = sprintf($numcalls_query, $filterstring);
     Horde::log(sprintf('Operator_Driver_asterisksql::getCallStats(): Values: %s', print_r($values, true)), 'DEBUG');
     Horde::log(sprintf('Operator_Driver_asterisksql::getCallStats(): %s', $sql), 'DEBUG');
     $numcalls_res = $this->_db->getAll($sql, $values, DB_FETCHMODE_ASSOC);
     if (is_a($numcalls_res, 'PEAR_Error')) {
         Horde::log($numcalls_res, 'ERR');
         throw new Operator_Exception(_("Internal error.  Details have been logged for the administrator."));
     }
     $sql = sprintf($minutes_query, $filterstring);
     Horde::log(sprintf('Operator_Driver_asterisksql::getCallStats(): %s', $sql), 'DEBUG');
     $minutes_res = $this->_db->getAll($sql, $values, DB_FETCHMODE_ASSOC);
     if (is_a($minutes_res, 'PEAR_Error')) {
         Horde::log($minutes_res, 'ERR');
         throw new Operator_Exception(_("Internal error.  Details have been logged for the administrator."));
     }
     $sql = sprintf($failed_query, $filterstring);
     Horde::log(sprintf('Operator_Driver_asterisksql::getCallStats(): %s', $sql), 'DEBUG');
     $failed_res = $this->_db->getAll($sql, $values, DB_FETCHMODE_ASSOC);
     if (is_a($failed_res, 'PEAR_Error')) {
         Horde::log($failed_res, 'ERR');
         throw new Operator_Exception(_("Internal error.  Details have been logged for the administrator."));
     }
     // Normalize the results from the database.  This is done because
     // the database will not return values if there are no data that match
     // the query.  For example if there were no calls in the month of June
     // the results will not have any rows with data for June.  Instead of
     // searching through the results for each month we stuff the values we
     // have into a temporary array and then create the return value below
     // using 0 values where necessary.
     $numcalls = array();
     foreach ($numcalls_res as $row) {
         $numcalls[$row['year']][$row['month']] = $row['numcalls'];
     }
     $minutes = array();
     foreach ($minutes_res as $row) {
         $minutes[$row['year']][$row['month']] = $row['minutes'];
     }
     $failed = array();
     foreach ($failed_res as $row) {
         $failed[$row['year']][$row['month']] = $row['failed'];
     }
     $s_numcalls = array();
     $s_minutes = array();
     $s_failed = array();
     while ($start->compareDate($end) <= 0) {
         $index = $start->strftime('%Y-%m');
         $year = $start->year;
         $month = $start->month;
         if (empty($numcalls[$year]) || empty($numcalls[$year][$month])) {
             $s_numcalls[$index] = 0;
         } else {
             $s_numcalls[$index] = $numcalls[$year][$month];
         }
         if (empty($minutes[$year]) || empty($minutes[$year][$month])) {
             $s_minutes[$index] = 0;
         } else {
             $s_minutes[$index] = $minutes[$year][$month];
         }
         if (empty($failed[$year]) || empty($failed[$year][$month])) {
             $s_failed[$index] = 0;
         } else {
             $s_failed[$index] = $failed[$year][$month];
         }
         // Find the first day of the next month
         $start->month++;
     }
     $info = Operator::getGraphInfo('numcalls');
     $stats['numcalls'] = array($info['title'] => $s_numcalls);
     $info = Operator::getGraphInfo('minutes');
     $stats['minutes'] = array($info['title'] => $s_minutes);
     //        $info = Operator::getGraphInfo('failed');
     //        $stats['failed'] = array($info['title'] => $s_failed);
     return $stats;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:101,代码来源:asterisksql.php

示例4: unserialize

 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Ben Klang <ben@alkaloid.net>
 */
require_once __DIR__ . '/lib/Application.php';
$operator = Horde_Registry::appInit('operator');
$cache =& $GLOBALS['cache'];
// Work around warnings in Image_Graph
// Needed for Image_Graph <= 0.7.2 and Image_Canvas <= 0.3.2
//error_reporting(E_NONE);
//ini_set("display_errors", 0);
//setlocale(LC_ALL, $registry->preferredLang());
//setlocale(LC_ALL, 'en');
$graphtype = Horde_Util::getFormData('graph');
$graphinfo = Operator::getGraphInfo($graphtype);
$cachekey = Horde_Util::getFormData('key');
$stats = unserialize($cache->get($cachekey, 0));
// Create the graph image base.
if (empty($graphinfo['imageX'])) {
    $graphinfo['imageX'] = 700;
}
if (empty($graphinfo['imageY'])) {
    $graphinfo['imageY'] = 600;
}
if (!isset($graphinfo['charttype'])) {
    $graphinfo['charttype'] = 'bar';
}
if (!isset($graphinfo['markers'])) {
    $graphinfo['markers'] = true;
}
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:graphgen.php


注:本文中的Operator::getGraphInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。