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
75ee7094
Commit
75ee7094
authored
Dec 10, 2018
by
David Villalba
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into dev_villa
parents
979ffd27
466caa69
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
9 deletions
+89
-9
201812101713_add_desc_ingredient.sql
201812101713_add_desc_ingredient.sql
+2
-0
index.php
fuel/app/classes/controller/menussaludables/menu/index.php
+1
-2
recipe.php
fuel/app/classes/model/recipe.php
+71
-5
inutraliaWS.php
fuel/app/classes/trait/inutraliaWS.php
+2
-2
index.twig
fuel/app/views/menussaludables/menu/index.twig
+2
-0
custom.css
public/assets/css/custom.css
+11
-0
No files found.
201812101713_add_desc_ingredient.sql
0 → 100644
View file @
75ee7094
ALTER
TABLE
`ingredients`
ADD
COLUMN
`desc`
varchar
(
255
)
NULL
AFTER
`id`
;
fuel/app/classes/controller/menussaludables/menu/index.php
View file @
75ee7094
...
@@ -37,8 +37,7 @@ class Controller_Menussaludables_Menu_Index extends \Controller_App{
...
@@ -37,8 +37,7 @@ class Controller_Menussaludables_Menu_Index extends \Controller_App{
);
);
$view
->
auto_filter
(
false
);
$view
->
auto_filter
(
false
);
$view
->
name_menu
=
$view
->
items
->
ds
;
Log
::
error
(
print_r
(
$view
->
items
,
true
));
return
Response
::
forge
(
$view
);
return
Response
::
forge
(
$view
);
}
}
...
...
fuel/app/classes/model/recipe.php
View file @
75ee7094
...
@@ -13,8 +13,8 @@ use Orm\Model;
...
@@ -13,8 +13,8 @@ use Orm\Model;
* @license SETI Consultyn Software License <license.txt>
* @license SETI Consultyn Software License <license.txt>
* @link http://seticonsultyn.es
* @link http://seticonsultyn.es
*/
*/
class
Model_Recipe
extends
Model
{
class
Model_Recipe
extends
Model
{
use
\Trait_InutraliaWS
;
protected
static
$_table_name
=
'recipes'
;
protected
static
$_table_name
=
'recipes'
;
...
@@ -22,12 +22,77 @@ class Model_Recipe extends Model{
...
@@ -22,12 +22,77 @@ class Model_Recipe extends Model{
protected
static
$_has_many
=
array
(
protected
static
$_has_many
=
array
(
'ingredients'
=>
array
(
'ingredients'
=>
array
(
'key_from'
=>
'id'
,
'key_from'
=>
'id'
,
'key_to'
=>
'recipe_local_id'
,
'key_to'
=>
'recipe_local_id'
,
'model_to'
=>
'Model_Ingredients'
,
'model_to'
=>
'Model_Ingredient'
,
'cascade_delete'
=>
false
'cascade_delete'
=>
false
,
'conditions'
=>
array
(
'where'
=>
array
(
'used'
=>
0
),
'order_by'
=>
array
(
'used'
=>
'DESC'
),
'group_by'
=>
'ingredient_id'
)
),
),
);
);
public
static
function
get_recipes_current_week
()
{
//Devolvemos recetas guardadas en la base de datos que correspondan a esta vista.
return
self
::
recipes_current_week
()
->
get
();
}
public
static
function
recipes_current_week
()
{
//Devolvemos recetas guardadas en la base de datos que correspondan a esta vista.
return
self
::
query
()
->
where
(
'week_year'
,
date
(
'W'
))
->
where
(
'year'
,
date
(
'Y'
))
->
where
(
'user_id'
,
\Fuel\Core\Session
::
get
(
'user_id'
));
}
public
function
load_ingredients
()
{
if
(
$this
->
loaded
==
'S'
||
count
(
$this
->
ingredients
)
>
0
)
{
return
false
;
}
try
{
\DB
::
start_transaction
();
$recipe
=
$this
->
ws_recipe_get
(
$this
->
recipe_id
);
foreach
(
$recipe
->
ingredients
as
$ingredientRecipe
)
{
$ingredient
=
Model_Ingredient
::
forge
();
$ingredient
->
ingredient_id
=
$ingredientRecipe
->
id
;
$ingredient
->
desc
=
$ingredientRecipe
->
name
;
$ingredient
->
used
=
'N'
;
$ingredient
->
created_at
=
date
(
"Y-m-d H:i:s"
);
$this
->
ingredients
[]
=
$ingredient
;
}
$this
->
loaded
=
'S'
;
$this
->
save
(
true
);
}
catch
(
Exception
$e
)
{
Log
::
error
(
$e
->
getMessage
());
\DB
::
rollback_transaction
();
return
false
;
}
\DB
::
commit_transaction
();
return
$this
->
ingredients
;
}
}
}
\ No newline at end of file
fuel/app/classes/trait/inutraliaWS.php
View file @
75ee7094
...
@@ -128,8 +128,8 @@ trait Trait_InutraliaWS {
...
@@ -128,8 +128,8 @@ trait Trait_InutraliaWS {
}
}
public
function
ws_recipe_get
(
$id
=
null
)
{
public
function
ws_recipe_get
(
$id
=
null
)
{
return
$this
->
ws_get
(
'recipe'
.
((
$id
!=
null
)
?
"/
$id
"
:
""
));
return
$this
->
ws_get
(
'recipe'
.
((
$id
!=
null
)
?
"/
$id
"
:
""
));
}
}
...
...
fuel/app/views/menussaludables/menu/index.twig
View file @
75ee7094
...
@@ -17,6 +17,8 @@
...
@@ -17,6 +17,8 @@
<div
class=
"container mt20"
>
<div
class=
"container mt20"
>
<h2
class=
"name-menu-saludable"
>
Menú
{{
name_menu
}}
</h2>
<div
id=
"exTab2"
class=
"container"
>
<div
id=
"exTab2"
class=
"container"
>
<ul
class=
"nav nav-tabs nav-tabs-menus-saludables"
>
<ul
class=
"nav nav-tabs nav-tabs-menus-saludables"
>
<li
class=
"active"
>
<li
class=
"active"
>
...
...
public/assets/css/custom.css
View file @
75ee7094
...
@@ -913,6 +913,17 @@ a:focus {
...
@@ -913,6 +913,17 @@ a:focus {
}
}
}
}
.name-menu-saludable
{
padding-left
:
20px
;
}
@media
(
max-width
:
600px
){
.name-menu-saludable
{
padding-left
:
20px
;
font-size
:
15px
;
}
}
/****************************************************************************************************/
/****************************************************************************************************/
/**********************************MODALS***********************************/
/**********************************MODALS***********************************/
...
...
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