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


PHP Institution::all方法代碼示例

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


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

示例1: index

 public static function index()
 {
     if (self::get_user_admin() == null) {
         Redirect::to('/home');
     }
     $institutions = Institution::all();
     View::make('admin/institutions.html', array('institutions' => $institutions));
 }
開發者ID:nopomi,項目名稱:abinet,代碼行數:8,代碼來源:institution_controller.php

示例2: search

 public function search()
 {
     // Pick up parameters
     $params = $_POST;
     $keyword = $params['keyword'];
     $city = $params['city'];
     $institutions = $params['institutions'];
     $accepted_max = $params['accepted_max'];
     $accepted_min = $params['accepted_min'];
     $extent_max = $params['extent_max'];
     $extent_min = $params['extent_min'];
     //check number values are valid
     if (!is_numeric($accepted_max) || !is_numeric($accepted_min) || !is_numeric($extent_min) || !is_numeric($extent_max)) {
         View::make('search.html', array('error' => 'Some search parameters were weird, try again!'));
     }
     //Convert percentages to decimal
     $accepted_max = $accepted_max / 100;
     $accepted_min = $accepted_min / 100;
     //Find degrees that match the city and numeric parameters
     $degrees = Degree::search($city, $accepted_max, $accepted_min, $extent_max, $extent_min);
     $institutionCorrectDegrees = array();
     //filter the results that contain correct institution
     foreach ($degrees as $degree) {
         foreach ($degree->institutions as $degreeInstitution) {
             if (in_array($degreeInstitution->id, $institutions)) {
                 $institutionCorrectDegrees[] = $degree;
                 break;
             }
         }
     }
     //filter the results that match the keyword
     $keywordMatchingDegrees = array();
     if (strlen($keyword) > 0) {
         $keywordMatchingDegrees = $this->filterByKeyword($institutionCorrectDegrees, $keyword);
     } else {
         $keywordMatchingDegrees = $institutionCorrectDegrees;
     }
     self::makeInstitutionsStrings($keywordMatchingDegrees);
     $allInstitutions = Institution::all();
     //add favorites
     $favorites = FavoriteController::getUserFavorites();
     //return view
     if (empty($keywordMatchingDegrees)) {
         $error = 'No results were found, sorry!';
         View::make('search.html', array('institutions' => $allInstitutions, 'error' => $error, 'degrees' => $keywordMatchingDegrees));
     }
     View::make('search.html', array('institutions' => $allInstitutions, 'degrees' => $keywordMatchingDegrees, 'favorites' => $favorites));
 }
開發者ID:nopomi,項目名稱:abinet,代碼行數:48,代碼來源:search_controller.php

示例3: update

 public static function update($id)
 {
     if (self::get_user_admin() == null) {
         Redirect::to('/home');
     }
     $params = $_POST;
     $degree = self::createDegree($params, $id);
     $errors = $degree->errors();
     if (count($errors) == 0 && isset($params['institutions'])) {
         $degree->update();
         $degree->updateInstitutions($params['institutions']);
         Redirect::to('/degrees', array('message' => 'Changes saved!'));
     } else {
         $allInstitutions = Institution::all();
         if (isset($params['institutions'])) {
             $degree->institutions = $params['institutions'];
         }
         View::make('edit.html', array('errors' => $errors, 'degree' => $degree, 'institutions' => $allInstitutions));
     }
 }
開發者ID:nopomi,項目名稱:abinet,代碼行數:20,代碼來源:degree_controller.php


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