Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
canap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SI-FSD
canap
Commits
152fdddd
Commit
152fdddd
authored
6 years ago
by
nicrausaz
Browse files
Options
Downloads
Patches
Plain Diff
update file
parent
23d6c383
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
canapEPFL/cible.php
+0
-2
0 additions, 2 deletions
canapEPFL/cible.php
canapEPFL/helpers.php
+22
-7
22 additions, 7 deletions
canapEPFL/helpers.php
canapEPFL/templates/formParts/edit/annexes.php
+0
-44
0 additions, 44 deletions
canapEPFL/templates/formParts/edit/annexes.php
with
22 additions
and
53 deletions
canapEPFL/cible.php
+
0
−
2
View file @
152fdddd
...
@@ -31,8 +31,6 @@
...
@@ -31,8 +31,6 @@
// TODO: check if i can pass only candidateData
// TODO: check if i can pass only candidateData
$candidateData
=
uploadAllFiles
(
$filesPath
,
$candidateData
->
fichiers
,
$candidateData
);
$candidateData
=
uploadAllFiles
(
$filesPath
,
$candidateData
->
fichiers
,
$candidateData
);
// print_r($candidateData->fichiers);
// insert files in DB
// insert files in DB
insertFiles
(
$pdo
,
$candidateData
->
fichiers
,
$candidateId
,
$candidateData
->
rootpath
);
insertFiles
(
$pdo
,
$candidateData
->
fichiers
,
$candidateId
,
$candidateData
->
rootpath
);
...
...
This diff is collapsed.
Click to expand it.
canapEPFL/helpers.php
+
22
−
7
View file @
152fdddd
...
@@ -475,14 +475,29 @@ function updatePostulation ($pdo, $posted_data) {
...
@@ -475,14 +475,29 @@ function updatePostulation ($pdo, $posted_data) {
}
}
insertTrainings
(
$pdo
,
$to_add
,
$posted_data
->
id
);
insertTrainings
(
$pdo
,
$to_add
,
$posted_data
->
id
);
// Update files
// Update files
foreach
(
$posted_files
as
$key
=>
$file
)
{
$sqlreq
=
"UPDATE file SET file_path=:file_path
$file_data
=
getOneFile
(
$pdo
,
$file
[
'id'
],
$posted_data
->
id
);
WHERE fk_applicant_id=:applicant_id AND file_id=:file_id"
;
if
(
!
move_uploaded_file
(
$file
[
'tmp_name'
],
$file_data
[
'file_path'
]))
{
// Erreur: Le fichier est ouvert
foreach
(
$posted_files
as
$key
=>
$file
)
{
$_SESSION
[
'edit_error'
][
'files'
]
=
"Erreur lors du remplacement du fichier"
.
$_FILES
[
'file'
.
$i
][
'name'
]
.
", réessayez plus tard."
;
$file_data
=
getOneFile
(
$pdo
,
$file
[
'id'
],
$posted_data
->
id
);
$extension
=
strtolower
(
"."
.
pathinfo
(
$file
[
'name'
])[
'extension'
]);
$path
=
preg_replace
(
'/\\.[^.\\s]{3,4}$/'
,
''
,
$file_data
[
'file_path'
])
.
$extension
;
if
(
!
move_uploaded_file
(
$file
[
'tmp_name'
],
$path
))
{
// Erreur: Le fichier est ouvert
echo
"err"
;
$_SESSION
[
'edit_error'
][
'files'
]
=
"Erreur lors du remplacement d'un fichier, réessayez plus tard."
;
}
else
{
// success, update db
$query
=
$pdo
->
prepare
(
$sqlreq
);
$query
->
bindParam
(
':applicant_id'
,
$posted_data
->
id
,
PDO
::
PARAM_INT
);
$query
->
bindParam
(
':file_path'
,
$path
,
PDO
::
PARAM_STR
);
$query
->
bindParam
(
':file_id'
,
$file_data
[
'file_id'
],
PDO
::
PARAM_STR
);
$query
->
execute
();
// TODO: old delete file ?
}
}
}
}
// header('Location: viewpostulation.php');
// header('Location: viewpostulation.php');
}
}
#endregion
#endregion
...
...
This diff is collapsed.
Click to expand it.
canapEPFL/templates/formParts/edit/annexes.php
+
0
−
44
View file @
152fdddd
...
@@ -4,9 +4,7 @@
...
@@ -4,9 +4,7 @@
<small>
Remplacez ou ajouter des annexes (le fichier actuel est conservé si il n'est pas remplacé)
</small>
<small>
Remplacez ou ajouter des annexes (le fichier actuel est conservé si il n'est pas remplacé)
</small>
<br>
<br>
<small>
Formats autorisés:
<b>
PDF, JPG, JPEG, PNG
</b></small>
<small>
Formats autorisés:
<b>
PDF, JPG, JPEG, PNG
</b></small>
<!-- Annexes obligatoires -->
<div
class=
"form-group mt-3"
id=
"files"
>
<div
class=
"form-group mt-3"
id=
"files"
>
<?php
foreach
(
$files
as
$key
=>
$file
)
{
<?php
foreach
(
$files
as
$key
=>
$file
)
{
$name
=
preg_replace
(
'/\\.[^.\\s]{3,4}$/'
,
''
,
$file
[
'file_name'
]);
$name
=
preg_replace
(
'/\\.[^.\\s]{3,4}$/'
,
''
,
$file
[
'file_name'
]);
?>
?>
...
@@ -22,47 +20,5 @@
...
@@ -22,47 +20,5 @@
<small
class=
"error"
class=
"form-text text-muted"
></small>
<small
class=
"error"
class=
"form-text text-muted"
></small>
</div>
</div>
<?php
}
?>
<?php
}
?>
<!-- / Annexes obligatoires -->
<!-- Annexes spécifiques -->
<!-- <div class="form-group" id="polyOnly">
<label for="gimch">Attestation de tests d'aptitudes GIM-CH (polymécanicien):</label>
<input type="file" name="gimch" class="upload-input" id="gimch" onchange="changeTitleFile(this)"/>
<br>
<label for="gimch" class="btn btn-secondary btn-sm icon-right">
Remplacer...
</label>
<br>
<small class="error" class="form-text text-muted"></small>
</div> -->
<!-- <div class="form-group" id="griTest">
<label for="griTestInput">Attestation de tests d'aptitudes GRI (informaticien):</label>
<input type="file" name="griTestInput" class="upload-input" id="griTestInput" onchange="changeTitleFile(this)"/>
<br>
<label for="griTestInput" class="btn btn-secondary btn-sm icon-right">
Remplacer...
</label>
<br>
<small class="error" class="form-text text-muted"></small>
</div> -->
<!-- / Annexes spécifiques -->
<!-- Annexes supplémentaires -->
<!-- <div class="form-group">
<table id="newCertifZone">
<tr>
<td>
<label for="certifs1">Certificats, diplômes et bulletins de notes des derniers 3-4 semestres:</label>
<input type="file" name="certifs1" class="upload-input" id="certifs1" onchange="changeTitleFile(this)"/>
<br>
<label for="certifs1" class="btn btn-secondary btn-sm icon-right">
Remplacer...
</label>
<br>
<small class="error" class="form-text text-muted"></small>
</td>
</tr>
</table>
</div> -->
<button
type=
"button"
class=
"btn btn-primary btn-sm mt-3 mb-2"
id=
"addInputFile"
>
Ajouter une annexe
</button>
<button
type=
"button"
class=
"btn btn-primary btn-sm mt-3 mb-2"
id=
"addInputFile"
>
Ajouter une annexe
</button>
<!-- region/ Annexes supplémentaires -->
</div>
</div>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment