/** * Add Medias for User * * <code> * $media_data = array( * *string 'userid => 'User ID', * array 'medias' => array( * string 'mediatypeid' => 'media type ID', * string 'sendto' => 'address', * int 'severity' => 'severity', * int 'active' => 'active', * string 'period' => 'period', * ) * ); * </code> * * @static * @param array $media_data * @return boolean */ public static function addMedia($media_data) { $result = false; $userid = $media_data['userid']; foreach ($media_data['medias'] as $media) { $result = add_media($userid, $media['mediatypeid'], $media['sendto'], $media['severity'], $media['active'], $media['period']); if (!$result) { break; } } if ($result) { return true; } else { self::$error = array('error' => ZBX_API_ERROR_INTERNAL, 'data' => 'Internal zabbix error'); return false; } }
break; case 'rename_media_group': /** Đổi tên nhóm media */ $args = array(); $args['group_name'] = hm_post('group_name'); $args['group_id'] = hm_post('group_id', 0); echo rename_media_group($args); break; case 'del_media_group': /** Xóa nhóm media */ $args = array(); $args['group_id'] = hm_post('group_id', 0); echo del_media_group($args); break; case 'add_media': /** Upload media */ echo add_media(); break; case 'delete_media': /** Delete media */ delete_media(hm_post('id')); break; case 'multi_delete_media': /** Delete multi media */ multi_delete_media(hm_post('ids')); break; case 'thumbnail_media': /** Trả về link thumbnail của file */ echo thumbnail_media(hm_post('id')); break; }