コード例 #1
0
<?php

include "../app/inc.php";
include "../app/class/classmanager.php";
if (isset($_POST['class_id'])) {
    if (isset($_POST['class_id']) && trim($_POST['class_id']) !== '') {
        //if class name is set and not empty
        delete_class($_POST['class_id']);
        add_success("Deleted Class");
        header('location: classview.php');
        die;
    }
    add_error("No Comprende");
    header('location: classview.php');
    die;
}
コード例 #2
0
ファイル: class.lib.php プロジェクト: rhertzog/lcs
/**
 * This function delete all classes,
 * remove link between courses and classes
 * remove link between classes and users
 * delete related users from related courses
 *
 */
function delete_all_classes()
{
    $tbl = claro_sql_get_main_tbl();
    $sql = "\n        SELECT id FROM `" . $tbl['class'] . "` ORDER BY class_level DESC";
    $searchResultList = claro_sql_query_fetch_all($sql);
    foreach ($searchResultList as $thisClass) {
        $classId = $thisClass['id'];
        // find all the students enrolled in that class
        $sql2 = "\n            SELECT user_id from `" . $tbl['rel_class_user'] . "`\n            WHERE class_id = '" . claro_sql_escape($classId) . "'";
        $thisClassUser = claro_sql_query_fetch_all($sql2);
        // Find all the courses to whom the class is enrolled
        $sql2 = "\n            SELECT courseId\n            FROM `" . $tbl['rel_course_class'] . "`\n            WHERE classId = '" . claro_sql_escape($classId) . "'";
        $searchResultList2 = claro_sql_query_fetch_all($sql2);
        foreach ($searchResultList2 as $thisCourse) {
            $courseCode = $thisCourse['courseId'];
            foreach ($thisClassUser as $thisUser) {
                $user_id = $thisUser['user_id'];
                if (!user_remove_from_course($user_id, $courseCode, false, false, $classId)) {
                    return claro_failure::set_failure('PROBLEM_WITH_COURSE_UNSUSCRIBTION');
                    //TODO : ameliorer la detection d'erreur
                }
            }
        }
        delete_class($classId);
    }
    return true;
}
コード例 #3
0
ファイル: admin_class.php プロジェクト: rhertzog/lcs
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
// Javascript
JavascriptLanguage::getInstance()->addLangVar('Are you sure to delete %name ?');
JavascriptLoader::getInstance()->load('admin');
JavascriptLoader::getInstance()->load('admin_users');
//-------------------------------------------------------
// Main section
//-------------------------------------------------------
$cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null;
$form_data['class_id'] = isset($_REQUEST['class_id']) ? (int) $_REQUEST['class_id'] : 0;
$form_data['class_name'] = isset($_REQUEST['class_name']) ? trim($_REQUEST['class_name']) : '';
$form_data['class_parent_id'] = isset($_REQUEST['class_parent_id']) ? $_REQUEST['class_parent_id'] : 0;
switch ($cmd) {
    // Delete an existing class
    case 'exDelete':
        if (delete_class($form_data['class_id'])) {
            $dialogBox->success(get_lang('Class deleted'));
        } else {
            switch (claro_failure::get_last_failure()) {
                case 'class_not_found':
                    $dialogBox->error(get_lang('Error : Class not found'));
                    break;
                case 'class_has_sub_classes':
                    $dialogBox->error(get_lang('Error : Class has sub-classes'));
                    break;
            }
        }
        break;
        // Delete all classes
    // Delete all classes
    case 'exDeleteAll':