本文整理汇总了PHP中Package::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::all方法的具体用法?PHP Package::all怎么用?PHP Package::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::all方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: packages
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);
}
}
示例2: index
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);
}
示例3: 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);
}
示例4: managePackage
/**
* @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);
}
示例5: getIndex
/**
* Function to retrieve the index page
*
* User selects package to continue
*
**/
public function getIndex()
{
$packages = Package::all();
return View::make('showPackages')->with('packages', $packages);
}
示例6: popularPackages
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);
}
示例7: attach
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);
}