本文整理汇总了PHP中Url::toUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::toUrl方法的具体用法?PHP Url::toUrl怎么用?PHP Url::toUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url::toUrl方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolve
public function resolve(ResourceLocator $locator)
{
if ($locator->hasResourceId()) {
$context = Claro_Context::getCurrentContext();
$context[CLARO_CONTEXT_COURSE] = $locator->getCourseId();
if ($locator->inGroup()) {
$context[CLARO_CONTEXT_GROUP] = $locator->getGroupId();
}
$path = get_path('coursesRepositorySys') . claro_get_course_path($locator->getCourseId());
// in a group
if ($locator->inGroup()) {
$groupData = claro_get_group_data($context);
$path .= '/group/' . $groupData['directory'];
$groupId = $locator->getGroupId();
} else {
$path .= '/document';
}
$path .= '/' . $this->urlDecodePath(ltrim($locator->getResourceId(), '/'));
$resourcePath = '/' . $this->urlDecodePath(ltrim($locator->getResourceId(), '/'));
$path = secure_file_path($path);
if (!file_exists($path)) {
// throw new Exception("Resource not found {$path}");
return false;
} elseif (is_dir($path)) {
$url = new Url(get_module_entry_url('CLDOC'));
$url->addParam('cmd', 'exChDir');
$url->addParam('file', base64_encode($resourcePath));
return $url->toUrl();
} else {
return claro_get_file_download_url($resourcePath, Claro_Context::getUrlContext($context));
}
} else {
return get_module_entry_url('CLDOC');
}
}
示例2: resolve
public function resolve(ResourceLocator $locator)
{
if ($locator->hasResourceId()) {
$assignement_id = $locator->getResourceId();
$url = new Url(get_module_url('CLWRK') . '/work_list.php');
$url->addParam('assigId', (int) $assignement_id);
return $url->toUrl();
} else {
return get_module_entry_url('CLWRK');
}
}
示例3: resolve
public function resolve(ResourceLocator $locator)
{
if ($locator->hasResourceId()) {
$parts = explode('/', ltrim($locator->getResourceId(), '/'));
if (count($parts) == 1) {
$url = new Url(get_module_url('CLWIKI') . '/wiki.php');
$url->addParam('wikiId', (int) $parts[0]);
return $url->toUrl();
} elseif (count($parts) == 2) {
$url = new Url(get_module_url('CLWIKI') . '/page.php');
$url->addParam('wikiId', (int) $parts[0]);
$url->addParam('title', $parts[1]);
return $url->toUrl();
} else {
return get_module_entry_url('CLWIKI');
}
} else {
return get_module_entry_url('CLWIKI');
}
}
示例4: get_help_page_url
/**
* Get url of a module help page
* @param string $block name of the help block to display
* @param string $module module label or 'platform'
* @return string
*/
function get_help_page_url($block, $module = 'platform')
{
$helpUrl = new Url(get_path('url') . '/claroline/help/index.php');
if ($module) {
$helpUrl->addParam('module', $module);
}
$helpUrl->addParam('block', $block);
return $helpUrl->toUrl();
}
示例5: claro_get_file_download_url
/**
* Get the url to download the file at the given file path
* @param string $file path to the file
* @param array $context
* @param string $moduleLabel
* @since Claroline 1.10.5
* @return string url to the file
*/
function claro_get_file_download_url($file, $context = null, $moduleLabel = null)
{
$file = download_url_encode($file);
if ($GLOBALS['is_Apache'] && get_conf('usePrettyUrl', false)) {
// slash argument method - only compatible with Apache
$url = get_path('url') . '/claroline/backends/download.php' . str_replace('%2F', '/', $file);
} else {
// question mark argument method, for IIS ...
$url = get_path('url') . '/claroline/backends/download.php?url=' . $file;
}
$urlObj = new Url($url);
if (!empty($context)) {
$urlObj->relayContext(Claro_Context::getUrlContext($context));
} else {
$urlObj->relayCurrentContext();
}
if ($moduleLabel) {
$urlObj->addParam('moduleLabel', $moduleLabel);
}
return $urlObj->toUrl();
}
示例6: getTemplate
/**
* @return template object
* @since 1.10
* @todo write a CategoryBrowserView class (implementing Display)
*/
public function getTemplate()
{
$currentCategory = $this->getCurrentCategorySettings();
$categoryList = $this->getSubCategoryList();
$navigationUrl = new Url($_SERVER['PHP_SELF'] . '#categoryContent');
/*
* Build url param list
* @todo find a better way to do that
*/
if (isset($_REQUEST['cmd'])) {
$navigationUrl->addParam('cmd', $_REQUEST['cmd']);
}
if (isset($_REQUEST['fromAdmin'])) {
$navigationUrl->addParam('fromAdmin', $_REQUEST['fromAdmin']);
}
if (isset($_REQUEST['uidToEdit'])) {
$navigationUrl->addParam('uidToEdit', $_REQUEST['uidToEdit']);
}
if (isset($_REQUEST['asTeacher'])) {
$navigationUrl->addParam('asTeacher', $_REQUEST['asTeacher']);
}
$courseTreeView = CourseTreeNodeViewFactory::getCategoryCourseTreeView($this->categoryId, $this->userId);
$courseTreeView->setViewOptions($this->viewOptions);
$template = new CoreTemplate('categorybrowser.tpl.php');
$template->assign('currentCategory', $currentCategory);
$template->assign('categoryBrowser', $this);
$template->assign('categoryList', $categoryList);
$template->assign('courseTreeView', $courseTreeView);
$template->assign('navigationUrl', $navigationUrl->toUrl());
return $template;
}
示例7: add_request_variable_list_to_url
/**
* add a GET request variable list to the given URL
* @param string url url
* @param array variableList list of the request variables to add
* @return string url
*/
function add_request_variable_list_to_url($url, $variableList)
{
$urlObj = new Url($url);
$urlObj->addParamList($variableList);
return $urlObj->toUrl();
}
示例8: resolve
public function resolve(ResourceLocator $locator)
{
if ($locator instanceof ExternalResourceLocator) {
return $locator->__toString();
} else {
// 1 . get most accurate resolver
// 1.1 if Module
if ($locator->inModule()) {
$resolver = $this->loadModuleResolver($locator->getModuleLabel());
if (!$resolver) {
$resolver = new ToolResolver();
}
} elseif ($locator->inGroup()) {
$resolver = new GroupResolver();
} elseif ($locator->inCourse()) {
$resolver = new CourseResolver();
}
// 1.4 get base url
if ($resolver) {
$url = $resolver->resolve($locator);
} else {
$url = get_path('rootWeb');
}
$urlObj = new Url($url);
// 2. add context information
$context = Claro_Context::getCurrentContext();
if ($locator->inGroup()) {
$context[CLARO_CONTEXT_GROUP] = $locator->getGroupId();
} else {
if (isset($context[CLARO_CONTEXT_GROUP])) {
unset($context[CLARO_CONTEXT_GROUP]);
}
}
if ($locator->inCourse()) {
$context[CLARO_CONTEXT_COURSE] = $locator->getCourseId();
} else {
if (isset($context[CLARO_CONTEXT_COURSE])) {
unset($context[CLARO_CONTEXT_COURSE]);
}
}
$urlObj->relayContext(Claro_Context::getUrlContext($context));
return $urlObj->toUrl();
}
}