Changeset 10165 for contributed_modules
- Timestamp:
- 07/20/10 09:15:55 (3 years ago)
- Files:
-
- contributed_modules/modules/setcid/functions.inc.php (modified) (6 diffs)
- contributed_modules/modules/setcid/page.setcid.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
contributed_modules/modules/setcid/functions.inc.php
r8276 r10165 1 1 <?php 2 2 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 description13 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 }42 3 43 4 function setcid_get_config($engine) { … … 47 8 $ext->addInclude('from-internal-additional', 'app-setcid'); 48 9 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'].'>')); 50 11 $ext->add('app-setcid',$row['cid_id'], '', new ext_set('CALLERID(name)', $row['cid_name'])); 51 12 $ext->add('app-setcid',$row['cid_id'], '', new ext_set('CALLERID(num)', $row['cid_num'])); … … 66 27 } 67 28 return $results; 29 } 30 31 function 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; 68 45 } 69 46 … … 115 92 } 116 93 94 95 96 //---------------------------------------------------------------------------- 97 // Dynamic Destination Registry and Recordings Registry Functions 98 117 99 function setcid_check_destinations($dest=true) { 118 100 global $active_modules; … … 122 104 return $destlist; 123 105 } 124 $sql = "SELECT cid_id, des t, description FROM setcid ";106 $sql = "SELECT cid_id, description FROM setcid "; 125 107 if ($dest !== true) { 126 $sql .= "WHERE destin ('".implode("','",$dest)."')";108 $sql .= "WHERE cid_id in ('".implode("','",$dest)."')"; 127 109 } 128 110 $results = sql($sql,"getAll",DB_FETCHMODE_ASSOC); … … 131 113 132 114 foreach ($results as $result) { 133 $thisdest = $result['des t'];115 $thisdest = $result['description']; 134 116 $thisid = $result['cid_id']; 135 117 $destlist[] = array( 136 118 '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), 139 121 ); 140 122 } 141 123 return $destlist; 142 124 } 125 126 function setcid_getdest($id) { 127 return array("app-setcid,$id,1"); 128 } 129 130 function 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 143 148 ?> contributed_modules/modules/setcid/page.setcid.php
r7298 r10165 78 78 79 79 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 80 90 } else { 81 91 echo "<h2>"._("Add CallerID")."</h2>"; … … 85 95 echo $helptext; 86 96 echo $row['dest']; 97 98 99 87 100 ?> 88 101 … … 114 127 </td> 115 128 116 <?php117 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 <?php125 }126 }127 ?>128 129 </tr> 129 130 </table>
