Show
Ignore:
Timestamp:
07/20/10 09:15:55 (3 years ago)
Author:
mbrevda
Message:

closes #4316; re #4284 - not sure what wrong, but I cant seem to figure it out

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • contributed_modules/modules/setcid/functions.inc.php

    r8276 r10165  
    11<?php 
    22 
    3 function setcid_destinations() { 
    4   global $module_page; 
    5   $extens = array(); 
    6  
    7   // it makes no sense to point at another callerid (and it can be an infinite loop) 
    8   if ($module_page == 'setcid') { 
    9     return false; 
    10   } 
    11  
    12   // return an associative array with destination and description 
    13   foreach (setcid_list() as $row) { 
    14     $extens[] = array('destination' => 'app-setcid,' . $row['cid_id'] . ',1', 'description' => $row['description']); 
    15   } 
    16   return $extens; 
    17 } 
    18  
    19 function setcid_getdest($exten) { 
    20   return array('app-setcid,'.$exten.',1'); 
    21 } 
    22  
    23 function setcid_getdestinfo($dest) { 
    24   global $active_modules; 
    25  
    26   if (substr(trim($dest),0,14) == 'app-setcid,') { 
    27     $exten = explode(',',$dest); 
    28     $exten = $exten[1]; 
    29     $thisexten = setcid_get($exten); 
    30     if (empty($thisexten)) { 
    31       return array(); 
    32     } else { 
    33       $type = isset($active_modules['setcid']['type'])?$active_modules['setcid']['type']:'setup'; 
    34       return array('description' => 'Callerid_name : '.$thisexten['description'], 
    35                    'edit_url' => 'config.php?display=setcid&type='.$type.'&extdisplay='.urlencode($exten), 
    36                   ); 
    37     } 
    38   } else { 
    39     return false; 
    40   } 
    41 } 
    423 
    434function setcid_get_config($engine) { 
     
    478      $ext->addInclude('from-internal-additional', 'app-setcid'); 
    489      foreach (setcid_list() as $row) { 
    49           $ext->add('app-setcid',$row['cid_id'], '', new ext_noop('Changing Callerid from ${CALLERID(all)} to CALLERID(name): '.$row['cid_name'].', CALLERID(num): '. $row['cid_num'].'; ('.$row['description'].')')); 
     10          $ext->add('app-setcid',$row['cid_id'], '', new ext_noop('('.$row['description'].') Changing cid to '.$row['cid_name'].' <'. $row['cid_num'].'>')); 
    5011          $ext->add('app-setcid',$row['cid_id'], '', new ext_set('CALLERID(name)', $row['cid_name'])); 
    5112          $ext->add('app-setcid',$row['cid_id'], '', new ext_set('CALLERID(num)', $row['cid_num'])); 
     
    6627  } 
    6728  return $results; 
     29} 
     30 
     31function setcid_destinations() { 
     32  global $module_page; 
     33  $extens = array(); 
     34 
     35  // it makes no sense to point at another callerid (and it can be an infinite loop) 
     36  if ($module_page == 'setcid') { 
     37    return false; 
     38  } 
     39 
     40  // return an associative array with destination and description 
     41  foreach (setcid_list() as $row) { 
     42    $extens[] = array('destination' => 'app-setcid,' . $row['cid_id'] . ',1', 'description' => $row['description']); 
     43  } 
     44  return $extens; 
    6845} 
    6946 
     
    11592} 
    11693 
     94 
     95 
     96//---------------------------------------------------------------------------- 
     97// Dynamic Destination Registry and Recordings Registry Functions 
     98 
    11799function setcid_check_destinations($dest=true) { 
    118100  global $active_modules; 
     
    122104    return $destlist; 
    123105  } 
    124   $sql = "SELECT cid_id, dest, description FROM setcid "; 
     106  $sql = "SELECT cid_id, description FROM setcid "; 
    125107  if ($dest !== true) { 
    126     $sql .= "WHERE dest in ('".implode("','",$dest)."')"; 
     108    $sql .= "WHERE cid_id in ('".implode("','",$dest)."')"; 
    127109  } 
    128110  $results = sql($sql,"getAll",DB_FETCHMODE_ASSOC); 
     
    131113 
    132114  foreach ($results as $result) { 
    133     $thisdest = $result['dest']; 
     115    $thisdest = $result['description']; 
    134116    $thisid   = $result['cid_id']; 
    135117    $destlist[] = array( 
    136118      'dest' => $thisdest, 
    137       'description' => 'CallerID Change: '.$result['description'], 
    138       'edit_url' => 'config.php?display=setcid&type='.$type.'&extdisplay='.urlencode($thisid), 
     119      'description' => 'Set CallerID: '.$result['description'], 
     120      'edit_url' => 'config.php?display=setcid&type=tool&id='.urlencode($thisid), 
    139121    ); 
    140122  } 
    141123  return $destlist; 
    142124} 
     125 
     126function setcid_getdest($id) { 
     127  return array("app-setcid,$id,1"); 
     128} 
     129 
     130function setcid_getdestinfo($dest) {dbug('$thiscid',$dest); 
     131  if (substr(trim($dest),0,10) == 'app-setcid,') { 
     132    $grp = explode(',',$dest); 
     133    $id = $grp[1]; 
     134    $thiscid = setcid_get($id); 
     135    dbug('$thiscid',$grp); 
     136    if (empty($thiscid)) { 
     137      return array(); 
     138    } else { 
     139      return array('description' => sprintf(_("Set CallerID %s: "),$thiscid['description']), 
     140                   'edit_url' => 'config.php?display=setcid&id='.urlencode($id), 
     141                  ); 
     142    } 
     143  } else { 
     144    return false; 
     145  } 
     146} 
     147 
    143148?> 
  • contributed_modules/modules/setcid/page.setcid.php

    r7298 r10165  
    7878 
    7979  echo "<h2>"._("Edit: ")."$description ($cid_name)"."</h2>"; 
     80 
     81    $usage_list = framework_display_destination_usage(setcid_getdest($extdisplay)); 
     82    if (!empty($usage_list)) { 
     83    ?> 
     84      <tr><td colspan="2"> 
     85      <a href="#" class="info"><?php echo $usage_list['text']?>:<span><?php echo $usage_list['tooltip']?></span></a> 
     86      </td></tr><br /><br /> 
     87    <?php 
     88    } 
     89 
    8090} else { 
    8191  echo "<h2>"._("Add CallerID")."</h2>"; 
     
    8595echo $helptext; 
    8696echo $row['dest']; 
     97 
     98 
     99 
    87100?> 
    88101 
     
    114127    </td>    
    115128 
    116     <?php 
    117     if ($extdisplay) { 
    118       $usage_list = framework_display_destination_usage(setcid_getdest($extdisplay)); 
    119       if (!empty($usage_list)) { 
    120       ?> 
    121         <tr><td colspan="2"> 
    122         <a href="#" class="info"><?php echo $usage_list['text']?>:<span><?php echo $usage_list['tooltip']?></span></a> 
    123         </td></tr> 
    124       <?php 
    125       } 
    126     } 
    127     ?> 
    128129  </tr> 
    129130</table>