/** * Generates a URL from the given parameters. * * @param mixed $params The parameter values * @param array $context The context * @param Boolean $absolute Whether to generate an absolute URL * * @return string The generated URL */ public function generate($params, $context = array(), $absolute = false) { $slug = null; $defaults = $this->getDefaults(); if (isset($params['sf_subject']) && !isset($params['engine-slug'])) { // Don't override the current page if it is an engine, or a previously // pushed engine page $slug = aRouteTools::getContextEngineSlug($this); if ($slug) { $params['engine-slug'] = $slug; } else { if (method_exists($params['sf_subject'], 'getEngineSlug')) { $params['engine-slug'] = $params['sf_subject']->getEngineSlug(); } } } if (isset($params['engine-slug'])) { $slug = $params['engine-slug']; aRouteTools::pushTargetEngineSlug($slug, $defaults['module']); unset($params['engine-slug']); } $result = aRouteTools::addPageToUrl($this, parent::generate($params, $context, false), $absolute); if ($slug) { aRouteTools::popTargetEngine($defaults['module']); } return $result; }
public function matchesParameters($params, $context = array()) { if ('object' !== $this->options['type'] || is_array($params)) { $params = array_merge(array('username' => $this->getUserId()), $params); } return parent::matchesParameters($params, $context); }
protected function getObjectForParameters($parameters) { $result = parent::getObjectForParameters($parameters); if (!$result instanceof opAccessControlRecordInterface) { $this->acl = call_user_func($this->getAclBuilderName() . '::buildResource', $result, $this->getTargetMemberList()); } return $result; }
public function matchesUrl($url, $context = array()) { if (false === ($parameters = parent::matchesUrl($url, $context))) { return false; } if (!$parameters['slug']) { return false; } if ($res = parent::matchesUrl($url, $context)) { $page = Doctrine_Core::getTable('Cms')->retrieveBySlug($parameters); } if (!$page) { return false; } else { $this->object = $page; } return $res; }
protected function getObjectForParameters($parameters) { $result = parent::getObjectForParameters($parameters); $this->acl = call_user_func($this->getAclBuilderName() . '::buildResource', $result, $this->getTargetMemberList()); return $result; }
/** * Generates a URL from the given parameters. * * @param mixed $params The parameter values * @param array $context The context * @param Boolean $absolute Whether to generate an absolute URL * * @return string The generated URL */ public function generate($params, $context = array(), $absolute = false) { // Note that you must pass false to parent::generate for the $absolute parameter return aRouteTools::addPageToUrl($this, parent::generate($params, $context, false), $absolute); }
protected function doConvertObjectToArray($object) { $parameters = parent::doConvertObjectToArray($object); unset($parameters['id']); return $parameters; }