예제 #1
0
function fill_course_properties($courseDbName)
{
    $currentCourseDbNameGlu = get_conf('courseTablePrefix') . $courseDbName . get_conf('dbGlu');
    $sql = "INSERT " . "INTO `{$currentCourseDbNameGlu}course_properties`(`name`, `value`, `category`)\n" . "VALUES\n" . "('self_registration'     , '1', 'GROUP'),\n" . "('self_unregistration'   , '0', 'GROUP'),\n" . "('nbGroupPerUser'        , '1', 'GROUP'),\n" . "('private'               , '1', 'GROUP')";
    $groupToolList = get_group_tool_label_list();
    foreach ($groupToolList as $thisGroupTool) {
        $sql .= ",\n(" . "'" . claro_sql_escape($thisGroupTool['label']) . "', '1', 'GROUP'" . ")";
    }
    return claro_sql_query($sql);
}
예제 #2
0
if ($cidReset) {
    if ($cidReq) {
        $_course = claro_get_course_data($cidReq, true);
        if ($_course == false) {
            die('WARNING !! The course\'s datas couldn\'t be loaded at line ' . __LINE__ . '.  Please contact your platform administrator.');
        }
        $_cid = $_course['sysCode'];
        $_groupProperties = claro_get_main_group_properties($_cid);
        if ($_groupProperties == false) {
            die('WARNING !! The group\'s properties couldn\'t be loaded at line ' . __LINE__ . '.  Please contact your platform administrator.');
        }
    } else {
        $_cid = null;
        $_course = null;
        $_groupProperties['registrationAllowed'] = false;
        $groupToolList = get_group_tool_label_list();
        foreach ($groupToolList as $thisGroupTool) {
            $thisGroupToolLabel = $thisGroupTool['label'];
            $propertyList['tools'][$thisGroupToolLabel] = false;
        }
        $_groupProperties['private'] = true;
    }
} else {
    $_cid = !empty($_SESSION['_cid']) ? $_SESSION['_cid'] : null;
    $_course = !empty($_SESSION['_course']) ? $_SESSION['_course'] : null;
    $_groupProperties = !empty($_SESSION['_groupProperties']) ? $_SESSION['_groupProperties'] : null;
}
/*---------------------------------------------------------------------------
  Course / user relation initialisation
 ---------------------------------------------------------------------------*/
if ($uidReset || $cidReset) {
예제 #3
0
/**
 *  TODO : merge with claro_main.lib.php#claro_get_main_group_properties
 *  TODO : merge both with kernel/course.lib.php#Claro_Course
 */
function get_current_course_group_properties()
{
    $tbl = claro_sql_get_course_tbl();
    $sql_getGroupProperties = "SELECT name, value\n" . "FROM `{$tbl['course_properties']}`\n" . "WHERE category = 'GROUP'";
    $db_groupProperties = claro_sql_query_fetch_all($sql_getGroupProperties);
    if (!$db_groupProperties) {
        // throw new Exception("Cannot load group properties for {$courseId}");
        // Workaround for upgrade from Claroline 1.5 to Claroline 1.6 : missing group properties !!!!
        $db_groupProperties = array('self_registration' => 0, 'private' => 1);
    }
    $groupProperties = array();
    foreach ($db_groupProperties as $currentProperty) {
        $groupProperties[$currentProperty['name']] = (int) $currentProperty['value'];
    }
    $groupProperties['registrationAllowed'] = (bool) ($groupProperties['self_registration'] == 1);
    unset($groupProperties['self_registration']);
    $groupProperties['private'] = (bool) ($groupProperties['private'] == 1);
    $groupProperties['tools'] = array();
    $groupToolList = get_group_tool_label_list();
    foreach ($groupToolList as $thisGroupTool) {
        $groupTLabel = $thisGroupTool['label'];
        if (array_key_exists($groupTLabel, $groupProperties)) {
            $groupProperties['tools'][$groupTLabel] = (bool) ($groupProperties[$groupTLabel] == 1);
            unset($groupProperties[$groupTLabel]);
        } else {
            $groupProperties['tools'][$groupTLabel] = false;
        }
    }
    return $groupProperties;
}