Skip to content

Commit

Permalink
Merge 6d26fb1 into 0f34142
Browse files Browse the repository at this point in the history
  • Loading branch information
willkoua committed May 16, 2016
2 parents 0f34142 + 6d26fb1 commit 8532851
Show file tree
Hide file tree
Showing 5 changed files with 472 additions and 139 deletions.
39 changes: 28 additions & 11 deletions src/Controller/PagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ public function home()
);
$numberMissions = count($missions->toArray());

$fichiers = $this->_getImgCarousel();
$path = WWW_ROOT . "img/carousel/";
$fichiers = $this->_getImgagesDir($path);

$this->set(compact('numberUsers', 'numberProjects', 'numberMissions', 'numberStudents', 'fichiers'));
}
Expand Down Expand Up @@ -561,43 +562,59 @@ public function administration($img = null)
$organizations = $this->Organizations->find('all', ['conditions' => ['isValidated' => 0, 'isRejected' => 0]])->toArray();

//gestion des images du carousel
$path = WWW_ROOT . "img/carousel/";
$pathCar = WWW_ROOT . "img/carousel/";
$pathTV = WWW_ROOT . "img/tv/";

$request = $this->request;

if (is_file($path . $img)) {
unlink($path . $img);
if (is_file($pathCar . $img)) {
unlink($pathCar . $img);
}
if ($request->is('post') && !empty($request->data)) {
$image = $this->request->data['avatar_file'];
$hidden = $this->request->data('hidden');
$fileName = $image['name'];
$dim = null;

if (!empty($image['tmp_name']) && $image['type'] == 'image/png') {
$dim = getimagesize($image['tmp_name']);

if ($dim[0] >= 1920 && $dim[1] >= 1080) {
move_uploaded_file($image['tmp_name'], $path . $image['name']);
if ($hidden == 'car') {
move_uploaded_file($image['tmp_name'], $pathCar . $fileName);
}
if ($hidden == 'tv') {
if (preg_match("#tv[1-5]#", $fileName)) {
move_uploaded_file($image['tmp_name'], $pathTV . $fileName);
} else {
$this->Flash->error(__('rename image file (tv[1,2,3,4 or 5])'), ['key' => 'er_tv']);
}
}
} else {
$this->Flash->error('Erreur: fichier trop petit');
$this->Flash->error(__('image file size incorrect'), 'er_gene');
}
} else {
$this->Flash->error('Erreur: vérifier les conditions de tranfert de fichier');
$this->Flash->error(__('Error'), 'er_gene');
}
}
//fin gestion du carousel
$fichiers = $this->_getImgCarousel();
$this->set(compact('projects', 'organizations', 'fichiers'));
$filesCar = $this->_getImgagesDir($pathCar);
$filesTV = $this->_getImgagesDir($pathTV);
$this->set(compact('projects', 'organizations', 'filesCar', 'filesTV'));
}

/**
* GetImgCarousel method
*
* @param $path _getImgagesDir page
*
* @return array
*/
private function _getImgCarousel()
private function _getImgagesDir($path)
{
$fichiers = [];

if (false !== ($dossier = opendir(WWW_ROOT . "img/carousel/"))) {
if (false !== ($dossier = opendir($path))) {
while (false !== ($fichier = readdir($dossier))) {
if ($fichier != '.' && $fichier != '..' && $fichier != 'index.php') {
array_push($fichiers, $fichier);
Expand Down
266 changes: 265 additions & 1 deletion src/Locale/cake.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2016-04-01 15:00+0000\n"
"POT-Creation-Date: 2016-05-13 20:33+0000\n"
"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
"Last-Translator: NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
Expand All @@ -22,3 +22,267 @@ msgstr ""
msgid "Error"
msgstr ""

#: Controller/Component/AuthComponent.php:454
msgid "You are not authorized to access that location."
msgstr ""

#: Controller/Component/CsrfComponent.php:154
msgid "Missing CSRF token cookie"
msgstr ""

#: Controller/Component/CsrfComponent.php:158
msgid "CSRF token mismatch."
msgstr ""

#: Error/ExceptionRenderer.php:247
msgid "Not Found"
msgstr ""

#: Error/ExceptionRenderer.php:249
msgid "An Internal Error Has Occurred."
msgstr ""

#: I18n/Number.php:89
msgid "{0,number,#,###.##} KB"
msgstr ""

#: I18n/Number.php:91
msgid "{0,number,#,###.##} MB"
msgstr ""

#: I18n/Number.php:93
msgid "{0,number,#,###.##} GB"
msgstr ""

#: I18n/Number.php:95
msgid "{0,number,#,###.##} TB"
msgstr ""

#: I18n/Number.php:87
msgid "{0,number,integer} Byte"
msgid_plural "{0,number,integer} Bytes"
msgstr[0] ""
msgstr[1] ""

#: I18n/RelativeTimeFormatter.php:80
msgid "{0} from now"
msgstr ""

#: I18n/RelativeTimeFormatter.php:80
msgid "{0} ago"
msgstr ""

#: I18n/RelativeTimeFormatter.php:82
msgid "{0} after"
msgstr ""

#: I18n/RelativeTimeFormatter.php:82
msgid "{0} before"
msgstr ""

#: I18n/RelativeTimeFormatter.php:113
msgid "just now"
msgstr ""

#: I18n/RelativeTimeFormatter.php:150
msgid "about a second ago"
msgstr ""

#: I18n/RelativeTimeFormatter.php:151
msgid "about a minute ago"
msgstr ""

#: I18n/RelativeTimeFormatter.php:152
msgid "about an hour ago"
msgstr ""

#: I18n/RelativeTimeFormatter.php:153;328
msgid "about a day ago"
msgstr ""

#: I18n/RelativeTimeFormatter.php:154;329
msgid "about a week ago"
msgstr ""

#: I18n/RelativeTimeFormatter.php:155;330
msgid "about a month ago"
msgstr ""

#: I18n/RelativeTimeFormatter.php:156;331
msgid "about a year ago"
msgstr ""

#: I18n/RelativeTimeFormatter.php:166
msgid "in about a second"
msgstr ""

#: I18n/RelativeTimeFormatter.php:167
msgid "in about a minute"
msgstr ""

#: I18n/RelativeTimeFormatter.php:168
msgid "in about an hour"
msgstr ""

#: I18n/RelativeTimeFormatter.php:169;341
msgid "in about a day"
msgstr ""

#: I18n/RelativeTimeFormatter.php:170;342
msgid "in about a week"
msgstr ""

#: I18n/RelativeTimeFormatter.php:171;343
msgid "in about a month"
msgstr ""

#: I18n/RelativeTimeFormatter.php:172;344
msgid "in about a year"
msgstr ""

#: I18n/RelativeTimeFormatter.php:300
msgid "today"
msgstr ""

#: I18n/RelativeTimeFormatter.php:364
msgid "%s ago"
msgstr ""

#: I18n/RelativeTimeFormatter.php:365
msgid "on %s"
msgstr ""

#: I18n/RelativeTimeFormatter.php:47;125;312
msgid "{0} year"
msgid_plural "{0} years"
msgstr[0] ""
msgstr[1] ""

#: I18n/RelativeTimeFormatter.php:51;128;315
msgid "{0} month"
msgid_plural "{0} months"
msgstr[0] ""
msgstr[1] ""

#: I18n/RelativeTimeFormatter.php:57;131;318
msgid "{0} week"
msgid_plural "{0} weeks"
msgstr[0] ""
msgstr[1] ""

#: I18n/RelativeTimeFormatter.php:59;134;321
msgid "{0} day"
msgid_plural "{0} days"
msgstr[0] ""
msgstr[1] ""

#: I18n/RelativeTimeFormatter.php:64;137
msgid "{0} hour"
msgid_plural "{0} hours"
msgstr[0] ""
msgstr[1] ""

#: I18n/RelativeTimeFormatter.php:68;140
msgid "{0} minute"
msgid_plural "{0} minutes"
msgstr[0] ""
msgstr[1] ""

#: I18n/RelativeTimeFormatter.php:72;143
msgid "{0} second"
msgid_plural "{0} seconds"
msgstr[0] ""
msgstr[1] ""

#: Network/Response.php:1417
msgid "The requested file was not found"
msgstr ""

#: ORM/RulesChecker.php:49
msgid "This value is already in use"
msgstr ""

#: ORM/RulesChecker.php:83
msgid "This value does not exist"
msgstr ""

#: Utility/Text.php:731
msgid "and"
msgstr ""

#: Validation/Validator.php:103
msgid "This field is required"
msgstr ""

#: Validation/Validator.php:104
msgid "This field cannot be left empty"
msgstr ""

#: Validation/Validator.php:1447
msgid "The provided value is invalid"
msgstr ""

#: View/Helper/FormHelper.php:946
msgid "New %s"
msgstr ""

#: View/Helper/FormHelper.php:949
msgid "Edit %s"
msgstr ""

#: View/Helper/FormHelper.php:1756
msgid "Submit"
msgstr ""

#: View/Helper/HtmlHelper.php:770
msgid "Home"
msgstr ""

#: View/Widget/DateTimeWidget.php:530
msgid "January"
msgstr ""

#: View/Widget/DateTimeWidget.php:531
msgid "February"
msgstr ""

#: View/Widget/DateTimeWidget.php:532
msgid "March"
msgstr ""

#: View/Widget/DateTimeWidget.php:533
msgid "April"
msgstr ""

#: View/Widget/DateTimeWidget.php:534
msgid "May"
msgstr ""

#: View/Widget/DateTimeWidget.php:535
msgid "June"
msgstr ""

#: View/Widget/DateTimeWidget.php:536
msgid "July"
msgstr ""

#: View/Widget/DateTimeWidget.php:537
msgid "August"
msgstr ""

#: View/Widget/DateTimeWidget.php:538
msgid "September"
msgstr ""

#: View/Widget/DateTimeWidget.php:539
msgid "October"
msgstr ""

#: View/Widget/DateTimeWidget.php:540
msgid "November"
msgstr ""

#: View/Widget/DateTimeWidget.php:541
msgid "December"
msgstr ""

Loading

0 comments on commit 8532851

Please sign in to comment.