当前位置: 首页>>代码示例>>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;未经允许,请勿转载。