本文整理匯總了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);
//.........這裏部分代碼省略.........