public function getSections()
 {
     $sections = array();
     $users = \FreePBX::Core()->listUsers(true);
     $ret = array();
     $ret['title'] = _("Users");
     $featurecodes = \featurecodes_getAllFeaturesDetailed();
     $ret['textdesc'] = _('User');
     $ret['numdesc'] = _('Extension');
     $ret['items'] = array();
     foreach ($users as $user) {
         $ret['items'][] = array($user[1], $user[0]);
     }
     $sections[] = $ret;
     $hookdata = \FreePBX::Hooks()->processHooks();
     foreach ($hookdata as $key => $value) {
         $sections[] = $value;
     }
     $html .= '<div class="row holder">';
     $html .= '<div class="col-sm-12">';
     foreach ($sections as $k => $v) {
         $html .= '<div class="row">';
         $html .= '<h3>' . $v['title'] . '</h3>';
         $html .= '<ul class="list-group">';
         foreach ($v['items'] as $item) {
             $html .= '	<li class="list-group-item col-sm-6"><b>' . $item[1] . '</b> - ' . $item[0] . '</li>';
         }
         $html .= '</ul>';
         $html .= '<br/>';
         $html .= '	</div>';
     }
     $html .= '</div>';
     $html .= '</div>';
     return $html;
 }
 public function printExtensions()
 {
     $ret = array();
     $ret['title'] = _("Feature Codes");
     $featurecodes = \featurecodes_getAllFeaturesDetailed();
     $ret['textdesc'] = _('Description');
     $ret['numdesc'] = _("Code");
     $ret['items'] = array();
     foreach ($featurecodes as $fc) {
         if ($fc['featureenabled'] && $fc['moduleenabled']) {
             $code = $fc['customcode'] ? $fc['customcode'] : $fc['defaultcode'];
             $ret['items'][] = array($fc['featuredescription'], $code);
         }
     }
     return $ret;
 }
Ejemplo n.º 3
0
function featurecodeadmin_check_extensions($exten = true)
{
    $extenlist = array();
    if (is_array($exten) && empty($exten)) {
        return $extenlist;
    }
    $featurecodes = featurecodes_getAllFeaturesDetailed();
    foreach ($featurecodes as $result) {
        $thisexten = $result['customcode'] != '' ? $result['customcode'] : $result['defaultcode'];
        // Ignore disabled codes, and modules, and any exten not being requested unless all (true)
        //
        if ($result['featureenabled'] == 1 && $result['moduleenabled'] == 1 && ($exten === true || in_array($thisexten, $exten))) {
            $extenlist[$thisexten]['description'] = _("Featurecode: ") . $result['featurename'] . " (" . $result['modulename'] . ":" . $result['featuredescription'] . ")";
            $extenlist[$thisexten]['status'] = 'INUSE';
            $extenlist[$thisexten]['edit_url'] = 'config.php?type=setup&display=featurecodeadmin';
        }
    }
    return $extenlist;
}
//	License for all code of this FreePBX module can be found in the license file inside the module directory
//	Copyright 2013 Schmooze Com Inc.
//
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$dispnum = "featurecodeadmin";
//used for switch on config.php
$tabindex = 0;
//if submitting form, update database
switch ($action) {
    case "save":
        if (!empty($_POST['fc'])) {
            \FreePBX::Featurecodeadmin()->update($_POST['fc']);
        }
        break;
}
$featurecodes = featurecodes_getAllFeaturesDetailed();
$exten_conflict_arr = array();
$conflict_url = array();
$exten_arr = array();
foreach ($featurecodes as $result) {
    /* if the feature code starts with "In-Call Asterisk" then it is not conflicting with normal feature codes. This would be featuremap and future
     * application map type codes. This is a real kludge and instead there should be a category associated with these codes when the feature code
     * is created. However, the logic would be the same, thus my willingness to put in such a kludge for now. When the schema changes to add this
     * then this can be updated to reflect that
     */
    if ($result['featureenabled'] == 1 && $result['moduleenabled'] == 1 && substr($result['featuredescription'], 0, 16) != 'In-Call Asterisk') {
        $exten_arr[] = $result['customcode'] != '' ? $result['customcode'] : $result['defaultcode'];
    }
}
$usage_arr = framework_check_extension_usage($exten_arr);
unset($usage_arr['featurecodeadmin']);
 public function printExtensions()
 {
     $ret = array();
     $ret['title'] = _("Conferences");
     $featurecodes = \featurecodes_getAllFeaturesDetailed();
     $ret['textdesc'] = _('Conference');
     $ret['numdesc'] = _('Extension');
     $ret['items'] = array();
     foreach ($this->listConferences() as $conf) {
         $ret['items'][] = array($conf[1], $conf[0]);
     }
     return $ret;
 }
Ejemplo n.º 6
0
function featurecodeadmin_destinations()
{
    $featurecodes = featurecodes_getAllFeaturesDetailed();
    if (isset($featurecodes)) {
        $text_domain = array();
        foreach ($featurecodes as $result) {
            // Ignore disabled codes, and modules, and ones not providing destinations
            //
            if ($result['featureenabled'] == 1 && $result['moduleenabled'] == 1 && $result['providedest'] == 1) {
                $modulename = $result['modulename'];
                $description = modgettext::_($result['featuredescription'], $modulename);
                // Just in case the translation was not found in either the module or amp, we will try to see
                // if they put it in the featurecode module i18n
                if ($description == $result['featuredescription']) {
                    $description = _($description);
                }
                $thisexten = $result['customcode'] != '' ? $result['customcode'] : $result['defaultcode'];
                $extens[] = array('destination' => 'ext-featurecodes,' . $result['defaultcode'] . ',1', 'description' => $description . ' <' . $thisexten . '>');
            }
        }
    }
    if (isset($extens)) {
        return $extens;
    } else {
        return null;
    }
}
Ejemplo n.º 7
0
    } elseif ($a != $b) {
        return $a < $b ? -1 : 1;
    } else {
        return 0;
    }
}
uksort($html_txt_arr, 'core_top');
if (!$quietmode) {
    //asort($module_select);
    uasort($module_select, 'core_top');
}
// Now, get all featurecodes.
//
$sub_heading_id = 'featurecodeadmin';
if (!$quietmode || isset($_REQUEST[$sub_heading_id])) {
    $featurecodes = featurecodes_getAllFeaturesDetailed(false);
    $sub_heading = dgettext($txtdom, $active_modules['featurecodeadmin']['name']);
    $module_select[$sub_heading_id] = $sub_heading;
    $html_txt_arr[$sub_heading] = "<div class=\"{$sub_heading_id}\"><table border=\"0\" width=\"75%\"><tr colspan=\"2\" width='100%'><td><br /><strong>" . sprintf("%s", $sub_heading) . "</strong></td></tr>\n";
    foreach ($featurecodes as $item) {
        $bind_domains = array();
        if (isset($bind_domains[$item['modulename']]) || extension_loaded('gettext') && is_dir("modules/" . $item['modulename'] . "/i18n")) {
            if (!isset($bind_domains[$item['modulename']])) {
                $bind_domains[$item['modulename']] = true;
                bindtextdomain($item['modulename'], "modules/" . $item['modulename'] . "/i18n");
                bind_textdomain_codeset($item['modulename'], 'utf8');
            }
        }
        $moduleena = $item['moduleenabled'] == 1 ? true : false;
        $featureena = $item['featureenabled'] == 1 ? true : false;
        $featurecodedefault = isset($item['defaultcode']) ? $item['defaultcode'] : '';