Ejemplo n.º 1
0
/**
 * This function deletes all the nodes of the tree module_tree
 *
 * @param $module_tree tree of modules we want to change the visibility
 *
 * @author Piraux Sebastien <*****@*****.**>
 */
function delete_module_tree($module_tree)
{
    foreach ($module_tree as $module) {
        switch ($module['contentType']) {
            case CTSCORMASSET_:
            case CTSCORM_:
                // delete asset if scorm
                Database::get()->query("DELETE FROM `lp_asset` WHERE `module_id` =  ?d", $module['module_id']);
                // no break because we need to delete module
            // no break because we need to delete module
            case CTLABEL_:
                // delete module if scorm && if label
                Database::get()->query("DELETE FROM `lp_module` WHERE `module_id` =  ?d", $module['module_id']);
                // no break because we need to delete LMP and UMP
            // no break because we need to delete LMP and UMP
            default:
                // always delete LPM and UMP
                Database::get()->query("DELETE FROM `lp_rel_learnPath_module`\n                                              WHERE `learnPath_module_id` = ?d", $module['learnPath_module_id']);
                Database::get()->query("DELETE FROM `lp_user_module_progress`\n                                              WHERE `learnPath_module_id` = ?d", $module['learnPath_module_id']);
                break;
        }
    }
    if (isset($module['children']) && is_array($module['children'])) {
        delete_module_tree($module['children']);
    }
}
Ejemplo n.º 2
0
         $modar['learnPath_module_id'] = $list->learnPath_module_id;
         $modar['learnPath_id'] = $list->learnPath_id;
         $modar['lock'] = $list->lock;
         $modar['visible'] = $list->visible;
         $modar['specificComment'] = $list->specificComment;
         $modar['rank'] = $list->rank;
         $modar['parent'] = $list->parent;
         $modar['raw_to_pass'] = $list->raw_to_pass;
         $extendedList[] = $modar;
     }
     //-- delete module cmdid and his children if it is a label
     // get the modules tree ( cmdid module and all its children)
     //$temp[0] = get_module_tree( build_element_list($extendedList, 'parent', 'learnPath_module_id'), $_REQUEST['cmdid'] , 'learnPath_module_id');
     $temp[0] = get_module_tree(build_element_list($extendedList, 'parent', 'learnPath_module_id'), $_REQUEST['cmdid'], 'learnPath_module_id');
     // delete the tree
     delete_module_tree($temp);
     break;
     // VISIBILITY COMMAND
 // VISIBILITY COMMAND
 case "mkVisibl":
 case "mkInvisibl":
     $visibility = $cmd == "mkVisibl" ? 1 : 0;
     //--- BUILD ARBORESCENCE OF MODULES IN LEARNING PATH
     $sql = "SELECT M.*, LPM.*\n                FROM `lp_module` AS M, `lp_rel_learnPath_module` AS LPM\n                WHERE M.`module_id` = LPM.`module_id`\n                AND LPM.`learnPath_id` = ?d\n                AND M.`course_id` = ?d\n                ORDER BY LPM.`rank` ASC";
     $result = Database::get()->queryArray($sql, $_SESSION['path_id'], $course_id);
     $extendedList = array();
     $modar = array();
     foreach ($result as $list) {
         $modar['module_id'] = $list->module_id;
         $modar['course_id'] = $list->course_id;
         $modar['name'] = $list->name;
Ejemplo n.º 3
0
/**
 * This function deletes all the nodes of the tree module_tree
 *
 * @param $module_tree tree of modules we want to change the visibility
 *
 * @author Piraux S�bastien <*****@*****.**>
 */
function delete_module_tree($module_tree)
{
    $tbl_cdb_names = claro_sql_get_course_tbl();
    $tbl_lp_rel_learnPath_module = $tbl_cdb_names['lp_rel_learnPath_module'];
    $tbl_lp_user_module_progress = $tbl_cdb_names['lp_user_module_progress'];
    $tbl_lp_module = $tbl_cdb_names['lp_module'];
    $tbl_lp_asset = $tbl_cdb_names['lp_asset'];
    foreach ($module_tree as $module) {
        switch ($module['contentType']) {
            case CTSCORM_:
                // delete asset if scorm
                $delAssetSql = "DELETE\n                                    FROM `" . $tbl_lp_asset . "`\n                                    WHERE `module_id` =  " . (int) $module['module_id'] . "\n                                    ";
                claro_sql_query($delAssetSql);
                // no break; because we need to delete modul
            // no break; because we need to delete modul
            case CTLABEL_:
                // delete module if scorm && if label
                $delModSql = "DELETE FROM `" . $tbl_lp_module . "`\n                                     WHERE `module_id` =  " . (int) $module['module_id'];
                claro_sql_query($delModSql);
                // no break; because we need to delete LMP and UMP
            // no break; because we need to delete LMP and UMP
            default:
                // always delete LPM and UMP
                claro_sql_query("DELETE FROM `" . $tbl_lp_rel_learnPath_module . "`\n                                        WHERE `learnPath_module_id` = " . (int) $module['learnPath_module_id']);
                claro_sql_query("DELETE FROM `" . $tbl_lp_user_module_progress . "`\n                                        WHERE `learnPath_module_id` = " . (int) $module['learnPath_module_id']);
                break;
        }
    }
    if (isset($module['children']) && is_array($module['children'])) {
        delete_module_tree($module['children']);
    }
}