예제 #1
0
 protected function isModuleAllowed()
 {
     $moduleData = get_module_data($this->moduleLabel);
     if ($moduleData['type'] == 'tool') {
         $contextList = get_module_context_list($this->moduleLabel);
         if (claro_is_in_a_course()) {
             $_mainToolId = get_tool_id_from_module_label($this->moduleLabel);
             $_profileId = claro_get_current_user_profile_id_in_course();
             $_cid = claro_get_current_course_id();
             if (claro_is_in_a_group()) {
                 $_groupProperties = claro_get_main_group_properties(claro_get_current_course_id());
                 $_mainToolId = get_tool_id_from_module_label('CLGRP');
                 $is_toolAllowed = array_key_exists($this->moduleLabel, $_groupProperties['tools']) && $_groupProperties['tools'][$this->moduleLabel] && claro_is_allowed_tool_read($_mainToolId, $_profileId, $_cid);
                 if ($_groupProperties['private']) {
                     $is_toolAllowed = $is_toolAllowed && (claro_is_group_member() || claro_is_group_tutor());
                 }
                 $is_toolAllowed = $is_toolAllowed || (claro_is_course_manager() || claro_is_platform_admin());
             } else {
                 // we ignore course visibility
                 if (!claro_is_allowed_tool_edit($_mainToolId, $_profileId, $_cid) && !claro_is_allowed_tool_read($_mainToolId, $_profileId, $_cid)) {
                     $is_toolAllowed = false;
                 } else {
                     $is_toolAllowed = true;
                 }
             }
         } else {
             if (in_array('platform', iterator_to_array($contextList))) {
                 $is_toolAllowed = get_module_data($this->moduleLabel, 'activation') == 'activated';
             } else {
                 $is_toolAllowed = false;
             }
         }
         return $is_toolAllowed;
     } else {
         // if an applet "tool", return true if activated
         // and let module manage it's access by itself
         return $moduleData['activation'] == 'activated';
     }
 }
예제 #2
0
/**
 * return all info of a course
 *
 * @param $cid the id of a course
 * @return array (array) an associative array containing all info of the course
 * @todo use claro_get_course_data
 */
function get_info_course($cid)
{
    if ($cid) {
        $_course = claro_get_course_data($cid);
        $_groupProperties = claro_get_main_group_properties($cid);
        if ($_groupProperties === false) {
            trigger_error('WARNING !! NO GROUP PROPERTIES !!');
        }
        $_course = array_merge($_course, $_groupProperties);
    } else {
        $_course = NULL;
        //// all groups of these course
        ///  ( theses properies  are from the link  between  course and  group,
        //// but a group  can be only in one course)
        $_course['registrationAllowed'] = FALSE;
        $_course['tools']['CLFRM'] = FALSE;
        $_course['tools']['CLDOC'] = FALSE;
        $_course['tools']['CLWIKI'] = FALSE;
        $_course['tools']['CLCHT'] = FALSE;
        $_course['private'] = TRUE;
    }
    return $_course;
}
예제 #3
0
  Course initialisation
 ---------------------------------------------------------------------------*/
// if the requested course is different from the course in session
if ($cidReq && (!isset($_SESSION['_cid']) || $cidReq != $_SESSION['_cid'])) {
    $cidReset = true;
    $gidReset = true;
    // As groups depend from courses, group id is reset
}
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 {
예제 #4
0
/**
 * @param int $gid 
 * @param string $courseId 
 * @param boolean $active if set to true, only actvated tool will be considered for display
 */
function get_group_tool_menu($gid = null, $courseId = null, $active = true)
{
    $toolList = array();
    if (is_null($gid)) {
        $gid = claro_get_current_group_id();
    }
    if (is_null($courseId)) {
        $courseId = claro_get_current_course_id();
    }
    require_once dirname(__FILE__) . '/../group.lib.inc.php';
    $groupToolList = get_group_tool_list($courseId, $active);
    // group space links
    /* $toolList[] =
       claro_html_cmd_link(
           claro_htmlspecialchars(Url::Contextualize( get_module_url('CLGRP').'/group_space.php' ))
           , '<img src="' . get_icon_url('group') . '" alt="" />&nbsp;'
           . get_lang('Group area')
       ); */
    $courseGroupData = claro_get_main_group_properties($courseId);
    foreach ($groupToolList as $groupTool) {
        if (is_tool_activated_in_groups($courseId, $groupTool['label']) && (isset($courseGroupData['tools'][$groupTool['label']]) && $courseGroupData['tools'][$groupTool['label']])) {
            $toolList[] = claro_html_cmd_link(claro_htmlspecialchars(Url::Contextualize(get_module_url($groupTool['label']) . '/' . $groupTool['url'])), '<img src="' . get_module_url($groupTool['label']) . '/' . $groupTool['icon'] . '" alt="" />' . '&nbsp;' . claro_get_tool_name($groupTool['label']), array('class' => $groupTool['visibility'] ? 'visible' : 'invisible'));
        }
    }
    if (count($toolList)) {
        return claro_html_menu_horizontal($toolList);
    } else {
        return '';
    }
}
예제 #5
0
파일: linker.lib.php 프로젝트: rhertzog/lcs
 public function getResourceList(ResourceLocator $rootNodeLocator)
 {
     $tbl_cdb_names = get_module_course_tbl(array('group_team'), $rootNodeLocator->getCourseId());
     $tbl_groups = $tbl_cdb_names['group_team'];
     $sql = 'SELECT `id`,`name` FROM `' . $tbl_groups . '`';
     $groups = claro_sql_query_fetch_all($sql);
     $groupProperties = claro_get_main_group_properties($rootNodeLocator->getCourseId());
     $groupList = new LinkerResourceIterator();
     foreach ($groups as $group) {
         $locator = new ClarolineResourceLocator($rootNodeLocator->getCourseId(), null, null, (int) $group['id']);
         $resource = new LinkerResource($group['name'], $locator, true, $groupProperties['private'] ? true : false, true);
         $groupList->addResource($resource);
     }
     return $groupList;
 }
예제 #6
0
 * @package     CLGRP
 * @author      Claro Team <*****@*****.**>
 */
$tlabelReq = 'CLGRP';
require '../inc/claro_init_global.inc.php';
// $_groupProperties = claro_get_main_group_properties(claro_get_current_course_id());
include_once get_path('incRepositorySys') . '/lib/group.lib.inc.php';
// display login form
if (!claro_is_in_a_course() || !claro_is_course_allowed()) {
    claro_disp_auth_form(true);
}
// check user right
if (!claro_is_allowed_to_edit()) {
    claro_die(get_lang("Not allowed"));
}
$nameTools = get_lang("Groups settings");
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Groups'), Url::Contextualize('group.php'));
$_groupProperties = claro_get_main_group_properties(claro_get_current_course_id());
// session_register('_groupProperties');
$_SESSION['_groupProperties'] =& $_groupProperties;
$claroline->display->body->appendContent(claro_html_tool_title(array('supraTitle' => get_lang("Groups"), 'mainTitle' => $nameTools)));
$tpl = new CoreTemplate('group_properties.tpl.php');
$tpl->assign('groupToolList', get_group_tool_list());
$tpl->assign('nbGroupPerUser', $_groupProperties['nbGroupPerUser']);
$tpl->assign('registrationAllowedInGroup', $_groupProperties['registrationAllowed']);
$tpl->assign('unregistrationAllowedInGroup', isset($_groupProperties['unregistrationAllowed']) ? $_groupProperties['unregistrationAllowed'] : false);
$tpl->assign('tutorRegistrationAllowedInGroup', isset($_groupProperties['tutorRegistrationAllowed']) ? $_groupProperties['tutorRegistrationAllowed'] : false);
$tpl->assign('groupPrivate', $_groupProperties['private']);
$tpl->assign('tools', $_groupProperties['tools']);
$claroline->display->body->appendContent($tpl->render());
echo $claroline->display->render();