<div class="large-4 columns end"> <script type="text/javascript"> var curUrl="<?php echo $this->createUrl('extras/order'); ?> "; var curUrlWithId="<?php echo $this->createUrl('extras/order', array('id' => $DeliveryDate->id)); ?> "; var selectedDate=<?php echo $DeliveryDate ? "'{$DeliveryDate->date}'" : 'null'; ?> ; var availableDates=<?php echo json_encode(SnapUtil::makeArray($AllDeliveryDates)); ?> ; </script> <div class="dropDown"> <h4 data-dropdown="calendarDropdown">Delivery Date: <strong><?php echo $DeliveryDate ? SnapFormat::date($DeliveryDate->date) : 'None Selected'; ?> </strong></h4> <div class="dropDownPanel" id="calendarDropdown"> <div class="delivery-date-picker"></div> <div class="item-list"> <h5>Your upcoming orders</h5> <?php foreach ($DeliveryDates as $DD) {
public function actionSearch() { $model = new Supplier('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Supplier'])) { $model->attributes = $_GET['Supplier']; } $criteria = new CDbCriteria(); $criteria->select = 'id,name,lattitude,longitude'; $Suppliers = $model->search(false)->getData(); //Build supplier array and supplier items in a format suitable for Mustache js $supplierArray = SnapUtil::makeArray($Suppliers); foreach ($Suppliers as $Supplier) { $supplierItems = SnapUtil::makeArray($Supplier->SupplierProducts); foreach ($supplierItems as $gi) { $supplierArray[$Supplier->id]['SupplierProducts'][] = $gi; } $supplierArray[$Supplier->id]['has_items'] = !empty($supplierArray[$Supplier->id]['SupplierProducts']) ? true : false; } echo json_encode($supplierArray); exit; }