Third version of the VileSci interface that allows easily to add more prestudent

to a group or change their stufe
This commit is contained in:
Paolo
2017-03-21 18:29:25 +01:00
parent 8d50b16413
commit 1615470a8f
3 changed files with 178 additions and 20 deletions
+46 -5
View File
@@ -36,6 +36,41 @@ class Users extends VileSci_Controller
$users = $returnUsers->retval;
}
// Gruppen
$this->load->model('organisation/Gruppe_model', 'GruppeModel');
$this->GruppeModel->addOrder('beschreibung');
$gruppen = $this->GruppeModel->loadWhere(array('aktiv' => true, 'aufnahmegruppe' => true));
if (hasData($gruppen))
{
// Adding an empty element at the beginning
$emptyElement = new stdClass();
$emptyElement->gruppe_kurzbz = '-1';
$emptyElement->beschreibung = 'Select a group...';
array_unshift($gruppen->retval, $emptyElement);
}
else
{
show_error($gruppen->retval);
}
// Stufe
$this->load->model('crm/Reihungstest_model', 'ReihungstestModel');
$this->ReihungstestModel->addSelect('DISTINCT ON(stufe) stufe, stufe AS beschreibung');
$this->ReihungstestModel->addOrder('stufe');
$stufen = $this->ReihungstestModel->loadWhere('stufe IS NOT NULL');
if (hasData($stufen))
{
// Adding an empty element at the beginning
$emptyElement = new stdClass();
$emptyElement->stufe = '-1';
$emptyElement->beschreibung = 'Select a stufe...';
array_unshift($stufen->retval, $emptyElement);
}
else
{
show_error($stufen->retval);
}
if ($returnUsers == null || isSuccess($returnUsers))
{
$viewData = array(
@@ -44,7 +79,9 @@ class Users extends VileSci_Controller
'gruppe' => $gruppe,
'reihungstest' => $reihungstest,
'stufe' => $stufe,
'users' => $users
'users' => $users,
'gruppen' => $gruppen->retval,
'stufen' => $stufen->retval
);
$this->load->view('system/users', $viewData);
@@ -67,11 +104,12 @@ class Users extends VileSci_Controller
if (isSuccess($result))
{
echo "Tutto ok!";
$href = str_replace("/system/Users/linkToStufe", "/system/Users", $_SERVER["REQUEST_URI"]);
echo "<div>Data correctly saved - <a href=\"" . $href . "\">Back</a></div>";
}
else
{
echo "Kaputt!";
echo "<div>Error occurred while saving data, please contact the administrator.</div>";
}
}
@@ -87,11 +125,12 @@ class Users extends VileSci_Controller
if (isSuccess($result))
{
echo "Tutto ok!";
$href = str_replace("/system/Users/linkToAufnahmegruppe", "/system/Users", $_SERVER["REQUEST_URI"]);
echo "<div>Data correctly saved - <a href=\"" . $href . "\">Back</a></div>";
}
else
{
echo "Kaputt!";
echo "<div>Error occurred while saving data, please contact the administrator.</div>";
}
}
@@ -112,7 +151,9 @@ class Users extends VileSci_Controller
sg.bezeichnung,
sg.orgform_kurzbz,
sgt.bezeichnung AS typ,
s.bezeichnung AS studienplan,
ps.rt_stufe,
aufnahmegruppe_kurzbz,
rtp.punkte'
);
+1
View File
@@ -653,6 +653,7 @@ class DB_Model extends FHC_Model
{
if (($isEntitled = $this->isEntitled($this->dbTable, $permission, FHC_NORIGHT, FHC_MODEL_ERROR)) !== true)
{
// TODO: resetQuery
return $isEntitled;
}
}
+131 -15
View File
@@ -19,13 +19,49 @@
</div>
<form id="linkUsersForm" action="" method="post">
<div>
Stufe: <input type="text" name="stufe" value=""> <button type="button" id="linkToStufe">To step</button>
</div>
<div>
Gruppe: <input type="text" name="aufnahmegruppe" value=""> <button type="button" id="linkToGruppe">To group</button>
</div>
<br>
<br>
<br>
<?php
if ($users != null)
{
?>
<div>
Assign to:<br>
<select id="linkToGruppe" name="aufnahmegruppe">
<?php foreach($gruppen as $v): ?>
<?php
$selected = '';
if ($v->gruppe_kurzbz == $selectedGruppe)
{
$selected = 'selected';
}
?>
<option value="<?php echo $v->gruppe_kurzbz; ?>" <?php echo $selected; ?>>
<?php echo $v->beschreibung; ?>
</option>
<?php endforeach; ?>
</select>
<select id="linkToStufe" name="stufe">
<?php foreach($stufen as $v): ?>
<?php
$selected = '';
if ($v->stufe == $selectedStufe)
{
$selected = 'selected';
}
?>
<option value="<?php echo $v->stufe; ?>" <?php echo $selected; ?>>
<?php echo $v->beschreibung; ?>
</option>
<?php endforeach; ?>
</select>
</div>
<?php
}
?>
<br>
<br>
@@ -33,20 +69,100 @@
<?php
if ($users != null)
{
?>
<table>
<thead>
<tr>
<th>&nbsp;</th>
<th>Prestudent ID</th>
<th>Person ID</th>
<th>Vorname</th>
<th>Nachname</th>
<th>Geschlecht</th>
<th>Studiengang</th>
<th>OrgForm</th>
<th>Studienplan</th>
<th>Geburtsdatum</th>
<th>Email</th>
<th>Stufe</th>
<th>Gruppe</th>
<th>Punkte</th>
</tr>
</thead>
<tbody>
<?php
for ($i = 0; $i < count($users); $i++)
{
$user = $users[$i];
echo '<input type="checkbox" name="prestudent_id[]" value="' . $user->prestudent_id . '"> - ';
echo $user->prestudent_id . ' - ';
echo $user->vorname . ' - ';
echo "<tr>";
echo "<td>";
echo '<input type="checkbox" name="prestudent_id[]" value="' . $user->prestudent_id . '">';
echo "</td>";
echo "<td>";
echo $user->prestudent_id;
echo "</td>";
echo "<td>";
echo $user->person_id;
echo "</td>";
echo "<td>";
echo $user->vorname;
echo "</td>";
echo "<td>";
echo $user->nachname;
echo '<br>';
echo "</td>";
echo "<td>";
echo $user->geschlecht;
echo "</td>";
echo "<td>";
echo $user->kurzbzlang;
echo "</td>";
echo "<td>";
echo $user->orgform_kurzbz;
echo "</td>";
echo "<td>";
echo $user->studienplan;
echo "</td>";
echo "<td>";
echo $user->gebdatum;
echo "</td>";
echo "<td>";
echo $user->email;
echo "</td>";
echo "<td>";
echo $user->rt_stufe;
echo "</td>";
echo "<td>";
echo $user->aufnahmegruppe_kurzbz;
echo "</td>";
echo "<td>";
echo $user->punkte;
echo "</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<?php
}
else
{
echo 'No data found!!!';
echo 'No users found.';
}
?>
</div>
@@ -62,7 +178,7 @@
$(document).ready(function() {
if ($("#linkToStufe"))
{
$("#linkToStufe").click(function() {
$("#linkToStufe").change(function() {
if ($("#linkUsersForm"))
{
$("#linkUsersForm").attr("action", "<?php echo $hrefLinkToStufe; ?>");
@@ -73,7 +189,7 @@
if ($("#linkToGruppe"))
{
$("#linkToGruppe").click(function() {
$("#linkToGruppe").change(function() {
if ($("#linkUsersForm"))
{
$("#linkUsersForm").attr("action", "<?php echo $hrefLinkToAufnahmegruppe; ?>");