* Deletes selected voicemails and updates page
*
* @param $args
* Common arguments
*/
function navSubMenu($args) {
global $ASTERISK_VOICEMAIL_PATH;
global $ASTERISK_VOICEMAIL_FOLDERS;
// args
$m = getArgument($args,'m');
$q = getArgument($args,'q');
$current_folder = getArgument($args,'folder');
$context = $_SESSION['ari_user']['context'];
$extension = $_SESSION['ari_user']['extension'];
// check for voicemail enabled or admin
if ($_SESSION['ari_user']['voicemail_enabled']!=1 ||
$extension=='admin') {
return;
}
// make folder list
$paths = preg_split('/;/',$ASTERISK_VOICEMAIL_PATH);
$i = 0;
while ($ASTERISK_VOICEMAIL_FOLDERS[$i]) {
$f = $ASTERISK_VOICEMAIL_FOLDERS[$i]['folder'];
$fn = $ASTERISK_VOICEMAIL_FOLDERS[$i]['name'];
foreach($paths as $key => $path) {
$path = appendPath($path,$context);
$path = appendPath($path,$extension);
if (is_dir($path) && is_readable($path)) {
$dh = opendir($path);
while (false!== ($folder = readdir($dh))) {
$folder_path = AppendPath($path,$folder);
if($folder!="." && $folder!=".." &&
filetype($folder_path)=='dir') {
if ($f==$folder) {
// get message count
$indexes = $this->getVoicemailIndex($folder_path,$q,$order,$sort);
$record_count = 0;
$record_count += $this->getVoicemailCount($indexes);
// set current folder color
$class='';
if ($current_folder==$folder ||
($current_folder=='' && $ASTERISK_VOICEMAIL_FOLDERS[0]['folder']==$folder)) {
$class = "class='current'";
}
// add folder to list
$ret .= "<p><small><small>
<a " . $class . " href='" . $_SESSION['ARI_ROOT'] . "?m=Voicemail&q=" . urlencode($q) . "&folder=" . $f. "'>
" . $fn . " (" . $record_count . ")" . "
</a>
</small></small></p>";
if ($folder=="INBOX") {
shell_exec("/usr/local/bin/notify_vmail_extern.sh $context $extension $record_count");
}
}
}
}
}
}
$i++;
}
return $ret;