本文整理汇总了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));
}
示例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));
}