Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
2018_web_app
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
inutralia
2018_web_app
Commits
25f7a11d
Commit
25f7a11d
authored
Dec 04, 2018
by
David Villalba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Añadidos datos en la vista de Mi menu.
parent
69e536ab
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
121 additions
and
45 deletions
+121
-45
app.php
fuel/app/classes/controller/app.php
+3
-1
index.php
fuel/app/classes/controller/login/index.php
+2
-1
index.php
fuel/app/classes/controller/perfil/index.php
+1
-0
extension.php
fuel/app/classes/twig/seti/extension.php
+14
-0
constants.php
fuel/app/config/development/constants.php
+3
-0
constants.php
fuel/app/config/production/constants.php
+3
-0
datos_generales.twig
fuel/app/views/perfil/datos_generales.twig
+22
-23
index.twig
fuel/app/views/perfil/index.twig
+9
-9
switches.twig
fuel/app/views/perfil/switches.twig
+64
-11
No files found.
fuel/app/classes/controller/app.php
View file @
25f7a11d
...
@@ -22,9 +22,11 @@ use Fuel\Core\Session;
...
@@ -22,9 +22,11 @@ use Fuel\Core\Session;
class
Controller_App
extends
Controller
{
class
Controller_App
extends
Controller
{
use
Trait_InutraliaWS
;
public
function
before
(){
public
function
before
(){
if
(
!
$this
->
control_time_session
()){
if
(
!
Session
::
get
(
'token_auth'
)
||
!
$this
->
control_time_session
()){
Session
::
destroy
();
Session
::
destroy
();
Response
::
redirect
(
"/"
);
Response
::
redirect
(
"/"
);
}
}
...
...
fuel/app/classes/controller/login/index.php
View file @
25f7a11d
...
@@ -55,6 +55,7 @@ class Controller_Login_Index extends Controller
...
@@ -55,6 +55,7 @@ class Controller_Login_Index extends Controller
'Se perdio la ventana de autenticación, ha pasado demasiado tiempo
'Se perdio la ventana de autenticación, ha pasado demasiado tiempo
inactivo, intentelo de nuevo.'
inactivo, intentelo de nuevo.'
);
);
\Session
::
delete
(
'token_auth'
);
Response
::
redirect
(
'auth/login'
);
Response
::
redirect
(
'auth/login'
);
return
null
;
return
null
;
}
}
...
@@ -85,7 +86,7 @@ class Controller_Login_Index extends Controller
...
@@ -85,7 +86,7 @@ class Controller_Login_Index extends Controller
);
);
}
}
\Session
::
delete
(
'token_auth'
);
Response
::
redirect
(
'auth/login'
);
Response
::
redirect
(
'auth/login'
);
return
null
;
return
null
;
}
}
...
...
fuel/app/classes/controller/perfil/index.php
View file @
25f7a11d
...
@@ -46,6 +46,7 @@ class Controller_Perfil_Index extends \Controller_App{
...
@@ -46,6 +46,7 @@ class Controller_Perfil_Index extends \Controller_App{
//Paso de las opciones de menu que deben aparecer seleccionadas
//Paso de las opciones de menu que deben aparecer seleccionadas
$view
->
option_menu
=
$this
->
_option_menu
;
$view
->
option_menu
=
$this
->
_option_menu
;
$view
->
profile
=
$this
->
ws_profile
();
return
Response
::
forge
(
$view
);
return
Response
::
forge
(
$view
);
}
}
...
...
fuel/app/classes/twig/seti/extension.php
View file @
25f7a11d
...
@@ -124,6 +124,7 @@ class Twig_Seti_Extension extends Twig_Extension
...
@@ -124,6 +124,7 @@ class Twig_Seti_Extension extends Twig_Extension
'sha1'
=>
new
Twig_Function_Function
(
'sha1'
),
'sha1'
=>
new
Twig_Function_Function
(
'sha1'
),
'var_dump'
=>
new
Twig_Function_Function
(
'var_dump'
),
'var_dump'
=>
new
Twig_Function_Function
(
'var_dump'
),
'is_divisible'
=>
new
Twig_Function_Method
(
$this
,
'is_divisible'
),
);
);
}
}
...
@@ -185,4 +186,17 @@ class Twig_Seti_Extension extends Twig_Extension
...
@@ -185,4 +186,17 @@ class Twig_Seti_Extension extends Twig_Extension
return
Fuel
::
VERSION
;
return
Fuel
::
VERSION
;
}
}
/**
*
* Comprueba si un numero es divisible a otro.
*
* @param $num
* @param $div
* @return bool
*/
public
function
is_divisible
(
$num
,
$div
)
{
return
(
$num
%
$div
==
0
)
?
true
:
false
;
}
}
}
fuel/app/config/development/constants.php
View file @
25f7a11d
...
@@ -33,9 +33,11 @@ const APIKEY = "?api-key=7745289b-f09c-4e0b-89d1-bb59c599c85e";
...
@@ -33,9 +33,11 @@ const APIKEY = "?api-key=7745289b-f09c-4e0b-89d1-bb59c599c85e";
// PARAMETERS
// PARAMETERS
const
USER
=
'user'
;
const
USER
=
'user'
;
const
PROFILE
=
'profile'
;
return
array
(
return
array
(
'user'
=>
DOMAIN
.
V1
.
USER
.
APIKEY
,
'user'
=>
DOMAIN
.
V1
.
USER
.
APIKEY
,
'profile'
=>
DOMAIN
.
V1
.
PROFILE
.
APIKEY
,
);
);
\ No newline at end of file
fuel/app/config/production/constants.php
View file @
25f7a11d
...
@@ -32,9 +32,11 @@ const APIKEY = "?api-key=7745289b-f09c-4e0b-89d1-bb59c599c85e";
...
@@ -32,9 +32,11 @@ const APIKEY = "?api-key=7745289b-f09c-4e0b-89d1-bb59c599c85e";
// PARAMETERS
// PARAMETERS
const
USER
=
'user'
;
const
USER
=
'user'
;
const
PROFILE
=
'profile'
;
return
array
(
return
array
(
'user'
=>
DOMAIN
.
V1
.
USER
.
APIKEY
,
'user'
=>
DOMAIN
.
V1
.
USER
.
APIKEY
,
'profile'
=>
DOMAIN
.
V1
.
PROFILE
.
APIKEY
,
);
);
\ No newline at end of file
fuel/app/views/perfil/datos_generales.twig
View file @
25f7a11d
<span
class=
"input input--nao"
>
<span
class=
"input input--nao"
>
<input
class=
"input__field input__field--nao"
type=
"text"
id=
"edad"
name=
"edad"
required=
""
/>
<input
class=
"input__field input__field--nao"
type=
"text"
id=
"edad"
name=
"edad"
required=
""
value=
"
{{
profile.age
}}
"
/>
<label
class=
"input__label input__label--nao"
for=
"input-1"
>
<label
class=
"input__label input__label--nao"
for=
"input-1"
>
<span
class=
"input__label-content input__label-content--nao"
>
Edad
</span>
<span
class=
"input__label-content input__label-content--nao"
>
Edad
</span>
</label>
</label>
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
</span>
</span>
<span
class=
"input input--nao"
>
<span
class=
"input input--nao"
>
<input
class=
"input__field input__field--nao"
type=
"text"
id=
"altura"
name=
"altura"
required=
""
/>
<input
class=
"input__field input__field--nao"
type=
"text"
id=
"altura"
name=
"altura"
required=
""
value=
"
{{
profile.height
}}
"
/>
<label
class=
"input__label input__label--nao"
for=
"input-1"
>
<label
class=
"input__label input__label--nao"
for=
"input-1"
>
<span
class=
"input__label-content input__label-content--nao"
>
Altura
</span>
<span
class=
"input__label-content input__label-content--nao"
>
Altura
</span>
</label>
</label>
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
</span>
</span>
<span
class=
"input input--nao"
>
<span
class=
"input input--nao"
>
<input
class=
"input__field input__field--nao"
type=
"text"
id=
"peso"
name=
"peso"
required=
""
/>
<input
class=
"input__field input__field--nao"
type=
"text"
id=
"peso"
name=
"peso"
required=
""
value=
"
{{
profile.weight
}}
"
/>
<label
class=
"input__label input__label--nao"
for=
"input-1"
>
<label
class=
"input__label input__label--nao"
for=
"input-1"
>
<span
class=
"input__label-content input__label-content--nao"
>
Peso
</span>
<span
class=
"input__label-content input__label-content--nao"
>
Peso
</span>
</label>
</label>
...
@@ -28,29 +28,27 @@
...
@@ -28,29 +28,27 @@
</svg>
</svg>
</span>
</span>
<span
class=
"input input--nao"
>
<select
class=
"cs-select cs-skin-underline mt20"
>
<input
class=
"input__field input__field--nao"
type=
"text"
id=
"genero"
name=
"genero"
required=
""
/>
<label
class=
"input__label input__label--nao"
for=
"input-1"
>
<span
class=
"input__label-content input__label-content--nao"
>
Género
</span>
</label>
<svg
class=
"graphic graphic--nao"
width=
"300%"
height=
"100%"
viewBox=
"0 0 1200 60"
preserveAspectRatio=
"none"
>
<path
d=
"M0,56.5c0,0,298.666,0,399.333,0C448.336,56.5,513.994,46,597,46c77.327,0,135,10.5,200.999,10.5c95.996,0,402.001,0,402.001,0"
/>
</svg>
</span>
<option
value=
""
{%
if
(
profile.gender
==
''
)
%}
selected
{%
endif
%}
disabled
>
Género...
</option>
<option
value=
"1"
{%
if
(
profile.gender
==
'H'
)
%}
selected
{%
endif
%}
>
Hombre
</option>
<option
value=
"2"
{%
if
(
profile.gender
==
'M'
)
%}
selected
{%
endif
%}
>
Mujer
</option>
<select
class=
"cs-select cs-skin-underline mt20"
>
<option
value=
""
disabled
selected
>
Actividad fisica...
</option>
<option
value=
"1"
>
Sedentario
</option>
<option
value=
"2"
>
Ligero
</option>
<option
value=
"3"
>
Moderado
</option>
<option
value=
"4"
>
Intenso
</option>
<option
value=
"5"
>
Muy Intenso
</option>
</select>
</select>
<select
class=
"cs-select cs-skin-underline mt20"
>
<select
class=
"cs-select cs-skin-underline mt20"
>
<option
value=
""
disabled
selected
>
Preferencia de dieta...
</option>
<option
value=
"1"
>
Normal
</option>
<option
value=
""
{%
if
(
profile.physical
==
''
)
%}
selected
{%
endif
%}
disabled
>
Actividad fisica...
</option>
<option
value=
"2"
>
Vegetariana
</option>
<option
value=
"1"
{%
if
(
profile.physical
==
'1'
)
%}
selected
{%
endif
%}
>
Sedentario
</option>
<option
value=
"3"
>
Vegana
</option>
<option
value=
"2"
{%
if
(
profile.physical
==
'2'
)
%}
selected
{%
endif
%}
>
Ligero
</option>
<option
value=
"3"
{%
if
(
profile.physical
==
'3'
)
%}
selected
{%
endif
%}
>
Moderado
</option>
<option
value=
"4"
{%
if
(
profile.physical
==
'4'
)
%}
selected
{%
endif
%}
>
Intenso
</option>
<option
value=
"5"
{%
if
(
profile.physical
==
'5'
)
%}
selected
{%
endif
%}
>
Muy Intenso
</option>
</select>
<select
class=
"cs-select cs-skin-underline mt20"
>
<option
value=
""
{%
if
profile.preference
==
""
%}
selected
{%
endif
%}
disabled
>
Preferencia de dieta...
</option>
<option
value=
"1"
{%
if
profile.preference
==
"1"
%}
selected
{%
endif
%}
>
Normal
</option>
<option
value=
"2"
{%
if
profile.preference
==
"2"
%}
selected
{%
endif
%}
>
Vegetariana
</option>
<option
value=
"3"
{%
if
profile.preference
==
"3"
%}
selected
{%
endif
%}
>
Vegana
</option>
</select>
</select>
\ No newline at end of file
fuel/app/views/perfil/index.twig
View file @
25f7a11d
...
@@ -16,15 +16,15 @@
...
@@ -16,15 +16,15 @@
</div>
</div>
</div>
</div>
<div
class=
"col-md-8"
>
<div
class=
"col-md-8"
>
<div
class=
"border-box border-perfil"
>
<div
class=
"border-box border-perfil"
>
<div
class=
"title-box-border-box bg-color-perfil"
>
<div
class=
"title-box-border-box bg-color-perfil"
>
¿Padeces, estás o tienes...
¿Padeces, estás o tienes...
</div>
</div>
<div
class=
"container-box-border-box"
>
<div
class=
"container-box-border-box"
>
{%
include
'switches.twig'
%}
{%
include
'switches.twig'
%}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"row"
>
...
...
fuel/app/views/perfil/switches.twig
View file @
25f7a11d
<div
class=
"row"
>
<div
class=
"row"
>
{%
for
i
in
1.
.
13
%}
<div
class=
"col-xs-6 col-sm-6 col-md-4"
>
<div
class=
"form-group text-center"
>
<label
class=
"switch"
for=
"checkbox_
{{
i
}}
"
>
<input
type=
"checkbox"
id=
"checkbox_
{{
i
}}
"
/>
<div
class=
"slider round"
></div>
</label>
<p>
caracteristica
{{
i
}}
</p>
</div>
</div>
{%
endfor
%}
{%
set
caracterisitcas
=
{
'cv'
:
'una enfermedad cardiovascular ?'
,
'hypertension'
:
'hipertensión ?'
,
'menopause'
:
'menopausia ?'
,
'pregnancy'
:
'embarazo ?'
,
'lactation'
:
'lactancia ?'
,
'celiac'
:
'celiacos ?'
,
'lactose'
:
'intolerante a la lactosa?'
,
'diabetes'
:
'diabetes ?'
,
'cholesterol'
:
'colesterol ?'
,
'triglycerides'
:
'trígliceridos ?'
,
'al_fish'
:
'alergia al pescado/marisco ?'
,
'al_egg'
:
'alergia al huevo ?'
,
'al_nuts'
:
'alergia a los frutos secos ?'
}
%}
<div
class=
"row"
>
{#FOR PARA COLOCAR EN ROWS DE 3 COLUMNAS LAS CARACTERISTICAS EN PANTALLAS GRANDES ( MD Y LG )#}
{%
for
key
,
value
in
caracterisitcas
%}
{%
if
is_divisible
(
loop.index
-
1
,
3
)
%}
</div>
<div
class=
"row"
>
{%
endif
%}
<div
class=
"col-md-4 col-lg-4 visible-md visible-lg"
>
<div
class=
"form-group text-center"
>
<label
class=
"switch"
for=
"
{{
key
}}
"
>
<input
type=
"checkbox"
id=
"
{{
key
}}
"
{%
if
attribute
(
profile
,
key
)
%}
checked
{%
endif
%}
/>
<div
class=
"slider round"
></div>
</label>
<p>
{{
value
}}
</p>
</div>
</div>
{%
endfor
%}
{#FIN FOR LG / MG#}
{#FOR PARA COLOCAR EN ROWS DE 2 COLUMNAS LAS CARACTERISTICAS EN PANTALLAS PEQUEÑAS ( XS Y SM )#}
{%
for
key
,
value
in
caracterisitcas
%}
{%
if
is_divisible
(
loop.index
-
1
,
2
)
%}
</div>
<div
class=
"row"
>
{%
endif
%}
<div
class=
"col-xs-6 col-sm-6 visible-xs visible-sm"
>
<div
class=
"form-group text-center"
>
<label
class=
"switch"
for=
"
{{
key
}}
"
>
<input
type=
"checkbox"
id=
"
{{
key
}}
"
{%
if
attribute
(
profile
,
key
)
%}
checked
{%
endif
%}
/>
<div
class=
"slider round"
></div>
</label>
<p>
{{
value
}}
</p>
</div>
</div>
{%
endfor
%}
</div>
</div>
</div>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment