本文整理汇总了PHP中Url::addParam方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::addParam方法的具体用法?PHP Url::addParam怎么用?PHP Url::addParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url::addParam方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()) {
$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');
}
}
示例3: 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');
}
}
示例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_to_url
/**
* add a GET request variable to the given URL
* @param string url url
* @param string name name of the variable
* @param string value value of the variable
* @return string url
*/
function add_request_variable_to_url($url, $name, $value)
{
$urlObj = new Url($url);
$urlObj->addParam($name, $value);
return $urlObj->toUrl();
}