Beispiel #1
0
 public function render()
 {
     $out = '';
     if (!claro_is_user_authenticated()) {
         if (get_conf('claro_displayLocalAuthForm', true) == true) {
             $out .= $this->renderLoginLink();
         }
     } elseif (!claro_is_platform_admin() && (claro_is_in_a_course() && !claro_is_course_member()) && claro_get_current_course_data('registrationAllowed')) {
         if (claro_is_current_user_enrolment_pending()) {
             $out .= '<img src="' . get_icon_url('warning') . '" alt="off" /> ' . '<b>' . get_lang('Enrolment pending') . '</b>';
         } else {
             $out .= $this->renderRegistrationLink();
         }
     } elseif (claro_is_display_mode_available()) {
         $out .= $this->renderViewModeSwitch();
     }
     return $out;
 }
Beispiel #2
0
    $topicId = $topicSettingList['topic_id'];
} elseif (false !== $topicSettingList) {
    $forumSettingList = get_forum_settings($topicSettingList['forum_id']);
    $forumId = $forumSettingList['forum_id'];
} else {
    $forumSettingList = get_forum_settings($forumId);
}
$incrementViewCount = 'show' == $cmd ? true : false;
//init anonymity status
if (get_conf('clfrm_anonymity_enabled') == 'TRUE') {
    $anonymityStatus = $forumSettingList['anonymity'];
} else {
    $anonymityStatus = 'forbidden';
}
//check access rights
$is_postAllowed = !claro_is_current_user_enrolment_pending() && claro_is_course_member() && $forumSettingList['forum_access'] != 0 && (!$topicId || !$topicSettingList['topic_status']) || claro_is_allowed_to_edit() ? true : false;
$is_viewAllowed = !is_null($forumSettingList['idGroup']) && !($forumSettingList['idGroup'] == claro_get_current_group_id() || claro_is_in_a_group() || claro_is_group_allowed()) && !claro_is_allowed_to_edit() ? false : true;
// NOTE : $forumSettingList['idGroup'] != claro_get_current_group_id() is necessary to prevent any hacking
// attempt like rewriting the request without $cidReq. If we are in group
// forum and the group of the concerned forum isn't the same as the session
// one, something weird is happening, indeed ...
if (!isset($_REQUEST['submit']) && !$is_postAllowed && 'show' != $cmd || !$is_viewAllowed) {
    $dialogBox->error(get_lang('Not allowed'));
} else {
    //handle user commands
    if ('exDelete' == $cmd) {
        if (delete_post($postId, $topicSettingList['topic_id'], $forumSettingList['forum_id'])) {
            $dialogBox->success('Post successfully deleted');
        } else {
            $dialogBox->error('Error while deleting post');
        }
Beispiel #3
0
    $template->assign('sourceCid', $sourceCid);
    $template->assign('sourceGid', $sourceGid);
    $template->assign('cidRequired', $cidRequired);
    $template->assign('courseList', $courseList);
    $claroline->display->body->appendContent($template->render());
    echo $claroline->display->render();
} else {
    if (!isset($userLoggedOnCas)) {
        $userLoggedOnCas = false;
    }
    $claroline->notifier->event('user_login', array('data' => array('ip' => $_SERVER['REMOTE_ADDR'])));
    if (claro_is_in_a_course() && !claro_is_course_allowed()) {
        $out = '';
        if ($_course['registrationAllowed']) {
            if (claro_is_user_authenticated()) {
                if (claro_is_current_user_enrolment_pending()) {
                    // enrolment pending message displayed by body.tpl
                } else {
                    // Display link to student to enrol to this course
                    $out .= '<p align="center">' . "\n" . get_lang('Your user profile doesn\'t seem to be enrolled on this course') . '<br />' . get_lang('If you wish to enrol on this course') . ' : ' . ' <a href="' . get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=exReg&amp;course=' . urlencode(claro_get_current_course_id()) . '">' . get_lang('Enrolment') . '</a>' . "\n" . '</p>' . "\n";
                }
            } elseif (get_conf('allowSelfReg')) {
                // Display a link to anonymous to register on the platform
                $out .= '<p align="center">' . "\n" . get_lang('Create first a user account on this platform') . ' : ' . '<a href="' . get_path('clarolineRepositoryWeb') . 'auth/inscription.php">' . get_lang('Go to the account creation page') . '</a>' . "\n" . '</p>' . "\n";
            } else {
                // Anonymous cannot register on the platform
                $out .= '<p align="center">' . "\n" . get_lang('Registration not allowed on the platform') . '</p>' . "\n";
            }
        } else {
            // Enrolment is not allowed for this course
            $out .= '<p align="center">' . "\n" . get_lang('Enrol to course not allowed');