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


PHP School::getAllSchools方法代码示例

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


在下文中一共展示了School::getAllSchools方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionView

 public function actionView()
 {
     if (isset($_GET['user'])) {
         $username = $_GET['user'];
     } else {
         $username = Yii::app()->user->name;
     }
     $user = User::model()->find("username=:username", array(':username' => $username));
     $saveQ = SavedQuery::model()->findAll("FK_userid=:id", array(':id' => $user->id));
     if ($user->FK_usertype == 2) {
         $this->actionViewEmployer();
         return;
     }
     //Get all schools
     $allSchools = School::getAllSchools();
     // Get Resume
     $resume = Resume::model()->findByPk($user->id);
     $videoresume = VideoResume::model()->findByPk($user->id);
     // 		print "<pre>"; print_r($videoresume->video_path);print "</pre>";return;
     $this->render('View', array('user' => $user, 'allSchools' => $allSchools, 'resume' => $resume, 'videoresume' => $videoresume, 'saveQ' => $saveQ));
 }
开发者ID:erick305,项目名称:testing,代码行数:21,代码来源:ProfileController.php

示例2: actionEmployersearch

 public function actionEmployersearch()
 {
     $srch_keyword = $_POST['skillkeyword'];
     // Get skill keyword to search
     $pieces = trim($srch_keyword);
     $pieces = explode(" ", $pieces);
     // split words to search
     $count = sizeof($pieces);
     // get number of word to search
     $query = '';
     for ($i = 0; $i < $count; $i++) {
         if ($i == $count - 1) {
             $query = $query . 'name like \'%' . $pieces[$i] . '%\'';
         } else {
             $query = $query . 'name like \'%' . $pieces[$i] . '%\' OR ';
         }
     }
     $criteria = new CDbCriteria();
     $criteria->condition = $query;
     $results = array();
     if ($srch_keyword != null) {
         $skillsArray = Skillset::model()->findAll($criteria);
         foreach ($skillsArray as $sk) {
             $student_ids = StudentSkillMap::model()->findAllByAttributes(array('skillid' => $sk->id));
             // search student skill map for students with that skill
             foreach ($student_ids as $tmp) {
                 $duplicate = 0;
                 if (sizeof($results) > 0) {
                     foreach ($results as $t) {
                         if ($t->id == $tmp->userid) {
                             $duplicate = 1;
                         }
                     }
                 }
                 if ($duplicate == 0) {
                     $results[] = User::model()->findByAttributes(array('id' => $tmp->userid));
                 }
             }
         }
         $school_id = School::model()->findAll($criteria);
         // get school ID
         foreach ($school_id as $si) {
             $student_ids = Education::model()->findAllByAttributes(array('FK_school_id' => $si->id));
             // search educations with school ID
             foreach ($student_ids as $tmp) {
                 $duplicate = 0;
                 if (sizeof($results) > 0) {
                     foreach ($results as $t) {
                         if ($t->id == $tmp->FK_user_id) {
                             $duplicate = 1;
                         }
                     }
                 }
                 if ($duplicate == 0) {
                     $results[] = User::model()->findByAttributes(array('id' => $tmp->FK_user_id));
                 }
             }
         }
     }
     if (isset($_GET['user'])) {
         $username = $_GET['user'];
     } else {
         $username = Yii::app()->user->name;
     }
     $user = User::model()->find("username=:username", array(':username' => $username));
     // pass user
     $skills = Skillset::getNames();
     // pass skills
     $universites = School::getAllSchools();
     // pass companies
     // 		foreach ($results as $tr){
     // 			print "<pre>"; print_r($tr->attributes);print "</pre>";
     // 		}
     // 		return;
     $this->render('employerSearchResults', array('results' => $results, 'skills' => $skills, 'universities' => $universites, 'user' => $user));
 }
开发者ID:erick305,项目名称:testing,代码行数:76,代码来源:HomeController.php


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