2012-05-31 Santiago Munin <burning1@gmail.com>
* include/functions_tags.php: Added a method to get all tags. * include/functions_api.php: Added de get_tags api call. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6391 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
ebaaaabd9f
commit
fa907a169d
|
@ -1,3 +1,8 @@
|
|||
2012-05-31 Santiago Munin <burning1@gmail.com>
|
||||
|
||||
* include/functions_tags.php: Added a method to get all tags.
|
||||
* include/functions_api.php: Added de get_tags api call.
|
||||
|
||||
2012-05-31 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* include/graphs/functions_pchart.php
|
||||
|
|
|
@ -5102,4 +5102,31 @@ function set_enable_module_alerts ($agent_name, $module_name, $thrash3, $thrash4
|
|||
returnData('string', array('type' => 'string', 'data' => "Correct alerts enable"));
|
||||
}
|
||||
|
||||
function get_tags($thrash1, $thrash2, $other, $returnType, $user_in_db) {
|
||||
if ($other['type'] == 'string') {
|
||||
if ($other['data'] != '') {
|
||||
returnError('error_parameter', 'Error in the parameters.');
|
||||
return;
|
||||
}
|
||||
else {//Default values
|
||||
$separator = ';';
|
||||
}
|
||||
}
|
||||
else if ($other['type'] == 'array') {
|
||||
$separator = $other['data'][0];
|
||||
}
|
||||
|
||||
$tags = tags_get_all_tags();
|
||||
|
||||
$data_tags = array();
|
||||
foreach ($tags as $id => $tag) {
|
||||
$data_tags[] = array($id, $tag);
|
||||
}
|
||||
|
||||
$data['type'] = 'array';
|
||||
$data['data'] = $data_tags;
|
||||
|
||||
returnData($returnType, $data, $separator);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -443,5 +443,24 @@ function tags_get_policy_module_tags ($id_policy_module){
|
|||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select all tags.
|
||||
*
|
||||
* @return mixed Array with tags.
|
||||
*/
|
||||
function tags_get_all_tags (){
|
||||
|
||||
$tags = db_get_all_fields_in_table('ttag', 'name');
|
||||
|
||||
if ($tags === false)
|
||||
return false;
|
||||
|
||||
$return = array();
|
||||
foreach ($tags as $id => $tag){
|
||||
$return[$id] = $tag['name'];
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue