<commit_before><?php

namespace SmartCore\Bundle\EngineBundle\Controller;

use Symfony\Component\HttpFoundation\Response;
use SmartCore\Bundle\EngineBundle\Engine\Theme;
use SmartCore\Bundle\EngineBundle\Templater\View;
use SmartCore\Bundle\EngineBundle\Container;

class NodeMapperController extends Controller
{
	/**
	 * Свойcтво поведения действия над нодой (всроенное в шаблон - 'built-it' или во всплывающем окошке - 'pupup' или 'ajax' - подгружаемое в блок размещения.).
	 * По умолчанию инициализируется как false.
	 * 
	 * @access private
	 * 
	 * @todo надо подумать, надо ли вообще это держать в кернеле?
	 */	
	protected $front_end_action_mode = false;
	
	/**
	 * @access private
	 * 
	 * @todo надо подумать, надо ли вообще это держать в кернеле?
	 */
	protected $front_end_action_node_id = 0;



	protected $template;
	protected $meta;
	protected $status;

	/**
	 * Constructor.
	 */
	public function __construct()
	{
		parent::__construct();
		$this->template	= 'index';
		$this->meta		= array();
		$this->status	= 200;
	}

	public function indexAction($slug)
	{
		$this->init();

//		sc_dump($user = $this->container->get('security.context')->getToken()->getUser());
//		sc_dump($this->container->getParameterBag());
//		sc_dump($this->container->getParameter('security.role_hierarchy.roles'));
		
		/*
		if ($this->get('security.context')->isGranted('IS_AUTHENTICATED_ANONYMOUSLY')) {
//			echo "123<br />";
		}
		*/
		
		$folders = $this->router($this->get('request')->getPathInfo());
		
//		sc_dump($folders);
		
		foreach ($folders as $folder) {
			$this->Breadcrumbs->add($folder['uri'], $folder['title'], $folder['descr']);
		}	
		
		$this->View->setOptions(array(
			'comment'	=> 'Базовый шаблон',
			//'engine'	=> 'twig',
			'template'	=> $this->template,
			'environment' => array(
				'cache'			=> $this->Env->dir_cache . 'twig',
				'auto_reload'	=> true,
				'autoescape'	=> false,
				//'debug'			=> true,
			),
		));
		
		$reflector = new \ReflectionClass('SmartCore\Bundle\EngineBundle\SmartCoreEngineBundle');
		$this->View->setPaths(array(
			$this->Env->dir_web_root . 'theme/views', // @todo сделать через настройки.
			$this->Env->dir_app . 'Resources/views',
			dirname($reflector->getFileName()) . '/Resources/views',
		));
		
		$this->View->html = $this->Html;
		$this->Html->title('SC Framework!');

		$this->View->assets = array(
			'theme_path'		=> $this->Env->base_path . $this->Env->theme_path,
			'theme_css_path'	=> $this->Env->base_path . $this->Env->theme_path . 'css/',
			'theme_js_path'		=> $this->Env->base_path . $this->Env->theme_path . 'js/',
			'theme_img_path'	=> $this->Env->base_path . $this->Env->theme_path . 'images/',
			'vendor'			=> $this->Env->global_assets,
		);
		
//		$Theme = new Theme();
		$this->Theme->processConfig($this->View);
		
		foreach ($this->JsLib->all() as $lib => $res) {
			if (isset($res['js']) and is_array($res['js'])) {
				foreach ($res['js'] as $js) {
					$this->Html->js($js, 200);
				}
			}
			if (isset($res['css']) and is_array($res['css'])) {
				foreach ($res['css'] as $css) {
					$this->Html->css($css, 200);
				}
			}
		}
		
		$this->View->block = new View();
		//$this->View->block->setRenderMethod('echoProperties');
		$this->View->block->setOptions(array('comment' => 'Блоки'));
		
		$nodes_list = $this->buildNodesList($folders);
		
//		sc_dump($nodes_list);
		
		$this->buildModulesData($nodes_list);
		
//		sc_dump($this->View->block);
//		sc_dump($this->Html);
        
        $View = $this->container->get('templating')->render("::{$this->View->getTemplateName()}.html.twig", array(
//        $View = $this->container->get('templating')->render("AcmeModule::{$this->View->getTemplateName()}.html.twig", array(<commit_msg>эксперименты с модулями.<commit_after><?php

namespace SmartCore\Bundle\EngineBundle\Controller;

use Symfony\Component\HttpFoundation\Response;
use SmartCore\Bundle\EngineBundle\Engine\Theme;
use SmartCore\Bundle\EngineBundle\Templater\View;
use SmartCore\Bundle\EngineBundle\Container;

class NodeMapperController extends Controller
{
	/**
	 * Свойcтво поведения действия над нодой (всроенное в шаблон - 'built-it' или во всплывающем окошке - 'pupup' или 'ajax' - подгружаемое в блок размещения.).
	 * По умолчанию инициализируется как false.
	 * 
	 * @access private
	 * 
	 * @todo надо подумать, надо ли вообще это держать в кернеле?
	 */	
	protected $front_end_action_mode = false;
	
	/**
	 * @access private
	 * 
	 * @todo надо подумать, надо ли вообще это держать в кернеле?
	 */
	protected $front_end_action_node_id = 0;



	protected $template;
	protected $meta;
	protected $status;

	/**
	 * Constructor.
	 */
	public function __construct()
	{
		parent::__construct();
		$this->template	= 'index';
		$this->meta		= array();
		$this->status	= 200;
	}

	public function indexAction($slug)
	{
		$this->init();

//		sc_dump($user = $this->container->get('security.context')->getToken()->getUser());
//		sc_dump($this->container->getParameterBag());
//		sc_dump($this->container->getParameter('security.role_hierarchy.roles'));
		
		/*
		if ($this->get('security.context')->isGranted('IS_AUTHENTICATED_ANONYMOUSLY')) {
//			echo "123<br />";
		}
		*/
		
		$folders = $this->router($this->get('request')->getPathInfo());
		
//		sc_dump($folders);
		
		foreach ($folders as $folder) {
			$this->Breadcrumbs->add($folder['uri'], $folder['title'], $folder['descr']);
		}	
		
		$this->View->setOptions(array(
			'comment'	=> 'Базовый шаблон',
			//'engine'	=> 'twig',
			'template'	=> $this->template,
			'environment' => array(
				'cache'			=> $this->Env->dir_cache . 'twig',
				'auto_reload'	=> true,
				'autoescape'	=> false,
				//'debug'			=> true,
			),
		));
		
		$reflector = new \ReflectionClass('SmartCore\Bundle\EngineBundle\SmartCoreEngineBundle');
		$this->View->setPaths(array(
			$this->Env->dir_web_root . 'theme/views', // @todo сделать через настройки.
			$this->Env->dir_app . 'Resources/views',
			dirname($reflector->getFileName()) . '/Resources/views',
		));
		
		$this->View->html = $this->Html;
		$this->Html->title('SC Framework!');

		$this->View->assets = array(
			'theme_path'		=> $this->Env->base_path . $this->Env->theme_path,
			'theme_css_path'	=> $this->Env->base_path . $this->Env->theme_path . 'css/',
			'theme_js_path'		=> $this->Env->base_path . $this->Env->theme_path . 'js/',
			'theme_img_path'	=> $this->Env->base_path . $this->Env->theme_path . 'images/',
			'vendor'			=> $this->Env->global_assets,
		);
		
//		$Theme = new Theme();
		$this->Theme->processConfig($this->View);
		
		foreach ($this->JsLib->all() as $lib => $res) {
			if (isset($res['js']) and is_array($res['js'])) {
				foreach ($res['js'] as $js) {
					$this->Html->js($js, 200);
				}
			}
			if (isset($res['css']) and is_array($res['css'])) {
				foreach ($res['css'] as $css) {
					$this->Html->css($css, 200);
				}
			}
		}
		
		$this->View->block = new View();
		//$this->View->block->setRenderMethod('echoProperties');
		$this->View->block->setOptions(array('comment' => 'Блоки'));
		
		$nodes_list = $this->buildNodesList($folders);
		
//		sc_dump($nodes_list);
		
		$this->buildModulesData($nodes_list);
		
//		sc_dump($this->View->block);
//		sc_dump($this->Html);

//        sc_dump($this->container->get('templating')->render("SmartCoreTexterModule::texter.html.twig", array('text' => 999)));
//        sc_dump($this->forward('SmartCoreTexterModule:Test:index', array('text' => 'yahoo :)'))->getContent());
//        sc_dump($this->forward('2:Test:index')->getContent());
                
        $View = $this->container->get('templating')->render("::{$this->View->getTemplateName()}.html.twig", array(
//        $View = $this->container->get('templating')->render("AcmeModule::{$this->View->getTemplateName()}.html.twig", array(
{'fraction_non_alphanumeric': 0.20644085193738773, 'fraction_numerical': 0.003849114703618168, 'mean_word_length': 3.788083538083538, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 220, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2537088', 'n_tokens_mistral': 3154, 'n_tokens_neox': 2871, 'n_words': 433}