Beispiel #1
0
 /**
  */
 public function perms()
 {
     $perms = array('accountcodes' => array('title' => _("Account Codes")));
     $accountcodes = Operator::getAccountCodes();
     foreach ($accountcodes as $accountcode) {
         $perms['accountcodes:' . $accountcode] = array('title' => $accountcode);
     }
     return $perms;
 }
Beispiel #2
0
function _operator_perms()
{
    static $perms = array();
    if (!empty($perms)) {
        return $perms;
    }
    @define('OPERATOR_BASE', __DIR__ . '/..');
    require_once OPERATOR_BASE . '/lib/base.php';
    $perms['tree']['operator']['accountcodes'] = false;
    $perms['title']['operator:accountcodes'] = _("Account Codes");
    $accountcodes = Operator::getAccountCodes();
    foreach ($accountcodes as $accountcode) {
        $perms['tree']['operator']['accountcodes'][$accountcode] = false;
        $perms['title']['operator:accountcodes:' . $accountcode] = $accountcode;
    }
    return $perms;
}
Beispiel #3
0
 public function __construct($title, &$vars)
 {
     parent::__construct($vars, $title);
     // FIXME: Generate a list of clients from Turba?
     //$clients =
     $now = time();
     if (!$vars->exists('startdate')) {
         // Default to the beginning of the previous calendar month
         $startdate = array('day' => 1, 'month' => date('n', $now), 'year' => date('Y', $now), 'hour' => 0, 'minute' => 0, 'second' => 0);
         $vars->set('startdate', $startdate);
     }
     if (!$vars->exists('enddate')) {
         // Default to the end of the previous calendar month
         $month = date('n', $now);
         $year = date('Y', $now);
         $lastday = Horde_Date_Utils::daysInMonth($month, $year);
         $enddate = array('day' => $lastday, 'month' => $month, 'year' => $year, 'hour' => 23, 'minute' => 59, 'second' => 59);
         $vars->set('enddate', $enddate);
     }
     try {
         $accountcodes = Operator::getAccountCodes(true);
     } catch (Exception $e) {
         $GLOBALS['notification']->push($e);
         $accountcodes = array();
     }
     // Parameters for Horde_Form_datetime
     $start_year = date('Y', $now) - 5;
     $end_year = '';
     $picker = true;
     $format_in = null;
     $format_out = '%x';
     $show_seconds = true;
     $params = array($start_year, $end_year, $picker, $format_in, $format_out, $show_seconds);
     $this->addVariable(_("Account Code"), 'accountcode', 'enum', false, false, null, array($accountcodes));
     $this->addVariable(_("Destination Context"), 'dcontext', 'text', false, false, _("An empty destination context will match all destination contexts."));
     $this->addVariable(_("Start Date & Time"), 'startdate', 'datetime', true, false, null, $params);
     $this->addVariable(_("End Date & Time"), 'enddate', 'datetime', true, false, null, $params);
 }