Build search url.

@param string $modelName
@param array $params
@param string $action
@return array|string
518310
public static function toSearch(string $modelName, array $params = [], string $action = 'index')
    {
        $formName = Inflector::id2camel($modelName) . 'Search';

        return static::toAction($modelName, [$formName => $params], $action);
    }
927648
public function customModelAction($modelName)
	{
		$config = app('itemconfig');
		$actionFactory = app('admin_action_factory');
		$actionName = $this->request->input('action_name', false);
		$dataTable = app('admin_datatable');

		//get the sort options and filters
		$page = $this->request->input('page', 1);
		$sortOptions = $this->request->input('sortOptions', array());
		$filters = $this->request->input('filters', array());

		//get the prepared query options
		$prepared = $dataTable->prepareQuery(app('db'), $page, $sortOptions, $filters);

		//get the action and perform the custom action
		$action = $actionFactory->getByName($actionName, true);
		$result = $action->perform($prepared['query']);

		//if the result is a string, return that as an error.
		if (is_string($result))
		{
			return response()->json(array('success' => false, 'error' => $result));
		}
		//if it's falsy, return the standard error message
		else if (!$result)
		{
			$messages = $action->getOption('messages');

			return response()->json(array('success' => false, 'error' => $messages['error']));
		}
		else
		{
			$response = array('success' => true);

			//if it's a download response, flash the response to the session and return the download link
			if (is_a($result, 'Symfony\Component\HttpFoundation\BinaryFileResponse'))
			{
				$file = $result->getFile()->getRealPath();
				$headers = $result->headers->all();
				$this->session->put('administrator_download_response', array('file' => $file, 'headers' => $headers));

				$response['download'] = route('admin_file_download');
			}
			//if it's a redirect, put the url into the redirect key so that javascript can transfer the user
			else if (is_a($result, '\Illuminate\Http\RedirectResponse'))
			{
				$response['redirect'] = $result->getTargetUrl();
			}

			return response()->json($response);
		}
	}
1108179
final public function url($module, $controller = null, $action = null, array $params = array(), $hash = null) {
        $module = ucfirst(Util::hyphenToCamel($module));
        $moduleOptions = engineGet('config', 'modules', $module, false);
        $module = (isset($moduleOptions['alias'])) ? $moduleOptions['alias'] : $module;

        $return = Util::camelToHyphen($module);
        if ($controller)
            $return .= '/' . Util::camelToHyphen($controller);
        if ($action)
            $return .= '/' . Util::camelToHyphen($action);
        if (!empty($params))
            $return .= str_replace('//', '/' . urlencode(' ') . '/', '/' . join('/', $this->encodeParams($params)));
        if ($hash)
            $return .= '#' . $hash;

        return engineGet('serverPath') . $return;
    }
581289
public function Link($action=null) {
        $link = Controller::join_links(
            $this->stat('url_base', true),
            $this->stat('url_segment', true), // in case we want to change the segment
            '/', // trailing slash needed if $action is null!
            "$action"
        );
        
        $this->extend('updateLink', $link);
        return $link;
    }
89591
protected static function buildParameterString($parameters, $action, &$query, &$cache_key, $request_params = [])
    {
        // Using raw query string here to allow for multiple parameters with the same key name.
        // The laravel Request object or PHP global array $_GET doesn't allow that.
        $requestQuery = explode('&', array_get($_SERVER, 'QUERY_STRING'));

        // If request is coming from a scripted service then $_SERVER['QUERY_STRING'] will be blank.
        // Therefore need to check the Request object for parameters.
        foreach ($request_params as $pk => $pv) {
            if (is_array($pv)) {
                foreach ($pv as $ipk => $ipv) {
                    $param = $pk.'[' . $ipk . ']=' . $ipv;
                    if (!in_array($param, $requestQuery)) {
                        $requestQuery[] = $param;
                    }
                }
            } else {
                $param = $pk . '=' . $pv;
                if (!in_array($param, $requestQuery)) {
                    $requestQuery[] = $param;
                }
            }
        }

        // inbound parameters from request to be passed on
        foreach ($requestQuery as $q) {
            $pairs = explode('=', $q);
            $name = trim(array_get($pairs, 0));
            $value = trim(array_get($pairs, 1));
            $outbound = true;
            $addToCacheKey = true;
            // unless excluded
            if (!empty($parameters)) {
                foreach ($parameters as $param) {
                    if (array_get_bool($param, 'exclude')) {
                        if (0 === strcasecmp($name, strval(array_get($param, 'name')))) {
                            if (static::doesActionApply($param, $action)) {
                                $outbound = !array_get_bool($param, 'outbound', true);
                                $addToCacheKey = !array_get_bool($param, 'cache_key', true);
                            }
                        }
                    }
                }
            }

            static::parseArrayParameter($query, $cache_key, $name, $value, $outbound, $addToCacheKey);
        }

        // DreamFactory additional outbound parameters
        if (!empty($parameters)) {
            foreach ($parameters as $param) {
                if (!array_get_bool($param, 'exclude')) {
                    if (static::doesActionApply($param, $action)) {
                        $name = array_get($param, 'name');
                        $value = array_get($param, 'value');
                        $outbound = array_get_bool($param, 'outbound', true);
                        $addToCacheKey = array_get_bool($param, 'cache_key', true);

                        static::parseArrayParameter($query, $cache_key, $name, $value, $outbound, $addToCacheKey);
                    }
                }
            }
        }
    }
438901
public function register_return_link($action, $params) {
        global $PAGE;
        $params['action'] = $action;
        $cm = $this->get_course_module();
        if ($cm) {
            $currenturl = new moodle_url('/mod/assign/view.php', array('id' => $cm->id));
        } else {
            $currenturl = new moodle_url('/mod/assign/index.php', array('id' => $this->get_course()->id));
        }

        $currenturl->params($params);
        $PAGE->set_url($currenturl);
    }
176384
protected function getModelPath($modelName)
    {
        $inputName = explode('/', ucfirst($modelName));
        array_pop($inputName);

        return implode('/', $inputName);
    }
811997
public static Parameter getActionParameter(Action action, String paramName) {
        for (Parameter param : action.getParameters()) {
            if (paramName.equals(param.getName())) {
                return param;
            }
        }
        return NOT_FOUND_PARAMETER;
    }
892373
public function setMvcUrl($controller = null, $action = null, array $params = [])
    {
        $this->mvcUrl = [
            'controller' => trim($controller),
            'action'     => trim($action),
            'params'     => $params
        ];
        return $this;
    }
344054
public function handleAction($action, $actionParams)
    {
        $this->setView($action);
        $response = parent::handleAction($action, $actionParams);

        if ($response instanceof Response) {
            return $response;
        }

        if (is_string($response)) {
            $this->controllerView->content = $response;
        } elseif (isset($this->view)) {
            $this->controllerView->content = $this->view->render();
        }

        $this->response->setContent($this->controllerView->render());

        return $this->response;
    }
975798
public function toRoute($action, $params=[])
    {
        $params = (array)$params;
        $url = URL::route($this->routePrefix . '.' . $action, $params);

        if ($passThruParams = $this->getPassThruParams()) {
            $url .= '?' . http_build_query($passThruParams);
        }

        return $url;

    }
1202662
public function Link($action = '')
    {
        $link = Controller::join_links(
            Director::baseURL(),
            Config::inst()->get('DocumentationViewer', 'link_base'),
            $this->getLanguage(),
            $action,
            '/'
        );

        return $link;
    }
423348
public function getUrl($name, $params = array())
	{
		return static::API_DOMAIN . $name . (empty($params) ? '' : ('?' . $this->http_build_query($params)));
	}
743601
final public function url($module, $controller = null, $action = null, array $params = array(), $hash = null) {
        return $this->view->url($module, $controller, $action, $params, $hash);
    }
862770
public function get($modelId, $params = array())
    {
        $resource = 'model/' . $modelId . '.json';
        $resource .= '?' . $this->buildQueryString($params);
        $response = $this->getServiceResponse($resource);

        $getModelResponse = new Models\ResponseModelGet($response);

        return $getModelResponse->getModel();
    }
1157795
public function getLinkToAction($actionName, $params, $pk_link = false)
    {
        $action = isset($params['action']) ? $params['action'] : 'List' . sfInflector::camelize($actionName);

        $url_params = $pk_link ? '?' . $this->getPrimaryKeyUrlParams() : '\'';

        $params['icon'] = (isset($params['icon']) ? $params['icon'] : 'icon-th-list');
        $params['params']['class'] = (isset($params['params']['class']) ? $params['params']['class'] : 'btn');
        $params['only_icon'] = (isset($params['only_icon']) ? $params['only_icon'] : true);
        $params['size'] = $this->defaultSize($params);
        $params['params']['class'] .= ' ' . $params['size'];
        $title = '__(\'' . $params['label'] . '\', array(), \'' . $this->getI18nCatalogue() . '\')';
        $label = (!$params['only_icon'] ? ' \'.' . $title : '\'');

        return '[?php echo link_to(\'<i class="' . $params['icon'] . '"></i>'
        . $label . ', \'' . $this->getModuleName() . '/' . $action
        . $url_params . ', ' . $this->asPhp($params['params']) . ') ?]';
    }
1278564
protected function _createURL($base, $controller, $action, $params, $searchDefined = true)
    {
        $params['controller'] = $controller;
        $params['action'] = $action;
        foreach ($this->urlRoutes as $route => $defined) { // first check those with strict params.
            $cBase = $base;
            $preparedParams = $params;
            if ($searchDefined) {
                if (is_numeric($route)) {
                    continue; // first only get those with defined conditions.
                }
                $match = true;
                foreach ($defined as $def => $value) { // first check if those exact values match.
                    if (($value || '0' === $value) && (!isset($params[$def]) || $params[$def] != $value)) {
                        $match = false;
                    } else {
                        unset($preparedParams[$def]);
                        if ('module' == $def) {
                            if (substr($cBase, -1 * strlen($value . '/')) == $value . '/') { // remove module from base url if it's there
                                $cBase = substr($cBase, 0, strlen($cBase) - strlen($value . '/'));
                            }
                        }
                    }
                }
                if (!$match) {
                    continue;
                }
            }
            $match = true;
            preg_match_all('/\(\?<([a-z0-9_\-]+)>.*?\)/', is_numeric($route) ? $defined : $route, $matches);
            if (!$matches) {
                continue;
            }
            $toReplace = array('\/' => '/');
            foreach ($matches[1] as $k => $word) {
                $match = $match & isset($params[$word]);
                if ($match) {
                    $toReplace[$matches[0][$k]] = $params[$word];
                    unset($preparedParams[$word]);
                } else {
                    break;
                }
            }

            if ($match) {
                unset($preparedParams['module']);
                return $cBase . str_replace(array_keys($toReplace), array_values($toReplace), is_numeric($route) ? $defined : $route) . $this->_params2string($preparedParams) . '.html';
            }
        }
        if ($searchDefined) {
            return $this->_createURL($base, $controller, $action, $params, false);
        }

    }