Example #1
0
function timeconditions_getdestinfo($dest)
{
    global $active_modules;
    if (substr(trim($dest), 0, 15) == 'timeconditions,') {
        $exten = explode(',', $dest);
        $exten = $exten[1];
        $thisexten = timeconditions_get($exten);
        if (empty($thisexten)) {
            return array();
        } else {
            //$type = isset($active_modules['announcement']['type'])?$active_modules['announcement']['type']:'setup';
            return array('description' => sprintf(_("Time Condition: %s"), $thisexten['displayname']), 'edit_url' => 'config.php?display=timeconditions&itemid=' . urlencode($exten));
        }
    } else {
        return false;
    }
}
Example #2
0
<?php

//	License for all code of this FreePBX module can be found in the license file inside the module directory
//	Copyright 2015 Sangoma Technologies.
//
extract($request, EXTR_SKIP);
$subhead = _("Add Time Condition");
if ($itemid) {
    $fcc = new featurecode('timeconditions', 'toggle-mode-' . $itemid);
    $code = $fcc->getCodeActive();
    unset($fcc);
    $thisItem = timeconditions_get($itemid);
    $displayname = $thisItem['displayname'] ? $thisItem['displayname'] : '';
    $fcc_password = $thisItem['fcc_password'] ? $thisItem['fcc_password'] : '';
    $time = $thisItem['time'] ? $thisItem['time'] : '';
    $invert_hint = $thisItem['invert_hint'] ? $thisItem['invert_hint'] : '0';
    $delURL = '?display=timeconditions&action=delete&itemid=' . $itemid;
    $thisItem['timezone'] = isset($thisItem['timezone']) ? $thisItem['timezone'] : 'default';
    $subhead = sprintf(_("Edit Time Condition: %s (%s)"), $displayname, $code);
}
if ($itemid && $thisItem['tcstate'] !== false) {
    $tcstate = $thisItem['tcstate'] == '' ? 'auto' : $thisItem['tcstate'];
    switch ($tcstate) {
        case 'auto':
            $state_msg = _('No Override');
            break;
        case 'true':
            $state_msg = _('Temporary Override matching state');
            break;
        case 'true_sticky':
            $state_msg = _('Permanent Override matching state');
function daynight_hookGet_config($engine)
{
    global $ext;
    // is this the best way to pass this?
    switch ($engine) {
        case "asterisk":
            if (!function_exists('timeconditions_get')) {
                return true;
            }
            $overrides = daynight_list_timecondition();
            $context = "timeconditions";
            if (is_array($overrides)) {
                foreach ($overrides as $item) {
                    $daynight_id = $item['ext'];
                    $mode = $item['dmode'] == 'timeday' ? 'DAY' : 'NIGHT';
                    $timecondition_id = $item['dest'];
                    $timeconditions_arr = timeconditions_get($timecondition_id);
                    if (is_array($timeconditions_arr)) {
                        $dest = $mode == 'DAY' ? 'truestate' : 'falsestate';
                        $ext->splice($context, $timecondition_id, 0, new ext_gotoif('$["${DB(DAYNIGHT/C' . $daynight_id . ')}" = "' . $mode . '"]', $dest));
                    }
                }
            }
            break;
    }
}