<?php
class AlertHelper
{
	static public function getAlertTagNames()
	{
	  if(paramdeep('alerts','search','dropdown_show_only_existent_tags'))
	  {
	    $tagNames = array();
	    foreach(query('SELECT distinct description AS d FROM event_reporting ORDER BY description',array(),false,false) as $x)
	      $tagNames[] = $x['d'];
	  }
	  else 
	  {
  		$tagNames = Behavior::getAlarmTagNames();
	  }
		
		$res = array();
				
		foreach($tagNames as $tName)
			$res[] = array('key' => $tName, 'value' => t($tName));
		
  	$res_val = array();
  	foreach($res as $rn)
  		$res_val[] = $rn['value']; 
  	
  	array_multisort($res_val, SORT_ASC, $res);
				
		return $res;
	}
}