| 1 |
<?PHP |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
function bulkdialpatterns_hook_core($viewing_itemid, $target_menuid) { |
|---|
| 19 |
global $db; |
|---|
| 20 |
if ($target_menuid == 'routing') { |
|---|
| 21 |
$html = '<tr><td colspan="2"><h5>'; |
|---|
| 22 |
$html .= _("Bulk Dial Patterns"); |
|---|
| 23 |
$html .= '<hr></h5></td></tr>'; |
|---|
| 24 |
$html .= '<tr>'; |
|---|
| 25 |
$html .= '<td><a href="#" class="info">'; |
|---|
| 26 |
$html .= _("Source").'<span>'._("Each Pattern Should Be Entered On A New Line").'.</span></a>:</td>'; |
|---|
| 27 |
$html .= '<td><textarea name="bulk_patterns" rows="10" cols="40">'; |
|---|
| 28 |
if(isset($_REQUEST['extdisplay'])) { |
|---|
| 29 |
$sql = 'SELECT `match_pattern_pass` FROM `outbound_route_patterns` WHERE `route_id` = '. $_REQUEST['extdisplay']; |
|---|
| 30 |
$result = $db->query($sql); |
|---|
| 31 |
while($row =& $result->fetchRow(DB_FETCHMODE_ASSOC)) { |
|---|
| 32 |
$html .= $row['match_pattern_pass']."\n"; |
|---|
| 33 |
} |
|---|
| 34 |
|
|---|
| 35 |
} |
|---|
| 36 |
$html .= '</textarea></td></tr>'; |
|---|
| 37 |
return $html; |
|---|
| 38 |
} |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
function bulkdialpatterns_hookProcess_core($viewing_itemid, $request) { |
|---|
| 42 |
global $db; |
|---|
| 43 |
if (($request['display'] == 'routing') && (isset($request['bulk_patterns']))) { |
|---|
| 44 |
$_POST['pattern_pass'] = ""; |
|---|
| 45 |
$data = explode("\n",$request['bulk_patterns']); |
|---|
| 46 |
$_POST['pattern_pass'] = $data; |
|---|
| 47 |
$count = count($data); |
|---|
| 48 |
$_POST['prepend_digit'] = array_fill(0, $count, ''); |
|---|
| 49 |
$_POST['pattern_prefix'] = array_fill(0, $count, ''); |
|---|
| 50 |
$_POST['match_cid'] = array_fill(0, $count, ''); |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
$sql = 'DELETE FROM `outbound_route_patterns` WHERE `outbound_route_patterns`.`route_id` = '.$_REQUEST['extdisplay']; |
|---|
| 54 |
$db->query($sql); |
|---|
| 55 |
|
|---|
| 56 |
foreach($data as $value){ |
|---|
| 57 |
$sql = "INSERT INTO outbound_route_patterns (route_id, match_pattern_pass) VALUES ('".$_REQUEST['extdisplay']."','".$value."')"; |
|---|
| 58 |
$db->query($sql); |
|---|
| 59 |
} |
|---|
| 60 |
*/ |
|---|
| 61 |
} |
|---|
| 62 |
} |
|---|
| 63 |
?> |
|---|