Écrit le contenu généré dans le fichier du modèle.

@return void
359935
public function writeContent()
    {
        $dirPath = dirname($this->getPath());

        if (!is_dir($dirPath)) {
            mkdir($dirPath, 0755, true);
        }

        file_put_contents(
            $this->getPath(),
            $this->getContent()
        );
    }
845685
protected function load() {

        // On initialise les variables
        $roles     = $this->getRoles();
        $resources = $this->getResources();
        $sections  = $this->getActions();
        $rules     = $this->getRules();

        // On parcourt les actions par section.
        foreach ($sections as $section) {

            // Si la section a des actions.
            if (!empty($section->actions)) {

                // On récupère la ressource.
                $resource = $resources[$section->name];

                // On crée une règle pour chaque action.
                foreach ($section->actions as $action) {

                    // On récupère les autorisations des rôles pour cette action.
                    if (isset($rules[$section->name]) && isset($rules[$section->name]->rules->{$action->name})) {
                        $ruleValues = $rules[$section->name]->rules->{$action->name};

                        // Et pour chaque rôle.
                        foreach ($roles as $role) {

                            // 3 valeurs possibles :
                            //   1    => le groupe est présent et autorisé
                            //   0    => le groupe est présent et non autorisé
                            //   null => le groupe n'est pas présent et donc hérite des droits du parent.
                            // Le groupe est présent, on crée une règle ACL pour le tri action-rôle-ressource.

                            if (is_object($ruleValues) && property_exists($ruleValues, $role->getName())) {

                                $rule = new Rule($action->name);
                                $rule->setRole($role);
                                $rule->setResource($resource);
                                $rule->setAction((bool) $ruleValues->{$role->getName()});

                                // On ajoute la règle au gestionnaire.
                                $this->acl->addRule($rule);

                            }

                        }
                    }

                }

            }

        }

    }
1194660
protected function writeContentToFile()
    {
        $content = '<?php' . PHP_EOL . PHP_EOL
                 . 'return ' . $this->getCleanContent() . ';' . PHP_EOL;

        try {
            File::put($this->path, $content);

        } catch (Exception $e) {

            throw (new ModelInformationFileWriteFailureException(
                    "Failed to write '{$this->path}', make sure the directory exists and is writable",
                    $e->getCode(),
                    $e
                ))->setModelClass($this->information->modelClass());
        }
    }
1226623
public function afficheStatistiques()
	{
		$t = new Template($this->getCheminPhysique().$this->cheminTemplates);
		$t->set_filenames(array('statsAccueil'=>'statistiquesAccueil.tpl'));

		// recherche du nombre d'evenements
		$reqEvenements = "SELECT DISTINCT idEvenement as nbEvenements FROM evenements;";
		$resEvenements = $this->connexionBdd->requete($reqEvenements);

		// recherche du nombre d'adresses
		$reqAdresses = "SELECT DISTINCT idAdresse as nbAdresses FROM historiqueAdresse;";
		$resAdresses = $this->connexionBdd->requete($reqAdresses);

		// recherche du nombre de photos
		$reqPhotos = "SELECT DISTINCT idImage as nbImages FROM historiqueImage;";
		$resPhotos = $this->connexionBdd->requete($reqPhotos);

		$t->assign_vars(array('architectes'=>$this->getListeArchitectesProductifs(array('sqlLimit'=>"LIMIT 10", "noPagination"=>true))));
		$t->assign_vars(array('rues'=>$this->getListeRuesCompletes(array('sqlLimit'=>"LIMIT 10", "noPagination"=>true))));

		$t->assign_vars(array('voirTousLesArchitectes'=>"<a href='".$this->creerUrl('', 'tousLesArchitectesClasses')."'>"._("Voir tous les architectes classés")."</a>"));

		$t->assign_vars(array('voirToutesLesRues'=>"<a href='".$this->creerUrl('', 'toutesLesRuesCompletesClassees')."'>"._("Voir toutes les rues classées")."</a>"));

		$t->assign_vars(array('nbAdresses'=>mysql_num_rows($resAdresses)));
		$t->assign_vars(array('nbEvenements'=>mysql_num_rows($resEvenements)));
		$t->assign_vars(array('nbPhotos'=>mysql_num_rows($resPhotos)));

		ob_start();
		$t->pparse('statsAccueil');
		$html .= ob_get_contents();
		ob_end_clean();

		return $html;
	}
930096
public function index() {
        $this->Prg->commonProcess();
        $conds = $this->IvaResponsabilidad->parseCriteria( $this->Prg->parsedParams() );
        $this->Paginator->settings['conditions'] = $conds;
        $this->IvaResponsabilidad->recursive = 0;
        $ivaResponsabilidades = $this->Paginator->paginate('IvaResponsabilidad');
        $this->set('ivaResponsabilidades',$ivaResponsabilidades);
    }
374576
public function generateModels()
    {
        $sourceRoot = $this->source . '/Model';

        $destinationRoot = $this->cwd
            . $this->schema['paths']['model']
            . '/' . ucwords($this->schema['name']);

        if(!is_dir($destinationRoot)) {
            mkdir($destinationRoot, 0777, true);
        }

        foreach($this->schema['model'] as $action) {
            $source = $sourceRoot . '/' . ucwords($action) . '.html';

            $destination = $destinationRoot . '/' . ucwords($action) . '.php';

            if(!file_exists($source)) {
                Index::error(sprintf(
                    self::SKIP,
                    'Model',
                    ucwords($action)),
                false);

                continue;
            }

            $this->copy($source, $destination);
        }
    }
1180434
public function Table() {
      if ($this->SyndicationMethod == SYNDICATION_NONE) {
         $this->View = 'table';
      } else
         $this->View = 'all';
      $this->All();
   }
230436
protected function render()
	{
		if (empty($this->getContent())) {
			$parsed = parse_ini_string($this->file->getContent(), true);
			$this->setContent(is_array($parsed) ? $parsed : []);
		}
	}
1148493
public function index()
    {
        $this->loadModel('Taxonomy.Vocabularies');
        $vocabularies = $this->Vocabularies
            ->find()
            ->order(['ordering' => 'ASC'])
            ->all();

        $this->title(__d('taxonomy', 'Vocabularies'));
        $this->set(compact('vocabularies'));
        $this->Breadcrumb
            ->push('/admin/system/structure')
            ->push(__d('taxonomy', 'Taxonomy'), '/admin/taxonomy/manage')
            ->push(__d('taxonomy', 'Vocabularies'), '#');
    }
699654
private function translateData(): void
    {
        foreach ($this->db->data as $key => $value) {
            $this->data[$key] = $value;
        }
    }
104838
protected function render()
    {
        $this->display('* Rendering documents');
        foreach ($this->documents as $file => &$document) {
            $this->display(' -> Rendering '.$file.'...');
            $target = $this->getTargetOf($file);

            $directory = dirname($target);
            if (!is_dir($directory)) {
                mkdir($directory, 0755, true);
            }

            file_put_contents($target, $document->renderDocument());
        }
    }
1234862
protected function scanLoadConfig(): void
    {
        /* @var SplFileInfo $directory */
        /* @var SplFileInfo $file */
        foreach (Finder::create()->directories()->depth(1)->name('Config')->in($this->modulePath()) as $directory) {
            foreach (Finder::create()->files()->name('*.php')->in($directory->getPathname()) as $file) {
                $this->mergeConfigFrom($file->getPathname(), Str::snake($directory->getRelativePath()));
            }
        }
    }
936600
public function index()
    {
        if($this->presenter->page->file instanceof SplFileInfo) {
            $this->view->page(presenter()->page->file->getRealPath());
        }
    }
1343758
public function render() : void
    {
        $langRoot = $this->categoryRepository->findLangRoot($this->activeLang);

        $categories = [];

        if ($langRoot && $langRoot->getDescendants() instanceof ObjectCollection)
        {
            $root = $this->categoryRepository->findDescendants($langRoot);
            $left = (count($root) > 0) ? $root[0]->getLeftValue() - 1 : 0;
            $categories = $this->nested->getTree($root, $left);
        }

        $this->template->categories = $categories;
        $this->template->setFile(__DIR__ . '/templates/modal.latte');
        $this->template->render();
    }
604300
public function getModels()
    {
        $tables = $this->driver->getTablesNames();
        $pivotTables = $this->getConfig('pivot_tables', []);

        foreach ($tables as $table) {
            // Crée l'instance du modèle pour la table correspondante
            $this->models[$table] = $this->createModel($table);

            // Crée l'instance du pivot si la table est définie ou reconnue comme tel
            if (array_key_exists($table, $pivotTables)) {
                if ($pivotTables[$table] !== null) {
                    $this->pivots[$table] = new Pivot($table, $pivotTables[$table]);
                }
            }
            elseif (in_array($table, $pivotTables) || strpos($table, '_has_') !== false) {
                $this->pivots[$table] = new Pivot($table);
            }
        }

        // Ajoute les relations 1-n et 1-1 selon les contraintes définies dans la BDD
        foreach ($this->models as $model) {
            $this->addRelationsAccordingToConstraints($model);
        }

        // Ajoute les relations n-n via les instances des pivots
        foreach ($this->pivots as $pivot) {
            $pivot->addBelongsToManyRelationsToRelatedModels();
        }

        // Ajoute les relations polymorphiques selon les informations renseignées dans la config
        foreach ($this->getConfig('polymorphic_relations', []) as $relation => $relatedTables) {
            list($table, $morphName) = explode('.', $relation);

            $this->addPolymorphicRelations($this->models[$table], $morphName, $relatedTables);
        }

        return $this->models;
    }
1031549
public function loadData()
	{
		if($this->_model!==null)
		{
			$class=CHtml::modelName($this->_model);
			if(strcasecmp($this->getRoot()->method,'get'))
			{
				if(isset($_POST[$class]))
					$this->_model->setAttributes($_POST[$class]);
			}
			elseif(isset($_GET[$class]))
				$this->_model->setAttributes($_GET[$class]);
		}
		foreach($this->getElements() as $element)
		{
			if($element instanceof self)
				$element->loadData();
		}
	}
1144057
protected function createContent()
    {
        $this->setCliMessage('Creating content...');

        $this->initConfig();
        $this->createDbConfig();
        $this->createStore();
        $this->createSuperadmin();
        $this->createCountries();
        $this->createLanguages();
        $this->createPages();
    }