public function packages() { $view = $this->getActionView(); $states = State::all(); $view->set('states', $states); $source = RequestMethods::get('source'); $source_state = State::first(array('id = ?' => $source)); $dest = RequestMethods::get('dest'); $dest_state = State::first(array('id = ?' => $dest)); $month = RequestMethods::get('month'); $year = RequestMethods::get('year'); $page = RequestMethods::get('page', 1); $limit = 9; if (RequestMethods::get('source')) { $count = Package::count(array('source Like ?' => $source, 'destination Like ?' => $dest, 'month = ?' => $month, 'year = ?' => $year)); $total_pages = $count / 9 + 1; for ($i = 1; $i <= $total_pages; $i++) { $pages[$i] = $i; } $packages = Package::all(array('source Like ?' => $source, 'destination Like ?' => $dest, 'month = ?' => $month, 'year = ?' => $year, 'live = ?' => 1), array("*"), null, null, $limit, $page); $view->set('n', 'http://planyourtours.io/travels/packages?source=' . $source . '&dest=' . $dest . '&type=Group&month=' . $month . '&year=' . $year . '&page=')->set('source', $source_state)->set('dest', $dest_state)->set('month', $month)->set('year', $year); } else { $count = Package::count(); $total_pages = $count / 9 + 1; for ($i = 1; $i <= $total_pages; $i++) { $pages[$i] = $i; } $packages = Package::all(array('live = ?' => 1), array("*"), null, null, $limit, $page); $view->set('n', 'http://planyourtours.io/travels/packages?&page='); } if (!empty($packages)) { $view->set('packages', $packages)->set('pages', $pages); } }
public function index() { $view = $this->getActionView(); $states = State::all(); $limit = 3; $page = 1; $packages = Package::all(array(), array("*"), null, null, $limit, $page); $view->set('states', $states)->set('packages', $packages); }
public function packages() { $this->seo(array("title" => "Packages", "view" => $this->getLayoutView())); $view = $this->getActionView(); $ps = array(); $packages = Package::all(array("live = ?" => 1), array("*"), "created", "desc"); foreach ($packages as $p) { $is = array(); $items = json_decode($p->item); foreach ($items as $key => $i) { $it = Item::first(array("id = ?" => $i), array("name")); array_push($is, $it->name); } array_push($ps, array("name" => $p->name, "price" => $p->price + $p->tax, "item" => implode(",", $is), "id" => $p->id)); } $view->set("packages", $ps); }
/** * @before _secure, _admin */ public function managePackage() { $this->seo(array("title" => "Manage Package", "view" => $this->getLayoutView())); $view = $this->getActionView(); $items = Item::all(array(), array("id", "name")); $setItems = array(); foreach ($items as $i) { $setItems["{$i->id}"] = $i; } $page = Shared\Markup::page(array("model" => "Package", "where" => array())); $packages = Package::all(array(), array("*"), "created", "desc", $page["limit"], $page["page"]); $view->set("packages", $packages)->set("items", $setItems)->set($page); }
/** * Function to retrieve the index page * * User selects package to continue * **/ public function getIndex() { $packages = Package::all(); return View::make('showPackages')->with('packages', $packages); }
public function popularPackages() { $this->seo(array("title" => "Popular Packages", "view" => $this->getLayoutView())); $view = $this->getActionView(); $organizations = Organization::all(array("live = ?" => true), array("id", "name")); $limit = RequestMethods::get("limit", 10); $page = RequestMethods::get("page", 1); $packages = Package::all(array("live = ?" => 1), array("title", "organization_id", "charge", "id"), "created", "desc", $limit, $page); $total = (int) Package::count(array("live = ?" => 1)); $results = array(); foreach ($packages as $p) { $data = array("title" => $p->title, "lab" => $organizations[$p->organization_id]->name, "lab_id" => $p->organization_id, "charge" => $p->charge, "id" => $p->id); $results[] = ArrayMethods::toObject($data); } $view->set("packages", $results)->set("total", $total); }
public function attach() { $member_id = Request::segment(3); $member = Member::find($member_id); if (empty($member) || !is_object($member)) { return Redirect::to('members')->with("error", "Member doesnt exists."); } $this->data['packages'] = Package::all(); if (Package::count() == 0) { return Redirect::to('members/packages/' . $member_id)->with("error", "No Available Packages."); } $this->data['member'] = $member; return $this->layout->content = View::make('members_packages_attach', $this->data); }