本文整理汇总了PHP中Repositories\SiteRepository::loadByID方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteRepository::loadByID方法的具体用法?PHP SiteRepository::loadByID怎么用?PHP SiteRepository::loadByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repositories\SiteRepository
的用法示例。
在下文中一共展示了SiteRepository::loadByID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processThingsToDoAfterGetUser
protected function processThingsToDoAfterGetUser(Request $request, Application $app)
{
global $CONFIG;
$siteRepo = new SiteRepository();
$eventRepo = new EventRepository();
$areaRepo = new AreaRepository();
$event = null;
$area = null;
$siteToAdd = null;
// Any sites of general interest?
if ($request->query->has("site") && !$CONFIG->isSingleSiteMode) {
$siteToAdd = $siteRepo->loadBySlug($request->query->get("site"));
if ($siteToAdd && $siteToAdd->getIsAllowedForAfterGetUser()) {
if (!$app['websession']->hasArray("afterGetUserAddSites")) {
$app['websession']->setArray("afterGetUserAddSites", array($siteToAdd->getId()));
} else {
if (!in_array($siteToAdd->getId(), $app['websession']->getArray("afterGetUserAddSites"))) {
$app['websession']->appendArray("afterGetUserAddSites", $siteToAdd->getId());
}
}
}
}
// Any events to add?
if ($request->query->has("event")) {
if ($CONFIG->isSingleSiteMode) {
$event = $eventRepo->loadBySiteIDAndEventSlug($CONFIG->singleSiteID, $request->query->get("event"));
} else {
$site = $siteRepo->loadBySlug($request->query->get("eventSite"));
if ($site) {
$event = $eventRepo->loadBySlug($site, $request->query->get("event"));
}
}
if ($event && $event->getIsAllowedForAfterGetUser()) {
if (!$app['websession']->hasArray("afterGetUserAddEvents")) {
$app['websession']->setArray("afterGetUserAddEvents", array($event->getId()));
} else {
if (!in_array($event->getId(), $app['websession']->getArray("afterGetUserAddEvents"))) {
$app['websession']->appendArray("afterGetUserAddEvents", $event->getId());
}
}
}
}
// Any areas to add?
if ($request->query->has("area")) {
if ($CONFIG->isSingleSiteMode) {
$area = $areaRepo->loadBySiteIDAndAreaSlug($CONFIG->singleSiteID, $request->query->get("area"));
} else {
$site = $siteRepo->loadBySlug($request->query->get("areaSite"));
if ($site) {
$area = $areaRepo->loadBySlug($site, $request->query->get("area"));
}
}
if ($area && $area->getIsAllowedForAfterGetUser()) {
if (!$app['websession']->hasArray("afterGetUserAddAreas")) {
$app['websession']->setArray("afterGetUserAddAreas", array($area->getId()));
} else {
if (!in_array($area->getId(), $app['websession']->getArray("afterGetUserAddAreas"))) {
$app['websession']->appendArray("afterGetUserAddAreas", $area->getId());
}
}
}
}
// Remove events?
if ($request->query->has("removeEventId")) {
$app['websession']->removeValueFromArray("afterGetUserAddEvents", $request->query->has("removeEventId"));
}
// Remove areas?
if ($request->query->has("removeAreaId")) {
$app['websession']->removeValueFromArray("afterGetUserAddAreas", $request->query->has("removeAreaId"));
}
// Remove Sites?
if ($request->query->has("removeSiteId")) {
$app['websession']->removeValueFromArray("afterGetUserAddSites", $request->query->has("removeSiteId"));
}
// load events to show user
$this->parameters['afterGetUserAddEvents'] = array();
if ($app['websession']->hasArray("afterGetUserAddEvents")) {
foreach ($app['websession']->getArray("afterGetUserAddEvents") as $eventID) {
if ($event != null && $eventID == $event->getId()) {
if ($event->getIsAllowedForAfterGetUser()) {
$this->parameters['afterGetUserAddEvents'][] = $event;
}
} else {
$eventTmp = $eventRepo->loadByID($eventID);
if ($eventTmp && $eventTmp->getIsAllowedForAfterGetUser()) {
$this->parameters['afterGetUserAddEvents'][] = $eventTmp;
}
}
}
}
// load areas to show user
$this->parameters['afterGetUserAddAreas'] = array();
if ($app['websession']->hasArray("afterGetUserAddAreas")) {
foreach ($app['websession']->getArray("afterGetUserAddAreas") as $areaID) {
if ($area != null && $areaID == $area->getId()) {
if ($area->getIsAllowedForAfterGetUser()) {
$this->parameters['afterGetUserAddAreas'][] = $area;
}
} else {
$areaTmp = $areaRepo->loadByID($areaID);
//.........这里部分代码省略.........