function change_visibility($data) { $panel = $data['panel']; ossim_valid($panel, OSS_DIGIT, 'illegal:' . _("Tab")); 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_visible() && $tab->is_default()) { $return['error'] = TRUE; $return['msg'] = _("Default tab cannot be disabled"); return $return; } $tab->set_visible(1 - intval($tab->is_visible())); $tab->save_db(); } catch (Exception $e) { $return['error'] = TRUE; $return['msg'] = $e->getMessage(); return $return; } $return['error'] = FALSE; $return['msg'] = _("Visibility Option Changed Successfully"); return $return; }
function change_disable_option($data) { $panel = $data['panel']; $user = $data['user']; ossim_valid($panel, OSS_DIGIT, 'illegal:' . _("Tab")); ossim_valid($user, OSS_USER, 'illegal:' . _("User")); if (ossim_error()) { $info_error = "Error: " . ossim_get_error(); ossim_clean_error(); $return['error'] = TRUE; $return['msg'] = $info_error; return $return; } if (!get_user_valid($user)) { $return['error'] = TRUE; $return['msg'] = _('You do not have permission to modify this tab'); return $return; } try { $tab = new Dashboard_tab($panel, $user); $tab->set_visible(1 - intval($tab->is_visible())); $tab->save_db(); } catch (Exception $e) { $return['error'] = TRUE; $return['msg'] = $e->getMessage(); return $return; } $return['error'] = FALSE; $return['msg'] = _("Visibility Option Changed Successfully"); return $return; }