コード例 #1
0
 public function __construct($courseId)
 {
     $this->courseId = $courseId;
     $courseCode = ClaroCourse::getCodeFromId($this->courseId);
     $tbl_mdb_names = claro_sql_get_main_tbl();
     $tbl_rel_course_portlet = $tbl_mdb_names['rel_course_portlet'];
     $sql = "SELECT id, courseId, rank, label, visible\n                FROM `{$tbl_rel_course_portlet}`\n                WHERE `courseId` = {$this->courseId}\n                ORDER BY `rank` ASC";
     $result = Claroline::getDatabase()->query($sql);
     foreach ($result as $portletInfos) {
         // Require the proper portlet class
         $portletPath = get_module_path($portletInfos['label']) . '/connector/coursehomepage.cnr.php';
         $portletName = $portletInfos['label'] . '_Portlet';
         if (file_exists($portletPath)) {
             require_once $portletPath;
         } else {
             echo "Le fichier {$portletPath} est introuvable<br/>";
         }
         if (class_exists($portletName)) {
             $portlet = new $portletName($portletInfos['id'], $courseCode, $portletInfos['courseId'], $portletInfos['rank'], $portletInfos['label'], $portletInfos['visible']);
             $this->portlets[] = $portlet;
         } else {
             echo "Can't find the class {$portletName}_portlet<br/>";
             return false;
         }
     }
 }
コード例 #2
0
ファイル: export.html.class.php プロジェクト: rhertzog/lcs
 public function export()
 {
     $postsList = $this->loadTopic($this->getTopicId());
     $topicInfo = get_topic_settings($this->getTopicId());
     $css = $this->importCss();
     $form = new PhpTemplate(get_module_path('CLFRM') . '/templates/forum_export.tpl.php');
     $form->assign('forum_id', $topicInfo['forum_id']);
     $form->assign('topic_id', $topicInfo['topic_id']);
     $form->assign('notification_bloc', false);
     $form->assign('topic_subject', $topicInfo['topic_title']);
     $form->assign('postList', $postsList);
     $form->assign('claro_notifier', false);
     $form->assign('is_allowedToEdit', false);
     $form->assign('date', null);
     $out = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n" . '<html>' . "\n" . '<head>' . "\n" . '<meta http-equiv="Content-Type" content="text/HTML; charset=' . get_conf('charset') . '"  />' . "\n" . '<style type="text/css">' . $css . '</style>' . "\n" . '<title>' . $topicInfo['topic_title'] . '</title>' . "\n" . '</head>' . "\n" . '<body><div id="forumExport">' . "\n";
     $out .= $form->render();
     $out .= '</div></body>' . "\n" . '</html>';
     $path = get_conf('rootSys') . get_conf('tmpPathSys') . '/forum_export/';
     $filename = $path . replace_dangerous_char(str_replace(' ', '_', $topicInfo['topic_title']) . '_' . $topicInfo['topic_id']) . '.html';
     claro_mkdir($path);
     file_put_contents($filename, $out);
     switch ($this->output) {
         case 'screen':
             header('Content-Description: File Transfer');
             header('Content-Type: application/force-download');
             header('Content-Length: ' . filesize($filename));
             header('Content-Disposition: attachment; filename=' . basename($filename));
             readfile($filename);
             claro_delete_file($filename);
             break;
         case 'file':
             break;
     }
     return true;
 }
コード例 #3
0
ファイル: icon.lib.php プロジェクト: rhertzog/lcs
/**
 * Returns the url of the given icon
 *
 * @param string $fileName file name with or without extension
 * @param string $moduleLabel label of the module (optional)
 * @return string icon url
 *         mixed null if icon not found
 */
function get_icon_url($fileName, $moduleLabel = null)
{
    $fileInfo = pathinfo($fileName);
    $currentModuleLabel = get_current_module_label();
    $imgPath = array();
    // Search kernel first for performance !
    // claroline theme iconset
    $imgPath[get_current_iconset_path()] = get_current_iconset_url();
    // claroline web/img <--- is now the default location find using get_current_iconset_url
    //$imgPath[get_path( 'rootSys' ) . 'web/img/'] = get_path('url') . '/web/img/';
    if (!empty($moduleLabel)) {
        // module img directory
        $imgPath[get_module_path($moduleLabel) . '/img/'] = get_module_url($moduleLabel) . '/img/';
        // module root directory
        $imgPath[get_module_path($moduleLabel) . '/'] = get_module_url($moduleLabel) . '/';
    }
    if (!empty($currentModuleLabel)) {
        // module img directory
        $imgPath[get_module_path($currentModuleLabel) . '/img/'] = get_module_url($currentModuleLabel) . '/img/';
        // module root directory
        $imgPath[get_module_path($currentModuleLabel) . '/'] = get_module_url($currentModuleLabel) . '/';
    }
    // img directory in working directory
    $imgPath['./img/'] = './img/';
    // working directory
    $imgPath['./'] = './';
    if (!empty($fileInfo['extension'])) {
        $img = array($fileName);
    } else {
        $img = array($fileName . '.png', $fileName . '.gif');
    }
    foreach ($imgPath as $tryPath => $tryUrl) {
        foreach ($img as $tryImg) {
            if (claro_debug_mode()) {
                pushClaroMessage("Try " . $tryPath . $tryImg, 'debug');
            }
            if (file_exists($tryPath . $tryImg)) {
                if (claro_debug_mode()) {
                    pushClaroMessage("Using " . $tryPath . $tryImg, 'debug');
                }
                return $tryUrl . $tryImg . '?' . filemtime($tryPath . $tryImg);
            }
        }
    }
    if (claro_debug_mode()) {
        pushClaroMessage("Icon {$fileName} not found", 'error');
    }
    // WORKAROUND : avoid double submission if missing image !!!!
    return 'image_not_found.png';
}
コード例 #4
0
 private function loadModuleManager($cidReq = null)
 {
     $toolList = claro_get_main_course_tool_list();
     foreach ($toolList as $tool) {
         if (!is_null($tool['label'])) {
             $file = get_module_path($tool['label']) . '/connector/trackingManager.cnr.php';
             if (file_exists($file)) {
                 require_once $file;
                 if (claro_debug_mode()) {
                     pushClaroMessage('Tracking : ' . $tool['label'] . ' tracking managers loaded', 'debug');
                 }
             }
         }
     }
 }
コード例 #5
0
ファイル: notify.lib.php プロジェクト: rhertzog/lcs
/**
 * Load the event listener of the current module 
 */
function load_current_module_listeners()
{
    $claroline = Claroline::getInstance();
    $path = get_module_path(Claroline::getInstance()->currentModuleLabel()) . '/connector/eventlistener.cnr.php';
    if (file_exists($path)) {
        if (claro_debug_mode()) {
            pushClaroMessage('Load listeners for : ' . Claroline::getInstance()->currentModuleLabel(), 'debug');
        }
        include $path;
    } else {
        if (claro_debug_mode()) {
            pushClaroMessage('No listeners for : ' . Claroline::getInstance()->currentModuleLabel(), 'warning');
        }
    }
}
コード例 #6
0
 public function current()
 {
     $portlet = $this->portlets->current();
     $portletObj = '';
     // Require the proper portlet class
     $portletPath = get_module_path($portlet['label']) . '/connector/coursehomepage.cnr.php';
     $portletName = $portlet['label'] . '_Portlet';
     if (file_exists($portletPath)) {
         require_once $portletPath;
     } else {
         throw new Exception("Can\\'t find the file %portletPath", array('%portletPath' => $portletPath));
     }
     if (class_exists($portletName)) {
         $courseCode = ClaroCourse::getCodeFromId($this->courseId);
         $portletObj = new $portletName($portlet['id'], $courseCode, $portlet['courseId'], $portlet['rank'], $portlet['label'], $portlet['visible']);
         return $portletObj;
     } else {
         echo get_lang("Can't find the class %portletName_portlet", array('%portletName' => $portletName));
         return false;
     }
 }
コード例 #7
0
ファイル: dock.lib.php プロジェクト: rhertzog/lcs
 public function load()
 {
     $tblNameList = claro_sql_get_main_tbl();
     $sql = "SELECT M.`label` AS `label`,\n" . "M.`script_url` AS `entry`,\n" . "M.`name` AS `name`,\n" . "M.`activation` AS `activation`,\n" . "D.`name` AS `dock`\n" . "FROM `" . $tblNameList['dock'] . "` AS D\n" . "LEFT JOIN `" . $tblNameList['module'] . "` AS M\n" . "ON D.`module_id` = M.`id`\n" . "ORDER BY D.`rank` ";
     $appletList = claro_sql_query_fetch_all_rows($sql);
     if ($appletList) {
         $dockAppletList = array();
         foreach ($appletList as $key => $applet) {
             if (!array_key_exists($applet['dock'], $dockAppletList)) {
                 $dockAppletList[$applet['dock']] = array();
             }
             $entryPath = get_module_path($applet['label']) . '/' . $applet['entry'];
             if (file_exists($entryPath)) {
                 $applet['path'] = $entryPath;
                 // $appletList[$key] = $applet;
                 $dockAppletList[$applet['dock']][] = $applet;
             }
         }
         $this->_dockAppletList = $dockAppletList;
     }
 }
コード例 #8
0
ファイル: interfac3.class.php プロジェクト: guillaum3f/codie
 public function export_modules()
 {
     $parent = $this->parent->get('parent');
     //record the "menu interface" of object client
     //$interfaces_object = $this->parent->get(\get_constant('\platform\config\interfac3::_namespace'));
     foreach (get_constant('\\platform\\config\\interfac3::_i_' . $this->name) as $module) {
         if (module_exist($module)) {
             $module_path = get_module_path($module);
             $parent->lib2namespace($module_path, $parent->name . '.' . get_constant('\\platform\\config\\interfac3::_module_namespace'), build_extension(get_constant('\\platform\\config\\interfac3::_valid_module_extension'), 1));
             //update the "menu interface" of object client
             //$interfaces_object->{$this->name}->{$module} = get_module_description($module);
         } else {
             //update the "menu interface" of object client
             //$interfaces_object->{$this->name}->{$module} = get_constant('\platform\config\interfac3::_no_module_description_msg');
         }
         //            if($this->slots > $this->slots_max){
         //                throw new \Exception;
         //            }else{
         //                $this->slots_number += $module->slots_number;
         //            }
     }
 }
コード例 #9
0
ファイル: index.php プロジェクト: rhertzog/lcs
 * @see         http://www.claroline.net/wiki/CLDSC/
 * @author      Claro Team <*****@*****.**>
 * @package     CLDSC
 * @since       1.9
 */
// TODO add config var to allow multiple post of same type
$tlabelReq = 'CLDSC';
require '../inc/claro_init_global.inc.php';
if (!claro_is_in_a_course() || !claro_is_course_allowed()) {
    claro_disp_auth_form(true);
}
claro_set_display_mode_available(true);
$is_allowedToEdit = claro_is_allowed_to_edit();
//-- Tool libraries
include_once get_module_path($tlabelReq) . '/lib/courseDescription.class.php';
include_once get_module_path($tlabelReq) . '/lib/courseDescription.lib.php';
//-- Get $tipList
$tipList = get_tiplistinit();
/*
 * init request vars
 */
$acceptedCmdList = array('rqEdit', 'exEdit', 'exDelete', 'mkVis', 'mkInvis');
if (isset($_REQUEST['cmd']) && in_array($_REQUEST['cmd'], $acceptedCmdList)) {
    $cmd = $_REQUEST['cmd'];
} else {
    $cmd = null;
}
if (isset($_REQUEST['descId']) && is_numeric($_REQUEST['descId'])) {
    $descId = (int) $_REQUEST['descId'];
} else {
    $descId = null;
コード例 #10
0
ファイル: index.php プロジェクト: rhertzog/lcs
 * @author      Claro Team <*****@*****.**>
 * @since       1.9
 */
// Reset session variables
$cidReset = true;
// course id
$gidReset = true;
// group id
$tidReset = true;
// tool id
// Load Claroline kernel
require_once dirname(__FILE__) . '/../inc/claro_init_global.inc.php';
// Build the breadcrumb
$nameTools = get_lang('Headlines');
// Initialisation of variables and used classes and libraries
require_once get_module_path('CLTI') . '/lib/toolintroductioniterator.class.php';
$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
$cmd = !empty($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null;
$isAllowedToEdit = claro_is_allowed_to_edit();
set_current_module_label('CLINTRO');
// Init linker
FromKernel::uses('core/linker.lib');
ResourceLinker::init();
// Javascript confirm pop up declaration for header
JavascriptLanguage::getInstance()->addLangVar('Are you sure to delete %name ?');
JavascriptLoader::getInstance()->load('tool_intro');
// Instanciate dialog box
$dialogBox = new DialogBox();
$toolIntroForm = '';
if (isset($cmd) && $isAllowedToEdit) {
    // Set linker's params
コード例 #11
0
ファイル: do_install.inc.php プロジェクト: rhertzog/lcs
 include_once 'init_profile_right.lib.php';
 create_required_profile();
 /**
  * ADD MODULES
  */
 $preInstalledTools = array('CLDSC', 'CLCAL', 'CLANN', 'CLDOC', 'CLQWZ', 'CLLNP', 'CLWRK', 'CLFRM', 'CLGRP', 'CLUSR', 'CLWIKI');
 if (file_exists(get_path('rootSys') . 'module')) {
     $moduleDirIterator = new DirectoryIterator(get_path('rootSys') . 'module');
     foreach ($moduleDirIterator as $moduleDir) {
         if ($moduleDir->isDir() && !$moduleDir->isDot()) {
             $preInstalledTools[] = $moduleDir->getFilename();
         }
     }
 }
 foreach ($preInstalledTools as $claroLabel) {
     $modulePath = get_module_path($claroLabel);
     if (file_exists($modulePath)) {
         $moduleId = register_module($modulePath);
         if (false !== activate_module($moduleId)) {
             trigger_error('module (id:' . $moduleId . ' ) not activated ', E_USER_WARNING);
         }
     } else {
         trigger_error('module path not found', E_USER_WARNING);
     }
 }
 // init default right profile
 init_default_right_profile();
 /***
  * Generate module conf from definition files.
  */
 $config_code_list = get_config_code_list('module');
コード例 #12
0
ファイル: userlist.lib.php プロジェクト: rhertzog/lcs
 /**
  * Remove a list of users given their user id from the cours
  * @param array $userIdList list of user ids to add
  * @param Claro_Class $class execute class unregistration instead of individual registration if given (default:null)
  * @param bool $keepTrackingData tracking data will be deleted if set to false (default:true, i.e. keep data)
  * @param array $moduleDataToPurge list of module_label => (purgeTracking => bool, purgeData => bool)
  * @param bool $unregisterFromSourceIfLastSession remove users that are in no other session course from the source course if any
  * @return boolean
  */
 public function removeUserIdListFromCourse($userIdList, $class = null, $keepTrackingData = true, $moduleDataToPurge = array(), $unregisterFromSourceIfLastSession = true)
 {
     if (!count($userIdList)) {
         return false;
     }
     $classMode = is_null($class) ? false : true;
     $courseCode = $this->course->courseId;
     $sqlCourseCode = $this->database->quote($courseCode);
     if ($classMode && !$class->isRegisteredToCourse($courseCode)) {
         $this->result->addError(get_lang("Class not registered to course"));
         $this->result->setStatus(Claro_BatchRegistrationResult::STATUS_ERROR_NOTHING_TO_DO);
         return false;
     }
     // update user registration counts
     $cntToChange = $classMode ? 'count_class_enrol' : 'count_user_enrol';
     $this->database->exec("\n            UPDATE\n                `{$this->tableNames['rel_course_user']}`\n            SET\n                `{$cntToChange}` = `{$cntToChange}` - 1\n            WHERE\n                `code_cours` = {$sqlCourseCode}\n            AND\n                `{$cntToChange}` > 0\n            AND\n                `user_id` IN (" . implode(',', $userIdList) . ")\n        ");
     // get the user ids to remove
     $userListToRemove = $this->database->query("\n            SELECT \n                `user_id`\n            FROM\n                `{$this->tableNames['rel_course_user']}`\n            WHERE\n                `count_class_enrol` <= 0\n            AND\n                `count_user_enrol` <= 0\n            AND\n                `code_cours` = {$sqlCourseCode}\n        ");
     if ($userListToRemove->numRows()) {
         $userIdListToRemove = array();
         foreach ($userListToRemove as $user) {
             $userIdListToRemove[] = $user['user_id'];
         }
         $sqlList = array();
         $sqlList[] = "DELETE FROM `{$this->tableNames['bb_rel_topic_userstonotify']}` WHERE user_id IN (" . implode(',', $userIdListToRemove) . ")";
         $sqlList[] = "DELETE FROM `{$this->tableNames['userinfo_content']}` WHERE user_id IN (" . implode(',', $userIdListToRemove) . ")";
         $sqlList[] = "UPDATE `{$this->tableNames['group_team']}` SET `tutor` = NULL WHERE `tutor` IN (" . implode(',', $userIdListToRemove) . ")";
         $sqlList[] = "DELETE FROM `{$this->tableNames['group_rel_team_user']}` WHERE user IN (" . implode(',', $userIdListToRemove) . ")";
         if (!$keepTrackingData) {
             $sqlList[] = "DELETE FROM `{$this->tableNames['tracking_event']}` WHERE user_id IN (" . implode(',', $userIdListToRemove) . ")";
         }
         $sqlList[] = "DELETE FROM `{$this->tableNames['rel_course_user']}` WHERE user_id IN (" . implode(',', $userIdListToRemove) . ") AND `code_cours` = {$sqlCourseCode}";
         foreach ($sqlList as $sql) {
             $this->database->exec($sql);
         }
         if (!empty($moduleDataToPurge)) {
             foreach ($moduleDataToPurge as $moduleData) {
                 $connectorPath = get_module_path($moduleData['label']) . '/connector/adminuser.cnr.php';
                 if (file_exists($connectorPath)) {
                     require_once $connectorPath;
                     $connectorClass = $moduleData['label'] . '_AdminUser';
                     if (class_exist($connectorClass)) {
                         $connector = new $connectorClass($this->database);
                         if ($moduleData['purgeTracking']) {
                             $connector->purgeUserListCourseTrackingData($userIdListToRemove, $this->course->courseId);
                         }
                         if ($moduleData['purgeResources']) {
                             $connector->purgeUserListCourseResources($userIdListToRemove, $this->course->courseId);
                         }
                     } else {
                         Console::warning("Class {$connectorClass} not found");
                     }
                 } else {
                     Console::warning("No user delete connector found for module {$moduleData['label']}");
                 }
             }
         }
         $this->result->addDeleted($userIdListToRemove);
         if ($this->course->isSourceCourse()) {
             $sessionCourseIterator = $this->course->getChildren();
             foreach ($sessionCourseIterator as $sessionCourse) {
                 $batchReg = new self($sessionCourse, $this->database);
                 $batchReg->removeUserIdListFromCourse($userIdListToRemove, $class, $keepTrackingData, $moduleDataToPurge, $unregisterFromSourceIfLastSession);
                 $this->result->mergeResult($batchReg->getResult());
             }
         }
         if ($this->course->hasSourceCourse() && $unregisterFromSourceIfLastSession) {
             $sourceCourse = $this->course->getSourceCourse();
             $sessionCourseIterator = $sourceCourse->getChildren();
             $foundSessionWithClass = false;
             if ($classMode) {
                 foreach ($sessionCourseIterator as $sessionCourse) {
                     if ($sessionCourse->courseId != $this->course->courseId && $class->isRegisteredToCourse($sessionCourse->courseId)) {
                         $foundSessionWithClass = true;
                     }
                 }
                 if (!$foundSessionWithClass) {
                     $batchReg = new self($sourceCourse, $this->database);
                     $batchReg->removeUserIdListFromCourse($userIdListToRemove, $class, $keepTrackingData, $moduleDataToPurge, $unregisterFromSourceIfLastSession);
                 }
             } else {
                 // get userids registered in other sessions than the current one
                 $sessionList = $sourceCourse->getChildrenList();
                 if (count($sessionList)) {
                     $userIdListToRemoveFromSource = array();
                     $sessionIdList = array_keys($sessionList);
                     $sqlCourseCode = $this->database->quote($this->course->courseId);
                     $usersInOtherSessions = $this->database->query("\n                            SELECT\n                                user_id\n                            FROM\n                                `{$this->tableNames['rel_course_user']}`\n                            WHERE\n                                user_id IN (" . implode(',', $userIdListToRemove) . ")\n                            AND\n                                code_cours IN ('" . implode("','", $sessionIdList) . "')\n                            AND\n                                code_cours != {$sqlCourseCode}\n                        ");
                     // loop on $userIdList and keep only those who are not in another session and inject them in $userIdListToRemoveFromSource
                     $usersInOtherSessionsList = array();
                     foreach ($usersInOtherSessions as $userNotToRemove) {
                         $usersInOtherSessionsList[$userNotToRemove['user_id']] = $userNotToRemove['user_id'];
                     }
                     foreach ($userListToRemove as $userIdToRemove) {
                         if (!isset($usersInOtherSessionsList[$userIdToRemove['user_id']])) {
                             $userIdListToRemoveFromSource[] = $userIdToRemove['user_id'];
                         }
                     }
                     if (count($userIdListToRemoveFromSource)) {
                         $batchReg = new self($sourceCourse, $this->database);
                         $batchReg->removeUserIdListFromCourse($userIdListToRemoveFromSource, $class, $keepTrackingData, $moduleDataToPurge, $unregisterFromSourceIfLastSession);
                         $this->result->mergeResult($batchReg->getResult());
                     }
                 }
             }
         }
     } else {
         $this->result->setStatus(Claro_BatchRegistrationResult::STATUS_ERROR_NOTHING_TO_DO);
         $this->result->addError(get_lang("No user to delete"));
     }
     return !$this->result->hasError();
 }
コード例 #13
0
ファイル: index.php プロジェクト: rhertzog/lcs
// Include specific CSS if any
if (file_exists(get_conf('coursesRepositorySys') . $_course['path'] . '/css/course.css')) {
    $claroline->display->header->addHtmlHeader('<link rel="stylesheet" media="screen" type="text/css" href="' . get_path('url') . '/' . get_path('coursesRepositoryAppend') . $_course['path'] . '/css/course.css" />');
}
// Instantiate course
$thisCourse = new ClaroCourse();
$thisCourse->load($cidReq);
include claro_get_conf_repository() . 'rss.conf.php';
// Include the course home page special CSS
CssLoader::getInstance()->load('coursehomepage', 'all');
$toolRepository = get_path('clarolineRepositoryWeb');
claro_set_display_mode_available(true);
// Manage portlets
if (claro_is_course_manager() && !empty($portletClass)) {
    // Require the right class
    $portletPath = get_module_path($portletLabel) . '/connector/coursehomepage.cnr.php';
    if (file_exists($portletPath)) {
        require_once $portletPath;
    } else {
        throw new Exception(get_lang('Cannot find this portlet'));
    }
    if ($portletCmd == 'exAdd') {
        $portlet = new $portletClass();
        $portlet->handleForm();
        if ($portlet->save()) {
            $dialogBox->success(get_lang('Portlet created'));
        } else {
            $dialogBox->error(get_lang('Can\'t create this portlet (%portlet)', array('%portlet' => $portlet->getLabel())));
        }
    } elseif ($portletCmd == 'delete' && !empty($portletId) && class_exists($portletClass)) {
        $portlet = new $portletClass();
コード例 #14
0
ファイル: index.php プロジェクト: rhertzog/lcs
         if (class_exists($className)) {
             $portlet = new $className($portletInDB['label']);
             if ($portlet->getLabel()) {
                 $portletList->addPortlet($portlet->getLabel(), $portlet->getName());
             } else {
                 Console::warning("Portlet {$className} has no label !");
             }
         }
     } else {
         continue;
     }
 }
 $moduleList = get_module_label_list();
 if (is_array($moduleList)) {
     foreach ($moduleList as $moduleId => $moduleLabel) {
         $portletPath = get_module_path($moduleLabel) . '/connector/desktop.cnr.php';
         if (file_exists($portletPath)) {
             require_once $portletPath;
             $className = "{$moduleLabel}_Portlet";
             // Load portlet from database
             $portletInDB = $portletList->loadPortlet($className);
             // If it's not in DB, add it
             if (!$portletInDB) {
                 if (class_exists($className)) {
                     $portlet = new $className($portletInDB['label']);
                     if ($portlet->getLabel()) {
                         $portletList->addPortlet($portlet->getLabel(), $portlet->getName());
                     } else {
                         Console::warning("Portlet {$className} has no label !");
                     }
                 }
コード例 #15
0
ファイル: language.lib.php プロジェクト: rhertzog/lcs
 public static function load_module_translation($moduleLabel = null, $language = null)
 {
     global $_lang;
     $moduleLabel = is_null($moduleLabel) ? get_current_module_label() : $moduleLabel;
     // In a module
     if (!empty($moduleLabel)) {
         $module_path = get_module_path($moduleLabel);
         $language = is_null($language) ? language::current_language() : $language;
         // load english by default if exists
         if (file_exists($module_path . '/lang/lang_english.php')) {
             /* FIXME : DEPRECATED !!!!! */
             $mod_lang = array();
             include $module_path . '/lang/lang_english.php';
             $_lang = array_merge($_lang, $mod_lang);
             if (claro_debug_mode()) {
                 pushClaroMessage(__FUNCTION__ . "::" . $moduleLabel . '::' . 'English lang file loaded', 'debug');
             }
         } else {
             // no language file to load
             if (claro_debug_mode()) {
                 pushClaroMessage(__FUNCTION__ . "::" . $moduleLabel . '::' . 'English lang file  not found', 'debug');
             }
         }
         // load requested language if exists
         if ($language != 'english' && file_exists($module_path . '/lang/lang_' . $language . '.php')) {
             /* FIXME : CODE DUPLICATION see 263-274 !!!!! */
             /* FIXME : DEPRECATED !!!!! */
             $mod_lang = array();
             include $module_path . '/lang/lang_' . $language . '.php';
             $_lang = array_merge($_lang, $mod_lang);
             if (claro_debug_mode()) {
                 pushClaroMessage(__FUNCTION__ . "::" . $moduleLabel . '::' . ucfirst($language) . ' lang file loaded', 'debug');
             }
         } elseif ($language != 'english') {
             // no language file to load
             if (claro_debug_mode()) {
                 pushClaroMessage(__FUNCTION__ . "::" . $moduleLabel . '::' . ucfirst($language) . ' lang file  not found', 'debug');
             }
         } else {
             // nothing to do
         }
     } else {
         // Not in a module
     }
 }
コード例 #16
0
ファイル: download.php プロジェクト: rhertzog/lcs
}
if (empty($requestUrl)) {
    $isDownloadable = false;
    $dialogBox->error(get_lang('Missing parameters'));
} else {
    if (isset($_REQUEST['moduleLabel']) && !empty($_REQUEST['moduleLabel'])) {
        $moduleLabel = $_REQUEST['moduleLabel'];
    } else {
        if (!claro_is_in_a_course()) {
            $moduleLabel = null;
        } else {
            $moduleLabel = 'CLDOC';
        }
    }
    if ($moduleLabel) {
        $connectorPath = secure_file_path(get_module_path($moduleLabel) . '/connector/downloader.cnr.php');
        if (file_exists($connectorPath)) {
            require_once $connectorPath;
            $className = $moduleLabel . '_Downloader';
            $downloader = new $className($moduleLabel);
        } else {
            $downloader = false;
            // $downloader = new Claro_Generic_Module_Downloader($moduleLabel);
            pushClaroMessage('No downloader found for module ' . strip_tags($moduleLabel), 'warning');
        }
    } else {
        $downloader = new Claro_PlatformDocumentsDownloader();
    }
    if ($downloader && $downloader->isAllowedToDownload($requestUrl)) {
        $pathInfo = $downloader->getFilePath($requestUrl);
        // use slashes instead of backslashes in file path
コード例 #17
0
ファイル: upgrade_modules.php プロジェクト: rhertzog/lcs
// Security Check
if (!claro_is_platform_admin()) {
    upgrade_disp_auth_form();
}
if (isset($_REQUEST['cmd']) && $_REQUEST['cmd'] == 'run') {
    // DB tables definition
    $tbl_mdb_names = claro_sql_get_main_tbl();
    $tbl_module = $tbl_mdb_names['module'];
    $tbl_module_info = $tbl_mdb_names['module_info'];
    $tbl_module_contexts = $tbl_mdb_names['module_contexts'];
    $modules = claro_sql_query_fetch_all("SELECT label, id, name FROM `{$tbl_module}`");
    $deactivatedModules = array();
    $readOnlyModules = array('CLDOC', 'CLGRP', 'CLUSR');
    $version = '';
    foreach ($modules as $module) {
        $manifest = readModuleManifest(get_module_path($module['label']));
        if ($manifest) {
            $version = array_key_exists('CLAROLINE_MAX_VERSION', $manifest) ? $manifest['CLAROLINE_MAX_VERSION'] : $manifest['CLAROLINE_MIN_VERSION'];
            if (!in_array($module['label'], $readOnlyModules) && !preg_match($patternVarVersion, $version)) {
                deactivate_module($module['id']);
                $deactivatedModules[] = $module;
            }
        }
    }
    $display = DISPLAY_RESULT_SUCCESS_PANEL;
}
// Display Header
echo upgrade_disp_header();
// Display Content
switch ($display) {
    case DISPLAY_WELCOME_PANEL:
コード例 #18
0
ファイル: group.lib.inc.php プロジェクト: rhertzog/lcs
/**
 * Create a new group
 *
 * @param  string $groupName - name of the group
 * @param  integer $maxMember  - max user allowed for this group
 * @return integer : id of the new group
 *
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 */
function create_group($prefixGroupName, $maxMember)
{
    require_once dirname(__FILE__) . '/forum.lib.php';
    require_once dirname(__FILE__) . '/fileManage.lib.php';
    $tbl_cdb_names = claro_sql_get_course_tbl();
    $tbl_groups = $tbl_cdb_names['group_team'];
    // Check name of group
    $sql = "SELECT name FROM  `" . $tbl_groups . "` WHERE name LIKE  '" . claro_sql_escape($prefixGroupName) . "%'";
    $existingGroupList = claro_sql_query_fetch_all_cols($sql);
    $existingGroupList = $existingGroupList['name'];
    $i = 1;
    do {
        $groupName = $prefixGroupName . str_pad($i, 4, ' ', STR_PAD_LEFT);
        $i++;
        if ($i - 2 > count($existingGroupList)) {
            die($groupName . 'infiniteloop');
        }
    } while (in_array($groupName, $existingGroupList));
    /**
     * Create a directory allowing group student to upload documents
     */
    //  Create a Unique ID path preventing other enter
    $globalPath = $GLOBALS['coursesRepositorySys'] . $GLOBALS['currentCourseRepository'] . '/group/';
    do {
        $groupRepository = str_replace(' ', '_', substr(uniqid(substr($groupName, 0, 19) . ' ', ''), 0, 30));
    } while (check_name_exist($globalPath . $groupRepository));
    claro_mkdir($globalPath . $groupRepository, CLARO_FILE_PERMISSIONS);
    /*
     * Insert a new group in the course group table and keep its ID
     */
    $sql = "INSERT INTO `" . $tbl_groups . "`\n            SET name = '" . $groupName . "',\n               `maxStudent`  = " . (is_null($maxMember) ? 'NULL' : "'" . (int) $maxMember . "'") . ",\n                secretDirectory = '" . claro_sql_escape($groupRepository) . "'";
    $createdGroupId = claro_sql_query_insert_id($sql);
    /*
     * Create a forum for the group in the forum table
     */
    if (is_tool_activated_in_course(get_tool_id_from_module_label('CLFRM'), claro_get_current_course_id()) && is_tool_activated_in_groups(claro_get_current_course_id(), 'CLFRM')) {
        create_forum($groupName . ' - ' . strtolower(get_lang('Forum')), '', 2, (int) GROUP_FORUMS_CATEGORY, '', $createdGroupId);
    }
    if (is_tool_activated_in_course(get_tool_id_from_module_label('CLWIKI'), claro_get_current_course_id()) && is_tool_activated_in_groups(claro_get_current_course_id(), 'CLWIKI')) {
        require_once get_module_path('CLWIKI') . '/lib/lib.createwiki.php';
        create_wiki($createdGroupId, $groupName . ' - Wiki');
    }
    return $createdGroupId;
}
コード例 #19
0
ファイル: add_course.lib.inc.php プロジェクト: rhertzog/lcs
/**
 * Install module databases at course creation
 */
function install_module_at_course_creation($moduleLabel, $courseDbName, $language, $courseDirectory)
{
    $sqlPath = get_module_path($moduleLabel) . '/setup/course_install.sql';
    $phpPath = get_module_path($moduleLabel) . '/setup/course_install.php';
    if (file_exists($sqlPath)) {
        if (!execute_sql_at_course_creation($sqlPath, $courseDbName)) {
            return false;
        }
    }
    if (file_exists($phpPath)) {
        // include the language file with all language variables
        language::load_translation($language);
        language::load_locale_settings($language);
        language::load_module_translation($moduleLabel, $language);
        // define tables to use in php install scripts
        $courseDbName = get_conf('courseTablePrefix') . $courseDbName . get_conf('dbGlu');
        $moduleCourseTblList = claro_sql_get_course_tbl($courseDbName);
        /*
         * @todo select database should not be needed if the setup scripts are
         * well written !
         */
        if (!get_conf('singleDbEnabled')) {
            claro_sql_select_db($courseDbName);
        }
        require_once $phpPath;
    }
    return true;
}
コード例 #20
0
 /**
  * Search in all activated modules
  *
  * @param string $cidReq
  */
 private function loadModuleRenderer()
 {
     if (!is_null($this->courseId)) {
         $profileId = claro_get_current_user_profile_id_in_course($this->courseId);
         $toolList = claro_get_course_tool_list($this->courseId, $profileId);
     } else {
         $toolList = claro_get_main_course_tool_list();
     }
     foreach ($toolList as $tool) {
         if (!is_null($tool['label'])) {
             $file = get_module_path($tool['label']) . '/connector/tracking.cnr.php';
             if (file_exists($file)) {
                 require_once $file;
                 if (claro_debug_mode()) {
                     pushClaroMessage('Tracking : ' . $tool['label'] . ' tracking renderers loaded', 'debug');
                 }
             }
         }
     }
 }
コード例 #21
0
<?php

/**
 * CLAROLINE
 *
 * @version 0.1
 *
 * @copyright (c) 2014 Quentin Devos
 *
 * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 *
 * @package OAUTH
 *
 * @author Quentin Devos <*****@*****.**>
 *
 */
require_once get_module_path('OAUTH') . '/lib/InitServer.php';
// Check that the provided Access Token is valid.
if ($server->verifyResourceRequest(OAuth2\Request::createFromGlobals())) {
    // Retrieve informations from the token and log in the corresponding user.
    $token = $server->getAccessTokenData(OAuth2\Request::createFromGlobals());
    $GLOBALS['_uid'] = $token['user_id'];
    $GLOBALS['uidReset'] = true;
    $claro_loginRequested = true;
    $claro_loginSucceeded = true;
} else {
    $GLOBALS['_uid'] = null;
    $claro_loginSucceeded = false;
    $claro_loginRequested = false;
}
コード例 #22
0
ファイル: modules.php プロジェクト: guillaum3f/codie
function description_exists($module_name)
{
    return is_file_exist(get_module_path($module_name) . '/' . get_constant('platform\\config\\interfac3::_valid_description_file'));
}
コード例 #23
0
ファイル: coursehomepage.cnr.php プロジェクト: rhertzog/lcs
// $Id: coursehomepage.cnr.php 14461 2013-05-29 09:34:33Z jrm_ $
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * CLAROLINE
 *
 * Course home page: Announcements portlet
 *
 * @version     $Revision: 14461 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @package     CLCHP
 * @author      Antonin Bourguignon <*****@*****.**>
 * @author      Claroline team <*****@*****.**>
 * @since       1.10
 */
require_once get_module_path('CLANN') . '/lib/announcement.lib.php';
class CLANN_Portlet extends CourseHomePagePortlet
{
    public function renderContent()
    {
        $output = '';
        $course = claro_get_current_course_data();
        $course['db'] = $course['dbName'];
        $toolId = get_tool_id_from_module_label('CLANN');
        if (is_module_installed_in_course('CLANN', claro_get_current_course_id()) && is_tool_activated_in_course($toolId, claro_get_current_course_id()) && claro_is_tool_visible($toolId, claro_get_current_course_id())) {
            $announcementList = announcement_get_course_item_list_portlet($course);
            // Manage announcement's datas
            if ($announcementList) {
                $output .= '<dl id="portletAnnouncements">' . "\n";
                $i = 0;
                foreach ($announcementList as $announcementItem) {
コード例 #24
0
ファイル: core.lib.php プロジェクト: rhertzog/lcs
 /**
  * Load a list of plugins from a given module
  * Usage : From::module(ModuleLable)->loadPlugins( list of connectors );
  * @since Claroline 1.9.6
  * @params  list of plugins
  * @return  array of not found plugins
  */
 public function loadPlugins()
 {
     $args = func_get_args();
     $notFound = array();
     foreach ($args as $cnr) {
         if (substr($cnr, -4) !== '.php' && substr($cnr, -4) === '.lib') {
             $cnr .= '.php';
         } elseif (substr($cnr, -8) !== '.lib.php') {
             $cnr .= '.lib.php';
         }
         $cnr = protect_against_file_inclusion($cnr);
         $cnrPath = get_module_path($this->moduleLabel) . '/plugins/' . $cnr;
         if (file_exists($cnrPath)) {
             require_once $cnrPath;
         } else {
             if (claro_debug_mode()) {
                 throw new Exception("Cannot load plugin {$cnrPath}");
             }
             $notFound[] = $cnr;
             continue;
         }
     }
     return $notFound;
 }
コード例 #25
0
ファイル: phptemplate.lib.php プロジェクト: rhertzog/lcs
 /**
  * @param   string $moduleLabel label of the module
  * @param   string $template name of the template
  */
 public function __construct($moduleLabel, $template)
 {
     $template = secure_file_path($template);
     $moduleLabel = secure_file_path($moduleLabel);
     // Custom template file for the installed campus
     $customTemplatePath = get_path('rootSys') . 'platform/templates/' . $moduleLabel . '/' . $template;
     // Version specific template file
     $defaultVersionTemplatePath = get_module_path($moduleLabel) . '/templates/1_11/' . $template;
     // Default template path
     $defaultTemplatePath = get_module_path($moduleLabel) . '/templates/' . $template;
     if (file_exists($customTemplatePath)) {
         parent::__construct($customTemplatePath);
     } elseif (file_exists($defaultVersionTemplatePath)) {
         parent::__construct($defaultVersionTemplatePath);
     } elseif (file_exists($defaultTemplatePath)) {
         parent::__construct($defaultTemplatePath);
     } else {
         throw new Exception("Template not found {$template} " . "at custom location {$customTemplatePath} " . "or default location {$defaultTemplatePath} !");
     }
 }
コード例 #26
0
ファイル: module_list.php プロジェクト: rhertzog/lcs
     case 'crsmanage':
     case 'admin':
         $moduleDefaultIcon = 'settings';
         break;
     default:
         $moduleDefaultIcon = 'exe';
         break;
 }
 $iconUrl = get_module_icon_url($module['label'], array_key_exists('icon', $module) ? $module['icon'] : null, $moduleDefaultIcon);
 $icon = '<img src="' . $iconUrl . '" alt="" />';
 // Module_id and icon column
 $out .= "\n" . '<tr ' . $class_css . '>' . "\n" . '<td align="center">' . $icon . '</td>' . "\n";
 // Name column
 $moduleName = $module['name'];
 $out .= '<td align="left">' . get_lang($moduleName) . '</td>' . "\n";
 if (file_exists(get_module_path($module['label']) . '/admin.php') && $module['type'] != 'tool') {
     $out .= '<td align="left"><a href="' . get_module_url($module['label']) . '/admin.php" >' . get_lang('Go to administration') . '</a></td>' . "\n";
 } else {
     $out .= '<td align="left">-</td>' . "\n";
 }
 // Displaying location column
 if ($module['type'] == 'applet') {
     $out .= '<td align="left"><small>';
     if (empty($module_dock[$module['id']])) {
         $out .= '<span align="center">' . get_lang('No dock chosen') . '</span>';
     } else {
         foreach ($module_dock[$module['id']] as $dock) {
             $out .= '<a href="module_dock.php?dock=' . $dock['dockname'] . '">' . $dockList[$dock['dockname']] . '</a> <br/>';
         }
     }
     $out .= '</small></td>' . "\n";
コード例 #27
0
ファイル: module_dock.php プロジェクト: rhertzog/lcs
 $enditeration = sizeof($moduleList);
 foreach ($moduleList as $module) {
     //display settings...
     $class_css = $module['activation'] == 'activated' ? 'item' : 'invisible item';
     //find icon
     if (file_exists(get_module_path($module['label']) . '/icon.png')) {
         $icon = '<img src="' . get_module_url($module['label']) . '/icon.png" />';
     } elseif (file_exists(get_module_path($module['label']) . '/icon.gif')) {
         $icon = '<img src="' . get_module_url($module['label']) . '/icon.gif" />';
     } else {
         $icon = '<small>' . get_lang('No icon') . '</small>';
     }
     //module_id and icon column
     $out .= '<tr>' . '<td align="center">' . $icon . '</td>' . "\n";
     //name column
     if (file_exists(get_module_path($module['label']) . '/admin.php')) {
         $out .= '<td align="left" class="' . $class_css . '" ><a href="' . get_module_url($module['label']) . '/admin.php" >' . $module['name'] . '</a></td>' . "\n";
     } else {
         $out .= '<td align="left" class="' . $class_css . '" >' . $module['name'] . '</td>' . "\n";
     }
     //reorder column
     //up
     $out .= '<td align="center">' . "\n";
     if (!($iteration == 1)) {
         $out .= '<a href="module_dock.php?cmd=up&amp;module_id=' . $module['id'] . '&amp;dock=' . urlencode($dock) . '">' . '<img src="' . get_icon_url('move_up') . '" alt="' . get_lang('Move up') . '" />' . '</a>' . "\n";
     } else {
         $out .= '&nbsp;';
     }
     $out .= '</td>' . "\n";
     //down
     $out .= '<td align="center">' . "\n";
コード例 #28
0
ファイル: index.php プロジェクト: rhertzog/lcs
<?php

// $Id: index.php 13718 2011-10-20 09:24:38Z ffervaille $
require '../inc/claro_init_global.inc.php';
FromKernel::uses('utils/input.lib', 'utils/validator.lib');
$module = Claro_UserInput::getInstance()->get('module');
$block = Claro_UserInput::getInstance()->get('block');
if (!empty($module) && $module != 'platform' && file_exists(get_module_path($module) . '/templates/help.tpl.php')) {
    $tpl = new ModuleTemplate($module, 'help.tpl.php ');
} else {
    $tpl = new CoreTemplate('help.tpl.php');
}
if ($moduleName = get_module_data($module, 'moduleName')) {
    load_module_language($module);
    $tpl->assign('module', $moduleName);
} else {
    $tpl->assign('module', $module);
}
$tpl->assign('block', $block);
$claroline->setDisplayType(Claroline::POPUP);
$claroline->display->header->setTitle(get_lang('Claroline help'));
$claroline->display->body->appendContent($tpl->render());
echo $claroline->display->render();
コード例 #29
0
ファイル: loader.lib.php プロジェクト: rhertzog/lcs
 public function loadFromModule($moduleLabel, $lib, $media = 'all')
 {
     $lib = secure_file_path($lib);
     $moduleLabel = secure_file_path($moduleLabel);
     if (!get_module_data($moduleLabel)) {
         pushClaroMessage(__CLASS__ . "::{$moduleLabel} does not exists", 'error');
         return false;
     }
     if (claro_debug_mode()) {
         pushClaroMessage(__CLASS__ . "::Try to find {$lib} for {$moduleLabel}", 'debug');
     }
     $cssPath = array(0 => array('path' => get_path('rootSys') . 'platform/css/' . $moduleLabel . '/' . $lib . '.css', 'url' => get_path('url') . '/platform/css/' . $moduleLabel . '/' . $lib . '.css'), 1 => array('path' => get_module_path($moduleLabel) . '/css/' . $lib . '.css', 'url' => get_module_url($moduleLabel) . '/css/' . $lib . '.css'));
     /*$path = get_module_path( $moduleLabel ) . '/css/' . $lib . '.css';
       $url = get_module_url( $moduleLabel ) . '/css/' . $lib . '.css';*/
     foreach ($cssPath as $cssTry) {
         $path = $cssTry['path'];
         $url = $cssTry['url'];
         if (claro_debug_mode()) {
             pushClaroMessage(__CLASS__ . "::Try {$path}::{$url} for {$moduleLabel}", 'debug');
         }
         if (file_exists($path)) {
             if (array_key_exists($path, $this->css)) {
                 return false;
             }
             $this->css[$path] = array('url' => $url . '?' . filemtime($path), 'media' => $media);
             if (claro_debug_mode()) {
                 pushClaroMessage(__CLASS__ . "::Use {$path}::{$url} for {$moduleLabel}", 'debug');
             }
             ClaroHeader::getInstance()->addHtmlHeader('<link rel="stylesheet" type="text/css"' . ' href="' . $url . '"' . ' media="' . $media . '" />');
             return true;
         } else {
             if (claro_debug_mode()) {
                 pushClaroMessage(__CLASS__ . "::Cannot found css {$lib} for {$moduleLabel}", 'error');
             }
             return false;
         }
     }
 }
コード例 #30
0
ファイル: ical.write.lib.php プロジェクト: rhertzog/lcs
/**
 * Build the list of claro label of tool having a iCal creator.
 *
 * @return array of claro_label
 *
 * This function use 2 level of cache.
 * - memory Cache to compute only one time the list by script execution
 * - if enabled : use cache lite
 */
function ical_get_tool_compatible_list()
{
    static $iCalToolList = null;
    if (is_null($iCalToolList)) {
        $iCalToolList = array();
        $toolList = $GLOBALS['_courseToolList'];
        foreach ($toolList as $tool) {
            $toolLabel = trim($tool['label'], '_');
            $icalToolLibPath = get_module_path($toolLabel) . '/connector/ical.write.cnr.php';
            $icalToolFuncName = $toolLabel . '_write_ical';
            if (file_exists($icalToolLibPath)) {
                include_once $icalToolLibPath;
                if (function_exists($icalToolFuncName)) {
                    $iCalToolList[] = $toolLabel;
                }
            }
        }
    }
    // if is_null $iCalToolList -> if not use static
    return $iCalToolList;
}