本文整理汇总了PHP中get_module_path函数的典型用法代码示例。如果您正苦于以下问题:PHP get_module_path函数的具体用法?PHP get_module_path怎么用?PHP get_module_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_module_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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: export
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: get_icon_url
/**
* 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: loadModuleManager
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: load_current_module_listeners
/**
* 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: current
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: load
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: export_modules
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: claro_disp_auth_form
* @see http://www.claroline.net/wiki/CLDSC/
* @author Claro Team <cvs@claroline.net>
* @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: dirname
* @author Claro Team <cvs@claroline.net>
* @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: create_required_profile
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: removeUserIdListFromCourse
/**
* 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) {
//.........这里部分代码省略.........
示例13: get_path
// 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: get_module_label_list
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: load_module_translation
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
}
}