Store the controller.

@param Controller $controller
@throws ForbiddenException
761881
public function startup(Controller $controller) {
        $this->Controller = $controller;

        // Thrown an exception if accessing an override action without requestAction()
        if (substr($controller->action, 0, 6) === 'admin_' && empty($controller->request->params['override'])) {
            throw new ForbiddenException();
        }

        // Set ACL session
        $user_id = $this->Auth->user('id');

        if (!$user_id || $this->Auth->user(Configure::read('User.fieldMap.status')) == Configure::read('User.statusMap.banned')) {
            return;
        }

        if (!$this->Session->check('Acl')) {
            $roles = ClassRegistry::init('Admin.RequestObject')->getRoles($user_id);
            $isAdmin = false;
            $isSuper = false;
            $roleMap = array();

            foreach ($roles as $role) {
                if (!$isAdmin && $role['RequestObject']['alias'] == Configure::read('Admin.aliases.administrator')) {
                    $isAdmin = true;
                }

                if (!$isSuper && $role['RequestObject']['alias'] == Configure::read('Admin.aliases.superModerator')) {
                    $isSuper = true;
                }

                $roleMap[$role['RequestObject']['id']] = $role['RequestObject']['alias'];
            }

            $this->Session->write('Acl.isAdmin', $isAdmin);
            $this->Session->write('Acl.isSuper', $isSuper);
            $this->Session->write('Acl.roles', $roleMap);
        }

        // Set reported count
        if (Configure::read('Admin.menu.reports')) {
            Configure::write('Admin.menu.reports.count', Admin::introspectModel('Admin.ItemReport')->getCountByStatus());
        }
    }
929861
public function setController($controller)
    {
        $context = $this->_context;

        $context->controller = Text::camelize($controller);

        return $this;
    }
489176
public function setController($controller)
    {
        if (empty($controller)) {
            throw new InvalidArgumentException(sprintf('Missing controller for route with path "%s".', $this->getPath()));
        }

        $this->controller = $controller;

        return $this;
    }
483959
public function startup(Controller $controller) {
		$this->_setConfig();
		if (!$this->_controller->ViewExtension->isHtml()) {
			return;
		}

		$targetDeep = $this->_modelConfigSearchInfo->getTargetDeep();
		$querySearchMinLength = $this->_modelConfigSearchInfo->getQuerySearchMinLength();
		$targetFieldsSelected = $this->getTargetList();
		$targetFields = $this->_modelSearch->getTargetFields();

		$controller->set('search_targetDeep', $targetDeep);
		$controller->set('search_querySearchMinLength', $querySearchMinLength);
		$controller->set('search_targetFieldsSelected', $targetFieldsSelected);
		$controller->set('search_targetFields', $targetFields);
	}
348966
public function setControllerData($controller)
    {
        if (is_string($controller)) {
            $controller = $this->app->normalizeClassName($controller, 'Data');
        } elseif (!$controller instanceof Controller_Data) {
            throw $this->exception('Inappropriate Controller. Must extend Controller_Data');
        }
        $this->controller = $this->setController($controller);

        return $this->controller;
    }
894299
protected function _setControllerFile($src, $controller) {
        $controllerPath = SRC_PATH . $src . '/' . SRC_CONTROLLER_PATH . ucfirst($controller) . '.php';

        if (file_exists($controllerPath)) {
            require_once($controllerPath);

            return true;
        }

        return false;
    }
542518
public function excludeActions($controller, $action){
		$cid = $controller->id;
		$action = is_array($action) ? $action : array($action);

		if(!isset($this->excluded_actions[$cid])){
			$this->excluded_actions[$cid] = array();
		}

		foreach($action as $a){
			if(in_array($a, $this->excluded_actions[$cid])){
				continue;
			}

			$this->excluded_actions[$cid][] = $a;
		}

		return $this;
	}
435227
public function setController(AController $controller) {
        if (count(self::$_modules) > 0) {
            foreach (self::$_modules as $module) {
                $module->setController($controller);
            }
        }
    }
1001953
public function initialize(Controller $controller) {
		$this->_controller = $controller;
		$isAppInstalled = $this->isAppInstalled();
		if (($this->_controller->request->param('plugin') !== 'cake_installer') ||
			($this->_controller->request->param('controller') !== 'check') ||
			($this->_controller->request->param('action') !== 'index')) {
			if (!$isAppInstalled) {
				$urlRedirect = ['controller' => 'check', 'action' => 'index', 'plugin' => 'cake_installer'];
				$this->_controller->redirect($urlRedirect);
			}
		}
	}
510642
public function initialize(Controller $controller) {
		$this->_controller = $controller;
		if (!$this->_controller->Components->loaded('RequestHandler')) {
			$this->_controller->RequestHandler = $this->_controller->Components->load('RequestHandler');
			$this->_controller->RequestHandler->initialize($this->_controller);
		}
		if (!$this->_controller->Components->loaded('CakeTheme.ViewExtension')) {
			$this->_controller->ViewExtension = $this->_controller->Components->load('CakeTheme.ViewExtension');
			$this->_controller->ViewExtension->initialize($this->_controller);
		}
	}
57156
public function initialize(Controller $controller) {
		$this->_controller = $controller;
		$this->_model = $this->_controller->{$this->_controller->modelClass};
		if (!$this->_controller->Components->loaded('RequestHandler')) {
			$this->_controller->RequestHandler = $this->_controller->Components->load('RequestHandler');
			$this->_controller->RequestHandler->initialize($this->_controller);
		}

		$this->_modelConfigTheme = ClassRegistry::init('CakeTheme.ConfigTheme');
	}
845206
protected function makeController($controller)
    {

        if (!$this->creator) {
            return $this->container->make($controller);
        }

        return $this->creator->createController($controller, $this->getPage());

    }
1144860
public function initialize(Controller $controller) {
		$this->_controller = $controller;
		if (!$this->_controller->Components->loaded('RequestHandler')) {
			$this->_controller->RequestHandler = $this->_controller->Components->load('RequestHandler');
			$this->_controller->RequestHandler->initialize($this->_controller);
		}
		if (!$this->_controller->Components->loaded('Session')) {
			$this->_controller->Session = $this->_controller->Components->load('Session');
			$this->_controller->Session->initialize($this->_controller);
		}
		if ($this->_controller->Auth->loggedIn() ||
			$this->_controller->RequestHandler->prefers('json')) {
			return;
		}

		$isAuthCfg = $this->_modelSetting->isAuthGroupConfigured();
		if ($isAuthCfg) {
			if ($this->_controller->Session->read('Settings.FirstLogon')) {
				$this->_controller->Session->delete('Settings.FirstLogon');

				return $this->_controller->redirect($this->_controller->Auth->logout());
			}

			return;
		}

		$pluginName = $this->_controller->request->param('plugin');
		$controllerName = $this->_controller->request->param('controller');
		$actionName = $this->_controller->request->param('action');
		if (($pluginName !== 'cake_settings_app') ||
			($controllerName !== 'settings') ||
			($actionName !== 'index')) {
			return;
		}

		$this->_controller->Auth->allow('index');
		$this->_controller->Session->write('Settings.FirstLogon', true);
	}
854038
protected function setAssets(Controller $controller)
    {
        $controller->addAssetLibrary('jquery_ui');
        $controller->addAssetLibrary('bootstrap');
        $controller->addAssetLibrary('html5shiv', array('condition' => 'if lt IE 9'));
        $controller->addAssetLibrary('respond', array('condition' => 'if lt IE 9'));
        $controller->addAssetLibrary('font_awesome');

        $controller->setJs(__DIR__ . '/js/common.js');
        $controller->setCss(__DIR__ . '/css/common.css');
    }
662872
public function generate($controller)
    {
        $generator = new Generator(
            $this->setting->getControllerDirectory(),
            $controller
        );

        if ($generator->fileExists()) {
            echo "\033[0;31mThe controller already exists.\033[00m\n";

            exit(1);
        }

        if ($this->arg->options('--no-plain')) {
            $generator->write('controller/no-plain', [
                'baseNamespace' => $this->namespaces['controller']
            ]);
        } else {
            $generator->write('controller/controller', [
                'baseNamespace' => $this->namespaces['controller']
            ]);
        }

        echo "\033[0;32mThe controller was well created.\033[00m\n";

        exit(0);
    }
603792
protected function constants(String & $controller)
    {
        if( ! empty($this->settings['constants']) )
        {
            foreach( $this->settings['constants'] as $key => $val )
            {
                $controller .= HT."const {$key} = {$val};".EOL;
            }

            $controller .= EOL;
        }
    }
560181
public function resource($uri, $controller, array $options = [])
    {
        $this->get($uri, "$controller@index", $options);
        $this->post($uri, "$controller@store", $options);
        $this->get("$uri/{placeholder}", "$controller@show", $options);
        $this->put("$uri/{placeholder}", "$controller@update", $options);
        $this->delete("$uri/{placeholder}", "$controller@delete", $options);
    }