Exemple #1
0
function delete_evaluation_userdata($userid){
    global $DB;
   $completedtmp = $DB->get_fieldset_sql('select id from {evaluation_completedtmp} where userid='.$userid.' OR employee_id='.$userid.' ');
   $completed = $DB->get_fieldset_sql('select id from {evaluation_completed} where userid='.$userid.' OR employee_id='.$userid.' ');
   foreach($completedtmp as $completetmp){
    evaluation_delete_completedtmp($completetmp);
   }
   foreach($completed as $complete){
    evaluation_delete_completed($complete);
   }
}
    'do_show' => 'edit',
    'return' => $return);
$mform->set_data($newformdata);
$formdata = $mform->get_data();

if ($mform->is_cancelled()) {
    if ($return == 'entriesanonym') {
        redirect('show_entries_anonym.php?id=' . $id . '&clid=' . $classid . '');
    } else {
        redirect('show_entries.php?id=' . $id . '&clid=' . $classid . '&do_show=showentries');
    }
}

if (isset($formdata->confirmdelete) AND $formdata->confirmdelete == 1) {
    if ($completed = $DB->get_record('evaluation_completed', array('id' => $completedid))) {
        evaluation_delete_completed($completedid);
        add_to_log($classid, 'evaluation', 'delete', 'view.php?id=' . $id, $evaluation->id
        );

        if ($return == 'entriesanonym') {
            redirect('show_entries_anonym.php?id=' . $id . '&clid=' . $classid . '');
        } else {
            redirect('show_entries.php?id=' . $id . '&clid=' . $classid . '&do_show=showentries');
        }
    }
}

/// Print the page header
$strevaluations = get_string("modulenameplural", "local_evaluations");
$strevaluation = get_string("modulename", "local_evaluations");