/** * This function deletes a Group from the MySQL-table based on the given parameter ID * @param numeric_string $ID */ function DeleteGroup($ID) { require_once PATH_ACCESS . '/PriceClassManager.php'; $pcManager = new PriceClassManager(); try { //delete the priceclass $this->groupManager->delEntry($ID); } catch (Exception $e) { $this->groupInterface->dieError($this->msg['err_del_group'] . ' :' . $e->getMessage()); } try { //delete priceclasses which are connected to the groups $priceclasses = $pcManager->getTableData(sprintf('GID = %s', $ID)); } catch (Exception $e) { $this->groupInterface->dieError($this->msg['err_del_pc'] . ' :' . $e->getMessage()); } foreach ($priceclasses as $priceclass) { try { $pcManager->delEntry($priceclass['ID']); } catch (Exception $e) { $this->groupInterface->dieError($this->msg['err_del_pc'] . ' :' . $e->getMessage()); } } $this->groupInterface->dieMsg($this->msg['fin_del_group']); }
/** *reorganizes the meallist to: meallistweeksorted [Menu] [day] *@param meallist the meallist that should be reorganized *@return returns the reorganized meallist */ private function SortMeallist($meallist) { require_once PATH_ACCESS . '/PriceClassManager.php'; $priceclassmanager = new PriceClassManager(); if (!$meallist) { return false; } $weekday_name = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday', 'monday2', 'tuesday2', 'wednesday2', 'thursday2', 'friday2'); $weekday_date = array(); //at which day which date is, 0 is Monday, 1 Tuesday... //initialize weekdays for ($i = 0; $i < 12; $i++) { if ($i != 5 && $i != 6) { $weekday_date[$i] = $this->GetWeekday($i); } } //[A Row of meals(One week)] [day] [specific variable] $meallistweeksorted = array(); foreach ($meallist as &$meal) { for ($i = 0; $i < 12; $i++) { //Saturday and Sunday shall not be shown if ($i != 5 && $i != 6 && $meal["date"] == $weekday_date[$i]) { $pcn = $priceclassmanager->getPriceClassName($meal["price_class"]); $counter = 0; $countedPriceclassName = $this->addCounterToPriceclassName($meal["price_class"], $meallistweeksorted, $i, $weekday_name); $meallistweeksorted[$countedPriceclassName][$weekday_name[$i]]["description"] = $meal["description"]; $meallistweeksorted[$countedPriceclassName][$weekday_name[$i]]["title"] = $meal["name"]; $meallistweeksorted[$countedPriceclassName][$weekday_name[$i]]["priceclass"] = $pcn[0]["name"]; } } } return $meallistweeksorted; }
/** * Change Settings for Solis * Enter description here ... */ function ChangeSettings($soli_price) { require_once PATH_ACCESS . '/GlobalSettingsManager.php'; require_once PATH_ACCESS . '/PriceClassManager.php'; $gbManager = new GlobalSettingsManager(); $pcManager = new PriceClassManager(); die_error(SOLI_ERR_INP_PRICE); if ($soli_price !== NULL) { try { try { //inputcheck inputcheck($_POST['soli_price'], 'credits'); } catch (Exception $e) { die_error(SOLI_ERR_INP_PRICE); $this->soliInterface->dieError($this->msg['SOLI_ERR_INP_PRICE']); } $gbManager->changeSoliPrice($_POST['soli_price']); } catch (Exception $e) { die_error(SOLI_ERR_CHANGE_PRICE . ':' . $e->getMessage()); $this->soliInterface->dieError($this->msg['SOLI_ERR_CHANGE_PRICE '] . ':' . $e->getMessage()); } $this->soliInterface->dieMsg($this->msg['SOLI_FIN_CHANGE']); } else { try { $soli_price = $gbManager->getSoliPrice(); $priceclasses = $pcManager->getTableData(); } catch (Exception $e) { $this->soliInterface->dieError($this->msg['SOLI_ERR_PRICE']); } $this->soliInterface->ChangeSettings($soli_price, $priceclasses); } }
/** * This function shows the createMeal-Form with the variables already filled out */ function DuplicateMeal($name, $description, $pc_ID, $date, $max_orders) { require_once PATH_ACCESS . '/PriceClassManager.php'; $pcManager = new PriceClassManager(); try { $pc_arr = $pcManager->getAllPriceClassesPooled(); } catch (Exception $e) { $this->mealInterface->dieError($this->msg['err_no_pc'] . $e->getMessage()); } $pc_ids = array(); $pc_names = array(); foreach ($pc_arr as $pc) { $pc_ids[] = $pc['pc_ID']; $pc_names[] = $pc['name']; } $this->mealInterface->DuplicateMeal($pc_ids, $pc_names, $name, $description, $pc_ID, $max_orders, $date); }