mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Destinations - List: Show all selected Actions, including Other actions.
This commit is contained in:
@@ -87,26 +87,42 @@
|
||||
$destination = new destinations;
|
||||
$destination_array = $destination->all('dialplan');
|
||||
|
||||
//add a function to return the action_name
|
||||
function action_name($destination_array, $detail_action) {
|
||||
$result = '';
|
||||
if (!empty($destination_array)) {
|
||||
foreach($destination_array as $group => $row) {
|
||||
if (!empty($row)) {
|
||||
foreach ($row as $key => $value) {
|
||||
if ($value == $detail_action) {
|
||||
//add multi-lingual support
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$group."/app_languages.php")) {
|
||||
$language2 = new text;
|
||||
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$group);
|
||||
$result = trim($text2['title-'.$group].' '.$key);
|
||||
//function to return the action names in the order defined
|
||||
function action_name($destination_array, $destination_actions) {
|
||||
$actions = [];
|
||||
if (!empty($destination_array) && is_array($destination_array)) {
|
||||
if (!empty($destination_actions) && is_array($destination_actions)) {
|
||||
foreach ($destination_actions as $destination_action) {
|
||||
if (!empty($destination_action)) {
|
||||
foreach ($destination_array as $group => $row) {
|
||||
if (!empty($row) && is_array($row)) {
|
||||
foreach ($row as $key => $value) {
|
||||
if ($destination_action == $value) {
|
||||
if ($group == 'other') {
|
||||
if (!isset($language2) && !isset($text2)) {
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplans/app_languages.php")) {
|
||||
$language2 = new text;
|
||||
$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/dialplans');
|
||||
}
|
||||
}
|
||||
$actions[] = trim($text2['title-other'].' › '.$text2['option-'.str_replace('_','_',$key)]);
|
||||
}
|
||||
else {
|
||||
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$group."/app_languages.php")) {
|
||||
$language3 = new text;
|
||||
$text3 = $language3->get($_SESSION['domain']['language']['code'], 'app/'.$group);
|
||||
$actions[] = trim($text3['title-'.$group].' › '.$key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $actions;
|
||||
}
|
||||
|
||||
//set the type
|
||||
@@ -302,19 +318,14 @@
|
||||
|
||||
if (!empty($destinations)) {
|
||||
$x = 0;
|
||||
foreach($destinations as $row) {
|
||||
|
||||
//define variables with an empty string
|
||||
$destination_app = '';
|
||||
$destination_data = '';
|
||||
foreach ($destinations as $row) {
|
||||
|
||||
//prepare the destination actions
|
||||
if (!empty($row['destination_actions'])) {
|
||||
$destination_actions = json_decode($row['destination_actions'], true);
|
||||
if (!empty($destination_actions)) {
|
||||
foreach ($destination_actions as $action) {
|
||||
$destination_app = $action['destination_app'];
|
||||
$destination_data = $action['destination_data'];
|
||||
$destination_app_data[] = $action['destination_app'].':'.$action['destination_data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -361,7 +372,8 @@
|
||||
echo " </td>\n";
|
||||
|
||||
if (!$show == "all") {
|
||||
echo " <td class='overflow' style='min-width: 125px;'>".action_name($destination_array, $destination_app.':'.$destination_data)." </td>\n";
|
||||
$actions = action_name($destination_array, $destination_app_data);
|
||||
echo " <td class='overflow' style='min-width: 125px;'>".(!empty($actions) ? implode(', ', $actions) : null)." </td>\n";
|
||||
}
|
||||
if (permission_exists("destination_context")) {
|
||||
echo " <td>".escape($row['destination_context'])." </td>\n";
|
||||
@@ -379,8 +391,8 @@
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
//unset the destination app and data
|
||||
unset($destination_app, $destination_data);
|
||||
//unset the destination app and data array
|
||||
unset($destination_app_data);
|
||||
|
||||
//increment the id
|
||||
$x++;
|
||||
@@ -399,4 +411,4 @@
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user