Пример #1
0
function set_layout($data)
{
    $panel = $data['panel'];
    $new_cols = $data['new_col'];
    ossim_valid($panel, OSS_DIGIT, 'illegal:' . _("Panel"));
    ossim_valid($new_cols, OSS_DIGIT, 'illegal:' . _("Num Column"));
    if (ossim_error()) {
        $info_error = "Error: " . ossim_get_error();
        ossim_clean_error();
        $return['error'] = TRUE;
        $return['msg'] = $info_error;
        return $return;
    }
    list($user, $edit) = get_tabs_data_aux();
    if (!$edit) {
        $return['error'] = TRUE;
        $return['msg'] = _("You have to be in edit mode to achieve this action");
        return $return;
    }
    try {
        $tab = new Dashboard_tab($panel);
        if ($tab->is_locked()) {
            $return['error'] = TRUE;
            $return['msg'] = _("You cannot modify this tab");
            return $return;
        }
        Dashboard_widget::reorder_widgets_position($tab, $new_cols);
        $tab->set_layout($new_cols);
        $tab->save_db();
    } catch (Exception $e) {
        $return['error'] = TRUE;
        $return['msg'] = $e->getMessage();
        return $return;
    }
    $return['error'] = FALSE;
    $return['msg'] = _("New Column Configuration Saved");
    return $return;
}