protected function dataFetch() { TableMng::query('SET @activeSy := (SELECT ID FROM SystemSchoolyears WHERE active = "1");'); $this->_data = TableMng::query('SELECT st.ID AS schooltypeId, st.token AS schooltypeToken, g.gradelevel, userChosen.classesChosen, COUNT(*) AS userCount FROM SystemGrades g -- SystemSchooltypes (optional, splits gradelevels in schooltypes if -- needed) LEFT JOIN SystemSchooltypes st ON g.schooltypeId = st.ID -- Fetch how many classes the user has chosen INNER JOIN ( SELECT COUNT(*) AS classesChosen, uigs.gradeId AS gradeId FROM SystemAttendances uigs INNER JOIN KuwasysUsersInClassesAndCategories uicc ON uigs.userId = uicc.UserID INNER JOIN KuwasysClasses c ON c.ID = uicc.ClassID AND c.isOptional = 0 -- Check for interesting status INNER JOIN ( SELECT ID FROM KuwasysUsersInClassStatuses WHERE name="active" ) status ON status.ID = uicc.statusId WHERE uigs.schoolyearId = @activeSchoolyear GROUP BY uicc.UserID ) userChosen ON userChosen.gradeId = g.ID GROUP BY st.ID, g.gradelevel, userChosen.classesChosen'); }
public function execute($dataContainer) { //no direct access defined('_AEXEC') or die("Access denied"); require_once 'AdminCardInfoProcessing.php'; require_once 'AdminCardInfoInterface.php'; $interface = $dataContainer->getInterface(); $cardInfoInterface = new AdminCardInfoInterface($this->relPath); $cardInfoProcessing = new AdminCardInfoProcessing($cardInfoInterface); if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['card_ID'])) { $uid = $cardInfoProcessing->CheckCard($_POST['card_ID']); $userData = $cardInfoProcessing->GetUserData($uid); $cardInfoInterface->ShowCardInfo($userData, $_POST['card_ID']); } else { if (isset($_GET['lostcard'])) { TableMng::query(sprintf("UPDATE BabeskCards SET lost=1 WHERE cardnumber = '%s'", $_GET['lostcard'])); $interface->dieMsg("Karte wurde verloren gemeldet!"); $uid = $cardInfoProcessing->CheckCard($_GET['lostcard']); $userData = $cardInfoProcessing->GetUserData($uid); $cardInfoInterface->ShowCardInfo($userData, $_GET['lostcard']); } else { $cardInfoInterface->CardId(); } } }
/** * */ public function GetSumOfCardChanges() { require_once PATH_INCLUDE . '/TableMng.php'; TableMng::init(); $temp = TableMng::query('SELECT SUM(changed_cardID) FROM BabeskCards'); return $temp[0]["SUM(changed_cardID)"]; }
public function __construct() { if (!isset($_SESSION)) { $this->initEnvironment(); } else { if (!validSession()) { die(_g('The session is invalid, please login again')); } } try { $this->initSmarty(); TableMng::init(); $this->_adminInterface = new AdminInterface(NULL, $this->_smarty); // AdminInterface has used global $smarty, workaround AdminInterface::$smartyHelper = $this->_smarty; $this->_moduleExecutionParser = new ModuleExecutionInputParser(); $this->_moduleExecutionParser->setSubprogramPath('root/administrator'); $this->loadVersion(); $this->initDatabaseConnections(); $this->_logger = new Logger($this->_pdo); $this->_logger->categorySet('Administrator'); $this->_acl = new Acl($this->_logger, $this->_pdo); } catch (MySQLConnectionException $e) { die('Sorry, could not connect to the database.'); } }
protected static function dataFetch($userIds) { $query = 'SELECT CONCAT(u.forename, " ", u.name) AS userFullname, u.ID as userId, uic.statusId AS statusId, sy.label AS schoolyear, c.label AS classLabel, cu.name AS unitName, cu.translatedName AS unitTranslatedName, uics.translatedName AS statusTranslatedName, CONCAT(g.gradelevel, g.label) AS gradeName, IF(c.ID, CONCAT(u.ID, "-", c.ID), CONCAT(u.ID, "-")) AS grouper FROM SystemUsers u JOIN SystemAttendances uigs ON uigs.userId = u.ID JOIN SystemSchoolyears sy ON sy.ID = uigs.SchoolYearID JOIN KuwasysTemporaryRequestsAssign uic ON u.ID = uic.userId AND ( uic.statusId = 1 OR uic.statusId = 0 ) LEFT JOIN KuwasysUsersInClassStatuses uics ON uics.ID = uic.statusId LEFT JOIN KuwasysClasses c ON c.ID = uic.classId AND c.schoolyearId = @activeSchoolyear LEFT JOIN SystemGrades g ON g.ID = uigs.gradeId LEFT JOIN KuwasysClassCategories cu ON c.unitId = cu.ID WHERE uigs.schoolyearId = @activeSchoolyear GROUP BY grouper ;'; try { $data = TableMng::query($query); } catch (MySQLVoidDataException $e) { self::$_interface->dieError('Es wurden keine Schüler gefunden, für die man die Dokumente hätte erstellen können'); } catch (Exception $e) { self::$_interface->dieError('konnte die Daten der Schüler nicht abrufen' . $e->getMessage()); } return $data; }
/** * Fetches the data needed to create the Tables from the Database * @param $classIds array() an array of Ids of classes to fetch */ protected static function dataFetch() { $query = 'SELECT CONCAT(u.forename, " ", u.name) AS userFullname, u.telephone AS telephone, u.ID AS userId, c.label AS classLabel, c.ID AS classId, CONCAT(g.gradelevel, g.label) AS grade, CONCAT(ct.forename, " ", ct.name) AS classteacherFullname, cu.name AS categoryName, cu.translatedName AS translatedCategoryName FROM KuwasysClasses c INNER JOIN KuwasysUsersInClassesAndCategories uicc ON uicc.ClassID = c.ID INNER JOIN SystemUsers u ON uicc.UserID = u.ID INNER JOIN KuwasysClassesInCategories cic ON cic.classId = c.ID LEFT JOIN SystemAttendances uigs ON uigs.UserID = u.ID LEFT JOIN SystemGrades g ON uigs.gradeId = g.ID LEFT JOIN KuwasysClassteachersInClasses ctic ON ctic.ClassID = c.ID LEFT JOIN KuwasysClassteachers ct ON ctic.ClassTeacherID = ct.ID LEFT JOIN KuwasysClassCategories cu ON cu.ID = cic.categoryId WHERE uicc.statusId = (SELECT ID FROM KuwasysUsersInClassStatuses WHERE KuwasysUsersInClassStatuses.name="active") AND uigs.schoolyearId = @activeSchoolyear AND c.schoolyearId = @activeSchoolyear;'; try { $data = TableMng::query($query); } catch (Exception $e) { self::$_interface->dieError('Konnte die benötigten Daten nicht abrufen. Fehler:' . $e->getMessage()); } return $data; }
/** * Fetches the appropriate Userdata neede to Display all of them * * This function gets invoked by an Javascript-Script. It parses the data * and fetches userdata in one Query. It sends JSON-encoded data back. * * @uses $_POST['pagenumber'] The pagenumber to be displayed * @uses $_POST['usersPerPage'] How many Users are displayed per Page * @uses $_POST['sortFor'] What column should be sorted * @uses $_POST['filterForCol'] What Column should be filtered * @uses $_POST['filterForVal'] The value to filter for */ public function fetchUsersOrganized() { $pagenumber = $_POST['pagenumber']; $usersPerPage = $_POST['usersPerPage']; $sortFor = $_POST['sortFor']; $filterForVal = $_POST['filterForVal']; $toEscape = array(&$pagenumber, &$usersPerPage, &$sortFor, &$filterForVal); TableMng::sqlEscapeByArray($toEscape); $userToStart = ($pagenumber - 1) * $usersPerPage; if (empty($_POST['columnsToFetch'])) { $columnsToFetch = array(); } else { $columnsToFetch = $_POST['columnsToFetch']; foreach ($columnsToFetch as &$col) { TableMng::sqlEscape($col); } } $filterForColumns = array(); if (!empty($_POST['filterForColumns'])) { foreach ($_POST['filterForColumns'] as &$col) { TableMng::sqlEscape($col); } $filterForColumns = $_POST['filterForColumns']; } //When joining multiple tables, we have multiple IDs if ($filterForVal == 'ID') { $filterForVal = 'u.ID'; } //When user didnt select anything to sort For, default to Id if (empty($sortFor)) { $sortFor = 'ID'; } //Set the method of sorting $sortMethod = $_POST['sortMethod'] == 'ASC' ? 'ASC' : 'DESC'; try { $queryCreator = new UserDisplayAllQueryCreator($this->_pdo, $filterForColumns, $sortFor, $sortMethod, $userToStart, $usersPerPage); $query = $queryCreator->createQuery($columnsToFetch, $sortFor, $filterForVal); $countQuery = $queryCreator->createCountOfQuery($columnsToFetch, $sortFor, $filterForVal); // var_dump($query); // die(); //Fetch the Userdata TableMng::query('SET @activeSy := (SELECT ID FROM SystemSchoolyears WHERE active = "1");'); $data = TableMng::query($query); $usercount = TableMng::query($countQuery); // No division by zero, never show zero sites if ($usersPerPage != 0 && $usercount[0]['count'] > 0) { $pagecount = ceil((int) $usercount[0]['count'] / (int) $usersPerPage); } else { $pagecount = 1; } $data = $this->fetchedDataToReadable($data, $columnsToFetch); } catch (Exception $e) { $this->_logger->log('Error processing the data', 'Error', Null, json_encode(array('msg' => $e->getMessage()))); die(json_encode(array('value' => 'error', 'message' => 'Ein Fehler ist bei der Datenverarbeitung ' . 'aufgetreten.'))); } die(json_encode(array('value' => 'data', 'users' => $data, 'pagecount' => $pagecount))); }
/** * Fetches a date-modifier indicating when the Orders are canceable * * @return string The Date */ protected function lastOrdercancelDatemodGet() { try { $data = TableMng::query('SELECT * FROM SystemGlobalSettings WHERE name = "ordercancelEnddate"'); } catch (Exception $e) { $this->_interface->dieError('Error fetching ordercancelEnddate!'); } if (count($data)) { return $data[0]['value']; } else { $this->_interface->dieError('ordercancelEnddate ist nicht gesetzt! Administrator verständigen.'); } }
/** * Returns some generic user data for identifying a card */ public function GetUserData($uid) { try { $data = TableMng::query(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', $uid)); } catch (MySQLVoidDataException $e) { $this->cardInfoInterface->dieError('Der Benutzer wurde nicht gefunden'); } catch (Exception $e) { $this->cardInfoInterface->dieError('Der Benutzer konnte nicht von der Datenbanke abgerufen werden!'); } return $data[0]; }
protected static function dataFetch($gradeId, $userIds) { $whereQuery = ''; foreach ($userIds as $uid) { $whereQuery .= sprintf('u.ID = %s OR ', $uid); } $whereQuery = rtrim($whereQuery, 'OR '); $query = sprintf('SELECT CONCAT(u.forename, " ", u.name) AS userFullname, u.ID as userId, sy.label AS schoolyear, c.label AS classLabel, cu.name AS unitName, cu.translatedName AS unitTranslatedName, uics.translatedName AS statusTranslatedName, CONCAT(g.gradelevel, g.label) AS gradeName, IF( c.ID, CONCAT(u.ID, "-", c.ID, "-", cu.ID), CONCAT(u.ID, "-") ) AS grouper FROM SystemUsers u INNER JOIN SystemAttendances uigs ON uigs.userId = u.ID INNER JOIN SystemSchoolyears sy ON sy.ID = uigs.schoolyearId INNER JOIN KuwasysUsersInClassesAndCategories uicc ON u.ID = uicc.UserID LEFT JOIN KuwasysUsersInClassStatuses uics ON uics.ID = uicc.statusId LEFT JOIN KuwasysClasses c ON c.ID = uicc.ClassID AND c.schoolyearId = @activeSchoolyear LEFT JOIN KuwasysClassesInCategories cic ON cic.classId = c.ID LEFT JOIN SystemGrades g ON g.ID = uigs.gradeId LEFT JOIN KuwasysClassCategories cu ON cic.categoryId = cu.ID WHERE uigs.schoolyearId = @activeSchoolyear AND (uics.ID IS NULL OR uics.name = "active") AND (uicc.UserID IS NULL OR uicc.categoryId = cic.categoryId) GROUP BY grouper ORDER BY g.gradelevel, g.label, cu.ID ;', $gradeId); try { $data = TableMng::query($query); } catch (MySQLVoidDataException $e) { self::$_interface->dieError('Es wurden keine Schüler gefunden, für die man die Dokumente hätte erstellen können'); } catch (Exception $e) { self::$_interface->dieError('konnte die Daten der Schüler nicht abrufen' . $e->getMessage()); } return $data; }
/** * Generates the executePath from the module name and gets the module ID. * Result is stored in adminBookmarks * @todo: Works with one sublevel only. Have to extend it... (count the pipes, make things relative to that...) * @todo: 4 bookmarks possible atm. more? * @todo: no drag&drop sortable for bookmark list */ protected function saveBookmark() { if (!isset($_POST['moduleId'])) { die('error'); } try { TableMng::query("update SystemAdminBookmarks set bmid = '0' WHERE bmid='1' AND uid=" . $_SESSION['UID']); TableMng::query("update SystemAdminBookmarks set bmid = '1' WHERE bmid='2' AND uid=" . $_SESSION['UID']); TableMng::query("update SystemAdminBookmarks set bmid = '2' WHERE bmid='3' AND uid=" . $_SESSION['UID']); TableMng::query("update SystemAdminBookmarks set bmid = '3' WHERE bmid='4' AND uid=" . $_SESSION['UID']); $stmt = $this->_pdo->prepare('INSERT INTO SystemAdminBookmarks (uid, bmid, mid) VALUES (?, "4", ?)'); $stmt->execute(array($_SESSION['UID'], $_POST['moduleId'])); TableMng::query("delete from SystemAdminBookmarks WHERE bmid = '0' AND uid=" . $_SESSION['UID']); } catch (Exception $e) { $this->_logger->log('Could not add a bookmark', 'Notice', Null, json_encode(array('msg' => $e->getMessage()))); die('error'); } }
protected function dataFetch() { $this->_gradeData = TableMng::query('SELECT COUNT(uicc.ID) AS gradelevelCount, gradelevel AS gradelevel FROM SystemGrades g INNER JOIN SystemAttendances uigs ON g.ID = uigs.gradeId AND uigs.schoolyearId = @activeSchoolyear INNER JOIN KuwasysUsersInClassesAndCategories uicc ON uicc.UserID = uigs.userId INNER JOIN KuwasysClasses c ON c.ID = uicc.ClassID AND c.schoolyearId = @activeSchoolyear AND c.isOptional = 0 INNER JOIN ( SELECT ID FROM KuwasysUsersInClassStatuses WHERE name="active" ) status ON status.ID = uicc.statusId GROUP BY g.gradelevel '); }
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'); }
protected function dataFetch() { $this->_gradeData = TableMng::query('SELECT COUNT(*) AS gradeCount, CONCAT(g.gradelevel, "-", g.label) AS gradeName FROM SystemGrades g INNER JOIN SystemAttendances uigs ON uigs.gradeId = g.ID AND uigs.schoolyearId = @activeSchoolyear INNER JOIN KuwasysUsersInClassesAndCategories uicc ON uicc.statusId = ( SELECT ID FROM KuwasysUsersInClassStatuses WHERE name="active" ) AND uicc.userId = uigs.userId INNER JOIN KuwasysClasses c ON c.ID = uicc.ClassID AND c.schoolyearId = @activeSchoolyear AND c.isOptional = 0 GROUP BY g.ID ORDER BY g.gradelevel, g.label '); }
protected function dataFetch() { $this->_schoolyearData = TableMng::query('SELECT COUNT(*) AS classCount, sy.ID AS id, sy.label AS label FROM SystemGrades g INNER JOIN SystemAttendances uigs ON g.ID = uigs.gradeId INNER JOIN KuwasysUsersInClassesAndCategories uicc ON uicc.UserID = uigs.userId INNER JOIN SystemSchoolyears sy INNER JOIN KuwasysClasses c ON c.ID = uicc.ClassID AND c.schoolyearId = sy.ID AND c.isOptional = 0 INNER JOIN ( SELECT ID FROM KuwasysUsersInClassStatuses WHERE name="active" ) status ON status.ID = uicc.statusId GROUP BY sy.ID '); }
protected function dataFetch() { $this->_schoolyearData = TableMng::query('SELECT COUNT(*) AS userCount, uniqueUsersPerSchoolyear.id AS id, uniqueUsersPerSchoolyear.label AS label FROM (SELECT sy.ID AS id, uicc.UserID as userId, sy.label AS label FROM SystemSchoolyears sy INNER JOIN KuwasysUsersInClassesAndCategories uicc INNER JOIN KuwasysClasses c ON c.ID = uicc.ClassID AND c.schoolyearId = sy.ID AND c.isOptional = 0 WHERE uicc.statusId = ( SELECT ID FROM KuwasysUsersInClassStatuses uics WHERE name = "active" ) GROUP BY uicc.userId, sy.ID ) uniqueUsersPerSchoolyear GROUP BY uniqueUsersPerSchoolyear.id'); }
protected function groupsGetAllWithCheckIsUserIn($userId) { $groups = TableMng::query("SELECT ID, name,\n\t\t\t(SELECT COUNT(*) AS count FROM SystemUsersInGroups uig\n\t\t\t\tWHERE g.ID = uig.groupId AND uig.userId = {$userId})\n\t\t\t\t\tAS isUserIn\n\t\t\tFROM SystemGroups g"); return $groups; }
private function markMsgAsRead($msgReceiverId) { $db = TableMng::getDb(); $query = sprintf('UPDATE MessageReceivers SET `read` = "1" WHERE ID = "%s";', $db->real_escape_string($msgReceiverId)); if ($db->query($query)) { return; } else { $this->_interface->DieError('Konnte die Nachricht nicht als gelesen markieren' . $db->error); } }
/** * Deletes a Template from the Database * * Dies if an Error occured in the Process * * @param int $id the ID of the Template to delete */ protected function templateDeleteFromDb($id) { try { TableMng::query(sprintf('DELETE FROM MessageTemplate WHERE `ID` = %s', $id)); } catch (Exception $e) { $this->_interface->dieError('Konnte die Nachricht nicht löschen'); } }
private function rebmemer2() { // REBMEMER IS REMEMBER BACKWARDS, BECAUSE IT DOES THE OPPOSITE (and i like it... ;P) if (!isset($_GET['class'])) { die("ERROR: No Class selected."); } else { $classId = $_GET['class']; $classNamelabel = TableMng::query("SELECT label FROM SystemGrades WHERE ID='{$classId}'"); $classNamelabel = $classNamelabel[0]["label"]; $classNamelevel = TableMng::query("SELECT gradelevel FROM SystemGrades WHERE ID='{$classId}'"); $classNamelevel = $classNamelevel[0]["gradelevel"]; $className = "{$classNamelevel}{$classNamelabel}"; $studentIDs = $this->getStudentIDsOfClass($classId); $nrOfStudentIDs = count($studentIDs); // excluded from for loop to increase speed.... (dont like it? channge it...) $name = $forename = $books = []; foreach ($studentIDs as $userId) { $user = $this->_em->getReference('DM:SystemUsers', $userId); $name[] = $this->getNameOfStudentId($userId); $forename[] = $this->getForenameOfStudentId($userId); $books[] = $this->_loanHelper->loanBooksOfUserGet($user); } $listOfClasses = $this->getListOfClasses("rebmemer2"); } $this->SchbasAccountingInterface->showRebmemerList2($name, $forename, $books, $nrOfStudentIDs - 1, $className, $listOfClasses); }
protected function infotextsFetch() { $data = TableMng::query('SELECT * FROM SystemGlobalSettings WHERE name = "menu_text1" OR name = "menu_text2"'); if (count($data) == 2) { foreach ($data as $infotext) { if ($infotext['name'] == 'menu_text1') { $this->_infotext1 = $infotext['value']; } else { $this->_infotext2 = $infotext['value']; } } } else { throw new Exception('Could not fetch Infotexts'); } }
/** * Deletes the Order-Entry (and SoliOrder-Entry) in the Db * * @param int $orderId The ID of the Order to delete */ protected function orderDbEntryDelete($orderId) { TableMng::query("DELETE FROM BabeskOrders WHERE ID = {$orderId}"); if ($this->_isSoli) { TableMng::query("DELETE FROM BabeskSoliOrders WHERE ID = {$orderId}"); } }
protected function isEnabledUpdateEntry($isEnabled) { $ie = $isEnabled ? '1' : '0'; try { TableMng::query(sprintf('UPDATE SystemGlobalSettings SET value = "%s" WHERE name = "schooltypeEnabled"', $ie)); } catch (Exception $e) { $this->_interface->dieError('Konnte die Schultypen nicht (de-)aktivieren'); } }
/** * Changes the global Setting messageEditGroupId to the $newGroupId * * dies when error occured while changing the group * * @param int $newGroupId the Id of the new group thats allowed to edit * Messages */ protected function authorGroupChangeCommit($newGroupId) { try { TableMng::query(sprintf('UPDATE SystemGlobalSettings SET `value` = "%s" WHERE `name` = "messageEditGroupId"', $newGroupId)); if (TableMng::getDb()->affected_rows == 0) { TableMng::query(sprintf('INSERT INTO SystemGlobalSettings (`value`, `name`) VALUES ("%s", "messageEditGroupId")', $newGroupId)); } } catch (Exception $e) { $this->_interface->dieError('Konnte die Gruppe nicht verändern'); } }
/** * Fetches all Schoolyears and returns them * * @return array The fetched Schoolyears */ private function schoolyearsGetAll() { $schoolyears = TableMng::query('SELECT * FROM SystemSchoolyears'); return $schoolyears; }
/** * Escapes the string for MySQL * * Usage: '<index>' => 'sql_escape' * * @access protected * @author Pascal Ernst <*****@*****.**> * @param string $value * @param array $params * @return string */ protected function filter_sql_escape($value, $params = NULL) { $locValue = $value; if (class_exists('TableMng')) { TableMng::sqlEscape($locValue); } else { trigger_error('TableMng not existing in gump!'); } return $locValue; }
/** * Removes a Message from the Database by the ID given * * It also removes the links to this Message in the Tables * MessageReceivers and MessageManagers. * * @param int $id the ID of the message to remove */ protected function messageDeleteFromDb($id) { try { TableMng::getDb()->autocommit(false); $query = sprintf('DELETE FROM MessageMessages WHERE `ID` = %s; DELETE FROM MessageReceivers WHERE `messageId` = %s; DELETE FROM MessageManagers WHERE `messageId` = %s;', $id, $id, $id); TableMng::queryMultiple($query); TableMng::getDb()->autocommit(true); } catch (Exception $e) { $this->_interface->dieError('Konnte die Nachricht nicht löschen!'); } }
/** * 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']; }
/** * Removes Expired Temporary files * @return int The count of removed Entries */ protected static function removeExpired() { $now = self::toDatetime(time()); $oldEntries = TableMng::query("SELECT * FROM SystemTemporaryFiles WHERE until < '{$now}'"); $deletedEntries = 0; if (count($oldEntries)) { foreach ($oldEntries as $entry) { $temp = TemporaryFile::load($entry['ID']); $temp->remove(); $deletedEntries += 1; } } return $deletedEntries; }
/** * Fetches the Price that soli-users should pay when ordering meals * * Saves it into the protected variable $_soliprice */ protected static function solipriceFetch() { try { $res = TableMng::query('SELECT value FROM SystemGlobalSettings WHERE name = "soli_price"'); } catch (Exception $e) { throw new Exception('Could not fetch the soliprice'); } self::$_soliprice = $res[0]['value']; }