当前位置: 首页>>代码示例>>PHP>>正文


PHP Package::count方法代码示例

本文整理汇总了PHP中Package::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::count方法的具体用法?PHP Package::count怎么用?PHP Package::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Package的用法示例。


在下文中一共展示了Package::count方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
     }
 }
开发者ID:shreyanshgoel,项目名称:tours,代码行数:34,代码来源:travels.php

示例2: __construct

 public function __construct()
 {
     $this->header("Content-Type: text/html; charset=utf-8");
     $this->total_packages = Package::count();
     $this->sidebar = array();
     $this->title = '';
     if ($this->is_logged_in()) {
         $this->login_user();
     }
 }
开发者ID:xetorthio,项目名称:pearfarm_channel_server,代码行数:10,代码来源:application_controller.php

示例3: testDeleteBobsPackage

 public function testDeleteBobsPackage()
 {
     $_SERVER['SERVER_NAME'] = 'bob.localhost.com';
     $count = Package::count();
     $v_count = Version::count();
     $p = Package::find_by_name('bobs_other_package');
     $versions = $p->count('versions');
     $this->delete('delete', array(), array('id' => $p->id), array('user' => User::find_by_username('bob')->id));
     $this->assertEquals($count - 1, Package::count(array('cache' => false)));
     $this->assertEquals($v_count - $versions, Version::count(array('cache' => false)));
     $this->assertRedirect('/');
 }
开发者ID:scottdavis,项目名称:pearfarm_channel_server,代码行数:12,代码来源:PackageControllerTest.php

示例4: 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);
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:16,代码来源:promotion.php

示例5: create_package

 /**
  * @before _secure, changeLayout
  */
 public function create_package()
 {
     $this->seo(array("title" => "Dashboard", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $states = State::all();
     $view->set('states', $states);
     if (RequestMethods::post('name')) {
         $imageFileType1 = pathinfo($_FILES["package1"]["name"], PATHINFO_EXTENSION);
         if (!empty($_FILES["package2"]["name"])) {
             $imageFileType2 = pathinfo($_FILES["package2"]["name"], PATHINFO_EXTENSION);
         } else {
             $imageFileType2 = NULL;
         }
         if (!empty($_FILES["package3"]["name"])) {
             $imageFileType3 = pathinfo($_FILES["package3"]["name"], PATHINFO_EXTENSION);
         } else {
             $imageFileType3 = NULL;
         }
         if (!empty($_FILES["package4"]["name"])) {
             $imageFileType4 = pathinfo($_FILES["package4"]["name"], PATHINFO_EXTENSION);
         } else {
             $imageFileType4 = NULL;
         }
         if (!empty($_FILES["package5"]["name"])) {
             $imageFileType5 = pathinfo($_FILES["package5"]["name"], PATHINFO_EXTENSION);
         } else {
             $imageFileType5 = NULL;
         }
         $package = new Package(array('name' => RequestMethods::post('name'), 'source' => RequestMethods::post('source'), 'destination' => RequestMethods::post('dest'), 'desc' => RequestMethods::post('desc'), 'start_date' => RequestMethods::post('startdate'), 'end_date' => RequestMethods::post('enddate'), 'month' => RequestMethods::post('month'), 'year' => RequestMethods::post('year'), 'price' => RequestMethods::post('price'), 'people' => RequestMethods::post('people'), 'people_left' => RequestMethods::post('people'), 'imgext1' => $imageFileType1, 'imgext2' => $imageFileType2, 'imgext3' => $imageFileType3, 'imgext4' => $imageFileType4, 'imgext5' => $imageFileType5));
         if ($package->validate()) {
             $package->save();
             $view->set('success', 'success');
             $count = Package::count();
             $target_dir = "/public/uploads/packages/";
             $target_file = APP_PATH . $target_dir . $count . '_';
             $img = 0;
             // Check if image file is a actual image or fake image
             $check = getimagesize($_FILES["package1"]["tmp_name"]);
             if ($check !== false) {
                 $img++;
             }
             if ($imageFileType1 != "jpg" && $imageFileType1 != "png" && $imageFileType1 != "jpeg" && $_FILES["package"]["size"] > 5000000) {
                 $img--;
             }
             if ($img == 1) {
                 $flag = 0;
                 if (move_uploaded_file($_FILES["package1"]["tmp_name"], $target_file . '1.' . $imageFileType1)) {
                     $flag++;
                 }
                 if ($flag == 1) {
                 } else {
                     $view->set('errorimg', 'Error in first image. Not uploaded');
                 }
             }
             if (!empty($imageFileType2)) {
                 $img = 0;
                 // Check if image file is a actual image or fake image
                 $check = getimagesize($_FILES["package2"]["tmp_name"]);
                 if ($check !== false) {
                     $img++;
                 }
                 if ($imageFileType2 != "jpg" && $imageFileType2 != "png" && $imageFileType2 != "jpeg" && $_FILES["package2"]["size"] > 5000000) {
                     $img--;
                 }
                 if ($img == 1) {
                     $flag = 0;
                     if (move_uploaded_file($_FILES["package2"]["tmp_name"], $target_file . '2.' . $imageFileType2)) {
                         $flag++;
                     }
                     if ($flag == 1) {
                     } else {
                         $view->set('errorimg', 'Error in second image. Not uploaded');
                     }
                 }
             }
             if (!empty($imageFileType3)) {
                 $img = 0;
                 // Check if image file is a actual image or fake image
                 $check = getimagesize($_FILES["package3"]["tmp_name"]);
                 if ($check !== false) {
                     $img++;
                 }
                 if ($imageFileType3 != "jpg" && $imageFileType3 != "png" && $imageFileType3 != "jpeg" && $_FILES["package3"]["size"] > 5000000) {
                     $img--;
                 }
                 if ($img == 1) {
                     $flag = 0;
                     if (move_uploaded_file($_FILES["package3"]["tmp_name"], $target_file . '3.' . $imageFileType3)) {
                         $flag++;
                     }
                     if ($flag == 1) {
                     } else {
                         $view->set('errorimg', 'Error in third image. Not uploaded');
                     }
                 }
             }
             if (!empty($imageFileType4)) {
//.........这里部分代码省略.........
开发者ID:shreyanshgoel,项目名称:tours,代码行数:101,代码来源:admin.php

示例6: 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);
 }
开发者ID:jacobDaeHyung,项目名称:PHPLaravelGymManagementSystem,代码行数:14,代码来源:MembersController.php


注:本文中的Package::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。