diff --git a/gii/enlaceGiiantModel.json b/gii/enlaceGiiantModel.json new file mode 100644 index 0000000..3477a37 --- /dev/null +++ b/gii/enlaceGiiantModel.json @@ -0,0 +1 @@ +{"tablename":{"value":"enlace","name":"tableName"},"tableprefix":{"value":"","name":"tablePrefix"},"modelclass":{"value":"Enlace","name":"modelClass"},"ns":{"value":"app\\models","name":"ns"},"baseclass":{"value":"yii\\db\\ActiveRecord","name":"baseClass"},"db":{"value":"db","name":"db"},"generaterelations":{"value":"all","name":"generateRelations"},"generatelabelsfromcomments":{"value":"0","name":"generateLabelsFromComments"},"generatehintsfromcomments":{"value":"1","name":"generateHintsFromComments"},"generatemodelclass":{"value":"1","name":"generateModelClass"},"generatequery":{"value":"0","name":"generateQuery"},"queryns":{"value":"app\\models","name":"queryNs"},"queryclass":{"value":"","name":"queryClass"},"querybaseclass":{"value":"yii\\db\\ActiveQuery","name":"queryBaseClass"},"enablei18n":{"value":"1","name":"enableI18N"},"singularentities":{"value":"0","name":"singularEntities"},"messagecategory":{"value":"models","name":"messageCategory"},"usetranslatablebehavior":{"value":"0","name":"useTranslatableBehavior"},"languagetablename":{"value":"{{table}}_lang","name":"languageTableName"},"languagecodecolumn":{"value":"language","name":"languageCodeColumn"},"useblameablebehavior":{"value":"0","name":"useBlameableBehavior"},"createdbycolumn":{"value":"created_by","name":"createdByColumn"},"updatedbycolumn":{"value":"updated_by","name":"updatedByColumn"},"usetimestampbehavior":{"value":"0","name":"useTimestampBehavior"},"createdatcolumn":{"value":"created_at","name":"createdAtColumn"},"updatedatcolumn":{"value":"updated_at","name":"updatedAtColumn"}} \ No newline at end of file diff --git a/migrations/m180523_130440_enlace.php b/migrations/m180523_130440_enlace.php new file mode 100644 index 0000000..d02d9c5 --- /dev/null +++ b/migrations/m180523_130440_enlace.php @@ -0,0 +1,44 @@ +createTable('enlace', [ + 'id' => $this->primaryKey(), + 'nombre' => $this->string(255), + 'uri' => $this->string(255), + ]); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropTable('enlace'); + } + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + + public function down() + { + echo "m180523_130440_enlace cannot be reverted.\n"; + + return false; + } + */ +} diff --git a/models/Enlace.php b/models/Enlace.php new file mode 100644 index 0000000..c263b3d --- /dev/null +++ b/models/Enlace.php @@ -0,0 +1,34 @@ + 255] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => Yii::t('models', 'ID'), + 'nombre' => Yii::t('models', 'Nombre'), + 'uri' => Yii::t('models', 'Uri'), + ]; + } + + + + +} diff --git a/views/layouts/main.php b/views/layouts/main.php index 690142f..160c568 100644 --- a/views/layouts/main.php +++ b/views/layouts/main.php @@ -10,6 +10,7 @@ /* @var $content string */ use app\assets\AppAsset; +use app\models\Enlace; use app\widgets\Alert; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; @@ -25,6 +26,10 @@ 'Área de Aplicaciones. Servicio de Informática y Comunicaciones de la Universidad de Zaragoza.' ), ]); + +$enlaces = array_map(function ($e) { + return ['label' => $e->nombre, 'url' => $e->uri]; +}, Enlace::find()->all()); ?> beginPage() ?> @@ -69,6 +74,12 @@ ], ], */ [ + 'encode' => false, + 'label' => '  ' . + Yii::t('app', 'Enlaces'), + 'items' => $enlaces, + 'visible' => !empty($enlaces), + ], [ 'encode' => false, 'label' => '  ' . Yii::t('app', 'Propuestas'),