Beispiel #1
0
/**
 * This function set visibility for all the nodes of the tree module_tree
 *
 * @param $module_tree tree of modules we want to change the visibility
 * @param $visibility ths visibility string as requested by the DB
 *
 * @author Piraux Sebastien <*****@*****.**>
 */
function set_module_tree_visibility($module_tree, $visibility)
{
    foreach ($module_tree as $module) {
        if ($module['visible'] != $visibility) {
            $sql = "UPDATE `lp_rel_learnPath_module`\n                       SET `visible` = ?s\n                     WHERE `learnPath_module_id` = ?d\n                       AND `visible` != ?s";
            Database::get()->query($sql, $visibility, $module['learnPath_module_id'], $visibility);
        }
        if (isset($module['children']) && is_array($module['children'])) {
            set_module_tree_visibility($module['children'], $visibility);
        }
    }
}
         $modar['launch_data'] = $list->launch_data;
         $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;
     }
     //-- set the visibility for 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']);
     // change the visibility according to the new father visibility
     set_module_tree_visibility($temp, $visibility);
     break;
     // ACCESSIBILITY COMMAND
 // ACCESSIBILITY COMMAND
 case "mkBlock":
 case "mkUnblock":
     $blocking = $cmd == "mkBlock" ? 'CLOSE' : 'OPEN';
     Database::get()->query("UPDATE `lp_rel_learnPath_module`\n                SET `lock` = ?s\n                WHERE `learnPath_module_id` = ?d\n                AND `lock` != ?s", $blocking, $_REQUEST['cmdid'], $blocking);
     break;
     // ORDER COMMAND
 // ORDER COMMAND
 case "changePos":
     // changePos form sent
     if (isset($_POST["newPos"]) && $_POST["newPos"] != "") {
         // get order of parent module
         $movedModule = Database::get()->querySingle("SELECT *\n                    FROM `lp_rel_learnPath_module`\n                    WHERE `learnPath_module_id` = ?d LIMIT 1", $_REQUEST['cmdid']);
Beispiel #3
0
/**
 * This function set visibility for all the nodes of the tree module_tree
 *
 * @param $module_tree tree of modules we want to change the visibility
 * @param $visibility ths visibility string as requested by the DB
 *
 * @author Piraux S�bastien <*****@*****.**>
 */
function set_module_tree_visibility($module_tree, $visibility)
{
    $tbl_cdb_names = claro_sql_get_course_tbl();
    $tbl_lp_rel_learnPath_module = $tbl_cdb_names['lp_rel_learnPath_module'];
    foreach ($module_tree as $module) {
        if ($module['visibility'] != $visibility) {
            $sql = "UPDATE `" . $tbl_lp_rel_learnPath_module . "`\n                        SET `visibility` = '" . claro_sql_escape($visibility) . "'\n                        WHERE `learnPath_module_id` = " . (int) $module['learnPath_module_id'] . "\n                          AND `visibility` != '" . claro_sql_escape($visibility) . "'";
            claro_sql_query($sql);
        }
        if (isset($module['children']) && is_array($module['children'])) {
            set_module_tree_visibility($module['children'], $visibility);
        }
    }
}