當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Url::toUrl方法代碼示例

本文整理匯總了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');
     }
 }
開發者ID:rhertzog,項目名稱:lcs,代碼行數:35,代碼來源:linker.cnr.php

示例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');
     }
 }
開發者ID:rhertzog,項目名稱:lcs,代碼行數:11,代碼來源:linker.cnr.php

示例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');
     }
 }
開發者ID:rhertzog,項目名稱:lcs,代碼行數:20,代碼來源:linker.cnr.php

示例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();
}
開發者ID:rhertzog,項目名稱:lcs,代碼行數:15,代碼來源:helpers.lib.php

示例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();
}
開發者ID:rhertzog,項目名稱:lcs,代碼行數:29,代碼來源:file.lib.php

示例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;
 }
開發者ID:rhertzog,項目名稱:lcs,代碼行數:36,代碼來源:categorybrowser.class.php

示例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();
}
開發者ID:rhertzog,項目名稱:lcs,代碼行數:12,代碼來源:lib.url.php

示例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();
     }
 }
開發者ID:rhertzog,項目名稱:lcs,代碼行數:44,代碼來源:linker.lib.php


注:本文中的Url::toUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。