Changeset 14225

Show
Ignore:
Timestamp:
07/02/12 19:55:53 (11 months ago)
Author:
GameGamer43
Message:

adds getters and setters for donotdisturb, not currently used anywhere but should be used in the future for things like ARI, etc

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.10/donotdisturb/functions.inc.php

    r13091 r14225  
    189189} 
    190190 
     191function donotdisturb_set($extension, $state = '') { 
     192  global $amp_conf, $astman; 
     193 
     194  if ($state != "") { 
     195          $r = $astman->database_put('DND', $extension, $state_value); 
     196                $value_opt = 'BUSY'; 
     197        } else { 
     198                $astman->database_del('DND', $extension); 
     199                $value_opt = 'NOT_INUSE'; 
     200        } 
     201         
     202  // This is a kludge but ... check if the is DND and if so do additional processing 
     203        // 
     204  if ($amp_conf['USEDEVSTATE']) { 
     205          $version = $amp_conf['ASTVERSION']; 
     206                if (version_compare($version, "1.6", "ge")) { 
     207                  $DEVSTATE = "DEVICE_STATE"; 
     208                } else { 
     209                        $DEVSTATE = "DEVSTATE"; 
     210                } 
     211 
     212                $devices = $astman->database_get("AMPUSER", $extension . "/device"); 
     213 
     214                $device_arr = explode('&', $devices); 
     215                foreach ($device_arr as $device) { 
     216                  $ret = $astman->set_global($amp_conf['AST_FUNC_DEVICE_STATE'] . "(Custom:DEVDND$device)", $value_opt); 
     217                } 
     218                // And also handle the state associated with the user 
     219                $ret = $astman->set_global($amp_conf['AST_FUNC_DEVICE_STATE'] . "(Custom:DND$extensions)", $value_opt); 
     220        } 
     221  return true; 
     222} 
     223 
     224function donotdisturb_get($extension = '') { 
     225  global $astman; 
     226                   
     227        $result = false; 
     228        if ($extension) { 
     229    $result = $astman->database_get("DND", $extension); 
     230  } else { 
     231    $result = $astman->database_show("DND");  
     232  }  
     233 
     234  return $result; 
     235} 
     236 
    191237?>