forked from science-ation/science-ation
Fix import and display issues
This commit is contained in:
parent
76f2d5c214
commit
cefdfbe868
@ -98,7 +98,7 @@ if (get_value_from_array($_POST, 'save') == 'edit' || get_value_from_array($_POS
|
|||||||
|
|
||||||
/* Get info about science head */
|
/* Get info about science head */
|
||||||
// FIX ME
|
// FIX ME
|
||||||
$split = explode(' ', get_value_from_array($_POST, 'principal') ?? '', 2);
|
$split = explode(' ', get_value_from_array($_POST, 'principal', ''), 2);
|
||||||
|
|
||||||
if (count($split) === 2) {
|
if (count($split) === 2) {
|
||||||
list($first, $last) = $split;
|
list($first, $last) = $split;
|
||||||
@ -181,7 +181,7 @@ if (get_value_from_array($_POST, 'save') == 'edit' || get_value_from_array($_POS
|
|||||||
$stmt->execute([
|
$stmt->execute([
|
||||||
get_value_from_array($_POST, 'school'),
|
get_value_from_array($_POST, 'school'),
|
||||||
get_value_from_array($_POST, 'schoollang'),
|
get_value_from_array($_POST, 'schoollang'),
|
||||||
get_value_from_array($_POST, 'designate'), // FIXED: Corrected key name
|
get_value_from_array($_POST, 'designate', ''),
|
||||||
get_value_from_array($_POST, 'schoollevel'),
|
get_value_from_array($_POST, 'schoollevel'),
|
||||||
get_value_from_array($_POST, 'board'),
|
get_value_from_array($_POST, 'board'),
|
||||||
get_value_from_array($_POST, 'district'),
|
get_value_from_array($_POST, 'district'),
|
||||||
@ -192,13 +192,13 @@ if (get_value_from_array($_POST, 'save') == 'edit' || get_value_from_array($_POS
|
|||||||
get_value_from_array($_POST, 'schoolemail'),
|
get_value_from_array($_POST, 'schoolemail'),
|
||||||
get_value_from_array($_POST, 'phone'),
|
get_value_from_array($_POST, 'phone'),
|
||||||
get_value_from_array($_POST, 'fax'),
|
get_value_from_array($_POST, 'fax'),
|
||||||
get_value_from_array($_POST, 'registration_password'),
|
get_value_from_array($_POST, 'registration_password', ''),
|
||||||
get_value_from_array($_POST, 'projectlimit'),
|
get_value_from_array($_POST, 'projectlimit', 0),
|
||||||
get_value_from_array($_POST, 'projectlimitper'),
|
get_value_from_array($_POST, 'projectlimitper', 0),
|
||||||
get_value_from_array($_POST, 'accesscode'),
|
get_value_from_array($_POST, 'accesscode'),
|
||||||
get_value_from_array($_POST, 'sciencehead'), // FIXED: Using function for consistency
|
get_value_from_array($_POST, 'sciencehead'),
|
||||||
get_value_from_array($_POST, 'principal'),
|
get_value_from_array($_POST, 'principal'),
|
||||||
get_value_from_array($_POST, 'atrisk'),
|
get_value_from_array($_POST, 'atrisk', 'no'),
|
||||||
get_value_from_array($_POST, 'id')
|
get_value_from_array($_POST, 'id')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -263,6 +263,7 @@ if (get_value_from_array($_GET, 'action') == 'edit' || get_value_from_array($_GE
|
|||||||
echo '<option value="">' . i18n('Choose') . "</option>\n";
|
echo '<option value="">' . i18n('Choose') . "</option>\n";
|
||||||
|
|
||||||
foreach ($config['languages'] AS $k => $l) {
|
foreach ($config['languages'] AS $k => $l) {
|
||||||
|
$sel = ($r->schoollang == $k) ? 'selected="selected"' : '';
|
||||||
echo "<option $sel value=\"$k\">" . i18n($l) . "</option>\n";
|
echo "<option $sel value=\"$k\">" . i18n($l) . "</option>\n";
|
||||||
}
|
}
|
||||||
echo '</select>';
|
echo '</select>';
|
||||||
|
@ -58,7 +58,7 @@ if (get_value_from_array($_POST, 'action') == 'import') {
|
|||||||
$row = explode(',', $raw_row[0]);
|
$row = explode(',', $raw_row[0]);
|
||||||
|
|
||||||
for ($n = 0; $n < count($row); $n++) {
|
for ($n = 0; $n < count($row); $n++) {
|
||||||
$row[$n] = trim($row[$n]);
|
$row[$n] = trim(trim($row[$n]), '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
// $email = $row[16];
|
// $email = $row[16];
|
||||||
@ -110,23 +110,23 @@ if (get_value_from_array($_POST, 'action') == 'import') {
|
|||||||
$stmt->bindParam(':registration_password', $row[13]);
|
$stmt->bindParam(':registration_password', $row[13]);
|
||||||
$stmt->bindParam(':projectlimit', $row[14]);
|
$stmt->bindParam(':projectlimit', $row[14]);
|
||||||
$stmt->bindParam(':projectlimitper', $row[15]);
|
$stmt->bindParam(':projectlimitper', $row[15]);
|
||||||
$stmt->bindParam(':year', $row[16]);
|
$stmt->bindParam(':year', $config['FAIRYEAR']);
|
||||||
$stmt->bindParam(':principal_uid', $principal['uid']);
|
$stmt->bindParam(':principal_uid', $principal['uid']);
|
||||||
$stmt->bindParam(':sciencehead_uid', $scienceHead['uid']);
|
$stmt->bindParam(':sciencehead_uid', $scienceHead['uid']);
|
||||||
|
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
if (!$pdo->errorInfo())
|
if ($pdo->errorInfo() != '00000') {
|
||||||
$loaded++;
|
$loaded++;
|
||||||
else
|
} else {
|
||||||
show_pdo_errors_if_any($pdo);
|
show_pdo_errors_if_any($pdo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
echo happy(i18n('Successfully loaded %1 schools', array($loaded)));
|
echo happy(i18n('Successfully loaded %1 schools', array($loaded)));
|
||||||
echo '<a href="schools.php">' . i18n('School Management') . '</a> <br />';
|
echo '<a href="schools.php">' . i18n('School Management') . '</a> <br />';
|
||||||
} else {
|
} else {
|
||||||
echo error(i18n('Found no CSV data in the uploaded file'));
|
echo error(i18n('Found no CSV data in the uploaded file'));
|
||||||
}
|
}
|
||||||
print_r($data);
|
|
||||||
} else {
|
} else {
|
||||||
echo error(i18n('Please choose a valid CSV file to upload'));
|
echo error(i18n('Please choose a valid CSV file to upload'));
|
||||||
$showform = true;
|
$showform = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user