Example #1
0
 /**
  * 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 generate($params, $context = array(), $absolute = false)
 {
     if ('object' !== $this->options['type'] || is_array($params)) {
         $params = array_merge(array('username' => $this->getUserId()), $params);
         //sfContext::getInstance()->getLogger()->info(print_r($params,true));
     }
     return parent::generate($params, $context, $absolute);
 }
Example #3
0
 /**
  * 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);
 }