Implements hook "theme"
@param \gplcart\core\Controller $controller
351590
public function hookTheme(Controller $controller)
    {
        if ($controller->isCurrentTheme('backend') && !$controller->isInternalRoute()) {
            $this->setAssets($controller);
            $this->setMetaTags($controller);
        }
    }
550761
static public function build_plan($controller) {

        $plan = $controller->get_plan();

        // Add the root task, responsible for
        // preparing everything, creating the
        // needed structures (users, roles),
        // preloading information to temp table
        // and other init tasks
        $plan->add_task(new restore_root_task('root_task'));
        $controller->get_progress()->progress();

        switch ($controller->get_type()) {
            case backup::TYPE_1ACTIVITY:
                self::build_activity_plan($controller, key($controller->get_info()->activities));
                break;
            case backup::TYPE_1SECTION:
                self::build_section_plan($controller, key($controller->get_info()->sections));
                break;
            case backup::TYPE_1COURSE:
                self::build_course_plan($controller, $controller->get_courseid());
                break;
        }

        // Add the final task, responsible for closing
        // all the pending bits (remapings, inter-links
        // conversion...)
        // and perform other various final actions.
        $plan->add_task(new restore_final_task('final_task'));
        $controller->get_progress()->progress();
    }
976983
public function beforeRender(Controller $controller) {
        $badges = array();

        foreach (Configure::read('Admin.menu') as $section => $menu) {
            $badges[$section] = $menu['count'];
        }

        $controller->set('badgeCounts', $badges);

        if (isset($controller->Model)) {
            $controller->set('model', $controller->Model);
        }

        if (isset($controller->request->params['override'])) {
            $controller->layout = 'Admin.admin';
            $controller->request->params['action'] = str_replace('admin_', '', $controller->action);
        }
    }
523884
public function startup(Controller $controller) {
		if (!$this->_controller->ViewExtension->isHtml()) {
			return;
		}

		$this->_setConfigVar($controller);
	}
702313
protected function _setLayout(Controller &$controller) {
		if ($controller->name == 'CakeError') {
			$controller->layout = 'CakeTheme.error';

			return;
		}

		$isAjax = $controller->request->is('ajax');
		$isPjax = $controller->request->is('pjax');
		$isHtml = $this->_controller->ViewExtension->isHtml();
		if ($isPjax) {
			$controller->layout = 'CakeTheme.pjax';
		} elseif ($isHtml && !$isAjax) {
			if ($controller->request->param('controller') === 'users') {
				$controller->layout = 'CakeTheme.login';
			} else {
				if ($controller->layout === 'default') {
					$controller->layout = 'CakeTheme.main';
				}
			}
		}
	}
511149
public function render(object $controller, String $view, array $data = null): string
    {
        $this->dot = new IteratorDot($data);

        $this->data[] = (null === $data) ? array() : $data;
        $this->view = $view;
        $remove_namespace = explode('\\', get_class($controller));
        $this->controllers = $remove_namespace[2];
        extract($this->data);
        ob_start();
        $this->isHeader();
        include $this->file = DIR_FILE.'Views/'.$this->controllers.DS.$this->view.$this->ex;
        $this->isFooter();
        if (null === $this->layout) {
            ob_end_flush();
        } else {
            ob_end_clean();
            $this->include_file($this->layout);
        }
        $content = ob_get_contents();

        return $content;
    }
606617
public static function resources($resource, $controller)
    {
        $uri = strtolower(Inflector::controllerise($resource));

        // Index, show
        static::get("/{$uri}")->to("{$controller}::index");
        static::get("/{$uri}/:id")->to("{$controller}::show");

        // New
        static::get("/{$uri}/new")->to("{$controller}::new");
        static::post("/{$uri}/new")->to("{$controller}::create");

        // Edit
        static::get("/{$uri}/:id/edit")->to("{$controller}::edit");
        static::post("/{$uri}/:id/edit")->to("{$controller}::save");

        // Delete
        static::get("/{$uri}/:id/delete")->to("{$controller}::delete");
        static::post("/{$uri}/:id/delete")->to("{$controller}::destroy");
    }
348176
public function initController(\OWeb\types\Controller $controller = null)
    {

        if ($this->controller == null)
            return;

        Events::getInstance()->sendEvent('Init_Prepare@OWeb\manage\Controller', $this->controller);

        $this->controller->initController();

        Events::getInstance()->sendEvent('Init_Done@OWeb\manage\Controller', $this->controller);

        Events::getInstance()->sendEvent('ActionDist_Prepare@OWeb\manage\Controller', $this->controller);

        //gestion des Actions...
        $source[] = \OWeb\OWeb::getInstance()->get_get();
        $source[] = \OWeb\OWeb::getInstance()->get_post();

        foreach ($source as $get) {
            if (isset($get['action']))
                $this->controller->doAction($get['action']);

            $i = 1;
            while (isset($get['action_' . $i])) {
                $this->controller->doAction($get['action_' . $i]);
                $i++;
            }
        }

        Events::getInstance()->sendEvent('ActionDist_Done@OWeb\manage\Controller', $this->controller);
    }
813304
protected function viewImage($file, $controller)
    {
        $path = $file->getRealPath();

        $data = array(
            'file' => $file,
            'src' => $controller->image(gplcart_file_relative($path)),
            'exif' => function_exists('exif_read_data') ? exif_read_data($path) : array()
        );

        return $controller->render('file_manager|readers/image', $data);
    }
351014
public function startup($controller = null)
    {
        if (!$controller) {
            $controller = new Controller(new Request());
        }
        $registry = new ComponentRegistry();
        $this->Acl = new AclComponent($registry, Configure::read('Acl'));
        $this->Aco = $this->Acl->Aco;
        $this->controller = $controller;
        $this->_buildPrefixes();
        $this->_processIgnored();
    }
39292
public function generate($controller)
    {
        // We create command generator instance
        $generator = new Generator(
            $this->setting->getControllerDirectory(),
            $controller
        );

        // We check if the file already exists
        if ($generator->fileExists()) {
            echo Color::danger('The controller already exists');

            exit(1);
        }

        // We create the resource url prefix
        $prefix = preg_replace("/controller/i", "", strtolower($controller));
        $model = ucfirst($prefix);
        $prefix = '/'.trim($prefix, '/');

        $model_namespace = '';

        $options = $this->arg->options();

        // We check if --with-view exists. If that exists,
        // we launch the question
        if ($options->has('--with-view')
            && $this->readline("Do you want me to create the associated views? ")
        ) {
            $model = preg_replace("/controller/i", "", strtolower($controller));

            $model = strtolower($model);

            $this->createDefaultView($model, $filename);
        }

        $prefix = Str::plurial(Str::snake($prefix));

        $this->createResourceController(
            $generator,
            $prefix,
            $controller,
            $model_namespace
        );

        exit(0);
    }
1236764
public function startup(Controller $controller) {
		if ($this->settings['isTest']) {
			return;
		}

		foreach ($this->routes as $route) {
			if (!$this->_parse($route['route'])) {
				continue;
			}

			if (!$this->_execute($route)) {
				break;
			}

			$this->Session->write('Sanction.referer', $this->request->here());
			return $this->redirect($controller, $route);
		}
	}
839088
protected function configureController(Controller $controller)
    {
        $controller->setInput($this->getInput())
            ->setOutput($this->getOutput())
            ->setCommand($this->getCommand());
        $composer = new Composer();
        $controller->add($composer);
    }
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');
    }
369843
protected function addGroupNamespace($controller)
    {
        if (! empty($this->groupStack)) {
            $group = end($this->groupStack);

            if (isset($group['namespace']) && strpos($controller, '\\') !== 0) {
                return $group['namespace'].'\\'.$controller;
            }
        }

        return $controller;
    }
898083
public function setController(Controller $controller)
    {
        $this->_Controller = $controller;
        $this->setEventManager($controller->getEventManager());
    }
528743
public function getUrlTemplateByController($controller)
    {
        $result = $this->findUriTemplatesByController($controller);

        // Now check the results of search
        if (isset($result[0])) {
            return $result[0];
        } else {
            return false;
        }
    }