1
0

MERGE et améliorations !

This commit is contained in:
HorlogeSkynet
2016-12-06 01:06:52 +01:00
14 changed files with 289 additions and 59 deletions

@ -77,6 +77,7 @@ class CategoriesController extends AppController
$this->Flash->success(__('The category has been saved.'));
return $this->redirect(['controller' => 'Camps', 'action' => 'view', $category->camp_id]);
} else {
$this->Flash->error(__('The category could not be saved. Please, try again.'));
}
@ -119,12 +120,26 @@ class CategoriesController extends AppController
$this->Flash->success(__('The category has been saved.'));
return $this->redirect(['controller' => 'Camps', 'action' => 'view', $category->camp_id]);
} else {
$this->Flash->error(__('The category could not be saved. Please, try again.'));
}
}
$camps = $this->Categories->Camps->find('list', ['limit' => 200]);
$this->set(compact('category', 'camps'));
$sub_q = $this->Categories->Items->find()
->select(['id'])
->where(function ($exp, $q) {
return $exp->equalFields('Categories.id', 'Items.category_id');
});
$categories = $this->Categories->find('list')->where(
function ($exp, $q) use ($sub_q) {
return $exp->notExists($sub_q);
}
);
$this->set(compact('category', 'camps','categories'));
$this->set('_serialize', ['category']);
}
@ -146,5 +161,6 @@ class CategoriesController extends AppController
}
return $this->redirect(['controller' => 'Camps', 'action' => 'view', $category->camp_id]);
}
}

@ -126,7 +126,7 @@ class ItemsController extends AppController
if ($this->Items->save($item)) {
$this->Flash->success(__('The item has been saved.'));
return $this->redirect(['action' => 'index']);
return $this->redirect(['controller'=> 'Camps','action' => 'view', $this->Auth->user('camp_id')]);
} else {
$this->Flash->error(__('The item could not be saved. Please, try again.'));
}
@ -153,7 +153,7 @@ class ItemsController extends AppController
$this->Flash->error(__('The item could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
return $this->redirect(['controller'=> 'Camps' ,'action' => 'view'],$this->Auth->user('camp_id') );
}
/**

@ -82,7 +82,7 @@ class NeedsController extends AppController
ConnectionManager::get('default')->execute('UPDATE items SET hot=hot +1 WHERE id = :id',['id'=> $id]);
$data = ['user_id' => $this->Auth->user('id'), 'item_id' => $id, Time::now()];
$need = $this->Needs->patchEntity($need, $data);
if ($this->Needs->save($need))
if ($this->Needs->save($need))
{
$this->Flash->success(__('The need has been saved.'));

@ -9,16 +9,16 @@
?></li>
</ul>
</nav>
<div class="camps form large-9 medium-8 columns content">
<div class="items form large-centered large-4 medium-3 medium-centered columns content">
<?= $this->Form->create($camp) ?>
<fieldset>
<legend><?= __('Edit Camp') ?></legend>
<h4><?= __('Edit Camp') ?></h4>
<?php
echo $this->Form->input('name');
echo $this->Form->input('lng');
echo $this->Form->input('lat');
?>
</fieldset>
<?= $this->Form->submit(__('Submit'), ['class' => 'button']) ?>
<?= $this->Form->button(__('Submit'), ['class' => 'button expanded']) ?>
<?= $this->Form->end() ?>
</div>

@ -24,34 +24,53 @@
<h4> Categories for this camp </h4>
<ul>
<?php foreach($camp->categories as $category): ?>
<li> <?= h($category->name) ?> <?= $this->Form->postLink(__('<i class="fi-x-circle"></i>'), ['controller' => 'Categories', 'action' => 'delete', $category->id], ['confirm' => __('Are you sure you want to delete : {0}?', $category->name), 'escape' => false]) ?></li>
<li> <?= h($category->name) ?> <?= $this->Form->postLink(__('<i class="fi-x-circle"></i> '), ['controller' => 'Categories', 'action' => 'delete', $category->id], ['confirm' => __('Are you sure you want to delete : {0}?', $category->name), 'escape' => false]) ?>
<?php echo $this->Html->link(__(' <i class="fi-pencil"></i>'),
[
'controller' => 'Categories',
'action' => 'edit',
$category->id
],
[
'escape' => false
]
); ?>
</li>
<?php endforeach; ?>
</ul>
<h4> Items for this camp </h4>
<ul>
<?php
<?php
foreach ($items as $key => $value) {
echo '<li>';
echo $value['name'];
echo ' ';
echo ' hot : ' . $value['hot'];
echo ' ';
echo $this->Html->link(__('<i class="fi-refresh"></i>'),
[
'controller' => 'Items',
'action' => 'reset',
$value['id']
],
[
'escape' => false
]
);
echo '</li>';
}
?>
echo '<li>';
echo $value['name'];
echo ' ';
echo ' hot : ' . $value['hot'];
echo ' ';
echo $this->Html->link(__('<i class="fi-refresh"></i> '),
[
'controller' => 'Items',
'action' => 'reset',
$value['id']
],
[
'escape' => false
]
);
echo $this->Html->link(__(' <i class="fi-pencil"></i>'),
[
'controller' => 'Items',
'action' => 'edit',
$value['id']
],
[
'escape' => false
]
);
echo '</li>';
}
?>
</ul>

@ -11,7 +11,7 @@
echo $this->Form->hidden('camp_id', ['type' => 'number' , 'default' => $camp]);
?>
</fieldset>
<?= $this->Form->button(__('Submit'), ['class' => 'button large']) ?>
<?= $this->Form->button(__('Submit'), ['class' => 'button expanded']) ?>
</div>
<div class="large-2 medium-3 columns" id="blank"><br></div>
<?= $this->Form->end() ?>

@ -7,27 +7,19 @@
['confirm' => __('Are you sure you want to delete # {0}?', $category->id)]
)
?></li>
<li><?= $this->Html->link(__('List Categories'), ['action' => 'index']) ?></li>
<li><?= $this->Html->link(__('List Camps'), ['controller' => 'Camps', 'action' => 'index']) ?></li>
<li><?= $this->Html->link(__('New Camp'), ['controller' => 'Camps', 'action' => 'add']) ?></li>
<li><?= $this->Html->link(__('List Categories'), ['controller' => 'Categories', 'action' => 'index']) ?></li>
<li><?= $this->Html->link(__('New Category'), ['controller' => 'Categories', 'action' => 'add']) ?></li>
<li><?= $this->Html->link(__('List Items'), ['controller' => 'Items', 'action' => 'index']) ?></li>
<li><?= $this->Html->link(__('New Item'), ['controller' => 'Items', 'action' => 'add']) ?></li>
<li><?= $this->Html->link(__('List Posts'), ['controller' => 'Posts', 'action' => 'index']) ?></li>
<li><?= $this->Html->link(__('New Post'), ['controller' => 'Posts', 'action' => 'add']) ?></li>
</ul>
</nav>
<div class="categories form large-9 medium-8 columns content">
<div class="items form large-centered large-4 medium-3 medium-centered columns content">
<?= $this->Form->create($category) ?>
<fieldset>
<legend><?= __('Edit Category') ?></legend>
<h4><?= __('Edit Category') ?></h4>
<?php
echo $this->Form->input('name');
echo $this->Form->input('category_id');
echo $this->Form->input('camp_id', ['options' => $camps]);
echo $this->Form->input('category_id', ['options' => $categories, 'empty' => true]);
//echo $this->Form->input('camp_id', ['options' => $camps]);
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->button(__('Submit'),['class' => 'button expanded']) ?>
<?= $this->Form->end() ?>
</div>

@ -1,14 +1,16 @@
<h1 class="text-center">Please select a category below</h1>
<div class="row small-up-2 medium-up-3 large-up-4">
<?php foreach ($categories as $category): ?>
<?php $file = WWW_ROOT . 'img' . DS . 'icons' . DS . strtolower($category->name).'.svg';?>
<?php $sclass = "cat-icon-mask cat-color" . (string)($category->id-1)%4 ?>
<?php $caticon = 'icons/'.strtolower($category->name).'.svg'?>
<?php if (file_exists($file)==false): ?>
<?php $caticon = 'icons/unknown.svg'?>
<?php endif; ?>
<div class="column text-center">
<?= $this->Html->link(
$this->Html->image('icons/food.svg', array('class' => $sclass)).
$this->Html->image($caticon, array('class' => $sclass)).
'<h4 class="cat-text">' . $category->name . '</h4>', [
'controller' => 'categories',
'action' => 'view',

@ -8,11 +8,17 @@
<?php foreach ($category->categories as $category): ?>
<?php $file = WWW_ROOT . 'img' . DS . 'icons' . DS . strtolower($category->name).'.svg';?>
<?php $sclass = "cat-icon-mask cat-color" . (string)($category->id-1)%4 ?>
<?php $caticon = 'icons/'.strtolower($category->name).'.svg'?>
<?php if (file_exists($file)==false): ?>
<?php $caticon = 'icons/unknown.svg'?>
<?php endif; ?>
<?php $sclass = "cat-icon-mask cat-color" . (string)($category->id-1)%4 ?>
<div class="column text-center">
<a class="cat-container" href=<?php echo "" . (string)$category->id; ?>>
<?php echo $this->Html->image('icons/food.svg', array('class' => $sclass)) ?>
<?php echo $this->Html->image($caticon, array('class' => $sclass)) ?>
<h4 class="cat-text"><?= $category->name ?></h4>
</a>
</div>

@ -10,6 +10,6 @@
echo $this->Form->input('cooldown', ['label' => 'Cooldown (in days)']);
?>
</fieldset>
<?= $this->Form->button(__('Submit'), ['class' => 'button']) ?>
<?= $this->Form->button(__('Submit'), ['class' => 'button expanded']) ?>
<?= $this->Form->end() ?>
</div>

@ -7,16 +7,9 @@
['confirm' => __('Are you sure you want to delete # {0}?', $item->id)]
)
?></li>
<li><?= $this->Html->link(__('List Items'), ['action' => 'index']) ?></li>
<li><?= $this->Html->link(__('List Categories'), ['controller' => 'Categories', 'action' => 'index']) ?></li>
<li><?= $this->Html->link(__('New Category'), ['controller' => 'Categories', 'action' => 'add']) ?></li>
<li><?= $this->Html->link(__('List Needs'), ['controller' => 'Needs', 'action' => 'index']) ?></li>
<li><?= $this->Html->link(__('New Need'), ['controller' => 'Needs', 'action' => 'add']) ?></li>
<li><?= $this->Html->link(__('List Offers'), ['controller' => 'Offers', 'action' => 'index']) ?></li>
<li><?= $this->Html->link(__('New Offer'), ['controller' => 'Offers', 'action' => 'add']) ?></li>
</ul>
</nav>
<div class="items form large-9 medium-8 columns content">
<div class="items form large-centered large-4 medium-3 medium-centered columns content">
<?= $this->Form->create($item) ?>
<fieldset>
<legend><?= __('Edit Item') ?></legend>
@ -28,6 +21,6 @@
echo $this->Form->input('cooldown');
?>
</fieldset>
<?= $this->Form->submit(__('Submit'), ['class' => 'button']) ?>
<?= $this->Form->button(__('Submit'),['class' => 'button expanded']) ?>
<?= $this->Form->end() ?>
</div>

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 74 70.000069"
id="svg4251"
inkscape:version="0.91 r"
sodipodi:docname="posts.svg"
width="74"
height="70.000069">
<metadata
id="metadata4265">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs4263" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1031"
id="namedview4261"
showgrid="false"
inkscape:snap-page="true"
inkscape:zoom="2.8284271"
inkscape:cx="-37.276257"
inkscape:cy="-30.299345"
inkscape:window-x="1680"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="svg4251"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<g
transform="translate(-13,-967.36213)"
id="g4253">
<path
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;stroke:none;marker:none;enable-background:accumulate;fill-opacity:0.66666669"
d="m 75,967.36213 0,63.00007 c 0,3.878 3.122,7 7,7 l -62,0 c -3.878,0 -7,-3.122 -7,-7 l 0,-63.00007 62,0 z m -10,10 -20,0 0,14 20,0 0,-14 z m -30,0 -12,0 c -1.10457,0 -2,0.8954 -2,2 0,1.1046 0.89543,2 2,2 l 12,0 c 1.10457,0 2,-0.8954 2,-2 0,-1.1046 -0.89543,-2 -2,-2 z m 52,10 0,43.00007 c 0,2.8046 -2.19541,5 -5,5 -2.80459,0 -5,-2.1954 -5,-5 l 0,-43.00007 10,0 z m -52,0 -12,0 c -1.10457,0 -2,0.8954 -2,2 0,1.1046 0.89543,2 2,2 l 12,0 c 1.10457,0 2,-0.8954 2,-2 0,-1.1046 -0.89543,-2 -2,-2 z m 30,12 -42,0 c -1.10457,0 -2,0.89537 -2,1.99997 0,1.1046 0.89543,2 2,2 l 42,0 c 1.10457,0 2,-0.8954 2,-2 0,-1.1046 -0.89543,-1.99997 -2,-1.99997 z m 0,10.99997 -42,0 c -1.10457,0 -2,0.8954 -2,2 0,1.1046 0.89543,2 2,2 l 42,0 c 1.10457,0 2,-0.8954 2,-2 0,-1.1046 -0.89543,-2 -2,-2 z m 0,11.0001 -42,0 c -1.10457,0 -2,0.8954 -2,2 0,1.1046 0.89543,2 2,2 l 42,0 c 1.10457,0 2,-0.8954 2,-2 0,-1.1046 -0.89543,-2 -2,-2 z"
visibility="visible"
display="inline"
overflow="visible"
id="path4255"
inkscape:connector-curvature="0" />
</g>
</svg>

After

(image error) Size: 2.9 KiB

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 420.97507 420.9676"
id="svg4990"
inkscape:version="0.91 r"
sodipodi:docname="shelter.svg"
width="420.97507"
height="420.96765">
<metadata
id="metadata5004">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs5002" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1031"
id="namedview5000"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:snap-page="true"
inkscape:zoom="1.3350176"
inkscape:cx="371.684"
inkscape:cy="195.648"
inkscape:window-x="1680"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="svg4990" />
<path
style="opacity:1;fill:#000000;fill-opacity:0.2;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:50;stroke-dasharray:none;stroke-opacity:1"
d="M 0,-7.5330158e-6 0,210.48381 C 6.2e-4,94.234163 94.241599,-0.00348753 210.49124,-7.5330158e-6 l -210.49124,0 z m 210.49124,0 C 326.73799,6.0246698e-4 420.97446,94.23706 420.97507,210.48381 l 0,-210.4838175330158 -210.48383,0 z M 420.97507,210.48381 c -0.10443,68.21751 -33.26271,132.15408 -88.96243,171.53912 l 0,-168.68372 -121.51398,-102.52743 -121.513988,102.52743 0,168.84686 C 33.22956,342.77263 0.05658,278.76301 0,210.48381 l 0,210.48383 210.49124,0 c -37.44272,-0.0778 -74.18697,-10.14198 -106.4434,-29.15478 l 212.82005,0 c -32.23691,19.00133 -68.95659,29.06512 -106.37665,29.15478 l 210.48383,0 0,-210.48383 z M 210.60249,80.396203 c -0.27242,-0.0023 -0.54475,0.01025 -0.81583,0.03721 -1.5745,0.134463 -3.06785,0.756706 -4.27198,1.77999 L 46.02758,218.91664 c -7.73598,6.64041 2.2894,18.21734 9.967944,11.5106 L 210.49866,97.995985 365.00179,230.42724 c 7.67858,6.70723 17.70442,-4.87023 9.96794,-11.5106 L 215.48263,82.213407 c -1.36174,-1.161845 -3.09011,-1.805386 -4.88014,-1.817075 z m 64.45047,15.226333 0,27.530514 30.3785,26.10652 0,-53.637034 -30.3785,0 z m -117.71667,144.297854 45.56774,0 0,45.56775 -45.56774,0 0,-45.56775 z m 60.75699,0 45.56775,0 0,45.56775 -45.56775,0 0,-45.56775 z m -60.75699,60.75699 45.56774,0 0,45.56775 -45.56774,0 0,-45.56775 z m 60.75699,0 45.56775,0 0,45.56775 -45.56775,0 0,-45.56775 z"
id="rect5550"
inkscape:connector-curvature="0" />
<g
transform="matrix(3.797312,0,0,3.797312,20.63083,-3570.1768)"
id="g4992" />
</svg>

After

(image error) Size: 3.3 KiB

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 775.42383 775.42373"
id="svg4990"
inkscape:version="0.91 r"
sodipodi:docname="unknown.svg"
width="775.42383"
height="775.42383">
<metadata
id="metadata5004">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs5002" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1031"
id="namedview5000"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:snap-page="true"
inkscape:zoom="0.944"
inkscape:cx="586.5917"
inkscape:cy="346.35085"
inkscape:window-x="1680"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="svg4990"
inkscape:snap-center="true"
inkscape:snap-object-midpoints="true"
inkscape:snap-text-baseline="true" />
<path
style="opacity:1;fill:#000000;fill-opacity:0.2;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:50;stroke-dasharray:none;stroke-opacity:1"
d="M 0 0 L 0 387.71289 A 387.71194 387.71194 0 0 1 387.71289 0 L 0 0 z M 387.71289 0 A 387.71194 387.71194 0 0 1 775.42383 387.71289 L 775.42383 0 L 387.71289 0 z M 775.42383 387.71289 A 387.71194 387.71194 0 0 1 387.71289 775.42383 L 775.42383 775.42383 L 775.42383 387.71289 z M 387.71289 775.42383 A 387.71194 387.71194 0 0 1 0 387.71289 L 0 775.42383 L 387.71289 775.42383 z M 387.70898 90.041016 L 90.041016 387.70898 L 387.71484 685.38477 L 685.38477 387.71484 L 387.70898 90.041016 z "
transform="translate(0,-6.1035156e-5)"
id="rect5573" />
</svg>

After

(image error) Size: 2.5 KiB