示例#1
0
/**
 * return the autorisation of the current user to send a message to the current group
 *
 * @return bool true if the current user is autorised do send a message to the current group
 *                 false if the current user is not autorised do send a message to the current group
 */
function current_user_is_allowed_to_send_message_to_current_group()
{
    if (claro_is_platform_admin()) {
        return true;
    }
    if (claro_is_group_tutor() || claro_is_course_admin()) {
        return true;
    }
    return false;
}
示例#2
0
 function buildRecords($exportUserInfo = true)
 {
     $tbl_mdb_names = claro_sql_get_main_tbl();
     $tbl_user = $tbl_mdb_names['user'];
     $tbl_rel_course_user = $tbl_mdb_names['rel_course_user'];
     $tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($this->course_id));
     $tbl_team = $tbl_cdb_names['group_team'];
     $tbl_rel_team_user = $tbl_cdb_names['group_rel_team_user'];
     $username = claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_username', false) ? "`U`.`username`     AS `username`," : "";
     if (claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_password', false)) {
         if (claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_password_encrypted', true)) {
             $password = "******";
         } else {
             $password = "******";
         }
     } else {
         $password = '';
     }
     // get user list
     $sql = "SELECT `U`.`user_id`      AS `userId`,\n                       `U`.`nom`          AS `lastname`,\n                       `U`.`prenom`       AS `firstname`,\n                       {$username}\n                       {$password}\n                       `U`.`email`        AS `email`,\n                       `U`.`officialCode`     AS `officialCode`,\n                       GROUP_CONCAT(`G`.`id`) AS `groupId`,\n                       GROUP_CONCAT(`G`.`name`) AS `groupName`\n               FROM\n                    (\n                    `" . $tbl_user . "`           AS `U`,\n                    `" . $tbl_rel_course_user . "` AS `CU`\n                    )\n               LEFT JOIN `" . $tbl_rel_team_user . "` AS `GU`\n                ON `U`.`user_id` = `GU`.`user`\n               LEFT JOIN `" . $tbl_team . "` AS `G`\n                ON `GU`.`team` = `G`.`id`\n               WHERE `U`.`user_id` = `CU`.`user_id`\n               AND   `CU`.`code_cours`= '" . claro_sql_escape($this->course_id) . "'\n               GROUP BY U.`user_id`\n               ORDER BY U.`user_id`";
     $userList = claro_sql_query_fetch_all($sql);
     // build recordlist with good values for answers
     if (is_array($userList) && !empty($userList)) {
         // add titles at row 0, for that get the keys of the first row of array
         $this->recordList[0] = array_keys($userList[0]);
         $i = 1;
         $userIdList = array();
         foreach ($userList as $user) {
             $userIdList[$user['userId']] = $i;
             if (!(claro_is_platform_admin() && get_conf('export_sensitive_data_for_admin', false) || get_conf('export_user_id', false))) {
                 $user['userId'] = $i;
             }
             // $this->recordList is defined in parent class csv
             $this->recordList[$i] = $user;
             $i++;
         }
         if ($exportUserInfo) {
             $userInfoList = new UserInfoList($this->course_id);
             $userInfoLabelList = $userInfoList->getUserInfoLabels();
             foreach ($userInfoLabelList as $catId => $catTitle) {
                 $this->recordList[0][] = $catTitle;
                 $userCatInfo = $userInfoList->getUserInfo($catId);
                 foreach ($userCatInfo as $userCatInfo) {
                     $this->recordList[$userIdList[$userCatInfo['userId']]][] = $userCatInfo['content'];
                 }
             }
         }
     }
     if (is_array($this->recordList) && !empty($this->recordList)) {
         return true;
     } else {
         return false;
     }
 }
示例#3
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;
 }
示例#4
0
 /**
  * Prepare the user banner
  */
 private function _prepareUserBanner()
 {
     if (claro_is_user_authenticated()) {
         $userToolUrlListLeft = array();
         $userToolUrlListRight = array();
         if (get_conf('display_former_homepage')) {
         }
         $userToolUrlListLeft[] = '<a href="' . get_path('clarolineRepositoryWeb') . 'desktop/index.php" target="_top">' . get_lang('My desktop') . '</a>';
         $userToolUrlListLeft[] = '<a href="' . get_path('clarolineRepositoryWeb') . 'messaging" target="_top">' . get_lang('My messages') . '</a>';
         if (claro_is_platform_admin()) {
             $userToolUrlListLeft[] = '<a href="' . get_path('clarolineRepositoryWeb') . 'admin/" target="_top">' . get_lang('Platform administration') . '</a>';
         }
         $userToolUrlListRight[] = '<a href="' . get_path('clarolineRepositoryWeb') . 'auth/profile.php" target="_top">' . get_lang('Manage my account') . '</a>';
         $userToolUrlListRight[] = '<a href="' . get_path('url') . '/index.php?logout=true" target="_top">' . get_lang('Logout') . '</a>';
         $this->assign('userToolListRight', $userToolUrlListRight);
         $this->assign('userToolListLeft', $userToolUrlListLeft);
         $this->showBlock('userBanner');
     } else {
         $this->hideBlock('userBanner');
     }
 }
示例#5
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';
     }
 }
示例#6
0
文件: image.php 项目: rhertzog/lcs
    // course context
    $is_allowedToEdit = claro_is_allowed_to_edit();
    $pathSys = get_path('coursesRepositorySys') . claro_get_course_path() . '/document/';
    $pathWeb = get_path('coursesRepositoryWeb') . claro_get_course_path() . '/document/';
    require claro_get_conf_repository() . 'CLDOC.conf.php';
    $maxFilledSpace = get_conf('maxFilledSpace_for_course');
} elseif (claro_is_in_a_group()) {
    // course context
    $is_allowedToEdit = claro_is_allowed_to_edit();
    $pathSys = get_path('coursesRepositorySys') . claro_get_course_path() . '/group/' . claro_get_current_group_data('directory');
    $pathWeb = get_path('coursesRepositoryWeb') . claro_get_course_path() . '/group/' . claro_get_current_group_data('directory');
    require claro_get_conf_repository() . 'CLDOC.conf.php';
    $maxFilledSpace = get_conf('maxFilledSpace_for_course');
} else {
    // platform context
    $is_allowedToEdit = claro_is_platform_admin();
    $pathSys = get_path('rootSys') . 'platform/document/';
    $pathWeb = get_path('rootWeb') . 'platform/document/';
}
/*
 * Libraries
 */
include_once $includePath . '/lib/fileUpload.lib.php';
include_once $includePath . '/lib/fileManage.lib.php';
/*
 * Init directory
 */
if (!file_exists($pathSys)) {
    claro_mkdir($pathSys);
}
/*
示例#7
0
        $url = trim(get_module_url($thisTool['label']) . '/' . $thisTool['url']);
    } elseif (!empty($thisTool['name'])) {
        $toolName = $thisTool['name'];
        $url = trim($thisTool['url']);
    } else {
        $toolName = '<i>no name</i>';
        $url = trim($thisTool['url']);
    }
    if (!empty($thisTool['icon'])) {
        $icon = get_icon_url($thisTool['icon'], $thisTool['label']);
    } else {
        $icon = get_icon_url('tool');
    }
    $style = '';
    // patchy
    if (claro_is_platform_admin() || claro_is_course_manager()) {
        if (!$_groupProperties['tools'][$thisTool['label']]) {
            $style = 'invisible ';
        }
    }
    // see if tool name must be displayed 'as containing new items' (a red ball by default)  or not
    $classItem = '';
    if (in_array($thisTool['id'], $modified_tools)) {
        $classItem = " hot";
    }
    if (!empty($url)) {
        $toolLinkList[] = '<a class="' . trim($style . ' item' . $classItem) . '" href="' . claro_htmlspecialchars(Url::Contextualize($url)) . '">' . '<img src="' . $icon . '" alt="" />&nbsp;' . $toolName . '</a>' . "\n";
    } else {
        $toolLinkList[] = '<span ' . trim($style) . '>' . '<img src="' . $icon . '" alt="" />&nbsp;' . $toolName . '</span>' . "\n";
    }
}
示例#8
0
文件: init.lib.php 项目: rhertzog/lcs
/**
 * Return if course status is enable
 */
function claro_is_course_enable()
{
    $tbl_mdb_names = claro_sql_get_main_tbl();
    $tbl_course = $tbl_mdb_names['course'];
    $courseId = claro_get_current_course_id();
    $curdate = claro_mktime();
    if (claro_is_course_manager()) {
        $sql = " SELECT c.`code`\n             FROM `" . $tbl_course . "` c\n            WHERE  (c.`status` != 'trash')\n              AND c.`code` = '" . $courseId . "';";
    } else {
        $sql = " SELECT c.`code`\n           FROM `" . $tbl_course . "` c\n           WHERE (c.`status` = 'enable'\n                   OR (c.`status` = 'date'\n                       AND (UNIX_TIMESTAMP(`creationDate`) <= '" . $curdate . "'\n                            OR `creationDate` IS NULL OR UNIX_TIMESTAMP(`creationDate`) = 0\n                           )\n                       AND ('" . $curdate . "' <= UNIX_TIMESTAMP(`expirationDate`)\n                            OR `expirationDate` IS NULL\n                           )\n                      )\n                 )\n                 AND c.`code` = '" . $courseId . "';";
    }
    $result = claro_sql_query_get_single_value($sql);
    if (isset($result) or claro_is_platform_admin()) {
        $return = true;
    } else {
        $return = false;
    }
    return $return;
}
示例#9
0
 /**
  * Display form
  *
  * @param $cancelUrl string url of the cancel button
  * @return string html output of form
  */
 public function displayForm($cancelUrl = null)
 {
     JavascriptLoader::getInstance()->load('course_form');
     $languageList = get_language_to_display_list('availableLanguagesForCourses');
     $categoriesList = claroCategory::getAllCategoriesFlat();
     $linkedCategoriesListHtml = '';
     // Categories linked to the course
     $unlinkedCategoriesListHtml = '';
     // Other categories (not linked to the course)
     foreach ($categoriesList as $category) {
         // Is that category linked to the current course or not ?
         $match = false;
         foreach ($this->categories as $searchCategory) {
             if ($category['id'] == (int) $searchCategory->id) {
                 $match = true;
                 break;
             } else {
                 $match = false;
             }
         }
         // Dispatch in the lists
         if ($match) {
             $linkedCategoriesListHtml .= '<option ' . (!$category['visible'] ? 'class="hidden" ' : '') . 'value="' . $category['id'] . '">' . $category['path'] . '</option>' . "\n";
         } else {
             if ($category['canHaveCoursesChild'] || claro_is_platform_admin()) {
                 $unlinkedCategoriesListHtml .= '<option ' . (!$category['visible'] ? 'class="hidden" ' : '') . 'value="' . $category['id'] . '">' . $category['path'] . '</option>' . "\n";
             }
         }
     }
     $publicDisabled = !(get_conf('allowPublicCourses', true) || claro_is_platform_admin()) ? ' disabled="disabled"' : '';
     $publicCssClass = !(get_conf('allowPublicCourses', true) || claro_is_platform_admin()) ? ' class="notice"' : '';
     $publicMessage = $this->access != 'public' && !(get_conf('allowPublicCourses', true) || claro_is_platform_admin()) ? '<br /><span class="notice">' . get_lang('If you need to create a public course, please contact the platform administrator') . '</span>' : '';
     $cancelUrl = is_null($cancelUrl) ? get_path('clarolineRepositoryWeb') . 'course/index.php?cid=' . claro_htmlspecialchars($this->courseId) : $cancelUrl;
     $template = new CoreTemplate('course_form.tpl.php');
     $template->assign('formAction', $_SERVER['PHP_SELF']);
     $template->assign('relayContext', claro_form_relay_context());
     $template->assign('course', $this);
     $template->assign('linkedCategoriesListHtml', $linkedCategoriesListHtml);
     $template->assign('unlinkedCategoriesListHtml', $unlinkedCategoriesListHtml);
     $template->assign('languageList', $languageList);
     $template->assign('publicDisabled', $publicDisabled);
     $template->assign('publicCssClass', $publicCssClass);
     $template->assign('publicMessage', $publicMessage);
     $template->assign('cancelUrl', $cancelUrl);
     $template->assign('nonRootCategoryRequired', !get_conf('clcrs_rootCategoryAllowed', true));
     return $template->render();
 }
示例#10
0
/**
 * Include a textzone file
 * @param   string $textzone name of the textzone
 * @param   string $defaultContent content displayed if textzone cannot be found or doesn't exist
 */
function include_textzone($textzone, $defaultContent = null)
{
    $textzone = secure_file_path($textzone);
    // find correct path where the file is
    // FIXME : move ALL textzones to the same location !
    if (file_exists(get_path('rootSys') . './platform/textzone/' . $textzone)) {
        $textzonePath = get_path('rootSys') . './platform/textzone/' . $textzone;
    } elseif (file_exists(get_path('rootSys') . './' . $textzone)) {
        $textzonePath = get_path('rootSys') . './' . $textzone;
    } else {
        $textzonePath = null;
    }
    // textzone content
    if (!is_null($textzonePath)) {
        include $textzonePath;
    } else {
        if (!is_null($defaultContent)) {
            echo $defaultContent;
        }
        if (claro_is_platform_admin()) {
            // help tip for administrator
            echo '<p>' . get_lang('blockTextZoneHelp', array('%textZoneFile' => $textzone)) . '</p>';
        }
    }
    // edit link
    if (claro_is_platform_admin()) {
        echo '<p>' . "\n" . '<a href="' . get_path('rootAdminWeb') . 'managing/editFile.php?cmd=rqEdit&amp;file=' . $textzone . '">' . "\n" . '<img src="' . get_icon_url('edit') . '" alt="" />' . get_lang('Edit text zone') . "\n" . '</a>' . "\n" . '</p>' . "\n";
    }
}
示例#11
0
文件: work.php 项目: rhertzog/lcs
        $sortKeyList['title'] = SORT_ASC;
    }
}
$offset = isset($_REQUEST['offset']) && !empty($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;
$assignmentPager = new claro_sql_pager($sql, $offset, $assignmentsPerPage);
foreach ($sortKeyList as $thisSortKey => $thisSortDir) {
    $assignmentPager->add_sort_key($thisSortKey, $thisSortDir);
}
$assignmentList = $assignmentPager->get_result_list();
// Help URL
$helpUrl = $is_allowedToEdit ? get_help_page_url('blockAssignmentsHelp', 'CLWRK') : null;
// Command list
$cmdList = array();
if ($is_allowedToEdit) {
    $cmdList[] = array('img' => 'assignment', 'name' => get_lang('Create a new assignment'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqMkAssig')));
    if (claro_is_platform_admin() || get_conf('allow_download_all_submissions')) {
        $cmdList[] = array('img' => 'save', 'name' => get_lang('Download submissions'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqDownload')));
    }
    if (get_conf('mail_notification', false) && !get_conf('automatic_mail_notification', false)) {
        $cmdList[] = array('img' => 'settings', 'name' => get_lang('Assignments preferences'), 'url' => claro_htmlspecialchars(Url::Contextualize('work_settings.php')));
    }
}
$out = '';
$out .= claro_html_tool_title($nameTools, $helpUrl, $cmdList);
if ($is_allowedToEdit) {
    $out .= $dialogBox->render();
    // Form
    if (isset($displayAssigForm) && $displayAssigForm) {
        $out .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data">' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . '<input type="hidden" name="cmd" value="' . $cmdToSend . '" />' . "\n" . claro_form_relay_context() . "\n" . '<fieldset>';
        if (!is_null($assigId)) {
            $out .= '<input type="hidden" name="assigId" value="' . $assigId . '" />' . "\n";
示例#12
0
 /**
  * Get the authentication profile for the given user id
  * @param int $userId
  * @return AuthProfile
  */
 public static function getUserAuthProfile($userId)
 {
     if ($userId != claro_get_current_user_id()) {
         $user = new Claro_User($userId);
         $user->loadFromDatabase();
     } else {
         $user = Claro_CurrentUser::getInstance();
     }
     $authSource = $user->authSource;
     if (!$authSource) {
         throw new Exception("Cannot find user authentication source for user {$userId}");
     }
     try {
         $profileOptions = AuthDriverManager::getDriver($authSource)->getAuthProfileOptions();
     } catch (Exception $e) {
         if (claro_is_platform_admin() || claro_is_in_a_course() && claro_is_course_manager() && $userId != claro_get_current_user_id()) {
             Console::warning("Cannot find user authentication source for user {$userId}, use claroline default options instead");
             $profileOptions = AuthDriverManager::getDriver('claroline')->getAuthProfileOptions();
         } else {
             throw $e;
         }
     }
     $authProfile = new AuthProfile($userId, $authSource);
     $authProfile->setAuthDriverOptions($profileOptions);
     if (claro_debug_mode()) {
         pushClaroMessage(var_export($profileOptions, true), 'debug');
     }
     return $authProfile;
 }
示例#13
0
/**
 * This dirty function is a blackbox to provide normalised output of tool list for a group
 * like  get_course_tool_list($course_id=NULL) in course_home.
 *
 * It's dirty because data structure is dirty.
 * Tool_list (with clarolabel and tid come from tool tables and  group properties and localinit)
 * @param $course_id
 * @param boolean $active, if set to true, only activated tools of the platform must be returned
 * @author Christophe Gesche <*****@*****.**>
 * @return array
 */
function get_group_tool_list($course_id = NULL, $active = true)
{
    global $forumId;
    $_groupProperties = claro_get_current_group_properties_data();
    $isAllowedToEdit = claro_is_course_manager() || claro_is_platform_admin();
    $tbl = claro_sql_get_main_tbl(array('module', 'course_tool'));
    $tbl_cdb_names = claro_sql_get_course_tbl(claro_get_course_db_name_glued($course_id));
    $tbl['course_tool'] = $tbl_cdb_names['tool'];
    // This stupid array is an hack to simulate the context
    // managing by module structure
    // It's represent tools aivailable to work in a group context.
    // $aivailable_tool_in_group = array('CLFRM','CLCHT','CLDOC','CLWIKI');
    $sql = "\nSELECT tl.id                               id,\n       tl.script_name                      name,\n       tl.visibility                       visibility,\n       tl.rank                             rank,\n       IFNULL(ct.script_url,tl.script_url) url,\n       ct.claro_label                      label,\n       ct.icon                             icon,\n       m.activation                        activation\nFROM      `" . $tbl['course_tool'] . "`       tl\nLEFT JOIN `" . $tbl['tool'] . "` `ct`\nON        ct.id = tl.tool_id\nLEFT JOIN `" . $tbl['module'] . "` `m`\nON        m.label = ct.claro_label\nLEFT JOIN `" . $tbl['module_contexts'] . "` `mc`\nON        m.id = mc.module_id\nWHERE `mc`.`context` = 'group'\nORDER BY tl.rank\n\n";
    $tool_list = claro_sql_query_fetch_all($sql);
    $group_tool_list = array();
    foreach ($tool_list as $tool) {
        $tool['label'] = trim($tool['label'], '_');
        if ($active !== true || 'activated' == $tool['activation']) {
            switch ($tool['label']) {
                case 'CLFRM':
                    if (!empty($_groupProperties['tools']['CLFRM']) || $isAllowedToEdit) {
                        $tool['url'] = 'viewforum.php?forum=' . $forumId . claro_url_relay_context('&amp;');
                        $group_tool_list[] = $tool;
                    }
                    break;
                default:
                    if (isset($_groupProperties['tools'][$tool['label']]) && $_groupProperties['tools'][$tool['label']] || $isAllowedToEdit) {
                        $tool['url'] .= claro_url_relay_context('?');
                        $group_tool_list[] = $tool;
                    }
                    break;
            }
        }
    }
    return $group_tool_list;
}
示例#14
0
文件: index.php 项目: rhertzog/lcs
<?php

// $Id: index.php 12977 2011-03-15 14:26:44Z abourguignon $
/**
 * CLAROLINE
 *
 * This is the index page of sdk tools.
 *
 * @version     $Revision: 12977 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @package     SDK
 * @author      Claro Team <*****@*****.**>
 * @author      Christophe Gesche <*****@*****.**>
 */
require '../../inc/claro_init_global.inc.php';
if (file_exists(get_path('rootSys') . 'platform/currentVersion.inc.php')) {
    include get_path('rootSys') . 'platform/currentVersion.inc.php';
}
$is_allowedToUseSDK = claro_is_platform_admin();
if (!$is_allowedToUseSDK) {
    claro_disp_auth_form();
}
$nameTools = get_lang('Technical Tools');
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
$out = '';
$out .= claro_html_tool_title(array('mainTitle' => $nameTools)) . '<ul>' . "\n" . '<li><a href="./files_stats.php">' . get_lang('Files statistics') . '</a></li>' . "\n" . '<li><a href="./phpInfo.php">' . get_lang('PHP system information') . '</a></li>' . "\n" . '</ul>' . "\n";
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
示例#15
0
function claro_is_current_user_enrolment_pending()
{
    return !claro_is_platform_admin() && claro_is_course_registration_pending();
}
        ?>
            
        <?php 
    }
    ?>
        
    <?php 
} else {
    ?>
        
    <?php 
}
?>
    
    <?php 
if ($this->courseUserPrivilegesList->getCoursePrivileges($this->node->getCourse()->courseId)->isCourseManager() || claro_is_platform_admin()) {
    ?>
    
    <a<?php 
    if (!empty($this->notifiedCourseList) && $this->notifiedCourseList->isCourseNotified($this->node->getCourse()->courseId)) {
        ?>
 class="hot"<?php 
    }
    ?>
        href="<?php 
    echo claro_htmlspecialchars(claro_get_course_homepage_url($this->node->getCourse()->sysCode));
    ?>
">
        
        <?php 
    echo claro_htmlspecialchars($this->node->getCourse()->officialCode);
示例#17
0
/**
 * Returns a courses list for the current user.
 *
 * @return string       list of courses (HTML format)
 * @deprecated use UserCourseList and CourseTreeView instead
 */
function render_user_course_list()
{
    // Get the list of personnal courses marked as contening new events
    $date = Claroline::getInstance()->notification->get_notification_date(claro_get_current_user_id());
    $modified_course = Claroline::getInstance()->notification->get_notified_courses($date, claro_get_current_user_id());
    // Get all the user's courses
    $userCourseList = claro_get_user_course_list();
    // Use the course id as array index, exclude disable courses
    // and flag hot courses
    $reorganizedUserCourseList = array();
    $tempSessionCourses = array();
    foreach ($userCourseList as $course) {
        // Do not include "disable", "pending", "trash" or "date" courses
        // (if we're not in the date limits)
        $curdate = claro_mktime();
        $courseIsEnable = (bool) ($course['status'] == 'enable' || $course['status'] == 'date' && (!isset($course['creationDate']) || strtotime($course['creationDate']) <= $curdate) && (!isset($course['expirationDate']) || strtotime($course['expirationDate']) >= $curdate));
        // Flag hot courses
        $course['hot'] = (bool) in_array($course['sysCode'], $modified_course);
        if (!isset($reorganizedUserCourseList[$course['courseId']]) && $courseIsEnable) {
            // If it's not a session course, include it in the final list
            if (empty($course['sourceCourseId'])) {
                $reorganizedUserCourseList[$course['courseId']] = $course;
            } else {
                $tempSessionCourses[$course['sourceCourseId']][] = $course;
            }
        }
    }
    unset($userCourseList);
    // Merge courses and their session courses (if any)
    foreach ($tempSessionCourses as $sourceCourseId => $sessionCourses) {
        /*
         * Sometimes, a session course could not find its associated source
         * course in the user course list.  Simply because, for some reason,
         * this user isn't registered to the source course anymore, but is
         * still registered in the session course.
         */
        if (!empty($reorganizedUserCourseList[$sourceCourseId])) {
            $reorganizedUserCourseList[$sourceCourseId]['sessionCourses'] = $sessionCourses;
        } else {
            foreach ($sessionCourses as $course) {
                $reorganizedUserCourseList[$course['courseId']] = $course;
            }
        }
    }
    unset($tempSessionCourses);
    // Now, $reorganizedUserCourseList contains all user's courses and, for
    // each course, its eventual session courses.
    // Display
    $out = '';
    // Courses organized by categories
    if (get_conf('userCourseListGroupByCategories')) {
        // Get all the categories names (used to build trails)
        $categoryList = ClaroCategory::getAllCategories(0, 0, 1);
        // Get the categories informations for these courses
        $userCategoryList = ClaroCategory::getCoursesCategories($reorganizedUserCourseList);
        // Use the category id as array index
        $reorganizedUserCategoryList = array();
        foreach ($userCategoryList as $category) {
            // Flag root courses and put it aside
            $reorganizedUserCourseList[$category['courseId']]['rootCourse'] = 0;
            if ($category['rootCourse']) {
                $reorganizedUserCourseList[$category['courseId']]['rootCourse'] = 1;
            }
            if (!isset($reorganizedUserCategoryList[$category['categoryId']])) {
                $reorganizedUserCategoryList[$category['categoryId']] = $category;
                //We won't need that key anymore
                unset($reorganizedUserCategoryList[$category['categoryId']]['courseId']);
            }
            // Initialise the category's course list
            $reorganizedUserCategoryList[$category['categoryId']]['courseList'] = array();
        }
        // Place courses in the right categories and build categories' trails
        $currentCategoryId = null;
        foreach ($userCategoryList as $category) {
            // Build the full trail for each category (excepted root category)
            if ($category['categoryId'] == 0) {
                $trail = $category['name'];
            } else {
                $trail = build_category_trail($categoryList, $category['categoryId']);
            }
            $reorganizedUserCategoryList[$category['categoryId']]['trail'] = $trail;
            // Put root courses aside
            if ($reorganizedUserCourseList[$category['courseId']]['rootCourse']) {
                $reorganizedUserCategoryList[$category['categoryId']]['rootCourse'] = $reorganizedUserCourseList[$category['courseId']];
            } else {
                // Do not include source courses (only display session courses)
                // (excepted if the user is manager of the course)
                if (!$reorganizedUserCourseList[$category['courseId']]['isSourceCourse'] || $reorganizedUserCourseList[$category['courseId']]['isCourseManager']) {
                    $reorganizedUserCategoryList[$category['categoryId']]['courseList'][] = $reorganizedUserCourseList[$category['courseId']];
                }
            }
        }
        unset($userCategoryList);
        if (count($reorganizedUserCategoryList) > 0) {
            $out .= '<dl class="courseList">';
            foreach ($reorganizedUserCategoryList as $category) {
                if (!empty($category['courseList']) || !empty($category['rootCourse'])) {
                    $out .= '<dt>' . "\n" . '<h4 id="' . $category['categoryId'] . '">' . $category['trail'] . (!empty($category['rootCourse']) ? ' [<a href="' . get_path('url') . '/claroline/course/index.php?cid=' . claro_htmlspecialchars($category['rootCourse']['sysCode']) . '">' . get_lang('Infos') . '</a>]' : '') . '</h4>' . "\n" . '</dt>' . "\n";
                    if (!empty($category['courseList'])) {
                        foreach ($category['courseList'] as $course) {
                            $out .= render_course_in_dl_list($course, $course['hot']);
                        }
                    } else {
                        $out .= '<dt>' . get_lang('There are no courses in this category') . '</dt>';
                    }
                }
            }
        }
        $out .= '</dl>';
    } else {
        if (count($reorganizedUserCourseList) > 0) {
            $out .= '<dl class="courseList">';
            foreach ($reorganizedUserCourseList as $course) {
                $displayIconAccess = $course['isCourseManager'] || claro_is_platform_admin() ? true : false;
                $out .= render_course_in_dl_list($course, $course['hot'], $displayIconAccess);
            }
            $out .= '</dl>' . "\n";
        }
    }
    return $out;
}
示例#18
0
/**
 * Is tool action allowed
 *
 * @param string $actionName name of the action
 * @param integer $tid tool identifier
 * @param integer $profileId profile identifier
 * @param string $courseId course identifier
 * @return boolean 'true' if it's allowed
 */
function claro_is_allowed_tool_action($actionName, $tid = null, $profileId = null, $courseId = null)
{
    global $_mainToolId;
    global $_profileId;
    // load tool id
    if (is_null($tid)) {
        if (!empty($_mainToolId)) {
            $tid = $_mainToolId;
        } else {
            return false;
        }
    }
    // load profile id
    if (is_null($profileId)) {
        if (!empty($_profileId)) {
            $profileId = $_profileId;
        } else {
            return false;
        }
    }
    // load course id
    if (is_null($courseId)) {
        if (claro_is_in_a_course()) {
            $courseId = claro_get_current_course_id();
        } else {
            return false;
        }
    }
    // FIXME
    if (claro_is_platform_admin()) {
        return true;
    }
    // get course profile right
    $courseProfileRight = claro_get_course_profile_right($profileId, $courseId);
    // return value for tool/action
    if (isset($courseProfileRight[$tid][$actionName])) {
        return $courseProfileRight[$tid][$actionName];
    } else {
        return false;
    }
}
示例#19
0
if ($currentUserId != claro_get_current_user_id()) {
    $userData = user_get_properties($currentUserId);
    if ($userData === false) {
        claro_die(get_lang("User not found"));
    } else {
        $title = get_lang('Messages of %firstName %lastName', array('%firstName' => claro_htmlspecialchars($userData['firstname']), '%lastName' => claro_htmlspecialchars($userData['lastname'])));
    }
} else {
    $title = get_lang('My messages');
}
$linkPage = $_SERVER['PHP_SELF'];
$acceptedValues = array('inbox', 'outbox', 'trashbox');
if (!isset($_REQUEST['box']) || !in_array($_REQUEST['box'], $acceptedValues)) {
    $_REQUEST['box'] = "inbox";
}
$link_arg['box'] = $_REQUEST['box'];
require_once dirname(__FILE__) . '/lib/tools.lib.php';
$content = "";
if ($link_arg['box'] == "inbox") {
    include dirname(__FILE__) . '/inboxcontroler.inc.php';
} elseif ($link_arg['box'] == "outbox") {
    include dirname(__FILE__) . '/outboxcontroler.inc.php';
} else {
    include dirname(__FILE__) . '/trashboxcontroler.inc.php';
}
$claroline->display->banner->breadcrumbs->append($title, $_SERVER['PHP_SELF'] . '?box=' . $link_arg['box']);
$claroline->display->body->appendContent(claro_html_tool_title($title));
$claroline->display->body->appendContent(claro_text_zone::get_block('textzone_messaging_top', claro_is_platform_admin()));
$claroline->display->body->appendContent($content);
// ------------ display ----------------------
echo $claroline->display->render();
示例#20
0
// Security check
if (!claro_is_user_authenticated()) {
    claro_disp_auth_form();
}
if (!claro_is_platform_admin()) {
    claro_die(get_lang('Not allowed'));
}
$nameTools = get_lang('User settings');
$dialogBox = new DialogBox();
// BC
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
$user_id = $_REQUEST['uidToEdit'];
//------------------------------------
// Execute COMMAND section
//------------------------------------
if (isset($_REQUEST['cmd']) && claro_is_platform_admin()) {
    if ($_REQUEST['cmd'] == 'UnReg') {
        if (user_remove_from_course($user_id, $_REQUEST['cidToEdit'], true, false)) {
            $dialogBox->success(get_lang('The user has been successfully unregistered'));
        } else {
            switch (claro_failure::get_last_failure()) {
                case 'cannot_unsubscribe_the_last_course_manager':
                    $dialogBox->error(get_lang('You cannot unsubscribe the last course manager of the course'));
                    break;
                case 'course_manager_cannot_unsubscribe_himself':
                    $dialogBox->error(get_lang('Course manager cannot unsubscribe himself'));
                    break;
                default:
            }
        }
    }
示例#21
0
文件: phpInfo.php 项目: rhertzog/lcs
    claro_die(get_lang('Not allowed'));
}
$claroCreditFilePath = get_path('rootSys') . 'CREDITS.txt';
if (file_exists(get_path('rootSys') . 'platform/currentVersion.inc.php')) {
    include get_path('rootSys') . 'platform/currentVersion.inc.php';
}
require dirname(__FILE__) . '/../../inc/installedVersion.inc.php';
if (!claro_is_platform_admin()) {
    claro_disp_auth_form();
}
if (!isset($clarolineVersion)) {
    $clarolineVersion = 'X';
}
$nameTools = get_lang('System Info');
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
$is_allowedToAdmin = claro_is_platform_admin();
if ($is_allowedToAdmin) {
    $htmlHeadXtra[] = phpinfo_getStyle();
    $claroline->display->body->appendContent(claro_html_tool_title(array('mainTitle' => $nameTools, 'subTitle' => get_conf('siteName'))));
    $cmd = array_key_exists('cmd', $_REQUEST) ? $_REQUEST['cmd'] : 'versions';
    $ext = array_key_exists('ext', $_REQUEST) ? $_REQUEST['ext'] : '';
    ob_start();
    ?>

<ul id="navlist">
    <li>
        <a href="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
?cmd=versions" <?php 
    echo $cmd == 'versions' ? 'class="current"' : '';
示例#22
0
 /**
  * create a new message
  *
  * @param int $messageId message identification
  * @param int $userId user identification
  * if it not defined it use the current user identification
  * @return ReceivedMessage the message created
  */
 public static function fromId($messageId, $userId = NULL)
 {
     if (is_null($userId)) {
         $userId = claro_get_current_user_id();
     }
     if (!claro_is_platform_admin()) {
         $userSql = " AND R.user_id = " . (int) $userId . "\n";
     } else {
         $userSql = "";
     }
     $tableName = get_module_main_tbl(array('im_message', 'im_message_status', 'user', 'im_recipient'));
     $messageSQL = "SELECT U.nom AS lastName, U.prenom AS firstName, M.message_id, M.sender,M.subject,  \n" . "M.message, M.send_time, R.is_read, R.is_deleted, R.user_id, M.course, M.group, M.tools, \n" . "RE.sent_to\n" . "FROM `" . $tableName['im_message'] . "` as M \n" . " LEFT JOIN `" . $tableName['im_message_status'] . "` AS R ON M.message_id = R.message_id\n" . " LEFT JOIN `" . $tableName['user'] . "` AS U ON M.sender = U.user_id\n" . " LEFT JOIN `" . $tableName['im_recipient'] . "` AS RE ON M.message_id = RE.message_id\n" . " WHERE M.message_id = " . (int) $messageId . "\n" . $userSql;
     $resultMessage = claro_sql_query_fetch_single_row($messageSQL);
     if (!$resultMessage) {
         $messageSQL = "SELECT U.nom AS lastName, U.prenom AS firstName, M.message_id, M.sender, M.subject, \n" . "M.message, M.send_time, R.is_read, R.is_deleted, R.user_id, M.course, M.group, M.tools, \n" . "RE.sent_to\n" . "FROM `" . $tableName['im_message'] . "` as M\n" . " LEFT JOIN `" . $tableName['im_message_status'] . "` AS R ON M.message_id = R.message_id\n" . " LEFT JOIN `" . $tableName['user'] . "` AS U ON M.sender = U.user_id\n" . " LEFT JOIN `" . $tableName['im_recipient'] . "` AS RE ON M.message_id = RE.message_id\n" . " WHERE R.user_id = 0" . " AND M.message_id = " . (int) $messageId;
         $resultMessage = claro_sql_query_fetch_single_row($messageSQL);
     }
     if (!$resultMessage) {
         return false;
     } else {
         return self::fromArray($resultMessage);
     }
 }
示例#23
0
文件: html.lib.php 项目: rhertzog/lcs
/**
 * Return the breadcrumb to display in the header
 *
 * @global string  $nameTools
 * @global array   $interbredcrump
 * @global boolean $noPHP_SELF
 * @global boolean $noQUERY_STRING
 *
 * @return string html content
 */
function claro_html_breadcrumb()
{
    // dirty global to keep value (waiting a refactoring)
    global $nameTools, $interbredcrump, $noPHP_SELF, $noQUERY_STRING;
    /******************************************************************************
       BREADCRUMB LINE
       ******************************************************************************/
    $htmlBC = '';
    if (claro_is_in_a_course() || isset($nameTools) || isset($interbredcrump) && is_array($interbredcrump)) {
        $htmlBC .= '<div id="breadcrumbLine">' . "\n\n" . '<hr />' . "\n";
        $breadcrumbUrlList = array();
        $breadcrumbNameList = array();
        $breadcrumbUrlList[] = get_path('url') . '/index.php';
        $breadcrumbNameList[] = get_conf('siteName');
        if (claro_is_in_a_course()) {
            $breadcrumbUrlList[] = get_path('clarolineRepositoryWeb') . 'course/index.php?cid=' . claro_htmlspecialchars(claro_get_current_course_id());
            $breadcrumbNameList[] = claro_get_current_course_data('officialCode');
        }
        if (claro_is_in_a_group()) {
            $breadcrumbUrlList[] = get_module_url('CLGRP') . '/index.php?cidReq=' . claro_htmlspecialchars(claro_get_current_course_id());
            $breadcrumbNameList[] = get_lang('Groups');
            $breadcrumbUrlList[] = get_module_url('CLGRP') . '/group_space.php?cidReq=' . claro_htmlspecialchars(claro_get_current_course_id()) . '&gidReq=' . (int) claro_get_current_group_id();
            $breadcrumbNameList[] = claro_get_current_group_data('name');
        }
        if (isset($interbredcrump) && is_array($interbredcrump)) {
            while (list(, $bredcrumpStep) = each($interbredcrump)) {
                $breadcrumbUrlList[] = $bredcrumpStep['url'];
                $breadcrumbNameList[] = $bredcrumpStep['name'];
            }
        }
        if (isset($nameTools)) {
            $breadcrumbNameList[] = $nameTools;
            if (isset($noPHP_SELF) && $noPHP_SELF) {
                $breadcrumbUrlList[] = null;
            } elseif (isset($noQUERY_STRING) && $noQUERY_STRING) {
                $breadcrumbUrlList[] = $_SERVER['PHP_SELF'];
            } else {
                // set Query string to empty if not exists
                if (!isset($_SERVER['QUERY_STRING'])) {
                    $_SERVER['QUERY_STRING'] = '';
                }
                $breadcrumbUrlList[] = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
            }
        }
        $htmlBC .= claro_html_breadcrumbtrail($breadcrumbNameList, $breadcrumbUrlList, ' &gt; ', get_icon_url('home'));
        if (!claro_is_user_authenticated()) {
            $htmlBC .= "\n" . '<div id="toolViewOption" style="padding-right:10px">' . '<a href="' . get_path('clarolineRepositoryWeb') . 'auth/login.php' . '?sourceUrl=' . urlencode(base64_encode((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) . '" target="_top">' . get_lang('Login') . '</a>' . '</div>' . "\n";
        } elseif (claro_is_in_a_course() && !claro_is_course_member() && claro_get_current_course_data('registrationAllowed') && !claro_is_platform_admin()) {
            $htmlBC .= '<div id="toolViewOption">' . '<a href="' . get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=exReg&course=' . claro_get_current_course_id() . '">' . '<img src="' . get_icon_url('enroll') . '" alt="" /> ' . '<b>' . get_lang('Enrolment') . '</b>' . '</a>' . '</div>' . "\n";
        } elseif (claro_is_display_mode_available()) {
            $htmlBC .= "\n" . '<div id="toolViewOption">' . "\n";
            if (isset($_REQUEST['View mode'])) {
                $htmlBC .= claro_html_tool_view_option($_REQUEST['View mode']);
            } else {
                $htmlBC .= claro_html_tool_view_option();
            }
            if (claro_is_platform_admin() && !claro_is_course_member()) {
                $htmlBC .= ' | <a href="' . get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=exReg&course=' . claro_get_current_course_id() . '">';
                $htmlBC .= '<img src="' . get_icon_url('enroll') . '" alt="" /> ';
                $htmlBC .= '<b>' . get_lang('Enrolment') . '</b>';
                $htmlBC .= '</a>';
            }
            $htmlBC .= "\n" . '</div>' . "\n";
        }
        $htmlBC .= '<div class="spacer"></div>' . "\n" . '<hr />' . "\n" . '</div>' . "\n";
    } else {
        // $htmlBC .= '<div style="height:1em"></div>';
    }
    return $htmlBC;
}
示例#24
0
function printInit($selection = "*")
{
    global $uidReset, $cidReset, $gidReset, $tidReset, $uidReq, $cidReq, $gidReq, $tidReq, $tlabelReq, $_user, $_course, $_groupUser, $_courseTool, $_SESSION, $_claro_local_run;
    if ($_claro_local_run) {
        echo "local init runned";
    } else {
        echo '<font color="red"> local init never runned during this script </font>';
    }
    echo '
<table width="100%" border="1" cellspacing="4" cellpadding="1" bordercolor="#808080" bgcolor="#C0C0C0" lang="en">
    <TR>';
    if ($selection == "*" or strstr($selection, "u")) {
        echo '
        <TD valign="top" >
            <strong>User</strong> :
            (_uid)             : ' . var_export(claro_get_current_user_id(), 1) . ' |
            (session[_uid]) : ' . var_export($_SESSION["_uid"], 1) . '
            <br />
            reset = ' . var_export($uidReset, 1) . ' |
            req = ' . var_export($uidReq, 1) . '<br />
            _user : <pre>' . var_export($_user, 1) . '</pre>
            <br />is_platformAdmin            :' . var_export(claro_is_platform_admin(), 1) . '
            <br />is_allowedCreateCourse    :' . var_export(claro_is_allowed_to_create_course(), 1) . '
        </TD>';
    }
    if ($selection == "*" or strstr($selection, "c")) {
        echo "\n        <TD valign=\"top\" >\n            <strong>Course</strong> : (_cid)" . var_export(claro_get_current_course_id(), 1) . "\n            <br />\n            reset = " . var_export($cidReset, 1) . " | req = " . var_export($cidReq, 1) . "\n            <br />\n            _course : <pre>" . var_export($_course, 1) . "</pre>\n            <br />\n            _groupProperties :\n            <PRE>\n                " . var_export(claro_get_current_group_properties_data(), 1) . "\n            </PRE>\n        </TD>";
    }
    echo '
    </TR>
    <TR>';
    if ($selection == "*" or strstr($selection, "g")) {
        echo '<TD valign="top" ><strong>Group</strong> : (_gid) ' . var_export(claro_get_current_group_id(), 1) . '<br />
        reset = ' . var_export($GLOBALS['gidReset'], 1) . ' | req = ' . var_export($gidReq, 1) . "<br />\n        _group :<pre>" . var_export(claro_get_current_group_data(), 1) . "</pre></TD>";
    }
    if ($selection == "*" or strstr($selection, "t")) {
        echo '<TD valign="top" ><strong>Tool</strong> : (_tid)' . var_export(claro_get_current_tool_id(), 1) . '<br />
        reset = ' . var_export($tidReset, 1) . ' |
        req = ' . var_export($tidReq, 1) . '|
        req = ' . var_export($tlabelReq, 1) . '
        <br />
        _tool :' . var_export(get_init('_tool'), 1) . "</TD>";
    }
    echo "</TR>";
    if ($selection == "*" or strstr($selection, "u") && strstr($selection, "c")) {
        echo '<TR><TD valign="top" colspan="2"><strong>Course-User</strong>';
        if (claro_is_user_authenticated()) {
            echo '<br /><strong>User</strong> :' . var_export(claro_is_in_a_course(), 1);
        }
        if (claro_is_in_a_course()) {
            echo ' in ' . var_export(claro_get_current_course_id(), 1) . '<br />';
        }
        if (claro_is_user_authenticated() && claro_get_current_course_id()) {
            echo '_courseUser            : <pre>' . var_export(getInit('_courseUser'), 1) . '</pre>';
        }
        echo '<br />is_courseMember    : ' . var_export(claro_is_course_member(), 1);
        echo '<br />is_courseAdmin    : ' . var_export(claro_is_course_manager(), 1);
        echo '<br />is_courseAllowed    : ' . var_export(claro_is_course_allowed(), 1);
        echo '<br />is_courseTutor    : ' . var_export(claro_is_course_tutor(), 1);
        echo '</TD></TR>';
    }
    echo "";
    if ($selection == "*" or strstr($selection, "u") && strstr($selection, "g")) {
        echo '<TR><TD valign="top"  colspan="2">' . '<strong>Course-Group-User</strong>';
        if (claro_is_user_authenticated()) {
            echo '<br /><strong>User</strong> :' . var_export(claro_is_in_a_course(), 1);
        }
        if (claro_is_in_a_group()) {
            echo ' in ' . var_export(claro_get_current_group_id(), 1);
        }
        if (claro_is_in_a_group()) {
            echo '<br />_groupUser:'******'_groupUser'), 1);
        }
        echo '<br />is_groupMember:' . var_export(claro_is_group_member(), 1) . '<br />is_groupTutor: ' . var_export(claro_is_group_tutor(), 1) . '<br />is_groupAllowed:' . var_export(claro_is_group_allowed(), 1) . '</TD>' . '</tr>';
    }
    if ($selection == "*" or strstr($selection, "c") && strstr($selection, "t")) {
        echo '<tr>
        <TD valign="top" colspan="2" ><strong>Course-Tool</strong><br />';
        if (claro_get_current_tool_id()) {
            echo 'Tool :' . claro_get_current_tool_id();
        }
        if (claro_is_in_a_course()) {
            echo ' in ' . claro_get_current_course_id() . '<br />';
        }
        if (claro_get_current_tool_id()) {
            echo "_courseTool    : <pre>" . var_export($_courseTool, 1) . '</pre><br />';
        }
        echo 'is_toolAllowed : ' . var_export(claro_is_tool_allowed(), 1);
        echo "</TD>";
    }
    echo "</TR></TABLE>";
}
示例#25
0
 /**
  * Display table with tool/right of the profile
  */
 public function displayProfileToolRightList()
 {
     $html = '';
     $html_table_header_list = array();
     $html_table_row_list = array();
     foreach ($this->rightProfileToolRightList as $profile_id => $rightProfileToolRight) {
         $isLocked = $rightProfileToolRight->profile->isLocked();
         $className = get_class($rightProfileToolRight);
         // use strtolower for PHP4 : get_class returns class name in lowercase
         $className = strtolower($className);
         $html_table_header_list[$profile_id] = claro_get_profile_name($profile_id);
         if ($isLocked && $className == strtolower('RightCourseProfileToolRight')) {
             $displayMode = claro_is_platform_admin() ? $this->displayMode : 'read';
             $html_table_header_list[$profile_id] .= '&nbsp;<img src="' . get_icon_url('locked') . '" alt="' . get_lang('Profile locked') . '" />';
         } else {
             $displayMode = $this->displayMode;
         }
         foreach ($rightProfileToolRight->toolActionList as $tool_id => $action_list) {
             $action_right = $rightProfileToolRight->getToolRight($tool_id);
             $html_right = '';
             if ($displayMode == 'edit') {
                 $param_append = '?profile_id=' . urlencode($profile_id) . '&amp;tool_id=' . urlencode($tool_id) . '&amp;cmd=set_right';
                 foreach ($this->urlParamAppendList as $name => $value) {
                     $param_append .= '&amp;' . $name . '=' . $value;
                 }
             }
             if (claro_get_profile_label($profile_id) != ANONYMOUS_PROFILE && claro_get_profile_label($profile_id) != GUEST_PROFILE) {
                 if ($action_right == 'none') {
                     $action_param_value = 'user';
                     $html_right = '<img src="' . get_icon_url('forbidden') . '" alt="' . get_lang('No access') . '" />&nbsp;<span style="font-size: smaller;">' . get_lang('No access') . "</span>\n";
                 } elseif ($action_right == 'user') {
                     $action_param_value = 'manager';
                     $html_right = '<img src="' . get_icon_url('user') . '" alt="' . get_lang('Access allowed') . '" />&nbsp;<span style="font-size: smaller;">' . get_lang('Access allowed') . "</span>\n";
                 } else {
                     $action_param_value = 'none';
                     $html_right = '<img src="' . get_icon_url('manager') . '" alt="' . get_lang('Edition allowed') . '" />&nbsp;<span style="font-size: smaller;">' . get_lang('Edition allowed') . "</span>\n";
                 }
             } else {
                 if ($action_right == 'none') {
                     $action_param_value = 'user';
                     $html_right = '<img src="' . get_icon_url('forbidden') . '" alt="' . get_lang('No access') . '" />&nbsp;<span style="font-size: smaller;">' . get_lang('No access') . "</span>\n";
                 } else {
                     $action_param_value = 'none';
                     $html_right = '<img src="' . get_icon_url('user') . '" alt="' . get_lang('Access allowed') . '" />&nbsp;<span style="font-size: smaller;">' . get_lang('Access allowed') . "</span>\n";
                 }
             }
             if ($displayMode == 'edit') {
                 $html_right = '<a href="' . $_SERVER['PHP_SELF'] . $param_append . '&amp;right_value=' . $action_param_value . '">' . $html_right . '</a>';
             }
             $html_table_row_list[$tool_id][$profile_id] = $html_right;
         }
     }
     // build table
     $html .= '<table class="claroTable emphaseLine" >' . "\n" . '<thead>' . "\n" . '<tr class="headerX">' . "\n" . '<th>' . get_lang('Tools') . '</th>' . "\n";
     // visibility column
     if ($this->isSetCourseToolInfo()) {
         $html .= '<th style="text-align:center; width:100px;" >' . get_lang('Visibility') . '</th>' . "\n";
     }
     foreach ($html_table_header_list as $html_table_header) {
         $html .= '<th style="text-align:center; width:100px;" >' . $html_table_header . '</th>' . "\n";
     }
     $html .= '</tr>' . "\n" . '</thead>' . "\n" . '<tbody>';
     foreach ($html_table_row_list as $tool_id => $html_table_row) {
         if (claro_is_in_a_course() && (!$this->isSetCourseToolInfo() || !isset($this->courseToolInfo[$tool_id]))) {
             // Not activated in course !
             continue;
         }
         $html .= '<tr>' . "\n";
         if ($this->isSetCourseToolInfo()) {
             // Add visibility and icon from courseToolInfo
             $html .= '<td ' . ($this->courseToolInfo[$tool_id]['visibility'] == true ? '' : 'class="invisible"') . '>' . '<img src="' . $this->courseToolInfo[$tool_id]['icon'] . '" alt="" />' . get_lang(claro_get_tool_name($tool_id)) . '</td>';
         } else {
             $html .= '<td>' . get_lang(claro_get_tool_name($tool_id)) . '</td>' . "\n";
         }
         // visibility column
         if ($this->isSetCourseToolInfo()) {
             if ($this->courseToolInfo[$tool_id]['visibility'] == true) {
                 $html .= '<td align="center">' . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exInvisible&amp;tool_id=' . $this->courseToolInfo[$tool_id]['tid'] . '" >' . '<img src="' . get_icon_url('visible') . '" alt="' . get_lang('Visible') . '" />' . '</a>' . '</td>' . "\n";
             } else {
                 $html .= '<td align="center">' . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exVisible&amp;tool_id=' . $this->courseToolInfo[$tool_id]['tid'] . '" >' . '<img src="' . get_icon_url('invisible') . '" alt="' . get_lang('Invisible') . '" />' . '</a></td>' . "\n";
             }
         }
         // profile colums
         foreach ($html_table_row as $html_table_row_cell) {
             $html .= '<td align="center">' . $html_table_row_cell . '</td>';
         }
         $html .= '</tr>' . "\n";
     }
     $html .= '</tbody></table>';
     return $html;
 }
示例#26
0
if ($this->courseTreeRootNode->hasChildren()) {
    ?>

<!-- Render the base of the course tree -->
<dl class="courseList">
    
    <?php 
    foreach ($this->courseTreeRootNode->getChildren() as $courseTreeNode) {
        ?>
        
        <?php 
        if ($courseTreeNode->hasCourse()) {
            ?>
            
            <?php 
            if ($courseTreeNode->getCourse()->isActivated() && ($courseTreeNode->getCourse()->isVisible() || claro_is_platform_admin() || $this->courseUserPrivilegesList->getCoursePrivileges($courseTreeNode->getCourse()->sysCode)->isCourseMember())) {
                ?>
            
            <!-- Render the course and its children -->
            <?php 
                $childNodeView = new CourseTreeNodeView($courseTreeNode, $this->courseUserPrivilegesList, $this->notifiedCourseList, $this->viewOptions);
                echo $childNodeView->render();
                ?>
            
            <?php 
            } elseif (claro_is_user_authenticated() && (!$courseTreeNode->getCourse()->isActivated() && $courseTreeNode->getCourse()->isVisible())) {
                ?>
            
            <!-- Render the course (deactivated) and its children -->
            <?php 
                $childNodeView = new CourseTreeNodeDeactivatedView($courseTreeNode, $this->courseUserPrivilegesList, $this->notifiedCourseList, $this->viewOptions);
示例#27
0
}
// show to authenticated and anonymous users
if ($textOrFilePresent && ($showAfterEndDate || $showAfterPost)) {
    $out .= '<fieldset>' . "\n" . '<legend>' . '<b>' . get_lang('Feedback') . '</b>' . '</legend>';
    if ($assignment->getAutoFeedbackText() != '') {
        $out .= claro_parse_user_text($assignment->getAutoFeedbackText());
    }
    if ($assignment->getAutoFeedbackFilename() != '') {
        $target = get_conf('open_submitted_file_in_new_window') ? 'target="_blank"' : '';
        $out .= '<p><a href="' . claro_htmlspecialchars(Url::Contextualize($assignment->getAssigDirWeb() . $assignment->getAutoFeedbackFilename())) . '" ' . $target . '>' . $assignment->getAutoFeedbackFilename() . '</a></p>';
    }
    $out .= '</fieldset>' . '<br />' . "\n";
}
if ($is_allowedToEditAll) {
    // Submission download requested
    if ($cmd == 'rqDownload' && (claro_is_platform_admin() || get_conf('allow_download_all_submissions'))) {
        require_once $includePath . '/lib/form.lib.php';
        $downloadForm = '<strong>' . get_lang('Download') . '</strong>' . "\n" . '<form action="' . get_module_url('CLWRK') . '/export.php?assigId=' . $req['assignmentId'] . '" method="POST">' . "\n" . claro_form_relay_context() . '<input type="hidden" name="cmd" value="exDownload" />' . "\n" . '<input type="radio" name="downloadMode" id="downloadMode_from" value="from" checked /><label for="downloadMode_from">' . get_lang('Submissions posted or modified after date :') . '</label><br />' . "\n" . claro_html_date_form('day', 'month', 'year', time(), 'long') . ' ' . claro_html_time_form('hour', 'minute', time() - fmod(time(), 86400) - 3600) . '<small>' . get_lang('(d/m/y hh:mm)') . '</small>' . '<br /><br />' . "\n" . '<input type="radio" name="downloadMode" id="downloadMode_all" value="all" /><label for="downloadMode_all">' . get_lang('All submissions') . '</label><br /><br />' . "\n" . '<input type="checkbox" name="downloadOnlyCurrentMembers" id="downloadOnlyCurrentMembers_id" value="yes" checked="checked" /><label for="downloadOnlyCurrentMembers_id">' . get_lang('Download only submissions from current course members') . '</label><br /><br />' . "\n" . '<input type="checkbox" name="downloadScore" id="downloadScore_id" value="yes" checked="checked" /><label for="downloadScore_id">' . get_lang('Download score') . '</label><br /><br />' . "\n" . '<input type="submit" value="' . get_lang('OK') . '" />&nbsp;' . "\n" . claro_html_button('work_list.php?assigId=' . $req['assignmentId'], get_lang('Cancel')) . '</form>' . "\n";
        $dialogBox->form($downloadForm);
    }
}
// Render dialog box
$out .= $dialogBox->render();
/**
 * Submitter (User or group) listing
 */
$headerUrl = $workPager->get_sort_url_list(Url::Contextualize($_SERVER['PHP_SELF'] . '?assigId=' . $req['assignmentId']));
$out .= $workPager->disp_pager_tool_bar(Url::Contextualize($_SERVER['PHP_SELF'] . "?assigId=" . $req['assignmentId'])) . '<table class="claroTable emphaseLine" width="100%">' . "\n" . '<thead>' . "\n" . '<tr class="headerX">' . "\n" . '<th>' . '<a href="' . $headerUrl['name'] . '">' . get_lang('Author(s)') . '</a>' . '</th>' . "\n" . '<th>' . '<a href="' . $headerUrl['last_edit_date'] . '">' . get_lang('Last submission') . '</a>' . '</th>' . "\n" . '<th>' . '<a href="' . $headerUrl['submissionCount'] . '">' . get_lang('Submissions') . '</a>' . '</th>' . "\n" . '<th>' . '<a href="' . $headerUrl['feedbackCount'] . '">' . get_lang('Feedbacks') . '</a>' . '</th>' . "\n";
if ($is_allowedToEditAll) {
    $out .= '<th>' . '<a href="' . $headerUrl['maxScore'] . '">' . get_lang('Best score') . '</a>' . '</th>' . "\n";
}
示例#28
0
                    <?php 
        echo get_lang('View my statistics');
        ?>
                    </a>
                </p>
                
                <?php 
    }
    ?>
            
            <?php 
}
?>
            
            <?php 
if ($this->userId == claro_get_current_user_id() || claro_is_platform_admin()) {
    ?>
            <p>
                
                <?php 
    if ($this->userId == claro_get_current_user_id()) {
        ?>
                
                <a class="claroCmd" href="<?php 
        echo get_path('clarolineRepositoryWeb');
        ?>
auth/profile.php">
                <img src="<?php 
        echo get_icon_url('edit');
        ?>
" alt="<?php 
示例#29
0
文件: profile.php 项目: rhertzog/lcs
    case DISP_PROFILE_FORM:
        // Display user tracking link
        $profileText = claro_text_zone::get_content('textzone_edit_profile_form');
        if (get_conf('is_trackingEnabled')) {
            // Display user tracking link
            $cmdList[] = array('img' => 'statistics', 'name' => get_lang('View my statistics'), 'url' => claro_htmlspecialchars(Url::Contextualize(get_conf('urlAppend') . '/claroline/tracking/userReport.php?userId=' . claro_get_current_user_id())));
        }
        // Display request course creator status
        if (!claro_is_allowed_to_create_course() && get_conf('can_request_course_creator_status')) {
            $cmdList[] = array('name' => get_lang('Request course creation status'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=reqCCstatus')));
        }
        // Display user revoquation
        if (get_conf('can_request_revoquation')) {
            $cmdList[] = array('img' => 'delete', 'name' => get_lang('Delete my account'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=reqRevoquation')));
        }
        if (claro_is_platform_admin()) {
            $dialogBox->info(get_lang('As a platform administrator, you can edit any field you want, even if this field isn\'t editable for other users.<br />You can check the list of editable fields in your platform\'s configuration.'));
        }
        break;
}
// Display
$out = '';
$out .= claro_html_tool_title($nameTools, null, $cmdList) . $dialogBox->render();
switch ($display) {
    case DISP_PROFILE_FORM:
        // Display form profile
        if (trim($profileText) != '') {
            $out .= '<div class="info profileEdit">' . $profileText . '</div>';
        }
        $out .= user_html_form($userId);
        break;
示例#30
0
 protected function getManagerLinkList()
 {
     $courseManageToolLinkList = array();
     if ($this->viewMode != 'STUDENT') {
         $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/tools.php', $this->currentCourseContext)) . '">' . '<img src="' . get_icon_url('edit') . '" alt="" /> ' . get_lang('Edit Tool list') . '</a>';
         $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/settings.php', $this->currentCourseContext)) . '">' . '<img src="' . get_icon_url('settings') . '" alt="" /> ' . get_lang('Course settings') . '</a>';
         if (!ClaroCourse::isSessionCourse($this->courseId) && claro_is_allowed_to_create_course() && (get_conf('courseSessionAllowed', true) || claro_is_platform_admin())) {
             $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/create.php', array('course_sourceCourseId' => $this->courseId))) . '">' . '<img src="' . get_icon_url('duplicate') . '" alt="" /> ' . get_lang("Create a session course") . '</a>';
         }
         if (get_conf('is_trackingEnabled')) {
             $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'tracking/courseReport.php', $this->currentCourseContext)) . '">' . '<img src="' . get_icon_url('statistics') . '" alt="" /> ' . get_lang('Statistics') . '</a>';
         }
         $extraManageToolList = get_course_manage_module_list(true);
         if ($extraManageToolList) {
             foreach ($extraManageToolList as $extraManageTool) {
                 $courseManageToolLinkList[] = '<a class="claroCmd" href="' . claro_htmlspecialchars(Url::Contextualize(get_module_entry_url($extraManageTool['label']))) . '">' . '<img src="' . get_module_icon_url($extraManageTool['label'], $extraManageTool['icon'], 'settings') . '" alt="" /> ' . get_lang($extraManageTool['name']) . '</a>';
             }
         }
     }
     return $courseManageToolLinkList;
 }