Changeset 9601

Show
Ignore:
Timestamp:
05/09/10 04:41:53 (3 years ago)
Author:
mbrevda
Message:

re #4147; add intuition functions

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.8/directory/functions.inc.php

    r9598 r9601  
    11<?php 
     2 
     3function 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 
    230function directory_configpageload() { 
    331  global $currentcomponent,$display; 
     
    115143} 
    116144 
     145function directory_getdest($exten) { 
     146  return array("directory,$exten,1"); 
     147} 
     148 
     149function 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 
    117166function directory_get_dir_entries($id){ 
    118167  global $db; 
     
    259308} 
    260309 
     310function 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 
    261328function directory_save_dir_entries($id,$entries){ 
    262329  global $db;