Exemplo n.º 1
0
function addedit_university($aggr)
{
    $column_labels = array('ID', 'University name', 'Country', 'Erasmus code');
    $column_types = array('RDONLY', 'text', '*', 'text');
    $column_seldata = db_countries();
    show_edit_form($column_labels, $aggr, $column_types, array($column_seldata));
}
Exemplo n.º 2
0
             message('error', 'Invalid value for inserted rows count!');
             $err = TRUE;
         }
         if ($err) {
             show_edit_form($vals);
         } else {
             $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
             message('notice', 'Configuration changed');
             $show_info = TRUE;
         }
     } else {
         $show_info = TRUE;
     }
     break;
 case 'lay_edit':
     show_edit_form($_SESSION['configuration']);
     break;
 case 'lay_window_real':
     if (isset($_POST['submit_save'])) {
         $vals = grab_values('EditInWindow:bool;QueryWindowHeight:int;QueryWindowWidth:int;QueryWindowDefTab');
         $err = FALSE;
         if (isset($vals['QueryWindowWidth']) && $vals['QueryWindowWidth'] < 1) {
             message('error', 'Invalid value for query window width!');
             $err = TRUE;
         }
         if (isset($vals['QueryWindowHeight']) && $vals['QueryWindowHeight'] < 1) {
             message('error', 'Invalid value for query window height');
             $err = TRUE;
         }
         if ($err) {
             show_window_form($vals);
Exemplo n.º 3
0
             message('error', 'Invalid value for inserted rows count!');
             $err = TRUE;
         }
         if ($err) {
             show_edit_form($vals);
         } else {
             $configuration = array_merge($configuration, $vals);
             message('notice', 'Configuration changed');
             $show_info = TRUE;
         }
     } else {
         $show_info = TRUE;
     }
     break;
 case 'lay_edit':
     show_edit_form($configuration);
     break;
 case 'lay_window_real':
     if (isset($_POST['submit_save'])) {
         $vals = grab_values('EditInWindow:bool;QueryWindowHeight:int;QueryWindowWidth:int;QueryWindowDefTab');
         $err = FALSE;
         if (isset($vals['QueryWindowWidth']) && $vals['QueryWindowWidth'] < 1) {
             message('error', 'Invalid value for query window width!');
             $err = TRUE;
         }
         if (isset($vals['QueryWindowHeight']) && $vals['QueryWindowHeight'] < 1) {
             message('error', 'Invalid value for query window height');
             $err = TRUE;
         }
         if ($err) {
             show_window_form($vals);
Exemplo n.º 4
0
function addedit_subject_area($sa)
{
    $column_labels = array('ID', 'Subject area CODE', 'Subject area NAME');
    $column_types = array('RDONLY', 'text', 'text');
    show_edit_form($column_labels, $sa, $column_types, NULL);
}
Exemplo n.º 5
0
function addedit_travel($tv)
{
    $column_labels = array('ID', 'Level', 'Agreement', 'Date FROM (Y-m-d)', 'Date TO (Y-m-d)', 'Student', 'Study program', 'Semester', 'Language:', 'Has level', 'Expected level', 'Soc.stip.', 'Handicap', 'Files', 'Courses', 'Notes', 'Cancelled', 'Year');
    $column_types = array('RDONLY', '*', '*', 'date', 'date', '*', '*', '*', '*', 'text', 'text', 'checkbox', 'checkbox', 'files', 'RDONLY', '100text', 'checkbox', '*');
    $aggr = db_retrieve_agreements_data(TRUE);
    $stds = db_students(TRUE);
    $sps = db_study_programs(TRUE);
    $langs = db_languages();
    //$cors = db_courses_for_an_exchange($tv[0]);
    $levels = array(array(1, "Bachelor"), array(2, "Master"), array(3, "Doctoral"));
    $years = selection_of_years();
    show_edit_form($column_labels, $tv, $column_types, array($levels, $aggr, $stds, $sps, array(array('W', 'winter'), array('S', 'summer')), $langs, $years));
}
Exemplo n.º 6
0
function do_perform_edit()
{
    // Check XSRF token
    if ($_SESSION['xsrf_token'] != $_POST['xsrf_token']) {
        trigger_error('Do_Edit: XSRF token invalid', E_USER_ERROR);
    }
    // Check if ID is valid
    $query = 'SELECT name FROM tests WHERE test_id="' . mysqli_real_escape_string(DB::get(), $_GET['ID']) . '" LIMIT 1';
    $result = DB::queryRaw($query);
    // If User ID isn't valid, show an error page
    if (mysqli_num_rows($result) != 1) {
        show_test_not_found_page();
    }
    // at the end, this function die()s.
    // Validate the entered information:
    //
    // Check name length
    $name = mysqli_real_escape_string(DB::get(), htmlentities($_POST['name']));
    if (strlen($_POST['name']) > 20) {
        show_edit_form('Name is too long');
        return;
    }
    if ($name == '') {
        show_edit_form('Name can\'t be blank');
        return;
    }
    // Check date
    $date = strtotime($_POST['date']);
    if ($date == false) {
        show_edit_form('Huh? I can\'t understand that date');
        return;
    }
    // Check total points
    $total_points = (int) $_POST['total_points'];
    if ($total_points <= 0) {
        show_edit_form('Too few points');
        return;
    }
    // ** INFORMATION VALIDATED AT THIS POINT **
    $query = 'UPDATE tests SET name="' . $name . '", date="' . date('Y-m-d', $date) . '", total_points="' . $total_points . '" WHERE test_id="' . mysqli_real_escape_string(DB::get(), $_GET['ID']) . '" LIMIT 1';
    DB::queryRaw($query);
    redirect();
}
Exemplo n.º 7
0
function addedit_student($st)
{
    $column_labels = array('ID', 'First name', 'Middle names', 'Last name', 'Born', 'Student ID', 'Gender', 'Citizenship', 'E-mail', 'Study programs', 'Year 1st participated');
    $column_types = array('RDONLY', 'text', 'text', 'text', 'date', 'text', '*', '*', 'text', '+', '*');
    $studprogs = db_study_programs(TRUE);
    $cntries = db_countries();
    $years = selection_of_years();
    show_edit_form($column_labels, $st, $column_types, array(array(array('M', 'male'), array('F', 'female')), $cntries, $studprogs, $years));
}
Exemplo n.º 8
0
function addedit_travel_course($tc)
{
    $column_labels = array('ID', 'Foreign course code', 'Foreign course name', 'Credits', 'Grade', 'Course type');
    $column_types = array('RDONLY', 'text', '100text', 'number', 'text', '*');
    show_edit_form($column_labels, $tc, $column_types, array(array(array('c', 'compulsory'), array('e', 'elective'), array('o', 'optional'))));
}
Exemplo n.º 9
0
function addedit_fmfi_course($fc)
{
    $column_labels = array('ID', 'Course CODE', 'Course NAME', 'Credits');
    $column_types = array('RDONLY', 'text', '100text', 'number');
    show_edit_form($column_labels, $fc, $column_types, NULL);
}
Exemplo n.º 10
0
function addedit_travel_course($tc)
{
    $column_labels = array('ID', 'Associated travel', 'Foreign course code', 'Foreign course name', 'Credits', 'Grade', 'Course type', 'FMFI course');
    $column_types = array('RDONLY', '*', 'text', 'text', 'number', 'text', '*', '*');
    show_edit_form($column_labels, $tc, $column_types, array(db_travels_list(), array(array('c', 'compulsory'), array('e', 'elective'), array('o', 'optional')), db_fmfi_courses(TRUE)));
}
Exemplo n.º 11
0
 *                  Network Operations Center, University of Athens,
 *                  Panepistimiopolis Ilissia, 15784, Athens, Greece
 *                  e-mail: info@openeclass.org
 * ======================================================================== */
$require_current_course = true;
require_once '../../include/baseTheme.php';
require_once 'work_functions.php';
require_once 'modules/group/group_functions.php';
$pageName = $m['grades'];
if ($is_editor && isset($_GET['assignment']) && isset($_GET['submission'])) {
    $as_id = intval($_GET['assignment']);
    $sub_id = intval($_GET['submission']);
    $assign = get_assignment_details($as_id);
    $navigation[] = array("url" => "index.php?course={$course_code}", "name" => $langWorks);
    $navigation[] = array("url" => "index.php?course={$course_code}&amp;id={$as_id}", "name" => q($assign->title));
    show_edit_form($as_id, $sub_id, $assign);
    draw($tool_content, 2);
} else {
    redirect_to_home_page('modules/work/index.php?course=' . $course_code);
}
// Returns an array of the details of assignment $id
function get_assignment_details($id)
{
    global $course_id;
    return Database::get()->querySingle("SELECT * FROM assignment WHERE course_id = ?d AND id = ?d", $course_id, $id);
}
// Show to professor details of a student's submission and allow editing of fields
// $assign contains an array with the assignment's details
function show_edit_form($id, $sid, $assign)
{
    global $m, $langGradeOk, $tool_content, $course_code;
Exemplo n.º 12
0
function addedit_fmfi_travel_course($tc)
{
    $column_labels = array('ID', 'FMFI course', 'Grade');
    $column_types = array('RDONLY', '*', 'text');
    show_edit_form($column_labels, $tc, $column_types, array(db_fmfi_courses(TRUE)));
}
Exemplo n.º 13
0
function addedit_study_program($sp)
{
    $column_labels = array('ID', 'Study program CODE', 'Study program NAME');
    $column_types = array('RDONLY', 'text', 'text');
    show_edit_form($column_labels, $sp, $column_types, NULL);
}
Exemplo n.º 14
0
function include_forums_text()
{
    global $orkTime, $cat;
    // Get stored session id from a user account
    if (isset($GLOBALS["objSrcUser"])) {
        $objSrcUser =& $GLOBALS["objSrcUser"];
        $strSession = $objSrcUser->get_user_info(SESSION);
    } elseif ($cat == 'main') {
        $strSession = 'guest';
        // Allow people without a stored session to read
        echo '<h2 style="margin: 15px auto; text-align: center;"><img src="' . HOST_PICS . 'first_forum.gif" alt="Forums" /></h2>';
    }
    // Show Links
    $set = 'news';
    if (isset($_GET['set'])) {
        $set = $_GET['set'];
    }
    echo get_forum_links($set);
    include_once 'inc/functions/forums.php';
    $posttype = select_forum($set, TRUE);
    session_start();
    $session = session_id();
    if ($strSession == $session || $strSession == 'guest') {
        $action = '';
        if (isset($_GET['action'])) {
            $action = $_GET['action'];
        }
        switch ($action) {
            case "moderation":
                if (mod_access($posttype) == 'yes') {
                    if (isset($_POST['posts'])) {
                        $posts = $_POST['posts'];
                        $postcount = count($posts);
                        $ids = "";
                        for ($i = 0; $i < $postcount; $i++) {
                            $ids .= intval($posts[$i]);
                            if ($i != $postcount - 1) {
                                $ids .= ",";
                            }
                        }
                        forum_moderation($objSrcUser, $posttype, $ids);
                    } else {
                        echo '<div class="center">' . 'Please select a topic or post first.' . '</div>';
                    }
                }
                break;
            case "edit":
                record_an_edit($posttype, $set, intval($_POST['postid']), intval($_POST['edit_id']), $orkTime);
                break;
        }
        $mode = 'threads';
        if (isset($_GET['mode'])) {
            $mode = $_GET['mode'];
        }
        switch ($mode) {
            case "threads":
                if (isset($_GET['action']) && $_GET['action'] == "post") {
                    record_a_thread_post($posttype, $set, $_POST['title'], $_POST['text']);
                }
                show_threads($posttype, $set);
                break;
            case "posts":
                if (isset($_GET['action']) && $_GET['action'] == "post") {
                    record_a_post($posttype, $set, intval($_POST['postid']), $_POST['text']);
                }
                show_posts($posttype, $set, intval($_GET['postid']), intval($_GET['start']), intval($_GET['finish']));
                break;
            case "edit":
                show_edit_form($posttype, $set, intval($_GET['postid']), intval($_GET['edit_id']));
                break;
        }
    } else {
        echo '<div class="center">' . 'Sorry, we lost your session. You need to log in again to see ' . 'the forums.' . '</div>';
    }
}
Exemplo n.º 15
0
function addedit_agreement($aggr)
{
    $column_labels = array('ID', 'University (country)', 'Valid FROM (YYYY/YYYY)', 'Valid TO (YYYY/YYYY)', 'Coordinator', 'Subject Area', 'BC', 'Mgr', 'PhD', '# of students', 'Files');
    $column_types = array('RDONLY', '*', 'text', 'text', 'text', '*', 'checkbox', 'checkbox', 'checkbox', 'number', 'files');
    $unis = db_universities_with_countries();
    $areas = db_subject_areas(TRUE);
    show_edit_form($column_labels, $aggr, $column_types, array($unis, $areas));
}