public function testToArray() { $packages = new Packages(); $packages[] = $this->buildPackage('namespace1', ['path1.1', 'path1.2']); $packages[] = $this->buildPackage('namespace2', ['path2.1', 'path2.2']); $this->assertSame(['psr-4' => ['namespace1\\' => ['path1.1', 'path1.2'], 'namespace2\\' => ['path2.1', 'path2.2']]], $packages->toArray()); }
public function addOrder($customer_id, $package_guid, $quantity, $userid) { $guid_order = Options::getUUIDv6(); $package = new Packages(); $package_toorder = array(); $package_toorder = $package->getPackageToOrderByGuid($package_guid); if ($package_toorder["id"] > 0) { $db = new clsDBdbConnection(); //Calculating total amount based on quantities taxes and fees $this->subtotal = $package_toorder["price"] * $quantity; $this->tax_total = $this->tax_percent * $this->subtotal; $this->paypal_totalfee = $this->paypal_ratepercent * $this->subtotal + $this->paypal_extrafee; $this->total = $this->subtotal + $this->tax_total + $this->paypal_totalfee; //Adding the order $sql = "insert into orders (guid,customer_id,subtotal,tax,paypal_fee,total,currency,created_iduser)\n values ('{$guid_order}',{$customer_id},{$this->subtotal},{$this->tax_total},{$this->paypal_totalfee},{$this->total},'{$this->currency}',{$userid})"; $db->query($sql); $db->query("select last_insert_id() as id"); $db->next_record(); $order_id = (int) $db->f("id"); //Add order detail $this->addOrderDetail($order_id, $quantity, $package_toorder, $db, $userid); $db->close(); //After order creation, set email notification to buyer //Notifications are sent via a separate module $this->setEmailNotification($order_id, $userid); return $this->getHumanOrderId($order_id); } else { //No package to set into the order return 0; } }
public function index() { $MyTheme = Theme::uses('admin')->layout('adminLayout'); $packages = new Packages(); $aMe = $packages->getAllPackageGroup(); $allAm = array(); $allAm[0] = 'Package Type'; foreach ($aMe as $aM) { $allAm[$aM->package_id] = $aM->package_name; } $Amenities = new Amenities(); $allAmenities = $Amenities->getAllAmenities(); $data = array('packages' => $allAm, 'allAmen' => $allAmenities); return $MyTheme->of('admin.Packages', $data)->render(); }
public function __construct($View = null, $settings = array()) { if (class_exists('Packages')) { Packages::initialize($this, __CLASS__); } parent::__construct($View, $settings); }
/** * Checks if Grav is currently symbolically linked * * @return boolean True if Grav is symlinked, False otherwise. */ public function isSymlink() { return $this->remote->isSymlink(); }
/** * Returns the changelog list for each version of Grav * @param string $diff the version number to start the diff from * * @return array return the changelog list for each version */ public function getChangelog($diff = null) { return $this->remote->getChangelog($diff); }
# $Id: filter.php,v 1.4 2012-07-21 23:23:57 dan Exp $ # # Copyright (c) 1998-2006 DVL Software Limited # require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/common.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/freshports.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/databaselogin.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/getvalues.php'; # # If they supply a package name, go for it. # if (isset($_REQUEST['package'])) { $package = pg_escape_string($_REQUEST['package']); if ($package != '') { require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/packages.php'; $Packages = new Packages($db); $CategoryPort = $Packages->GetCategoryPortFromPackageName($package); switch ($CategoryPort) { case "0": # no such port found header('Location: /package.php?package=' . $package . '¬found'); exit; case "-1": # multiple ports have that package name # search for them all and let the users decide which one they want require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/searches.php'; $Searches = new Searches($dbh); $Redirect = $Searches->GetLink($package, FRESHPORTS_SEARCH_METHOD_Exact, 1); header('Location: ' . $Redirect); exit; default:
public function getAllPackagesByID($id) { $allPackages = Packages::where('pc_id', $id)->get(); return $allPackages; }
public function updateMenuReservation() { $reservation = Reservation::find(Input::get('id')); if (!$reservation) { return Redirect::back()->withErrors('Could not find reservation.'); } //$reservation->menus()->detach(); //$reservation->items()->detach(); $date1 = new DateTime($reservation->reservation_start); $date2 = new DateTime($reservation->reservation_end); $diff = $date2->diff($date1)->format("%a"); $diff += 1; $date1 = date_format($date1, 'l, jS F Y'); $date2 = date_format($date2, 'l, jS F Y'); $id = Input::get('id'); $total_price = 0; $package_price = 0; $pricezs = 0; $qty = Input::get('quantity'); $model = Input::get('model'); $invid = Input::get('invId'); $pricey = Input::get('pricey'); foreach ($reservation->menu() as $value) { $total_price += $value->price; } foreach ($reservation->item as $value) { } for ($i = 0; $i < count($qty); $i++) { if ($qty[$i] > 0) { $reservation->items()->attach($invid[$i], ['qty' => $qty[$i]]); $pricezs = $pricezs + (int) $pricey[$i] * $qty[$i]; } } for ($index = 1; $index <= $diff; $index++) { if (count(Input::get('menu' . $index)) > 0) { foreach (Input::get('menu' . $index) as $menu) { $reservation->menus()->attach($menu, ['day' => $index]); $price = Menu::find($menu); $total_price += $price->price; } } if (count(Input::get('package' . $index)) > 0) { foreach (Input::get('package' . $index) as $package) { foreach (DB::table('menu_package')->where('package_id', '=', $package)->get() as $fuckage) { $reservation->menus()->attach($fuckage->menu_id, ['day' => $index, 'package' => $package]); } $price = Packages::find($package); $package_price += $price->price; } } } $reservation->net_total = $total_price * $reservation->pax + $package_price + $pricezs; if ($reservation->save()) { return Redirect::back()->with('flash_message', 'Reservation has been saved!'); } else { return Redirect::back()->withErrors('Could not update reservation'); } }
public function getPayment() { $_pack = new Packages(); $packId = Input::get('id'); return Response::json(array('success' => true, 'fullN' => Auth::user()->user_fname . ' ' . Auth::user()->user_mname . ' ' . Auth::user()->user_lname, 'price' => $_pack->getId($packId)->pc_price, 'packageN' => $_pack->getPack()->pc_name)); }
public function ajax() { $Logger = new TransLog(); $UserModel = new User(); $Amenities = new Amenities(); $Packages = new Packages(); $type = Input::get('type'); if ($type) { switch ($type) { case 'amenities-list': $pending = DB::table('tbl_amenities')->join('tbl_amenities_group', 'ag_id', '=', 'am_group'); $dtResult = GlobalController::setDatatable($pending, array('am_id', 'am_name', 'am_quantity', 'am_price', 'ag_groupname'), 'am_id'); foreach ($dtResult['objResult'] as $aRow) { $data = array($aRow->am_id, $aRow->am_name, $aRow->am_quantity, $aRow->am_capacity, number_format($aRow->am_price, 2), $aRow->ag_groupname, '', '<div class="button-container">' . '<button class="btn-blue-admin btn-view-item" data-id="' . $aRow->am_id . '">View</button>' . ' ' . '<button class="btn-blue-admin btn-edit-item" data-id="' . $aRow->am_id . '">Update</button>' . '</div>'); $dtResult['aaData'][] = $data; } unset($dtResult['objResult']); echo json_encode($dtResult); break; case 'viewItem': $id = Input::get('id'); $whereVal = array('am_id' => $id); $item = $this->GlobalModel->getModelRowDetailByWhereClause('tbl_amenities', $whereVal, ''); $images = DB::table('tbl_images')->where('image_fieldvalue', $id)->get(); $img = array(); foreach ($images as $im) { $d = array('image_id' => $im->image_id, 'image_name' => $im->image_name); array_push($img, $d); } $data = array('item_name' => $item->am_name, 'item_desc' => $item->am_description, 'item_quantity' => $item->am_quantity, 'item_price' => $item->am_price, 'item_capacity' => $item->am_capacity, 'item_group' => $this->GlobalModel->getGroupName($item->am_group)->ag_groupname, 'group_id' => $this->GlobalModel->getGroupName($item->am_group)->ag_id, 'image' => $img); return Response::json($data); break; case 'getOrderedRooms': if (Input::has('date') && Input::has('date_to')) { $datefrom = Input::get('date'); $dateto = Input::get('date_to'); } else { $datefrom = $dateto = date('Y-m-d'); } $Orders = new Orders(); $rooms = $Orders->getRoomOrderReserve($datefrom, $dateto); $order_room = array(); foreach ($rooms as $room) { $data = array('package_id' => $room->order_packageid, 'or_roomid' => json_decode($room->or_roomid)); array_push($order_room, $data); } // // $rooms = $Packages->getAllPackages(); // foreach($rooms as $room){ // foreach(json_decode($room->pc_itemid) as $pc){ // $data = array( // 'id' => $pc->id, // 'quantity' => $pc->quantity // ); // array_push($rooms_, $data); // } // } $package_rooms = array(); $pcg_id = array(); $rooms_ = array(); if (Input::has('package_id')) { $id = Input::get('package_id'); $rooms = $Packages->getAllPackagesByID($id); foreach ($rooms as $room) { foreach (json_decode($room->pc_itemid) as $pc) { array_push($pcg_id, $pc->id); $data = array('id' => $pc->id, 'quantity' => $pc->quantity); array_push($rooms_, $data); } $allAmenities = Amenities::join('tbl_amenities_group', 'ag_id', '=', 'am_group')->where('ag_groupname', 'Room')->whereNotIn('am_id', $pcg_id)->get(); foreach ($allAmenities as $aM) { $data = array('or_roomid' => $aM->am_id); array_push($package_rooms, array_filter($data)); } } } $data = array('order_rooms' => $order_room, 'package_rooms' => $package_rooms, 'rooms' => $rooms_); return Response::json(array('result' => $data)); break; } } }