| | 2 | |
|---|
| | 3 | function directory_check_destinations($dest=true) { |
|---|
| | 4 | global $active_modules; |
|---|
| | 5 | |
|---|
| | 6 | $destlist = array(); |
|---|
| | 7 | if (is_array($dest) && empty($dest)) { |
|---|
| | 8 | return $destlist; |
|---|
| | 9 | } |
|---|
| | 10 | $sql = "SELECT id, name FROM directory_details "; |
|---|
| | 11 | if ($dest !== true) { |
|---|
| | 12 | $sql .= "WHERE postdest in ('".implode("','",$dest)."')"; |
|---|
| | 13 | } |
|---|
| | 14 | $results = sql($sql,"getAll",DB_FETCHMODE_ASSOC); |
|---|
| | 15 | |
|---|
| | 16 | //$type = isset($active_modules['announcement']['type'])?$active_modules['announcement']['type']:'setup'; |
|---|
| | 17 | |
|---|
| | 18 | foreach ($results as $result) { |
|---|
| | 19 | $thisdest = $result['postdest']; |
|---|
| | 20 | $thisid = $result['grpnum']; |
|---|
| | 21 | $destlist[] = array( |
|---|
| | 22 | 'dest' => $thisdest, |
|---|
| | 23 | 'description' => sprintf(_("Ring Group: %s (%s)"),$result['description'],$thisid), |
|---|
| | 24 | 'edit_url' => 'config.php?display=ringgroups&extdisplay=GRP-'.urlencode($thisid), |
|---|
| | 25 | ); |
|---|
| | 26 | } |
|---|
| | 27 | return $destlist; |
|---|
| | 28 | } |
|---|
| | 29 | |
|---|
| | 145 | function directory_getdest($exten) { |
|---|
| | 146 | return array("directory,$exten,1"); |
|---|
| | 147 | } |
|---|
| | 148 | |
|---|
| | 149 | function directory_getdestinfo($dest) { |
|---|
| | 150 | if (substr(trim($dest),0,10) == 'directory,') { |
|---|
| | 151 | $grp = explode(',',$dest); |
|---|
| | 152 | $id = $grp[1]; |
|---|
| | 153 | $thisdir = directory_get_dir_details($id); |
|---|
| | 154 | if (empty($thisdir)) { |
|---|
| | 155 | return array(); |
|---|
| | 156 | } else { |
|---|
| | 157 | return array('description' => sprintf(_("Directory %s: "),($thisdir['dirname']?$thisdir['dirname']:$id)), |
|---|
| | 158 | 'edit_url' => 'config.php?display=directory&id='.urlencode($id), |
|---|
| | 159 | ); |
|---|
| | 160 | } |
|---|
| | 161 | } else { |
|---|
| | 162 | return false; |
|---|
| | 163 | } |
|---|
| | 164 | } |
|---|
| | 165 | |
|---|
| | 310 | function directory_recordings_usage($recording_id) { |
|---|
| | 311 | global $active_modules; |
|---|
| | 312 | |
|---|
| | 313 | $results = sql("SELECT `id`, `dirname` FROM `directory_details` WHERE `announcement` = '$recording_id' OR `valid_recording` = '$recording_id' OR `repeat_recording` = '$recording_id' OR `invalid_recording ` = '$recording_id'","getAll",DB_FETCHMODE_ASSOC); |
|---|
| | 314 | if (empty($results)) { |
|---|
| | 315 | return array(); |
|---|
| | 316 | } else { |
|---|
| | 317 | //$type = isset($active_modules['ivr']['type'])?$active_modules['ivr']['type']:'setup'; |
|---|
| | 318 | foreach ($results as $result) { |
|---|
| | 319 | $usage_arr[] = array( |
|---|
| | 320 | 'url_query' => 'config.php?display=directory&id='.urlencode($result['i']), |
|---|
| | 321 | 'description' => sprintf(_("Directory: %s"),($result['dirname']?$result['dirname']:$result['id'])), |
|---|
| | 322 | ); |
|---|
| | 323 | } |
|---|
| | 324 | return $usage_arr; |
|---|
| | 325 | } |
|---|
| | 326 | } |
|---|
| | 327 | |
|---|