forked from science-ation/science-ation
Resolve issues with saving project information
This commit is contained in:
parent
c020136f10
commit
f978216b43
@ -72,6 +72,7 @@ switch ($action) {
|
||||
$q = $pdo->prepare("SELECT id FROM projects WHERE registrations_id='{$registrations_id}' AND year='{$config['FAIRYEAR']}'");
|
||||
$q->execute();
|
||||
$i = $q->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$id = $i['id'];
|
||||
|
||||
$stmt = $pdo->prepare("UPDATE projects SET projectnumber=NULL,projectsort=NULL,
|
||||
@ -80,8 +81,9 @@ switch ($action) {
|
||||
$stmt->execute();
|
||||
show_pdo_errors_if_any($pdo);
|
||||
list($pn, $ps, $pns, $pss) = generateProjectNumber($registrations_id);
|
||||
|
||||
// print("Generated Project Number [$pn]");
|
||||
$stmt = $pdo->prepare("UPDATE projects SET projectnumber='$pn',projectsort='$ps',
|
||||
$stmt = $pdo->prepare("UPDATE projects SET projectnumber='$pn',projectsort='$ps',
|
||||
projectnumber_seq='$pns',projectsort_seq='$pss'
|
||||
WHERE id='$id'");
|
||||
$stmt->execute();
|
||||
@ -138,23 +140,40 @@ function project_save()
|
||||
error_('Project title truncated to %1 characters', array($config['participant_project_title_charmax']));
|
||||
} else
|
||||
$title = stripslashes($_POST['title']);
|
||||
|
||||
$stmt = $pdo->prepare('UPDATE projects SET '
|
||||
. "title='" . iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $title) . "', "
|
||||
. "projectdivisions_id='" . intval($_POST['projectdivisions_id'] . "', "
|
||||
. "projecttype='" . stripslashes($_POST['projecttype']) . "', "
|
||||
. "language='" . stripslashes($_POST['language']) . "', "
|
||||
. "req_table='" . stripslashes($_POST['req_table']) . "', "
|
||||
. "req_electricity='" . stripslashes($_POST['req_electricity']) . "', "
|
||||
. "req_special='" . iconv('UTF-8', 'ISO-8859-1//TRANSLIT', stripslashes($_POST['req_special'])) . "', "
|
||||
. "human_participants='" . stripslashes($_POST['human_participants']) . "', "
|
||||
. "animal_participants='" . stripslashes($_POST['animal_participants']) . "', "
|
||||
. "summary='" . iconv('UTF-8', 'ISO-8859-1//TRANSLIT', stripslashes($_POST['summary'])) . "', "
|
||||
. "summarycountok='$summarycountok',"
|
||||
. "feedback='" . iconv('UTF-8', 'ISO-8859-1//TRANSLIT', stripslashes($_POST['feedback'])) . "', "
|
||||
. "projectsort='" . stripslashes($_POST['projectsort']) . "'"
|
||||
. "WHERE id='" . intval($_POST['id'])) . "'");
|
||||
|
||||
|
||||
$stmt = $pdo->prepare(
|
||||
'UPDATE projects SET
|
||||
title = :title,
|
||||
projectdivisions_id = :projectdivisions_id,
|
||||
projecttype = :projecttype,
|
||||
language = :language,
|
||||
req_table = :req_table,
|
||||
req_electricity = :req_electricity,
|
||||
req_special = :req_special,
|
||||
human_participants = :human_participants,
|
||||
animal_participants = :animal_participants,
|
||||
summary = :summary,
|
||||
summarycountok = :summarycountok,
|
||||
feedback = :feedback,
|
||||
projectsort = :projectsort
|
||||
WHERE id = :id'
|
||||
);
|
||||
|
||||
$stmt->bindValue(':title', $_POST['title']);
|
||||
$stmt->bindValue(':projectdivisions_id', intval($_POST['projectdivisions_id']));
|
||||
$stmt->bindValue(':projecttype', $_POST['projecttype']);
|
||||
$stmt->bindValue(':language', $_POST['language']);
|
||||
$stmt->bindValue(':req_table', $_POST['req_table']);
|
||||
$stmt->bindValue(':req_electricity', $_POST['req_electricity']);
|
||||
$stmt->bindValue(':req_special', $_POST['req_special']);
|
||||
$stmt->bindValue(':human_participants', $_POST['human_participants']);
|
||||
$stmt->bindValue(':animal_participants', $_POST['animal_participants']);
|
||||
$stmt->bindValue(':summary', $_POST['summary']);
|
||||
$stmt->bindValue(':summarycountok', $summarycountok);
|
||||
$stmt->bindValue(':feedback', $_POST['feedback']);
|
||||
$stmt->bindValue(':projectsort', $_POST['projectsort']);
|
||||
$stmt->bindValue(':id', intval($_POST['id']));
|
||||
|
||||
$stmt->execute();
|
||||
|
||||
show_pdo_errors_if_any($pdo);
|
||||
@ -291,7 +310,7 @@ function countwords()
|
||||
?>
|
||||
<tr>
|
||||
<td><?= i18n('Age Category') ?>: </td>
|
||||
<td><?= i18n(get_value_from_2d_array($agecategories, $projectcategories_id, 'category')) ?> (<?= i18n('Grades %1-%2', array($agecategories[$projectcategories_id]['mingrade'], $agecategories[$projectcategories_id]['maxgrade'])) ?>)</td>
|
||||
<td><?= i18n($agecategories[$projectcategories_id]['category']) ?> (<?= i18n('Grades %1-%2', array($agecategories[$projectcategories_id]['mingrade'], $agecategories[$projectcategories_id]['maxgrade'])) ?>)</td>
|
||||
</tr><tr>
|
||||
<td><?= i18n('Division') ?>: </td>
|
||||
<td>
|
||||
|
@ -498,14 +498,25 @@ function print_row($r)
|
||||
$pcl = 'style="cursor:pointer;" onclick="popup_editor(\'' . get_value_property_or_default($r, 'reg_id') . "','project');\"";
|
||||
|
||||
echo "<td $scl>{$status_text}</td>";
|
||||
echo "<td $scl>" . get_value_property_or_default($r, 'email') . '</td>';
|
||||
echo "<td $scl>" . get_value_property_or_default($r, 'reg_num') . '</td>';
|
||||
$pn = str_replace(' ', ' ', get_value_property_or_default($r, 'projectnumber', ''));
|
||||
echo "<td $scl>$pn</td>";
|
||||
echo "<td $pcl>" . get_value_property_or_default($r, 'title') . '</td>';
|
||||
// echo "<td $scl>" . get_value_property_or_default($r, 'email') . '</td>';
|
||||
// echo "<td $scl>" . get_value_property_or_default($r, 'reg_num') . '</td>';
|
||||
// $pn = str_replace(' ', ' ', get_value_property_or_default($r, 'projectnumber', ''));
|
||||
// echo "<td $scl>$pn</td>";
|
||||
// echo "<td $pcl>" . get_value_property_or_default($r, 'title') . '</td>';
|
||||
|
||||
// echo "<td $scl>" . i18n(get_value_from_array($cats, get_value_property_or_default($r, 'projectcategories_id'), '')) . '</td>';
|
||||
// echo "<td $scl>" . i18n(get_value_from_array($divs, get_value_property_or_default($r, 'projectdivisions_id', ''))) . '</td>';
|
||||
|
||||
echo "<td $scl>{$r->email}</td>";
|
||||
echo "<td $scl>{$r->reg_num}</td>";
|
||||
$pn = str_replace(' ', ' ', $r->projectnumber);
|
||||
echo "<td $scl>$pn</td>";
|
||||
echo "<td $pcl>{$r->title}</td>";
|
||||
|
||||
echo "<td $scl>".i18n($cats[$r->projectcategories_id])."</td>";
|
||||
echo "<td $scl>".i18n($divs[$r->projectdivisions_id])."</td>";
|
||||
|
||||
|
||||
echo "<td $scl>" . i18n(get_value_from_array($cats, get_value_property_or_default($r, 'projectcategories_id'), '')) . '</td>';
|
||||
echo "<td $scl>" . i18n(get_value_from_array($divs, get_value_property_or_default($r, 'projectdivisions_id', ''))) . '</td>';
|
||||
|
||||
$sq = $pdo->prepare("SELECT students.firstname,
|
||||
students.lastname,
|
||||
|
Loading…
x
Reference in New Issue
Block a user