Skip to content

Commit

Permalink
Merge pull request #65 from sao-albacete/feature/AOA-57
Browse files Browse the repository at this point in the history
[AOA-57] Creada función para obtener la versión leyendo el contenido …
  • Loading branch information
viktorKhan authored Mar 3, 2020
2 parents ce6fbe1 + 2ce2a8a commit 0b23e1f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Controller/InicioController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class InicioController extends AppController {
/**
* Helpers
*/
public $helpers = array('ObservadorSecundario', 'ClaseEdadSexo', 'Importancia');
public $helpers = array('ObservadorSecundario', 'ClaseEdadSexo', 'Importancia', 'Version');

/**
* Modelos
Expand Down
2 changes: 1 addition & 1 deletion app/View/Elements/pie.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<a title="www.sao.albacete.org" href="http://www.sao.albacete.org/" target="_blank">
<img src="/img/logos/logo_sao_180x179" alt="Logotipo de la Sociedad Albacetense de Ornitología">
</a>
<h4>Versión 1.1.1</h4>
<h4><?=$this->Version->obtener_version();?></h4>
</div>
<div class="span5 segundo">
<a href="/pages/elanuario/"><?=__("El Anuario");?></a> |
Expand Down
18 changes: 18 additions & 0 deletions app/View/Helper/VersionHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

App::uses('AppHelper', 'View/Helper');

class VersionHelper extends AppHelper {

/**
* Devuelve el contenido del fichero app/View/Elements/version.txt
*/
public function obtener_version() {
// poner el contenido de un fichero en una cadena
$nombre_fichero = ROOT . DS . "version.txt";
$gestor = fopen($nombre_fichero, "r");
$contenido = fread($gestor, filesize($nombre_fichero));
fclose($gestor);
return $contenido ? "Versión ".$contenido : "";
}
}
Empty file added version.txt
Empty file.

0 comments on commit 0b23e1f

Please sign in to comment.