Ejemplo n.º 1
0
function showAdminPage($show_action, $show_last = FALSE)
{
    //TODO check for the role of current user
    echo '<h2>' . t('All the groups and persons') . '</h2>';
    $data = array();
    $data[] = array(1, 'Institutes', 'list', _INSTITUTE_GROUP);
    $data[] = array(1, 'Organisations', 'list', _ORGANISATION_GROUP);
    $data[] = array(1, 'Tutors', 'list', _SUPERVISOR_TYPE);
    $data[] = array(1, 'Mentors', 'list', _MENTOR_TYPE);
    $data[] = array(1, 'Students', 'list', _STUDENT_TYPE);
    $data[] = array(1, 'Organisation Admins', 'list', _ORGADMIN_TYPE);
    $data[] = array(1, 'Institute Admins', 'list', _INSTADMIN_TYPE);
    $nr_tabs = count($data);
    echo renderTabs($nr_tabs, null, 'admin_page-', '', $data, 0, TRUE, renderOrganisations(_INSTITUTE_GROUP, '', 'all', 'admin_page-1'));
    $s = '';
    for ($i = 1; $i <= $nr_tabs; $i++) {
        $s .= $i > 1 ? ', ' : '';
        $s .= "'admin_page-{$i}'";
    }
    ?>
	<script type="text/javascript">
       activatetabs('tab_', [<?php 
    echo $s;
    ?>
]);
    </script><?php 
}
include 'include.php';
//Includes the necessary bootstrapping and the ajax functions
include _VALS_SOC_ROOT . '/includes/classes/Project.php';
include _VALS_SOC_ROOT . '/includes/functions/render_functions.php';
include _VALS_SOC_ROOT . '/includes/pages/projects.php';
include _VALS_SOC_ROOT . '/includes/pages/administration.php';
//return result depending on action parameter
switch ($_GET['action']) {
    case 'list':
        $type = altSubValue($_POST, 'type');
        switch ($type) {
            case _INSTITUTE_GROUP:
            case _ORGANISATION_GROUP:
            case _PROJECT_OBJ:
            case _STUDENT_GROUP:
                echo renderOrganisations($type, '', 'all', $_POST['target']);
                break;
            case _SUPERVISOR_TYPE:
            case _STUDENT_TYPE:
            case _MENTOR_TYPE:
            case _ORGADMIN_TYPE:
            case _INSTADMIN_TYPE:
            case 'administer':
                echo renderUsers($type, '', 'all', '', TRUE);
                break;
            default:
                //echo tt('No such type: %1$s', $type);
                showError(tt('No such type: %1$s', $type));
        }
        break;
    case 'add':