當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Package::find_all方法代碼示例

本文整理匯總了PHP中Package::find_all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Package::find_all方法的具體用法?PHP Package::find_all怎麽用?PHP Package::find_all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Package的用法示例。


在下文中一共展示了Package::find_all方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index

 public function index()
 {
     $this->set_default_side_bar();
     $this->title = 'All Packages';
     Nimble::set_title($this->title);
     $page = isset($_GET['page']) ? $_GET['page'] : NULL;
     switch ($this->format) {
         case 'xml':
             $this->packages = Package::find_all();
             $this->header('Content-Type: text/xml', 200);
             echo $this->packages->to_xml();
             $this->layout = false;
             $this->has_rendered = true;
             break;
         case 'json':
             $this->packages = Package::find_all();
             $this->header('Content-type: application/json', 200);
             echo $this->packages->to_json();
             $this->layout = false;
             $this->has_rendered = true;
             break;
         case 'atom':
             $this->layout = false;
             $this->has_rendered = true;
             break;
         case 'rss':
             $this->layout = false;
             $this->has_rendered = true;
             break;
         default:
             $this->full = true;
             $this->packages = Package::paginate(array('select' => '`packages`.*, AVG(`package_ratings`.`rating`) as rating', 'order' => 'rating DESC', 'per_page' => 20, 'page' => $page, 'joins' => 'LEFT JOIN `package_ratings` on `package_ratings`.`package_id` = `packages`.`id`', 'group' => '`packages`.id'));
             break;
     }
 }
開發者ID:scottdavis,項目名稱:pearfarm_channel_server,代碼行數:35,代碼來源:package_controller.php

示例2: search

 public function search()
 {
     $methods = get_class_methods($this);
     $sql = array();
     foreach ($methods as $method) {
         $matches = array();
         if (preg_match('/([a-zA-z0-9_]+)_conditions$/', $method, $matches)) {
             $retrun = call_user_func(array($this, $method));
             if (!empty($return)) {
                 $sql[] = NimbleRecord::sanitize($return);
             }
         }
     }
     $conditions = implode(' ', $sql);
     return Package::find_all(array('conditions' => $conditions));
 }
開發者ID:scottdavis,項目名稱:pearfarm_channel_server,代碼行數:16,代碼來源:package_search.php

示例3: Package

<?php

require_once "../initialise_files.php";
include_once "sessioninc.php";
$packages = Package::find_all();
$smarty->assign('packages', $packages);
if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "delete") {
    $package = new Package();
    $package->id = (int) $_GET['id'];
    if ($package->delete()) {
        $session->message("<div class='success'>Package has been deleted.</div>");
        redirect_to($_SERVER['PHP_SELF']);
        die;
    } else {
        $message = "<div class='error'> Problem deleteing package</div>";
    }
}
$html_title = SITE_NAME . " List Packages ";
$smarty->assign('lang', $lang);
$smarty->assign('message', $message);
$smarty->assign('rendered_page', $smarty->fetch('admin/list_packages.tpl'));
$smarty->display('admin/index.tpl');
開發者ID:nim94sha,項目名稱:Online-Job-Portal,代碼行數:22,代碼來源:list_packages.php


注:本文中的Package::find_all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。