本文整理汇总了PHP中Cx\Core\Routing\Url::fromRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::fromRequest方法的具体用法?PHP Url::fromRequest怎么用?PHP Url::fromRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Routing\Url
的用法示例。
在下文中一共展示了Url::fromRequest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFileUrls
public function testFileUrls()
{
$testResult = 'file://' . getcwd();
$url = Url::fromRequest();
$this->assertEquals($testResult, $url->toString());
$this->assertEquals(getcwd(), (string) $url);
$url = Url::fromMagic($testResult);
$this->assertEquals($testResult, $url->toString());
$this->assertEquals(getcwd(), (string) $url);
}
示例2: parsePage
/**
* Parses a rudimentary system log backend page
* @param \Cx\Core\Html\Sigma $template Backend template for this page
* @param array $cmd Supplied CMD
*/
public function parsePage(\Cx\Core\Html\Sigma $template, array $cmd)
{
$em = $this->cx->getDb()->getEntityManager();
$logRepo = $em->getRepository('Cx\\Core_Modules\\SysLog\\Model\\Entity\\Log');
// @todo: parse message if no entries (template block exists already)
$parseObject = $this->getNamespace() . '\\Model\\Entity\\Log';
// set default sorting
if (!isset($_GET['order'])) {
$_GET['order'] = 'timestamp/DESC';
}
// configure view
$viewGenerator = new \Cx\Core\Html\Controller\ViewGenerator($parseObject, array('functions' => array('delete' => 'true', 'paging' => true, 'sorting' => true, 'edit' => true), 'fields' => array('id' => array('showOverview' => false), 'timestamp' => array('readonly' => true), 'severity' => array('readonly' => true, 'table' => array('parse' => function ($data, $rows) {
return '<span class="' . contrexx_raw2xhtml(strtolower($data)) . '_background">' . contrexx_raw2xhtml($data) . '</span>';
})), 'message' => array('readonly' => true, 'table' => array('parse' => function ($data, $rows) {
$url = clone \Cx\Core\Routing\Url::fromRequest();
$url->setMode('backend');
$url->setParam('editid', $rows['id']);
return '<a href="' . $url . '">' . contrexx_raw2xhtml($data) . '</a>';
})), 'data' => array('readonly' => true, 'showOverview' => false, 'type' => 'text'), 'logger' => array('readonly' => true))));
$template->setVariable('ENTITY_VIEW', $viewGenerator);
}
示例3: getViewGeneratorOptions
/**
* This function returns the ViewGeneration options for a given entityClass
*
* @access protected
* @global $_ARRAYLANG
* @param $entityClassName contains the FQCN from entity
* @return array with options
*/
protected function getViewGeneratorOptions($entityClassName)
{
global $_ARRAYLANG;
$classNameParts = explode('\\', $entityClassName);
$classIdentifier = end($classNameParts);
$langVarName = 'TXT_' . strtoupper($this->getType() . '_' . $this->getName() . '_ACT_' . $classIdentifier);
$header = '';
if (isset($_ARRAYLANG[$langVarName])) {
$header = $_ARRAYLANG[$langVarName];
}
switch ($entityClassName) {
case 'Cx\\Core_Modules\\SysLog\\Model\\Entity\\Log':
return array('functions' => array('delete' => 'true', 'paging' => true, 'sorting' => true, 'edit' => true), 'fields' => array('id' => array('showOverview' => false), 'timestamp' => array('readonly' => true), 'severity' => array('readonly' => true, 'table' => array('parse' => function ($data, $rows) {
return '<span class="' . contrexx_raw2xhtml(strtolower($data)) . '_background">' . contrexx_raw2xhtml($data) . '</span>';
})), 'message' => array('readonly' => true, 'table' => array('parse' => function ($data, $rows) {
$url = clone \Cx\Core\Routing\Url::fromRequest();
$url->setMode('backend');
$url->setParam('editid', $rows['id']);
return '<a href="' . $url . '">' . contrexx_raw2xhtml($data) . '</a>';
})), 'data' => array('readonly' => true, 'showOverview' => false, 'type' => 'text'), 'logger' => array('readonly' => true)));
break;
default:
return array('header' => $header, 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false));
}
}
示例4: postInit
/**
* Initializes request
*/
protected function postInit()
{
global $_CONFIG;
// if path configuration was wrong in loadConfig(), Url is not yet initialized
if (!$this->request) {
// this makes \Env::get('Resolver')->getUrl() return a sensful result
$request = !empty($_GET['__cap']) ? $_GET['__cap'] : '';
$offset = $this->websiteOffsetPath;
switch ($this->mode) {
case self::MODE_FRONTEND:
case self::MODE_BACKEND:
$this->request = new \Cx\Core\Routing\Model\Entity\Request($_SERVER['REQUEST_METHOD'], \Cx\Core\Routing\Url::fromCapturedRequest($request, $offset, $_GET));
break;
case self::MODE_COMMAND:
case self::MODE_MINIMAL:
try {
$this->request = new \Cx\Core\Routing\Model\Entity\Request($_SERVER['REQUEST_METHOD'], \Cx\Core\Routing\Url::fromRequest());
} catch (\Cx\Core\Routing\UrlException $e) {
}
break;
}
}
//call post-init hooks
$this->ch->callPostInitHooks();
}