/** * Returns the Data of the user that should be deleted * @return Array */ protected function userToDeleteGet($userId) { $userToDeleteRes = TableMng::querySingleEntry("SELECT forename, name, credit, birthday,\n\t\t\t\tCONCAT(g.gradelevel, '-', g.label) AS grade\n\t\t\tFROM SystemUsers u\n\t\t\tLEFT JOIN (\n\t\t\t\t\tSELECT g.gradelevel AS gradelevel, g.label AS label,\n\t\t\t\t\t\tuigs.userId AS userId\n\t\t\t\t\tFROM SystemAttendances uigs\n\t\t\t\t\tJOIN SystemGrades g ON uigs.gradeId = g.ID\n\t\t\t\t\tWHERE uigs.schoolyearId = @activeSchoolyear\n\t\t\t\t) g ON g.userId = u.ID\n\t\t\tWHERE u.ID = {$userId}", true); if (count($userToDeleteRes)) { return $userToDeleteRes; } else { throw new Exception('Konnte die Benutzerdaten nicht abrufen'); } }
public function execute($dataContainer) { //No direct access defined('_WEXEC') or die("Access denied"); require_once PATH_ACCESS . '/UserManager.php'; require_once PATH_ACCESS . '/FitsManager.php'; require_once PATH_ACCESS . '/GlobalSettingsManager.php'; $this->entryPoint($dataContainer); $smarty = $dataContainer->getSmarty(); $userManager = new UserManager(); $fitsManager = new FitsManager(); $gsm = new GlobalSettingsManager(); $has_Fits = false; try { $userDetails = TableMng::querySingleEntry(sprintf('SELECT u.*, (SELECT CONCAT(g.gradelevel, g.label) AS class FROM SystemAttendances uigs LEFT JOIN SystemGrades g ON uigs.gradeId = g.ID WHERE uigs.userId = u.ID AND uigs.schoolyearId = @activeSchoolyear) AS class FROM SystemUsers u WHERE `ID` = %s', $_SESSION['uid']), true); $userClass = $userDetails['class']; $fitsManager->prepUser($_SESSION['uid']); $has_Fits = $fitsManager->getFits($_SESSION['uid']); $class = $gsm->getFitsClass(); $allClasses = $gsm->getFitsAllClasses(); } catch (Exception $e) { $this->_logger->log('Error executing Fits: ' . $e->getMessage(), 'Notice', Null, ''); $this->_interface->dieError('Konnte Fits nicht ausführen.'); } if ($allClasses == true) { $userClass = preg_replace('/[^0-9]/i', '', $userClass); $class = preg_replace('/[^0-9]/i', '', $class); } if (isset($userClass) && $userClass == $class && $has_Fits == false) { $smarty->assign('showTestlink', true); } if ($has_Fits == true) { $smarty->assign('hasFits', true); } $smarty->assign('uid', $_SESSION['uid']); $smarty->display($this->smartyPath . 'menu.tpl'); }
/** * Checks if First Password in GlobalSettings enabled * * Dies when Error occured during fetching * * @return boolean If the User should input a new Password on First Login */ protected function isFirstPasswordEnabled() { try { $data = TableMng::querySingleEntry('SELECT value FROM SystemGlobalSettings WHERE name = "firstLoginChangePassword"'); } catch (Exception $e) { $this->_interface->dieError(_g('Could not check if first ' . 'Password on Login is enabled!')); } if (!count($data)) { return false; } else { return (bool) $data['value']; } }
/** * Returns the Count of Meals the User has ordered at that date * * @param int $userId The ID of the User * @param string $date The Date of the User, format DD-MM-YYYY * @return string The Count of Orders */ protected function orderCountOfDayByUserGet($userId, $date) { $row = TableMng::querySingleEntry("SELECT COUNT(*) AS count FROM BabeskOrders o\n\t\t\tJOIN BabeskMeals m ON m.ID = o.MID\n\t\t\tWHERE o.UID = '{$userId}' AND m.date = '{$date}'"); return $row['count']; }
/** * Returns the ID of the "NoGrade"-Grade * * Dies if Grade not found or multiple Entries returned * * @return string The ID of the Grade */ protected function noGradeIdGet() { try { $row = TableMng::querySingleEntry('SELECT ID FROM SystemGrades WHERE gradelevel = 0'); } catch (MultipleEntriesException $e) { $this->errorDie(_g('Multiple Grades with gradelevel "0" found!')); } catch (Exception $e) { $this->errorDie(_g('Could not find the ID of the "NoGrade"-Grade')); } if (!isset($row) || !count($row)) { $this->errorDie(_g('Could not find the ID of the "NoGrade"-Grade')); } return $row['ID']; }
protected function getSchoolYear() { try { $schoolyear = TableMng::querySingleEntry("SELECT * FROM SystemSchoolyears WHERE ID = {$_GET['ID']}"); } catch (Exception $e) { $this->_interface->dieError(_g('Could not fetch the Schoolyear from the Database')); } return $schoolyear; }