Esempio n. 1
0
    $modar['contentType'] = $module->contentType;
    $modar['name'] = $module->name;
    $modar['lesson_status'] = $module->lesson_status;
    $modar['raw'] = $module->raw;
    $modar['scoreMax'] = $module->scoreMax;
    $modar['credit'] = $module->credit;
    $modar['session_time'] = $module->session_time;
    $modar['total_time'] = $module->total_time;
    $modar['path'] = $module->path;
    $extendedList[] = $modar;
}

// build the array of modules
// build_element_list return a multi-level array, where children is an array with all nested modules
// build_display_element_list return an 1-level array where children is the deep of the module
$flatElementList = build_display_element_list(build_element_list($extendedList, 'parent', 'learnPath_module_id'));

$moduleNb = 0;
$globalProg = 0;
$global_time = "0000:00:00";

// look for maxDeep
$maxDeep = 1; // used to compute colspan of <td> cells
for ($i = 0; $i < sizeof($flatElementList); $i++) {
    if ($flatElementList[$i]['children'] > $maxDeep) {
        $maxDeep = $flatElementList[$i]['children'];
    }
}

$tool_content .= action_bar(array(
                array('title' => $langBack,
Esempio n. 2
0
     }
 }
 define("hu", PROTOCOL . $siteurl . '/');
 // v1.0 experimental relative url global
 define("rhu", preg_replace("/https?:\\/\\/.+(\\/.*)\\/?\$/U", "\$1", hu));
 if (!empty($locale)) {
     setlocale(LC_ALL, $locale);
 }
 $textarray = load_lang(LANG);
 include txpath . '/include/txp_auth.php';
 doAuth();
 // individual user prefs
 $prefs = get_user_prefs() + $prefs;
 build_element_list($elements_main);
 if ($elements_aux) {
     build_element_list($elements_aux);
 }
 load_elements('init');
 register_element_tabs();
 $event = gps('event') ? gps('event') : 'article';
 $step = gps('step');
 if (!$dbversion or $dbversion != $thisversion or $txp_using_svn) {
     define('TXP_UPDATE', 1);
     include txpath . '/update/_update.php';
 }
 load_elements($event);
 register_element_tabs();
 if (!empty($admin_side_plugins) and gps('event') != 'plugin') {
     load_plugins(1);
 }
 include txpath . '/lib/txplib_head.php';
Esempio n. 3
0
/**
 * Build an tree of $list from $id using the 'parent'
 * table. (recursive function)
 * Rows with a father id not existing in the array will be ignored
 *
 * @param $list modules of the learning path list
 * @param $parentField name of the field containing the parent id
 * @param $idField name of the field containing the current id
 * @param $id learnPath_module_id of the node to build
 * @return tree of the learning path
 *
 * @author Piraux Sebastien <*****@*****.**>
 */
function build_element_list($list, $parentField, $idField, $id = 0)
{
    $tree = array();
    if (is_array($list)) {
        foreach ($list as $element) {
            if ($element[$idField] == $id) {
                $tree = $element;
                // keep all $list informations in the returned array
                // explicitly add 'name' and 'value' for the build_nested_select_menu function
                //$tree['name'] = $element['name']; // useless since 'name' is the same word in db and in the  build_nested_select_menu function
                $tree['value'] = $element[$idField];
                break;
            }
        }
        foreach ($list as $element) {
            if ($element[$parentField] == $id && $element[$parentField] != $element[$idField]) {
                if ($id == 0) {
                    $tree[] = build_element_list($list, $parentField, $idField, $element[$idField]);
                } else {
                    $tree['children'][] = build_element_list($list, $parentField, $idField, $element[$idField]);
                }
            }
        }
    }
    return $tree;
}