1
0
This commit is contained in:
Korlan Colas
2015-12-04 02:19:50 +01:00
24 changed files with 446 additions and 315 deletions

@ -60,8 +60,11 @@ class ArticlesController extends AppController
*/
public function add()
{
$user_id = $this->Auth->user()['id'];
$article = $this->Articles->newEntity();
if ($this->request->is('post')) {
if ($this->request->is('post'))
{
$article->user_id = $user_id;
$article = $this->Articles->patchEntity($article, $this->request->data);
$article->user_id = $this->Auth->user('id');
if ($this->Articles->save($article)) {

@ -58,10 +58,10 @@ class CrisisController extends AppController
if ($this->request->is('post')) {
$crisi = $this->Crisis->patchEntity($crisi, $this->request->data);
if ($this->Crisis->save($crisi)) {
$this->Flash->success(__('The crisis has been saved.'));
$this->Flash->success(__('La Crise a bien été enregistrée.'));
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error(__('The crisis could not be saved. Please, try again.'));
$this->Flash->error(__('La Crise n\'a pas pu être enregistrée.'));
}
}
$users = $this->Crisis->Users->find('list', ['limit' => 200]);
@ -84,10 +84,10 @@ class CrisisController extends AppController
if ($this->request->is(['patch', 'post', 'put'])) {
$crisi = $this->Crisis->patchEntity($crisi, $this->request->data);
if ($this->Crisis->save($crisi)) {
$this->Flash->success(__('The crisis has been saved.'));
$this->Flash->success(__('La Crise a bien été enregistrée.'));
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error(__('The crisis could not be saved. Please, try again.'));
$this->Flash->error(__('La Crise n\'a pas pu être enregistrée.'));
}
}
$users = $this->Crisis->Users->find('list', ['limit' => 200]);
@ -107,9 +107,9 @@ class CrisisController extends AppController
$this->request->allowMethod(['post', 'delete']);
$crisi = $this->Crisis->get($id);
if ($this->Crisis->delete($crisi)) {
$this->Flash->success(__('The crisis has been deleted.'));
$this->Flash->success(__('La Crise a bien été supprimée.'));
} else {
$this->Flash->error(__('The crisis could not be deleted. Please, try again.'));
$this->Flash->error(__('La Crise n\'a pas pu être supprimée.'));
}
return $this->redirect(['action' => 'index']);
}

@ -35,7 +35,6 @@ class HomesController extends AppController
if($verifiedCrises->count() != 0)
{
$home_type = 'active';
}
else
{

@ -50,16 +50,20 @@ class InfosController extends AppController
*
* @return void Redirects on successful add, renders view otherwise.
*/
public function add()
public function add($crisis_id)
{
$user_id = $this->Auth->user()['id'];
$info = $this->Infos->newEntity();
if ($this->request->is('post')) {
if ($this->request->is('post'))
{
$info->crisis_id = $crisis_id;
$info->user_id = $user_id;
$info = $this->Infos->patchEntity($info, $this->request->data);
if ($this->Infos->save($info)) {
$this->Flash->success(__('The info has been saved.'));
$this->Flash->success(__('L\'Information a bien été enregistrée.'));
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error(__('The info could not be saved. Please, try again.'));
$this->Flash->error(__('L\'Information n\'a pas pu être enregistrée.'));
}
}
$Crisis = $this->Infos->Crisis->find('list', ['limit' => 200]);
@ -83,10 +87,10 @@ class InfosController extends AppController
if ($this->request->is(['patch', 'post', 'put'])) {
$info = $this->Infos->patchEntity($info, $this->request->data);
if ($this->Infos->save($info)) {
$this->Flash->success(__('The info has been saved.'));
$this->Flash->success(__('L\'Information a bien été enregistrée.'));
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error(__('The info could not be saved. Please, try again.'));
$this->Flash->error(__('L\'Information n\'a pas pu être enregistrée.'));
}
}
$Crisis = $this->Infos->Crisis->find('list', ['limit' => 200]);
@ -107,32 +111,31 @@ class InfosController extends AppController
$this->request->allowMethod(['post', 'delete']);
$info = $this->Infos->get($id);
if ($this->Infos->delete($info)) {
$this->Flash->success(__('The info has been deleted.'));
$this->Flash->success(__('L\'Information a bien été supprimée.'));
} else {
$this->Flash->error(__('The info could not be deleted. Please, try again.'));
$this->Flash->error(__('L\'Information n\'a pas pu être supprimée.'));
}
return $this->redirect(['action' => 'index']);
}
public function isAuthorized($user)
{
// A logged user can do an action about infos
if($this->request->action === 'add' && $user['id'] > 0)
{
return true;
}
if(in_array($this->request->action, ['edit', 'delete']))
{
$infoId = (int)$this->request->params['pass'][0];
if($this->Articles->isOwnedBy($infoId, $user['id']))
// A logged user can do an action about infos
if($this->request->action === 'add' && $user['id'] > 0)
{
return true;
}
}
return parent::isAuthorized($user);
if(in_array($this->request->action, ['edit', 'delete']))
{
$infoId = (int)$this->request->params['pass'][0];
if($this->Infos->isOwnedBy($infoId, $user['id']))
{
return true;
}
}
return parent::isAuthorized($user);
}
}

@ -76,6 +76,10 @@ class CrisisTable extends Table
$validator
->requirePresence('state', 'create')
->notEmpty('state');
$validator
->add('state', 'inList', ['rule' => ['inList', [
'spotted', 'verified', 'over']],
'message' => 'Merci de rentrer un role valide']);
$validator
->requirePresence('address', 'create')

@ -82,4 +82,9 @@ class InfosTable extends Table
$rules->add($rules->existsIn(['user_id'], 'Users'));
return $rules;
}
public function isOwnedBy($infoId, $userId)
{
return $this->exists(['id' => $infoId, 'user_id' => $userId]);
}
}

@ -7,7 +7,7 @@
<div class="articles form large-9 medium-8 columns content">
<?= $this->Form->create($article) ?>
<fieldset>
<legend><?= __('Ajouter article') ?></legend>
<legend><?= __('Ajouter un article') ?></legend>
<?php
echo $this->Form->input('title', ['label' => 'Titre de l\'article :']);
echo $this->Form->input('body', ['label' => 'Corps du texte :']);

@ -2,7 +2,7 @@
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Form->postLink(
__('Supprimer l\'Article'),
__('Supprimer l\'article'),
['action' => 'delete', $article->id],
['confirm' => __('Êtes-vous sûr de vouloir supprimer l\'Article #{0} ?', $article->id)]
)
@ -13,9 +13,9 @@
<div class="articles form large-9 medium-8 columns content">
<?= $this->Form->create($article) ?>
<fieldset>
<legend><?= __('Éditer l\'Article') ?></legend>
<legend><?= __('Éditer l\'article') ?></legend>
<?php
echo $this->Form->input('title', ['label' => 'Titre']);
echo $this->Form->input('title', ['label' => 'Titre de l\'article']);
echo $this->Form->input('body', ['label' => 'Corps du texte']);
// echo $this->Form->input('user_id', ['options' => $users, 'label' => 'Utilisateur']);
echo "<br />";

@ -4,17 +4,17 @@
<li><?= $this->Html->link(__('Nouvel Article'), ['action' => 'add']) ?></li>
</ul>
</nav>
<div class="articles index large-9 medium-8 columns content">
<h3><?= __('Articles') ?></h3>
<div class="articles index large-9 medium-8 columns content" >
<h3 style="margin-top: 20px; margin-bottom: 20px;"><?= __('Articles') ?></h3>
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th><?= $this->Paginator->sort('id') ?></th>
<th><?= $this->Paginator->sort('title') ?></th>
<th><?= $this->Paginator->sort('created') ?></th>
<th><?= $this->Paginator->sort('modified') ?></th>
<th><?= $this->Paginator->sort('user_id') ?></th>
<th><?= $this->Paginator->sort('category') ?></th>
<th><?= $this->Paginator->sort('id', ['label' => 'ID']) ?></th>
<th><?= $this->Paginator->sort('title', ['label' => 'Titre']) ?></th>
<th><?= $this->Paginator->sort('created', ['label' => 'Créé le']) ?></th>
<th><?= $this->Paginator->sort('modified', ['label' => 'Modifié le']) ?></th>
<th><?= $this->Paginator->sort('user_id', ['label' => 'ID utilisateur']) ?></th>
<th><?= $this->Paginator->sort('category', ['label' => 'Catégorie']) ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
</thead>
@ -28,9 +28,9 @@
<td><?= $article->has('user') ? $this->Html->link($article->user->id, ['controller' => 'Users', 'action' => 'view', $article->user->id]) : '' ?></td>
<td><?= h($article->category) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $article->id]) ?>
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $article->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $article->id], ['confirm' => __('Are you sure you want to delete # {0}?', $article->id)]) ?>
<?= $this->Html->link(__('Voir'), ['action' => 'view', $article->id]) ?>
<?= $this->Html->link(__('Editer'), ['action' => 'edit', $article->id]) ?>
<?= $this->Form->postLink(__('Supprimer'), ['action' => 'delete', $article->id], ['confirm' => __('Êtes-vous sûr de vouloir supprimer l\'article #{0} ?', $article->id)]) ?>
</td>
</tr>
<?php endforeach; ?>

@ -1,42 +1,67 @@
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<br/>
<?php $this->set('css','css_view.css');?>
<nav class="large-2 medium-2 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('List Articles'), ['action' => 'index']) ?> </li>
<li><?= $this->Html->link(__('New Article'), ['action' => 'add']) ?> </li>
<li><?= $this->Html->link(__('Edit Article'), ['action' => 'edit', $article->id]) ?> </li>
<li><?= $this->Form->postLink(__('Supprimer l\'Article'), ['action' => 'delete', $article->id], ['confirm' => __('Êtes-vous sûr de vouloir supprimer l\'Article # {0}?', $article->id)]) ?> </li>
<center><li class="heading"><?= __('Actions') ?></li></center>
<li class="menu_impair"><?= $this->Html->link(__('Edit Article'), ['action' => 'edit', $article->id]) ?> </li>
<li class="menu_pair"><?= $this->Form->postLink(__('Delete Article'), ['action' => 'delete', $article->id], ['confirm' => __('Are you sure you want to delete # {0}?', $article->id)]) ?> </li>
<li class="menu_impair"><?= $this->Html->link(__('List Articles'), ['action' => 'index']) ?> </li>
<li class="menu_pair"><?= $this->Html->link(__('New Article'), ['action' => 'add']) ?> </li>
<li class="menu_impair"><?= $this->Html->link(__('List Users'), ['controller' => 'Users', 'action' => 'index']) ?> </li>
<li class="menu_pair"><?= $this->Html->link(__('New User'), ['controller' => 'Users', 'action' => 'add']) ?> </li>
</ul>
</nav>
<div class="articles view large-9 medium-8 columns content">
<h3><?= h($article->title) ?></h3>
<table class="vertical-table">
<tr>
<th><?= __('Title') ?></th>
<td><?= h($article->title) ?></td>
</tr>
<tr>
<th><?= __('User') ?></th>
<td><?= $article->has('user') ? $this->Html->link($article->user->id, ['controller' => 'Users', 'action' => 'view', $article->user->id]) : '' ?></td>
</tr>
<tr>
<th><?= __('Category') ?></th>
<td><?= h($article->category) ?></td>
</tr>
<tr>
<th><?= __('Id') ?></th>
<td><?= $this->Number->format($article->id) ?></td>
</tr>
<tr>
<th><?= __('Created') ?></th>
<td><?= h($article->created) ?></td>
</tr>
<tr>
<th><?= __('Modified') ?></th>
<td><?= h($article->modified) ?></td>
</tr>
</table>
<div class="row">
<h4><?= __('Body') ?></h4>
<?= $this->Text->autoParagraph(h($article->body)); ?>
</div>
<div class="articles view large-10 medium-9 columns content">
<div class="crisis-panel red radius">
<div class="crisis-panel-label">
</div>
<div class="crisis-panel-content">
<p>
<h2 class="crisis-panel-title"><?= h($article->title) ?></h2>
<h4 class="crisis-panel-date subheader"><?= h($article->category) ?></h4>
</p>
<p>
<?= $this->Text->autoParagraph(h($article->body)); ?>
</p>
</div>
</div>
<div class="row">
<div class="small-9 large-9 medium columns"><?= __('User') ?>: <?= $article->has('user') ? $this->Html->link($article->user->id, ['controller' => 'Users', 'action' => 'view', $article->user->id]) : '' ?></div>
<div class="small-3 large-3 columns"><?= __('Created') ?>: <?= h($article->created) ?><br/>
<?= __('Modified') ?>: <?= h($article->modified) ?>
</div>
</div>

@ -11,9 +11,9 @@
<?php
echo $this->Form->input('abstract', ['label' => 'Résumé']);
echo $this->Form->input('severity', ['label' => 'Gravité']);
echo $this->Form->input('longitude', ['label' => 'Longitude', 'minLongi' => -180.0000, 'maxLongi' => 180.0000]);
echo $this->Form->input('latitude', ['label' => 'Latitude', 'minLati' => -90.0000, 'maxLati' => 90.0000]);
echo $this->Form->input('state', ['label' => 'Etat']);
echo $this->Form->input('longitude', ['label' => 'Longitude']);
echo $this->Form->input('latitude', ['label' => 'Latitude']);
echo $this->Form->input('state', ['options' => ['spotted' => 'Spotted', 'verified' => 'Verified', 'over' => 'Over'], 'label' => 'État']);
echo $this->Form->input('address', ['label' => 'Adresse']);
echo $this->Form->input('type', ['label' => 'Type']);
echo $this->Form->input('hashtags', ['label' => 'Hashtags']);

@ -17,9 +17,9 @@
<?php
echo $this->Form->input('abstract', ['label' => 'Résumé']);
echo $this->Form->input('severity', ['label' => 'Gravité']);
echo $this->Form->input('longitude', ['label' => 'Longitude', 'minLongi' => -180.0000, 'maxLongi' => 180.0000]);
echo $this->Form->input('latitude', ['label' => 'Latitude', 'minLati' => -90.0000, 'maxLati' => 90.0000]);
echo $this->Form->input('state', ['label' => 'Etat']);
echo $this->Form->input('longitude', ['label' => 'Longitude']);
echo $this->Form->input('latitude', ['label' => 'Latitude']);
echo $this->Form->input('state', ['options' => ['spotted' => 'Spotted', 'verified' => 'Verified', 'over' => 'Over'], 'label' => 'État']);
echo $this->Form->input('address', ['label' => 'Adresse']);
echo $this->Form->input('type', ['label' => 'Type']);
echo $this->Form->input('hashtags', ['label' => 'Hashtags']);

@ -5,7 +5,7 @@
</ul>
</nav>
<div class="crisis index large-9 medium-8 columns content">
<h3><?= __('Crisis') ?></h3>
<h3 style="margin-top: 20px; margin-bottom: 20px;"><?= __('Crisis') ?></h3>
<table cellpadding="0" cellspacing="0">
<thead>
<tr>

@ -3,15 +3,15 @@
<h2 class="main_degrade_title text-center"><?= h($crisi->type) ?> à <?= h($crisi->address) ?>
<?php if($crisi->state=='verified'): ?>
<i title="Verified by Staff" class="fi-checkbox verified_icon"></i>
<?php endif; ?>
<?php if($crisi->state=='over'): ?>
<i title="Crisis Ended" class="fi-x-circle"></i>
<?php endif; ?>
<?php if($crisi->state=='spotted'): ?>
<i title="Spotted by User" class="fi-sound spotted_icon"></i>
<?php endif; ?>
<?php if($crisi->state=='verified'): ?>
<i title="Verified by Staff" class="fi-checkbox verified_icon"></i>
<?php endif; ?>
<?php if($crisi->state=='over'): ?>
<i title="Crisis Ended" class="fi-x-circle"></i>
<?php endif; ?>
<?php if($crisi->state=='spotted'): ?>
<i title="Spotted by User" class="fi-sound spotted_icon"></i>
<?php endif; ?>
</h2>
@ -20,33 +20,44 @@
<div class="row">
<div class="large-8 columns">
<p>Créé le : <?= h($crisi->created) ?> </br>
<p><strong>Créé le : </strong><?= h($crisi->created) ?></br></br>
Description : <?= h($crisi->abstract) ?>
<strong>Description : </strong><?= h($crisi->abstract) ?>
</p>
<br>
<h4>Chat WebRTC ? </h4>
<h4>Informations à propos de cette crise :</h4>
<?php
foreach($crisi->infos as $info): ?>
<div class="panel">
<h4 class="hide-for-small"><?= $info->title ?><hr></h4>
<h5 class="subheader"><?= $info->body ?></h5>
<em>Tagged : <?= $info->type ?></em>
</div>
<?php endforeach; ?>
</div>
<div class="large-4 columns">
<h4>Ils en parlent...</h4>
<a class="twitter-timeline" href="https://twitter.com/hashtag/potus" data-widget-id="672517242656043008" data-screen-name="potus">Tweets sur #crise</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<h4>Chat WebRTC ? </h4>
<p>Hashtags : <?= h($crisi->hashtags) ?></p>
</div>
</div>
<div class="large-4 columns">
<h4>Ils en parlent...</h4>
<a class="twitter-timeline" href="https://twitter.com/hashtag/potus" data-widget-id="672517242656043008" data-screen-name="potus">Tweets sur #crise</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<p>Hashtags : <?= h($crisi->hashtags) ?></p>
</div>
</div>
<!-- GEOLOCALISATION / URL GOOGLE MAP == http://google.com/maps/bylatlng?lat=' + lat + '&lng=' + lng -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script><div style="overflow:hidden;height:500px;width:100%;"><div id="gmap_canvas" style="height:500px;width:100%;"></div><style>#gmap_canvas img{max-width:none!important;background:none!important}</style><a class="google-map-code" href="http://www.themecircle.net" id="get-map-data">themecircle.net</a></div><script type="text/javascript"> function init_map(){var myOptions = {zoom:14,center:new google.maps.LatLng(<?= $this->Number->format($crisi->longitude) ?>,<?= $this->Number->format($crisi->latitude) ?>),mapTypeId: google.maps.MapTypeId.ROADMAP};map = new google.maps.Map(document.getElementById("gmap_canvas"), myOptions);marker = new google.maps.Marker({map: map,position: new google.maps.LatLng(<?= $this->Number->format($crisi->longitude) ?>, <?= $this->Number->format($crisi->latitude) ?>)});infowindow = new google.maps.InfoWindow({content:"Geolocalisation du signalement (approximation)" });google.maps.event.addListener(marker, "click", function(){infowindow.open(map,marker);});infowindow.open(map,marker);}google.maps.event.addDomListener(window, 'load', init_map);</script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script><div style="overflow:hidden;height:500px;width:100%;"><div id="gmap_canvas" style="height:500px;width:100%;"></div><style>#gmap_canvas img{max-width:none!important;background:none!important}</style><a class="google-map-code" href="http://www.themecircle.net" id="get-map-data">themecircle.net</a></div><script type="text/javascript"> function init_map(){var myOptions = {zoom:14,center:new google.maps.LatLng(<?= $this->Number->format($crisi->longitude) ?>,<?= $this->Number->format($crisi->latitude) ?>),mapTypeId: google.maps.MapTypeId.ROADMAP};map = new google.maps.Map(document.getElementById("gmap_canvas"), myOptions);marker = new google.maps.Marker({map: map,position: new google.maps.LatLng(<?= $this->Number->format($crisi->longitude) ?>, <?= $this->Number->format($crisi->latitude) ?>)});infowindow = new google.maps.InfoWindow({content:"Géolocalisation du signalement (approximation)" });google.maps.event.addListener(marker, "click", function(){infowindow.open(map,marker);});infowindow.open(map,marker);}google.maps.event.addDomListener(window, 'load', init_map);</script>

@ -30,29 +30,26 @@
<div class="crisis-panel red radius">
<div class="crisis-panel-label">
<div class="label-text">
<?= $spottedCrises->first->severity ?>
<?= $verifiedCrises->first()->severity ?>
</div>
</div>
<div class="crisis-panel-content">
<p>
<h3 class="crisis-panel-title">Crisis location</h3>
<h4 class="crisis-panel-date subheader">Crisis date</h3>
<h3 class="crisis-panel-title"><?= $verifiedCrises->first()->address ?></h3>
<h4 class="crisis-panel-date subheader"><?= $verifiedCrises->first()->created ?></h3>
</p>
<p>
<h5 class="crisis-panel-state subheader">Crisis type</h5>
<h5 class="crisis-panel-state subheader">Crisis state</h5>
<h5 class="crisis-panel-state subheader"><?= $verifiedCrises->first()->type ?>:</h5>
<h5 class="crisis-panel-state subheader"><?= $verifiedCrises->first()->state ?></h5>
</p>
<p>
<span class="label secondary round radius">tag 1</span>
<span class="label secondary round radius">tag 2</span>
<span class="label secondary round radius">tag 3</span>
<span class="label secondary round radius">tag 4</span>
<span class="label secondary round radius">tag 5</span>
<?php $HTagsArray = explode(';', $verifiedCrises->first()->hashtags);?>
<?php foreach ($HTagsArray as $hashtag): ?>
<span class="label secondary round radius">#<?= $hashtag?></span>
<?php endforeach; ?>
</p>
<p>
Crisis description. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
<?= $verifiedCrises->first()->abstract ?>
</p>
</div>
@ -64,21 +61,66 @@
<div class="row">
<div class="small-6 large-8 columns">
<!-- Dernières crises -->
<ul>
<?php foreach ($spottedCrises as $crisis): ?>
<li>
<?= $crisis->abstract ?>
</li>
<div class="panel callout radius spotted-panel">
<?php foreach ($spottedCrises as $crisis): ?>
<div class="row text-left">
<div class="medium-12 large-12 small-12 columns">
<div class="crisis-panel red radius small">
<div class="crisis-panel-label">
<div class="label-text">
<?= $crisis->severity ?>
</div>
</div>
<div class="small-crisis-panel-content">
<span class="small crisis-panel-title"><?= $crisis->address ?></span>
<span class="small crisis-panel-date subheader"><?= $crisis->created ?></span>
<span class="small crisis-panel-state subheader"><?= $crisis->type ?>:</span>
<span class="small crisis-panel-state subheader"><?= $crisis->state ?></span>
<br/>
<span class="small crisis-panel-abstract"><?php
$string = $crisis->abstract;
$string = (strlen($string) > 64) ? substr($string,0,64).'...' : $string; echo $string ?></span>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</ul>
</div>
<div class="panel radius verified-panel">
<?php foreach ($verifiedCrises as $crisis): ?>
<div class="row text-left">
<div class="medium-12 large-12 small-12 columns">
<div class="crisis-panel red radius small">
<div class="crisis-panel-label">
<div class="label-text">
<?= $crisis->severity ?>
</div>
</div>
<div class="small-crisis-panel-content">
<span class="small crisis-panel-title"><?= $crisis->address ?></span>
<span class="small crisis-panel-date subheader"><?= $crisis->created ?></span>
<span class="small crisis-panel-state subheader"><?= $crisis->type ?>:</span>
<span class="small crisis-panel-state subheader"><?= $crisis->state ?></span>
<br/>
<span class="small crisis-panel-abstract"><?php
$string = $crisis->abstract;
$string = (strlen($string) > 64) ? substr($string,0,64).'...' : $string; echo $string ?></span>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="small-6 large-4 columns text-center submit-form">
<!-- Formulaire -->
<?= $this->Form->create($crisi) ?>
<!-- Formulaire TODO:vraie variable crisis-->
<?= $this->Form->create($newCrisis, [
'url' => ['controller' => 'Crisis', 'action' => 'add']
]); ?>
<legend><?= __('Submit crisis') ?></legend>
<?= $this->Form->input('abstract'); ?>
<label class='form-label'>Location:</label>

@ -40,7 +40,8 @@
<?= $this->Html->css('home_crisisdisplay.css') ?>
<?= $this->Html->css('foundation-icons.css') ?>
<?= $this->Html->css('crisis_template.css') ?>
<!-- Topbar style -->
<?= $this->Html->css('topbar.css') ?>
<!-- Footer style -->
<?= $this->Html->css('footer.css') ?>
@ -65,15 +66,15 @@
</div>
</nav>
<!-- Topbar -->
<!-- Topbar -->
<nav class="left-off-canvas-menu">
<ul class="off-canvas-list">
<li><label>Menu</label></li>
<li><?= $this->Html->link(__('Home'), ['controller'=>'Homes', 'action' => '/']) ?></li>
<li class="topbar-separator"><?= $this->Html->link(__('Home'), '/']) ?></li>
<li><?= $this->Html->link(__('Articles'), ['controller'=>'Articles', 'action' => 'index']) ?></li>
<li><?= $this->Html->link(__('Crisis'), ['controller'=>'Crisis', 'action' => 'index']) ?></li>
<li><?= $this->Html->link(__('Infos'), ['controller'=>'Infos', 'action' => 'index']) ?></li>
<li class="topbar-separator"><?= $this->Html->link(__('Infos'), ['controller'=>'Infos', 'action' => 'index']) ?></li>
<li class="topbar-separator"><?= $this->Html->link(__('User'), ['controller'=>'Users', 'action' => 'index']) ?></li>
<?php if($this->request->session()->read("Auth.User")): ?>
<li><?= $this->Html->link(__('Log out'), ['controller'=>'Users', 'action' => 'logout']) ?></li>
<?php else: ?>
@ -82,8 +83,7 @@
</ul>
</nav>
<!-- /Topbar -->
<!-- /Topbar -->
<?= $this->Flash->render() ?>
@ -92,7 +92,7 @@
</section>
<!-- Footer -->
<!-- Footer -->
<footer class="footer">
<div class="row">
<div class="small-12 columns">
@ -105,7 +105,7 @@
</div>
</div>
</footer>
<!-- /Footer -->
<!-- /Footer -->
</div>
</div>
@ -117,8 +117,10 @@
<?= $this->Html->script("foundation/foundation.js") ?>
<?= $this->Html->script("foundation/foundation.alert.js") ?>
<?= $this->Html->script("foundation/foundation.topbar.js") ?>
<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
<script>tinymce.init({ selector:'textarea' });</script>
<!--<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
<script>tinymce.init({ selector:'textarea' });</script>-->
<!-- Own script -->
<?= $this->Html->script("https://maps.googleapis.com/maps/api/js?key=AIzaSyC5JLLRv_0Innk5EXGfZhPpzGFadWeT5_4&signed_in=true&callback=initMap") ?>

@ -10,8 +10,8 @@
<?= $this->Form->create(); ?>
<?= $this->Form->input('username'); ?>
<?= $this->Form->input('password'); ?>
<?= $this->Form->button('Log in !', ['class' => 'log-in-button']); ?>
<?= $this->Form->input('password'); ?>
<?= $this->Form->button('Log in', ['class' => 'log-in-button']); ?>
<?= $this->Form->end(); ?>
<p class="text-center"><a href="#">Forgot your password?</a></p>

@ -1,162 +1,20 @@
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('Liste des Utilisateurs'), ['action' => 'index']) ?> </li>
<li><?= $this->Html->link(__('Nouvel Utilisateur'), ['action' => 'add']) ?> </li>
<li><?= $this->Html->link(__('Éditer l\'Utilisateur'), ['action' => 'edit', $user->id]) ?> </li>
<li><?= $this->Form->postLink(__('Supprimer l\'Utilisateur'), ['action' => 'delete', $user->id], ['confirm' => __('Are you sure you want to delete # {0}?', $user->id)]) ?> </li>
</ul>
</nav>
<div class="users view large-9 medium-8 columns content">
<h3><?= h($user->id) ?></h3>
<table class="vertical-table">
<tr>
<th><?= __('Username') ?></th>
<td><?= h($user->username) ?></td>
</tr>
<tr>
<th><?= __('Password') ?></th>
<td><?= h($user->password) ?></td>
</tr>
<tr>
<th><?= __('Organisation') ?></th>
<td><?= h($user->organisation) ?></td>
</tr>
<tr>
<th><?= __('Id') ?></th>
<td><?= $this->Number->format($user->id) ?></td>
</tr>
<tr>
<th><?= __('Created') ?></th>
<td><?= h($user->created) ?></td>
</tr>
<tr>
<th><?= __('Modified') ?></th>
<td><?= h($user->modified) ?></td>
</tr>
</table>
<div class="row">
<h4><?= __('Description') ?></h4>
<?= $this->Text->autoParagraph(h($user->description)); ?>
<?php $this->assign('css', 'users_view.css'); ?>
<!-- this adds Foundation Icon Fonts!! -->
<div class="row">
<div class="medium-15 ">
<div class="profile-card">
<img src="http://www.demacmedia.com/wp-content/uploads/2014/04/330x330xYeti-Feature-Small-2.png.pagespeed.ic.ASS9EY8apS.png" alt="Yeti">
<div class="profile-info">
<h4 class="subheader"><?= h($user->username) ?></h4>
<p>Organization : <?= h($user->organisation) ?></p>
<p><strong>Description - </strong><?= (h($user->description)); ?></p>
<p><?= h($user->created) ?> | <?= h($user->modified) ?></p>
<ul class="inline-list">
<div class="edit-button"><?= $this->Html->link(__('Edit'), ['action' => 'edit', $user->id]); ?></div>
</div>
</div>
</div>
<div class="related">
<h4><?= __('Related Articles') ?></h4>
<?php if (!empty($user->articles)): ?>
<table cellpadding="0" cellspacing="0">
<tr>
<th><?= __('Id') ?></th>
<th><?= __('Title') ?></th>
<th><?= __('Body') ?></th>
<th><?= __('Created') ?></th>
<th><?= __('Modified') ?></th>
<th><?= __('User Id') ?></th>
<th><?= __('Category') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
<?php foreach ($user->articles as $articles): ?>
<tr>
<td><?= h($articles->id) ?></td>
<td><?= h($articles->title) ?></td>
<td><?= h($articles->body) ?></td>
<td><?= h($articles->created) ?></td>
<td><?= h($articles->modified) ?></td>
<td><?= h($articles->user_id) ?></td>
<td><?= h($articles->category) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['controller' => 'Articles', 'action' => 'view', $articles->id]) ?>
<?= $this->Html->link(__('Edit'), ['controller' => 'Articles', 'action' => 'edit', $articles->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['controller' => 'Articles', 'action' => 'delete', $articles->id], ['confirm' => __('Are you sure you want to delete # {0}?', $articles->id)]) ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
</div>
<div class="related">
<h4><?= __('Related Crisis') ?></h4>
<?php if (!empty($user->crisis)): ?>
<table cellpadding="0" cellspacing="0">
<tr>
<th><?= __('Id') ?></th>
<th><?= __('Abstract') ?></th>
<th><?= __('Severity') ?></th>
<th><?= __('Longitude') ?></th>
<th><?= __('Latitude') ?></th>
<th><?= __('State') ?></th>
<th><?= __('Address') ?></th>
<th><?= __('Type') ?></th>
<th><?= __('Hashtags') ?></th>
<th><?= __('Created') ?></th>
<th><?= __('Modified') ?></th>
<th><?= __('User Id') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
<?php foreach ($user->crisis as $crisis): ?>
<tr>
<td><?= h($crisis->id) ?></td>
<td><?= h($crisis->abstract) ?></td>
<td><?= h($crisis->severity) ?></td>
<td><?= h($crisis->longitude) ?></td>
<td><?= h($crisis->latitude) ?></td>
<td><?= h($crisis->state) ?></td>
<td><?= h($crisis->address) ?></td>
<td><?= h($crisis->type) ?></td>
<td><?= h($crisis->hashtags) ?></td>
<td><?= h($crisis->created) ?></td>
<td><?= h($crisis->modified) ?></td>
<td><?= h($crisis->user_id) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['controller' => 'Crisis', 'action' => 'view', $crisis->id]) ?>
<?= $this->Html->link(__('Edit'), ['controller' => 'Crisis', 'action' => 'edit', $crisis->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['controller' => 'Crisis', 'action' => 'delete', $crisis->id], ['confirm' => __('Are you sure you want to delete # {0}?', $crisis->id)]) ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
</div>
<div class="related">
<h4><?= __('Related Infos') ?></h4>
<?php if (!empty($user->infos)): ?>
<table cellpadding="0" cellspacing="0">
<tr>
<th><?= __('Id') ?></th>
<th><?= __('Title') ?></th>
<th><?= __('Body') ?></th>
<th><?= __('Crisis Id') ?></th>
<th><?= __('User Id') ?></th>
<th><?= __('Created') ?></th>
<th><?= __('Modified') ?></th>
<th><?= __('Type') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
<?php foreach ($user->infos as $infos): ?>
<tr>
<td><?= h($infos->id) ?></td>
<td><?= h($infos->title) ?></td>
<td><?= h($infos->body) ?></td>
<td><?= h($infos->crisis_id) ?></td>
<td><?= h($infos->user_id) ?></td>
<td><?= h($infos->created) ?></td>
<td><?= h($infos->modified) ?></td>
<td><?= h($infos->type) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['controller' => 'Infos', 'action' => 'view', $infos->id]) ?>
<?= $this->Html->link(__('Edit'), ['controller' => 'Infos', 'action' => 'edit', $infos->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['controller' => 'Infos', 'action' => 'delete', $infos->id], ['confirm' => __('Are you sure you want to delete # {0}?', $infos->id)]) ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
</div>
</div>

@ -11,7 +11,7 @@
/* footer */
.footer {
margin-top: 10.5%;
margin-top: 5%;
background-color: #303030;
text-align: center;
font-size: 1.2rem;

@ -41,6 +41,46 @@
font-weight: normal;
display:inline;
margin-right: 10px}
.crisis-panel-abstract {
font-weight: normal;
display:inline;
margin-right: 10px}
.crisis-panel-title.small {
font-weight: bold;
font-size: 1rem;
display:inline;
margin-bottom: 1px;
margin-right: 10px;
margin-left: 10px}
.crisis-panel-date.small {
font-weight: normal;
font-size: 0.9rem;
display:inline;
margin-bottom: 1px;
margin-right: 10px}
.crisis-panel-state.small {
font-weight: normal;
font-size: 0.9rem;
display:inline;
margin-bottom: 1px;
margin-right: 10px}
.crisis-panel-abstract.small {
font-weight: normal;
font-size: 0.75rem;
margin-right: 10px;
margin-left: 10px;
margin-top: 1px;
margin-bottom: 1px}
.spotted-panel{
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);}
.verified-panel{
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);}
.submit-form {

@ -0,0 +1,7 @@
/***********/
/* Top bar */
/***********/
.topbar-separator {
border-bottom : 1px solid rgba(255, 255, 255, 0.7) !important;
}

@ -25,14 +25,14 @@
-webkit-appearance: none;
-moz-appearance: none;
border-radius: 1000px;
border-radius: 0px;
border-style: solid;
border-width: 0;
cursor: pointer;
font-family: Heavitas;
font-weight: normal;
line-height: normal;
line-height: normal;
margin: 0 0 1rem;
margin-top: 12px;
position: relative;
@ -41,7 +41,7 @@
display: inline-block;
padding: 0.625rem 1.25rem 0.6875rem 1.25rem;
font-size: 0.6875rem;
font-size: 0.8125rem;
background-color: #008CBA;
border-color: #007095;
@ -49,11 +49,12 @@
transition: background-color 300ms ease-out;
width: 100%;
background: #bfd255; /* Old browsers */
background: -moz-linear-gradient(top, #bfd255 0%, #8eb92a 50%, #72aa00 51%, #9ecb2d 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, #bfd255 0%,#8eb92a 50%,#72aa00 51%,#9ecb2d 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #bfd255 0%,#8eb92a 50%,#72aa00 51%,#9ecb2d 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
background: rgb(67,172,106); /* Old browsers */
background: -moz-linear-gradient(top, rgba(67,172,106,1) 0%, rgba(67,198,135,1) 43%, rgba(67,172,106,1) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgba(67,172,106,1) 0%,rgba(67,198,135,1) 43%,rgba(67,172,106,1) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgba(67,172,106,1) 0%,rgba(67,198,135,1) 43%,rgba(67,172,106,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#43ac6a', endColorstr='#43ac6a',GradientType=0 ); /* IE6-9 */
}
.log-in-button:hover {
@ -61,5 +62,5 @@
}
.log-in-button:focus {
color: #030303;
color: #020202;
}

131
webroot/css/users_view.css Normal file

@ -0,0 +1,131 @@
/**************/
/* Users view */
/*************/
/* edit button */
.edit-button {
-webkit-appearance: none;
-moz-appearance: none;
border-radius: 0px;
border-style: solid;
border-width: 0;
cursor: pointer;
font-family: Heavitas;
font-weight: normal;
line-height: normal;
margin: 0 0 1rem;
margin-top: 12px;
position: relative;
text-align: center;
text-decoration: none;
display: inline-block;
padding: 0.875rem 1.75rem 0.9375rem 1.75rem;
font-size: 0.8125rem;
background-color: #008CBA;
border-color: #007095;
transition: background-color 300ms ease-out;
background: rgb(67,172,106); /* Old browsers */
background: -moz-linear-gradient(top, rgba(67,172,106,1) 0%, rgba(67,198,135,1) 43%, rgba(67,172,106,1) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, rgba(67,172,106,1) 0%,rgba(67,198,135,1) 43%,rgba(67,172,106,1) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, rgba(67,172,106,1) 0%,rgba(67,198,135,1) 43%,rgba(67,172,106,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#43ac6a', endColorstr='#43ac6a',GradientType=0 ); /* IE6-9 */
}
}
.log-in-button:hover {
color: #030303;
}
.log-in-button:focus {
color: #020202;
}
.edit-button a {
color: white ;
}
/* profile card */
.profile-card {
padding: 1rem;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
margin: 2rem 0;
background-color: #fff;
}
.profile-card img {
width: 8rem;
display: block;
margin: 2rem auto;
text-align: center;
border-radius: 50%;
box-shadow: 2px 2px 5px #888888;
}
.profile-card .profile-info {
padding: 1rem;
}
.profile-card .profile-info h4 {
margin-top: 0;
text-align: center;
text-transform: uppercase;
}
.profile-card .profile-info p {
text-align: center;
}
.profile-card .profile-info .inline-list {
text-align: center;
margin-bottom: 1rem;
}
.profile-card .profile-info .inline-list li {
float: none;
display: inline-block;
}
.profile-card .profile-info .inline-list i.fi-social-facebook {
font-size: 1.5rem;
color: #3b5998;
}
.profile-card .profile-info .inline-list i.fi-social-facebook:hover {
transform: scale(1.5);
transition: all .5s ease-in-out;
}
.profile-card .profile-info .inline-list i.fi-social-twitter {
font-size: 1.5rem;
color: #55acee;
}
.profile-card .profile-info .inline-list i.fi-social-twitter:hover {
transform: scale(1.5);
transition: all .5s ease-in-out;
}
.profile-card .profile-info .inline-list i.fi-social-linkedin {
font-size: 1.5rem;
color: #0077b5;
}
.profile-card .profile-info .inline-list i.fi-social-linkedin:hover {
transform: scale(1.5);
transition: all .5s ease-in-out;
}
.profile-card .profile-info .inline-list i.fi-social-github {
font-size: 1.5rem;
color: #333;
}
.profile-card .profile-info .inline-list i.fi-social-github:hover {
transform: scale(1.5);
transition: all .5s ease-in-out;
}
.profile-card .profile-info .inline-list i.fi-social-youtube {
font-size: 1.5rem;
color: #cc181e;
}
.profile-card .profile-info .inline-list i.fi-social-youtube:hover {
transform: scale(1.5);
transition: all .5s ease-in-out;
}

BIN
webroot/img/test.png Normal file

Binary file not shown.

After

(image error) Size: 28 KiB