Added function 'local_webhooks_get_list_events_for_service'
Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
		
							
								
								
									
										21
									
								
								locallib.php
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								locallib.php
									
									
									
									
									
								
							@@ -71,6 +71,27 @@ function local_webhooks_cache_reset() {
 | 
			
		||||
    return $cache->purge();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Forms a list of events for the specified service.
 | 
			
		||||
 *
 | 
			
		||||
 * @param  number $serviceid
 | 
			
		||||
 * @return array
 | 
			
		||||
 */
 | 
			
		||||
function local_webhooks_get_list_events_for_service($serviceid) {
 | 
			
		||||
    global $DB;
 | 
			
		||||
 | 
			
		||||
    $rs = $DB->get_recordset(LOCAL_WEBHOOKS_TABLE_EVENTS, array("serviceid" => $serviceid), "id", "*", 0, 0);
 | 
			
		||||
    $events = array();
 | 
			
		||||
 | 
			
		||||
    foreach ($rs as $record) {
 | 
			
		||||
        $events[$record->name] = $record->status;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $rs->close();
 | 
			
		||||
 | 
			
		||||
    return $events;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Adds all events to the database.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user