本文整理汇总了PHP中Chamilo\CoreBundle\Framework\Container::getCourseDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::getCourseDir方法的具体用法?PHP Container::getCourseDir怎么用?PHP Container::getCourseDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chamilo\CoreBundle\Framework\Container
的用法示例。
在下文中一共展示了Container::getCourseDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_get_path
//.........这里部分代码省略.........
$paths[WEB_CODE_PATH] = $root_web . $code_folder;
$paths[SYS_CODE_PATH] = $root_sys . $code_folder;
$paths[REL_UPLOAD_PATH] = $root_rel . $paths[SYS_UPLOAD_PATH];
$paths[WEB_DEFAULT_COURSE_DOCUMENT_PATH] = $paths[WEB_CODE_PATH] . 'default_course_document/';
$paths[REL_DEFAULT_COURSE_DOCUMENT_PATH] = $paths[REL_PATH] . 'main/default_course_document/';
// Now we can switch into api_get_path() "terminology".
$paths[SYS_LANG_PATH] = $paths[SYS_CODE_PATH] . $paths[SYS_LANG_PATH];
$paths[SYS_APP_PATH] = $paths[SYS_PATH] . $paths[SYS_APP_PATH];
$paths[WEB_APP_PATH] = $paths[WEB_PATH] . $paths[WEB_APP_PATH];
$paths[SYS_UPLOAD_PATH] = $paths[SYS_PATH] . $paths[SYS_UPLOAD_PATH];
$paths[SYS_PLUGIN_PATH] = $paths[SYS_PATH] . $paths[SYS_PLUGIN_PATH];
$paths[SYS_ARCHIVE_PATH] = Container::getTempDir();
$paths[SYS_TEST_PATH] = $paths[SYS_PATH] . $paths[SYS_TEST_PATH];
$paths[SYS_TEMPLATE_PATH] = $paths[SYS_CODE_PATH] . $paths[SYS_TEMPLATE_PATH];
$paths[SYS_PUBLIC_PATH] = $paths[SYS_PATH] . $paths[SYS_PUBLIC_PATH];
$paths[SYS_CSS_PATH] = $paths[SYS_PATH] . $paths[SYS_CSS_PATH];
$paths[SYS_FONTS_PATH] = $paths[SYS_CODE_PATH] . $paths[SYS_FONTS_PATH];
$paths[WEB_CSS_PATH] = $paths[WEB_PATH] . $paths[WEB_CSS_PATH];
$bundleWebPath = Container::getAsset()->getUrl('bundles/chamilocore/');
$paths[WEB_IMG_PATH] = $bundleWebPath . 'img/';
$paths[SYS_IMG_PATH] = $paths[SYS_PATH] . $paths[SYS_IMG_PATH];
$paths[WEB_LIBRARY_PATH] = $paths[WEB_CODE_PATH] . $paths[WEB_LIBRARY_PATH];
$paths[WEB_LIBRARY_JS_PATH] = $bundleWebPath . 'js/';
$paths[WEB_AJAX_PATH] = $paths[WEB_CODE_PATH] . $paths[WEB_AJAX_PATH];
$paths[WEB_FONTS_PATH] = $paths[WEB_CODE_PATH] . $paths[WEB_FONTS_PATH];
$paths[WEB_PLUGIN_PATH] = $paths[WEB_PATH] . $paths[WEB_PLUGIN_PATH];
$paths[WEB_ARCHIVE_PATH] = $paths[WEB_PATH] . $paths[WEB_ARCHIVE_PATH];
$paths[WEB_TEMPLATE_PATH] = $paths[WEB_CODE_PATH] . $paths[WEB_TEMPLATE_PATH];
$paths[WEB_UPLOAD_PATH] = $paths[WEB_PATH] . $paths[WEB_UPLOAD_PATH];
$paths[WEB_PUBLIC_PATH] = $paths[WEB_PATH] . $paths[WEB_PUBLIC_PATH];
$paths[INCLUDE_PATH] = $paths[SYS_CODE_PATH] . $paths[INCLUDE_PATH];
$paths[LIBRARY_PATH] = $paths[SYS_CODE_PATH] . $paths[LIBRARY_PATH];
$paths[CONFIGURATION_PATH] = $paths[SYS_PATH] . $paths[CONFIGURATION_PATH];
$paths[SYS_COURSE_PATH] = Container::getCourseDir();
$is_this_function_initialized = true;
} else {
if ($load_new_config) {
// Redefining variables to work well with the "multiple url" feature
// All web paths need to be here
$web_paths = array(WEB_PATH => '', WEB_SERVER_ROOT_PATH => '', WEB_COURSE_PATH => '', WEB_CODE_PATH => '', WEB_IMG_PATH => 'img/', WEB_CSS_PATH => 'web/css/', WEB_PLUGIN_PATH => 'plugin/', WEB_ARCHIVE_PATH => 'archive/', WEB_LIBRARY_PATH => 'inc/lib/', WEB_AJAX_PATH => 'inc/ajax/');
$root_web = api_add_trailing_slash($root_web);
// Web server base and system server base.
$server_base_web = preg_replace('@' . $root_rel . '$@', '', $root_web);
// No trailing slash.
// Redefine root webs
$paths[WEB_PATH] = $root_web;
$paths[WEB_SERVER_ROOT_PATH] = $server_base_web . '/';
$paths[WEB_COURSE_PATH] = $root_web . $course_folder;
$paths[WEB_CODE_PATH] = $root_web . $code_folder;
$paths[WEB_IMG_PATH] = $paths[WEB_CODE_PATH] . $web_paths[WEB_IMG_PATH];
$paths[WEB_CSS_PATH] = $paths[WEB_PATH] . $web_paths[WEB_CSS_PATH];
$paths[WEB_PLUGIN_PATH] = $paths[WEB_PATH] . $web_paths[WEB_PLUGIN_PATH];
$paths[WEB_ARCHIVE_PATH] = $paths[WEB_PATH] . $web_paths[WEB_ARCHIVE_PATH];
$paths[WEB_LIBRARY_PATH] = $paths[WEB_CODE_PATH] . $web_paths[WEB_LIBRARY_PATH];
$paths[WEB_AJAX_PATH] = $paths[WEB_CODE_PATH] . $web_paths[WEB_AJAX_PATH];
$paths[WEB_FONTS_PATH] = $paths[WEB_CODE_PATH] . $paths[WEB_FONTS_PATH];
}
}
// Shallow purification and validation of input parameters.
$path_type = trim($path_type);
$path = trim($path);
if (empty($path_type)) {
return null;
}
// Retrieving a common-purpose path.
if (isset($paths[$path_type])) {
示例2: api_get_path
//.........这里部分代码省略.........
* api_get_path(CONFIGURATION_PATH) /var/www/chamilo/main/inc/conf/
* api_get_path(SYS_LANG_PATH) /var/www/chamilo/main/lang/
* api_get_path(SYS_PLUGIN_PATH) /var/www/chamilo/plugin/
* api_get_path(SYS_TEST_PATH) /var/www/chamilo/tests/
* api_get_path(SYS_TEMPLATE_PATH) /var/www/chamilo/main/template/
*
* api_get_path(WEB_SERVER_ROOT_PATH) http://www.mychamilo.org/
*
* api_get_path(WEB_PUBLIC_PATH) http://www.mychamilo.org/chamilo/web/
* api_get_path(WEB_PATH) http://www.mychamilo.org/chamilo/
* api_get_path(WEB_COURSE_PATH) http://www.mychamilo.org/chamilo/courses/
* api_get_path(WEB_CODE_PATH) http://www.mychamilo.org/chamilo/main/
* api_get_path(WEB_PLUGIN_PATH) http://www.mychamilo.org/chamilo/plugin/
* api_get_path(WEB_ARCHIVE_PATH) http://www.mychamilo.org/chamilo/archive/
* api_get_path(WEB_IMG_PATH) http://www.mychamilo.org/chamilo/web/chamilo/img/
* api_get_path(SYS_IMG_PATH) /var/www/chamilo/web/bundles/chamilocore/img/
*
* api_get_path(WEB_CSS_PATH) http://www.mychamilo.org/chamilo/main/css/
* api_get_path(WEB_LIBRARY_PATH) http://www.mychamilo.org/chamilo/main/inc/lib/
* api_get_path(WEB_LIBRARY_JS_PATH) http://www.mychamilo.org/chamilo/web/Chamilo/javascript
* api_get_path(WEB_TEMPLATE_PATH) http://www.mychamilo.org/chamilo/main/template/
*
*
* We can convert arbitrary paths, that are not registered (no defined constant).
* For guaranteed result, these paths should point inside the system Chamilo.
* Some random examples:
* api_get_path(TO_WEB, $_SERVER['REQUEST_URI'])
* api_get_path(TO_SYS, $_SERVER['PHP_SELF'])
* api_get_path(TO_REL, __FILE__)
* ...
*/
function api_get_path($path_type, $path = null)
{
$paths = array(SYS_DATA_PATH => 'data/', SYS_WEB_PATH => 'web/', SYS_CONFIG_PATH => 'config/', SYS_LOG_PATH => 'logs/', WEB_DATA_COURSE_PATH => 'courses/', WEB_DATA_PATH => '/', SYS_COURSE_PATH => 'data/', SYS_CSS_PATH => 'bundles/chamilocore/css/', SYS_LANG_PATH => 'lang/', WEB_IMG_PATH => 'bundles/chamilocore/img/', SYS_IMG_PATH => 'web/bundles/chamilocore/img/', WEB_CSS_PATH => 'bundles/chamilocore/css/', SYS_PLUGIN_PATH => 'plugin/', WEB_PLUGIN_PATH => 'plugin/', WEB_ARCHIVE_PATH => 'temp/', INCLUDE_PATH => 'inc/', LIBRARY_PATH => 'inc/lib/', SYS_LIBRARY_JS_PATH => 'bundles/chamilocore/js/', CONFIGURATION_PATH => 'inc/conf/', WEB_LIBRARY_PATH => 'inc/lib/', WEB_LIBRARY_JS_PATH => 'bundles/chamilocore/js/', WEB_AJAX_PATH => 'inc/ajax/', SYS_TEST_PATH => 'tests/', WEB_TEMPLATE_PATH => 'template/', SYS_TEMPLATE_PATH => 'template/');
$root_web = Container::getUrlGenerator()->generate('home');
$rootDir = Container::getRootDir();
// Configuration data for already installed system.
$root_sys = $rootDir;
$code_folder = 'main/';
//$course_folder = isset($_configuration['course_folder']) ? $_configuration['course_folder'] : null;
$course_folder = "courses/";
// Dealing with trailing slashes.
$root_web = api_add_trailing_slash($root_web);
$root_sys = api_add_trailing_slash($root_sys);
//$root_rel = api_add_trailing_slash($root_rel);
$code_folder = api_add_trailing_slash($code_folder);
$course_folder = api_add_trailing_slash($course_folder);
$root_rel = null;
// Initialization of a table that contains common-purpose paths.
$paths[WEB_PATH] = $root_web;
$webPathNoDev = str_replace('app_dev.php/', '', $paths[WEB_PATH]);
$paths[WEB_PUBLIC_PATH] = $root_web;
$paths[SYS_PATH] = $root_sys;
// Update data path to get it from config file if defined
$paths[SYS_DATA_PATH] = Container::getDataDir();
$paths[SYS_LOG_PATH] = Container::getLogDir();
$paths[SYS_CONFIG_PATH] = Container::getConfigDir();
$paths[SYS_COURSE_PATH] = Container::getCourseDir();
$paths[SYS_DEFAULT_COURSE_DOCUMENT_PATH] = $paths[SYS_DATA_PATH] . 'default_course_document/';
$paths[SYS_WEB_PATH] = $root_sys . 'web/';
$paths[REL_PATH] = $root_rel;
$paths[WEB_DATA_PATH] = $paths[WEB_PUBLIC_PATH] . 'data/';
$paths[WEB_COURSE_PATH] = $root_web . $course_folder;
$paths[WEB_DATA_COURSE_PATH] = $paths[WEB_DATA_PATH] . $course_folder;
$paths[REL_COURSE_PATH] = $root_rel . $course_folder;
$paths[REL_CODE_PATH] = $root_rel . $code_folder;
$paths[WEB_CODE_PATH] = $root_web . $code_folder;
$paths[REL_DATA_PATH] = $root_rel . 'data/';
$paths[WEB_DEFAULT_COURSE_DOCUMENT_PATH] = $paths[WEB_DATA_PATH] . 'default_course_document/';
$paths[REL_DEFAULT_COURSE_DOCUMENT_PATH] = $paths[REL_DATA_PATH] . 'default_course_document/';
$paths[SYS_CODE_PATH] = $root_sys . $code_folder;
// Now we can switch into api_get_path() "terminology".
$paths[SYS_LANG_PATH] = $paths[SYS_CODE_PATH] . $paths[SYS_LANG_PATH];
$paths[SYS_PLUGIN_PATH] = $paths[SYS_PATH] . $paths[SYS_PLUGIN_PATH];
$paths[SYS_ARCHIVE_PATH] = Container::getTempDir();
$paths[SYS_TEST_PATH] = $paths[SYS_PATH] . $paths[SYS_TEST_PATH];
$paths[SYS_TEMPLATE_PATH] = $paths[SYS_CODE_PATH] . $paths[SYS_TEMPLATE_PATH];
$paths[SYS_CSS_PATH] = $paths[SYS_PATH] . $paths[SYS_CSS_PATH];
$paths[WEB_CSS_PATH] = $paths[WEB_PATH] . $paths[WEB_CSS_PATH];
$paths[WEB_IMG_PATH] = $paths[WEB_PATH] . $paths[WEB_IMG_PATH];
$paths[SYS_IMG_PATH] = $paths[SYS_PATH] . $paths[SYS_IMG_PATH];
$paths[WEB_LIBRARY_PATH] = $paths[WEB_CODE_PATH] . $paths[WEB_LIBRARY_PATH];
$paths[WEB_LIBRARY_JS_PATH] = $webPathNoDev . $paths[WEB_LIBRARY_JS_PATH];
$paths[WEB_AJAX_PATH] = $paths[WEB_PUBLIC_PATH] . 'main/' . $paths[WEB_AJAX_PATH];
$paths[WEB_PLUGIN_PATH] = $paths[WEB_PATH] . $paths[WEB_PLUGIN_PATH];
$paths[WEB_ARCHIVE_PATH] = $paths[WEB_PATH] . $paths[WEB_ARCHIVE_PATH];
$paths[WEB_TEMPLATE_PATH] = $paths[WEB_CODE_PATH] . $paths[WEB_TEMPLATE_PATH];
$paths[INCLUDE_PATH] = $paths[SYS_CODE_PATH] . $paths[INCLUDE_PATH];
$paths[LIBRARY_PATH] = $paths[SYS_CODE_PATH] . $paths[LIBRARY_PATH];
$paths[SYS_LIBRARY_JS_PATH] = $paths[SYS_PATH] . $paths[SYS_LIBRARY_JS_PATH];
$paths[CONFIGURATION_PATH] = $paths[SYS_CODE_PATH] . $paths[CONFIGURATION_PATH];
// Path conversion to the requested type.
if (empty($path_type)) {
return null;
}
if (isset($paths[$path_type])) {
return $paths[$path_type];
}
return null;
}