/home
/deploy
/EHungry-2-joel
/Web
/classes
/CustomerOrder.class.php
public static function getPreviousOrdersForRestaurant($customer_id, int $restaurant_id, $limit = 4) {
$query = self::getPreviousOrdersQuery($customer_id);
$query->where('restaurant_id', $restaurant_id);
return $query->limit($limit)->get()->all();
}
private static function getPreviousOrdersQuery(int $customer_id) {
$query = self::where('customer_id', $customer_id);
$query->where('server_ready_at', '<=', DB::raw('NOW()'));
if (isSpringroll()) {
$query->where('is_on_springroll', true);
}
$query->orderBy('created_at', 'desc');
return $query;
}
<<<<<<< HEAD
//TODO: can we place this inside a getDeliveryDistance() instead? would the hidden update cause any trouble?
public function calculateDeliveryDistance() {
if ($this->getShouldHaveDeliveryAddress()) {
if ($this->delivery_distance) {
return $this->delivery_distance;
}
$distanceAddress = $this->getAddressObject()->getGeocoderAddress();
$geocoords = $this->getDeliveryCoordinates();
if ($geocoords) {
$restaurant = $this->restaurant;
$distance = ZipCode::getDistanceBetweenPoints($geocoords[0], $geocoords[1], $restaurant->latitude, $restaurant->longitude, $restaurant->id, $this->account->use_km, $distanceAddress);
if ($distance === false || $distance === '' || $distance === null) {
return 'Unknown';
} else {
$this->update(['delivery_distance' => $distance]);
return $distance;
}
} else {
Arguments
"syntax error, unexpected '<<' (T_SL), expecting function (T_FUNCTION) or const (T_CONST)"
/home
/deploy
/EHungry-2-joel
/PHP
/vendor
/composer
/ClassLoader.php
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
return null;
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
Arguments
"/home/deploy/EHungry-2-joel/PHP/vendor/composer/../../../Web/classes/CustomerOrder.class.php"
/home
/deploy
/EHungry-2-joel
/Web
/classes
/Cart.class.php
$counter++;
}
return $selectedTime;
};
//going forward by each hour, check for an open time
$selectedTime = $findOpenTime($selectedTime, '+60 Minute', $limit);
//opened sometime in last hour. If open 30 minutes ago, check the 30 before that, otherwise check last 30 minutes
$thrityAgo = strtotime('-30 Minute', $selectedTime);
if (!$this->getIsClosedAtTime($restaurant, $thrityAgo, $menu, false, $ignoreMenuTime)) {
$thrityAgo = strtotime('-60 Minute', $selectedTime);
}
return $findOpenTime($thrityAgo, '+1 Minute', 30);
}
public function getNextOpenTimeForAnyType($restaurant, $time = false) {
$tmpOt = $this->getBaseOrderType();
$nextOpenTime = null;
foreach (CustomerOrder::TYPES_CAMEL as $type => $typeCamel) {
if ($restaurant->{'getHas' . $typeCamel . 'Base'}()) {
$this->setBaseOrderType($type);
$newNextOpenTime = $this->getNextOpenTime($restaurant, $time ?: $restaurant->getLocalTime(), true, true);
$nextOpenTime = !$nextOpenTime || $newNextOpenTime < $nextOpenTime ? $newNextOpenTime : $nextOpenTime;
}
}
$this->setBaseOrderType($tmpOt);
return $nextOpenTime;
}
public function getNextOpenTimeForType($restaurant, $type, $time = false) {
$tmpOt = $this->getBaseOrderType();
$this->setBaseOrderType($type);
$nextOpenTime = $this->getNextOpenTime($restaurant, $time ?: $restaurant->getLocalTime(), true, true);
$this->setBaseOrderType($tmpOt);
return $nextOpenTime;
}
/*public function isItemInOrder($mid = NULL) {
if(!$mid) return false;
Arguments
/home
/deploy
/EHungry-2-joel
/Web
/eds
/ordering
/restaurant.php
$nextOpenTime = \Cache::Get($closedUntilKey);
} else {
$isOrderingClosed = isOrderingClosed(CLOSED_MSG_RESTAURANT);
$orderingClosedUntil = isOrderingClosed(CLOSED_MSG_RESTAURANT, true);
$orderingClosedUntilTimestamp = is_numeric($orderingClosedUntil)? $orderingClosedUntil : false;
$isOpen = !$isOrderingClosed && ($restaurant->pickupAvailableNow() || $restaurant->deliveryAvailableNow());
if ($restaurant->getPublicOrderingClosedUntil()) {
$hasAvailableDays =
$restaurant->hasAvailableDays($restaurant->getLocalTime(), $cart->getBaseOrderType());
if ($hasAvailableDays) {
$nextOpenTime = $cart->getNextOpenTimeForAnyType($restaurant, $orderingClosedUntilTimestamp);
if (date('giA', $nextOpenTime) > date('giA', $earliestOpen)) {
$earliestOpen = $nextOpenTime;
}
} else {
$orderingClosedUntil = 'Indefinitely';
$nextOpenTime = strtotime('+100 years');
}
} else {
$nextOpenTime = $cart->getNextOpenTimeForAnyType($restaurant, $orderingClosedUntilTimestamp);
}
$opensSoon =
!$isOpen && $orderingClosedUntil !== 'Indefinitely' && date('Y-m-d', $nextOpenTime) == date('Y-m-d', $restaurant->getLocalTime());
if ($isOpen) {
$closeTimestamp = $restaurant->getLatestEffectiveCloseTime($restaurant->getLocalTime());
\Cache::Set($openUntilKey, $closeTimestamp);
} elseif ($opensSoon) {
\Cache::Set($opensSoonKey, $nextOpenTime);
\Cache::Set($orderingClosedUntilKey, $orderingClosedUntil);
} else {
\Cache::Set($closedUntilKey, $nextOpenTime);
\Cache::Set($orderingClosedUntilKey, $orderingClosedUntil);
}
}
ob_start();
echo Label(
array_merge(
Arguments
/home
/deploy
/EHungry-2-joel
/Web
/templates4.0
/customer
/header.php
<div class="<?=$_REQUEST['form'] == 'home' ? 'home_hero' : 'menu_hero'?> backbgbox position-relative" role="img" aria-label="Image of food offered at the restaurant">
<? include(CORE_PATH. 'templates4.0/customer/logo.php'); ?>
</div>
<? // Restaurant open status & phone
if (is_object($restaurant)) { ?>
<div class="p-3">
<div class="pb-1">
<h1 role="heading" aria-level="2" class="eds-display-text-title-s m-0 p-0"><?=$restaurant->getDisplayName()?></h1>
<? if (isSpringroll()) { ?>
<p class="eds-copy-text-m-regular m-0">
<?=$restaurant->getFullAddress(false)?>
</p>
<? } ?>
</div>
<div class="d-sm-flex align-items-baseline">
<? if (!is_object($_REQUEST['_TEMPLATE_SETTINGS']['hide_open_sign']) || !$_REQUEST['_TEMPLATE_SETTINGS']['hide_open_sign'] || !$_REQUEST['_TEMPLATE_SETTINGS']['hide_open_sign']->getValue()) { ?>
<div class="mt-2">
<?=\EDS\Restaurant::openStatus([], $cart, $restaurant, !isSpringroll(), true, isSpringroll())?>
</div>
<? } ?>
<div class="d-flex gap-2 ms-sm-auto mt-2">
<? if (!is_object($_REQUEST['_TEMPLATE_SETTINGS']['hide_open_sign']) || !$_REQUEST['_TEMPLATE_SETTINGS']['hide_open_sign']->getValue()) { ?>
<?=\EDS\Restaurant::storeInfo(['class' => 'col text-nowrap'], 'Store info', $restaurant)?>
<? } ?>
<? if (!isSpringroll() && $account && isCMO($account)) { ?>
<?=\EDS\Restaurant::phone(['class' => 'col d-lg-none text-nowrap'], 'Call us', $restaurant)?>
<? } ?>
<? if (\RAHCampaign::isActiveForRestaurant($restaurant)) { ?>
<?=\RAHCampaign::badge(true)?>
<? } ?>
</div>
</div>
</div>
<? } ?>
</section>
Arguments
[]
Cart {}
Restaurant {}
false
true
true
/home
/deploy
/EHungry-2-joel
/Web
/controllers
/customer.php
}
if (!isset($cart) || !is_object($cart)) {
$GLOBALS['cart'] = \Cart::getCurrent();
}
//unset callback data in the event someone didn't hit the callback validation page
if (!in_array($_REQUEST['form'], ['checkout', 'nosuchpage', 'validatecallback', 'viewdeliveryzone'])) {
//TODO: probably need to add one more form here that is called ajax, callback seems to reset when it shouldnt
unset($_SESSION['validation_data']);
}
$locs = $account->getActiveRestaurants('position');
$tab = MainNavigationTab::getAllForAccount($account->getId());
include_once(CORE_PATH.'lib/helpers/customer3.0.php');
if (!in_array($_REQUEST['form'], $viewContentOnly)) {
App::debugbarTime('header');
include_once(getLayoutPartPath('header'));
App::debugbarTime('header');
}
App::debugbarTime("view '{$_REQUEST['form']}'");
$path = CORE_PATH.'view' . ($_REQUEST['_VERSION'] == 4 ? 4 : 3) . '.0/customer/'.$_REQUEST['form'].'.php';
if (is_readable($path)) {
include_once($path);
}
App::debugbarTime("view '{$_REQUEST['form']}'");
if (!in_array($_REQUEST['form'], $viewContentOnly)) {
App::debugbarTime('footer');
include_once(getLayoutPartPath('footer'));
App::debugbarTime('footer');
}
function getLayoutPartPath($part) {
if (isset($_REQUEST['_CORDOVA_APP']) && $_REQUEST['_VERSION'] != 4) {
$cart = Cart::getCurrent();
Arguments
"/home/deploy/EHungry-2-joel/Web/templates4.0/customer/header.php"
/home
/deploy
/EHungry-2-joel
/Web
/index.php
App::startTime();
ErrorHandlers::register();
// Global.php is the core setup file for the application
App::debugbarTime('Global.php');
require(dirname(__DIR__) . '/PHP/Global.php');
App::debugbarTime('Global.php');
/** @var string $controller The main controller - defined at /PHP/Global.php */
App::debugbarTime('Sentry - controller');
ErrorHandlers::sentryInit($controller); //doesn't always do much - not every controller has a Sentry project
App::debugbarTime('Sentry - controller');
App::debugbarTime("controller: $controller");
apache_note('AppController', $controller);
if (file_exists(CORE_PATH."lib/helpers/$controller.php")) {
require CORE_PATH."lib/helpers/$controller.php";
}
require CORE_PATH."controllers/$controller.php";
App::debugbarTime("controller: $controller");
Arguments
"/home/deploy/EHungry-2-joel/Web/controllers/customer.php"