$modar['startAsset_id'] = $list->startAsset_id;
         $modar['contentType'] = $list->contentType;
         $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"] != "") {
示例#2
0
/**
 * This function return the node with $module_id (recursive)
 *
 *
 * @param $lpModules array the tree of all modules in a learning path
 * @param $id node we are looking for
 * @param $field type of node we are looking for (learnPath_module_id, module_id,...)
 *
 * @return array the requesting node (with all its children)
 *
 * @author Thanos Kyritsis <*****@*****.**>
 * @author Piraux Sebastien <*****@*****.**>
 */
function get_module_tree($lpModules, $id, $field = 'module_id')
{
    foreach ($lpModules as $module) {
        if ($module[$field] == $id) {
            return $module;
        } elseif (isset($module['children']) && is_array($module['children'])) {
            $temp = get_module_tree($module['children'], $id, $field);
            if (is_array($temp)) {
                return $temp;
            }
            // else check next node
        }
    }
}