Example #1
0
function reload_asset_group_assets($conn, $filters, $data = array())
{
    //Default values to be returned
    $return['error'] = FALSE;
    $return['msg'] = '';
    $force = intval($data['force']);
    //If we reload, this means the extra filters window has been closed, so we delete the copy of the object
    Filter_list::delete_filter_copy();
    //Getting the number of filters to be applied
    $cont = $filters->get_num_filter_added();
    //Trying to achieve the action, in case of error an exception will arise
    try {
        //If there are no filters, this means we don't filter by any criteria
        if ($cont == 0) {
            //Cleaning the table user_host_filter
            $filters->empty_filter_search($conn);
        } else {
            //Force to execute the procedure to fill the table user_host_filter
            if ($force) {
                $filters->force_reload();
            }
            //Executing the procedure to populate the table the table user_host_filter
            $filters->apply_filter_search($conn);
        }
    } catch (Exception $e) {
        $return['error'] = TRUE;
        $return['msg'] = $e->getMessage();
    }
    return $return;
}