function getAdditionalsDestinations() { require_once "apps/features_code/libs/paloSantoFeaturesCode.class.php"; require_once "apps/shortcut_apps/libs/paloSantoShortcutApps.class.php"; $pFC = new paloFeatureCodePBX($this->_DB, $this->domain); $arrFC = $pFC->getAllFeaturesCode($this->domain); $FCs = array(); $SAs = array(); foreach ($arrFC as $kfc => $fc) { if ($fc['estado'] == "enabled") { $FCs[] = array("label" => $fc['description'], "code" => isset($fc['code']) ? $fc['code'] : $fc['default_code']); } } asort($FCs); $pSA = new paloSantoShortcutApps($this->_DB, $this->domain); $arrSA = $pSA->getShortcutApps($this->domain); foreach ($arrSA as $ksa => $sa) { $SAs[] = array("label" => $sa['description'], "code" => $sa['exten']); } asort($SAs); return array("fc" => $FCs, "sa" => $SAs); }
function deleteShortcutApps($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials) { $error = ""; $continue = true; $success = false; $idShortcutApps = getParameter("id"); //obtenemos la informacion del ring_group por el id dado, sino existe el ring_group mostramos un mensaje de error if (!isset($idShortcutApps)) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("Invalid ShortcutApps ID")); return reportShortcutApps($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } $domain = getParameter('organization'); //este parametro solo es selecionable cuando es el superadmin quien hace la accion if ($credentials['userlevel'] != 'superadmin') { $domain = $credentials['domain']; } $pShortcutApps = new paloSantoShortcutApps($pDB, $domain); $arrShortcutApps = $pShortcutApps->getShortcutAppsById($idShortcutApps); if ($arrShortcutApps === false) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($pShortcutApps->errMsg)); return reportShortcutApps($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } else { if (count($arrShortcutApps) == 0) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("ShortcutApps doesn't exist")); return reportShortcutApps($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); } } $pDB->beginTransaction(); $success = $pShortcutApps->deleteShortcutApps($idShortcutApps); if ($success) { $pDB->commit(); } else { $pDB->rollBack(); } $error .= $pShortcutApps->errMsg; if ($success) { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", _tr("ShortcutApps was deleted successfully")); //mostramos el mensaje para crear los archivos de ocnfiguracion $pAstConf = new paloSantoASteriskConfig($pDB); $pAstConf->setReloadDialplan($domain, true); } else { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr($error)); } return reportShortcutApps($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); }