本文整理汇总了PHP中Gender::getByNefubName方法的典型用法代码示例。如果您正苦于以下问题:PHP Gender::getByNefubName方法的具体用法?PHP Gender::getByNefubName怎么用?PHP Gender::getByNefubName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gender
的用法示例。
在下文中一共展示了Gender::getByNefubName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: retrieveEvents
public function retrieveEvents()
{
$url = NEFUB_ROOT . '/../pages/default.asp?subject_id=20';
$postData = array('category_id' => 205);
$html = $this->getNefubContents($url, 2, $postData);
if (!$html) {
$this->retrieveLog->successfully = 0;
} else {
$this->retrieveLog->successfully = 1;
}
$this->retrieveLog->finish_time = date('Y-m-d H:i:s');
$this->retrieveLog->total_time = $this->retrieveLog->getDuration();
$this->retrieveLog->finished = 1;
$this->retrieveLog->save();
$pattern = '|<td width=\\"100\\" valign=top class=\\"kalender_subtitle\\">(.*){4,16}<td valign=top class=\\"kalender_subtitle\\">([^<]{4,})<br|U';
$result = array();
preg_match_all($pattern, $html, $result, PREG_SET_ORDER);
$aEvents = array();
foreach ($result as $event) {
/*
[35]: Array
[35][0]: <td width="100" valign=top class="kalender_subtitle">za. 12.04.2014</td><td valign=top class="kalender_subtitle"> NeFUB Competitie ronde 15 <br
[35][1]: za. 12.04.2014</td>
[35][2]: NeFUB Competitie ronde 15
*/
$nefubName = utf8_encode(trim($event[2]));
$lowerName = strtolower($nefubName);
$oGenre = null;
$oGender = null;
$oGender2 = null;
if (strpos($lowerName, 'jeugd') !== false) {
$oGenre = Genre::getByNefubName(GENRE_JEUGD_NEFUB_NAME);
$oGender = Gender::getByNefubName(GENDER_MIXED_NEFUB_NAME);
} elseif (strpos($lowerName, 'mixed') !== false) {
$oGenre = Genre::getByNefubName(GENRE_COMPETITIE_NEFUB_NAME);
$oGender = Gender::getByNefubName(GENDER_MIXED_NEFUB_NAME);
} else {
if (strpos($lowerName, 'heren') !== false) {
$oGender = Gender::getByNefubName(GENDER_HEREN_NEFUB_NAME);
} elseif (strpos($lowerName, 'dames') !== false) {
$oGender = Gender::getByNefubName(GENDER_DAMES_NEFUB_NAME);
} else {
$oGender = Gender::getByNefubName(GENDER_HEREN_NEFUB_NAME);
$oGender2 = Gender::getByNefubName(GENDER_DAMES_NEFUB_NAME);
}
if (strpos($lowerName, 'cup') !== false || strpos($lowerName, 'beker') !== false) {
$oGenre = Genre::getByNefubName(GENRE_BEKER_NEFUB_NAME);
} else {
$oGenre = Genre::getByNefubName(GENRE_COMPETITIE_NEFUB_NAME);
}
}
$date = str_replace('</td>', '', $event[1]);
$date = array_pop(explode(' ', $date));
$dates = explode('-', $date);
if (count($dates) > 1) {
if (count($dates) == 2) {
$lastDate = array_pop($dates);
list($lastDay, $month, $year) = explode('.', trim($lastDate));
$firstDay = $dates[0];
$firstDate = $year . '-' . $month . '-' . $firstDay;
$oEvent = self::convertEvent($nefubName, $firstDate, $oGenre, $oGender);
$eventIds[] = $oEvent->getId();
if ($oGender2) {
$oEvent = self::convertEvent($nefubName, $firstDate, $oGenre, $oGender2);
$eventIds[] = $oEvent->getId();
}
$lastDate = $year . '-' . $month . '-' . $lastDay;
$oEvent = self::convertEvent($nefubName, $lastDate, $oGenre, $oGender);
$eventIds[] = $oEvent->getId();
if ($oGender2) {
$oEvent = self::convertEvent($nefubName, $firstDate, $oGenre, $oGender2);
$eventIds[] = $oEvent->getId();
}
self::put("Event " . $nefubName . " toegevoegd");
} else {
self::put("Event " . $nefubName . " niet toegevoegd, ongeldige data:");
self::put($date);
}
} else {
list($day, $month, $year) = explode('.', $date);
$formattedDate = $year . '-' . $month . '-' . $day;
$oEvent = self::convertEvent($nefubName, $formattedDate, $oGenre, $oGender);
$eventIds[] = $oEvent->getId();
if ($oGender2) {
$oEvent = self::convertEvent($nefubName, $formattedDate, $oGenre, $oGender2);
$eventIds[] = $oEvent->getId();
}
self::put("Event " . $nefubName . " toegevoegd");
}
if (count($eventIds)) {
$query = 'DELETE FROM Event WHERE id NOT IN (' . implode(', ', $eventIds) . ') AND season_nefub_id = ' . Season::getInstance()->nefub_id;
Database::query($query);
} else {
Database::delete_rows('Event', array('season_nefub_id' => Season::getInstance()->nefub_id));
}
}
}
示例2: showClub
/**
*
* @param int $nefubId
*/
public function showClub($nefubId)
{
$this->subdirectory = '/club';
$this->path = '/' . $nefubId;
$this->template = '/club/club.tpl';
if ($this->getClearRender()) {
$oClub = Club::getByNefubId($nefubId);
if ($oClub) {
$competitionGenders = array('Heren', 'Dames', 'Mixed');
$aCompetitions = array();
foreach ($competitionGenders as $competitionGender) {
$oGender = Gender::getByNefubName($competitionGender);
$aGenreCompetitions = Competition::getAll(array('gender_id' => $oGender->getId(), 'season_nefub_id' => $this->season->nefub_id), 'genre_id`,`name');
$aCompetitions = array_merge($aCompetitions, $aGenreCompetitions);
}
$aCompetitionTeams = array();
foreach ($aCompetitions as $oCompetition) {
$aTeams = Team::getAll(array('competition_nefub_id' => $oCompetition->nefub_id, 'club_nefub_id' => $oClub->nefub_id, 'season_nefub_id' => $oCompetition->season_nefub_id), 'name');
if (count($aTeams)) {
$aCompetitionTeams[] = array('competition' => $oCompetition, 'teams' => $aTeams);
}
}
$this->assign('oClub', $oClub);
$this->assign('aCompetitionTeams', $aCompetitionTeams);
} else {
$this->redirect();
}
}
$this->showOutput();
}
示例3: convertGender
/**
* @param string $gender
*
* return Gender
*/
protected function convertGender($gender)
{
$oGender = Gender::getByNefubName($gender);
if (!$oGender) {
$oGender = new Gender();
$oGender->name = ucfirst($gender);
$oGender->nefub_name = $gender;
$oGender->save();
self::put('Nieuwe gender ' . $oGender->Name . ' toegevoegd');
$this->addedNefubObject($oGender);
}
return $oGender;
}