Esempio n. 1
0
 public function doConfigPageInit($page)
 {
     $conf = \FreePBX::Config();
     $ramp_conf = $conf->get_conf_settings();
     foreach ($ramp_conf as $key => $value) {
         $amp_conf[$key] = $value['value'];
     }
     $request = $_REQUEST;
     $action = isset($request['action']) ? $request['action'] : null;
     $extdisplay = isset($request['extdisplay']) ? $request['extdisplay'] : null;
     if ($page == "extensions" || $page == "users") {
         // Catch the POST.
         if (isset($request['extdisplay']) && isset($request['intercom_override'])) {
             if (preg_match('/override=(.+)/', $request['intercom_override'], $match)) {
                 $this->setOverride($request['extdisplay'], $match[1]);
             }
         }
     }
     if ($page == "paging") {
         $get_vars = array('action' => '', 'announce' => '', 'conflict_url' => '', 'default_group' => 0, 'description' => '', 'display' => 'paging', 'duplex' => 0, 'extdisplay' => '', 'force_page' => 0, 'pagegrp' => '', 'pagelist' => '', 'pagenbr' => '', 'Submit' => '', 'announcement' => '', 'type' => 'tool');
         foreach ($get_vars as $k => $v) {
             $vars[$k] = isset($request[$k]) ? $request[$k] : $v;
         }
         $vars['pagenbr'] = trim($vars['pagenbr']);
         if ($vars['Submit'] == _('Delete')) {
             $vars['action'] = 'delete';
             $request['action'] = 'delete';
         }
         $vars['announce'] = $vars['announcement'];
         //action actions
         switch ($vars['action']) {
             case 'delete':
                 paging_del($vars['extdisplay']);
                 break;
             case 'submit':
                 //TODO: issue, we are deleting and adding at the same time so remeber later to check
                 //      if we are deleting a destination
                 $usage_arr = array();
                 if ($vars['pagegrp'] != $vars['pagenbr']) {
                     $usage_arr = framework_check_extension_usage($vars['pagenbr']);
                 }
                 if ($usage_arr) {
                     $vars['conflict_url'] = framework_display_extension_usage_alert($usage_arr);
                     break;
                 } else {
                     //limit saved devices to PAGINGMAXPARTICIPANTS
                     if (isset($amp_conf['PAGINGMAXPARTICIPANTS']) && $amp_conf['PAGINGMAXPARTICIPANTS']) {
                         if (!empty($vars['pagelist'])) {
                             $vars['pagelist'] = array_slice($vars['pagelist'], 0, $amp_conf['PAGINGMAXPARTICIPANTS']);
                         }
                     }
                     paging_modify($vars['pagegrp'], $vars['pagenbr'], $vars['pagelist'], $vars['force_page'], $vars['duplex'], $vars['description'], $vars['default_group'], $vars['announcement']);
                     $request['action'] = $vars['action'] = 'modify';
                     if ($vars['extdisplay'] == '' || $vars['pagegrp'] != $vars['pagenbr']) {
                         $request['extdisplay'] = $vars['extdisplay'] = $vars['pagenbr'];
                     }
                     $_REQUEST['extdisplay'] = $vars['extdisplay'];
                 }
                 break;
             case 'save_settings':
                 $def = paging_get_autoanswer_defaults(true);
                 $doptions = 'b(autoanswer^s^1(${ALERTINFO},${CALLINFO}))';
                 if (ctype_digit($vars['announce'])) {
                     $r = recordings_get($vars['announce']);
                     if ($r) {
                         $vars['announce'] = $r['filename'];
                     } else {
                         $vars['announce'] = 'beep';
                     }
                     $a = 'A(' . $vars['announce'] . ')' . $doptions;
                 } elseif ($vars['announce'] == 'none') {
                     $a = "A(){$doptions}";
                 } elseif ($vars['announce'] == 'beep') {
                     $a = "A(beep){$doptions}";
                 }
                 $this->setDropSilence($state, !empty($vars['drop_silence']));
                 paging_set_autoanswer_defaults(array('DOPTIONS' => $a));
                 needreload();
                 break;
             case 'getJSON':
                 header('Content-Type: application/json');
                 switch ($request['jdata']) {
                     case 'grid':
                         $pagelist = paging_list();
                         $rdata = array();
                         foreach ($pagelist as $pg) {
                             $rdata[] = array('description' => $pg['description'], 'page_group' => $pg['page_group'], 'is_default' => $pg['is_default'], 'link' => array($pg['description'], $pg['page_group']));
                         }
                         echo json_encode($rdata);
                         exit;
                         break;
                     default:
                         echo json_encode(array('error' => _("Unknown Request")));
                         exit;
                         break;
                 }
                 break;
             default:
                 break;
         }
     }
 }
Esempio n. 2
0
        paging_show($selection, $display, $type);
        break;
    case "submit":
        //TODO: issue, we are deleting and adding at the same time so remeber later to check
        //      if we are deleting a destination
        $usage_arr = array();
        if (trim($pagegrp) != trim($pagenbr)) {
            $usage_arr = framework_check_extension_usage($pagenbr);
        }
        if (!empty($usage_arr)) {
            $conflict_url = array();
            $conflict_url = framework_display_extension_usage_alert($usage_arr);
            paging_sidebar($selection, $type, $display);
            paging_show($pagegrp, $display, $type, $conflict_url);
        } else {
            paging_modify($pagegrp, $pagenbr, $pagelist, $force_page, $duplex, $description, $default_group);
            redirect_standard();
        }
        break;
    default:
        paging_sidebar($selection, $type, $display);
        paging_text();
}
function paging_text()
{
    $fcc = new featurecode('paging', 'intercom-prefix');
    $intercom_code = $fcc->getCodeActive();
    unset($fcc);
    $fcc = new featurecode('paging', 'intercom-on');
    $oncode = $fcc->getCodeActive();
    unset($fcc);