public static function Init($data) { if (isset($data['page']['params']['id'])) { $Account = AccountController::Get(array('ids' => $data['page']['params']['id'])); $Memberships = MembershipController::Search(array('account_id' => $Account['id'], 'operator' => 'eq')); foreach ($Memberships as $Membership) { $Act = ActController::Get(array('ids' => $Membership['act_id'])); $Roles = RoleController::Search(array('membership_id' => $Membership['id'], 'operator' => 'eq')); foreach ($Roles as $Role) { $Tag = TagController::Get(array('ids' => $Role['tag_id'])); $Act['roles'][$Tag['title']] = $Tag['title']; $Account['roles'][$Tag['title']][$Act['id']] = $Act; } $Performances = PerformanceController::Search(array('act_id' => $Act['id'])); foreach ($Performances as $Performance) { $Event = EventController::Get(array('ids' => $Performance['event_id'])); $Account['performances'][$Performance['id']] = array('where' => $Event, 'as' => $Act, 'when' => $Performance, 'with' => array()); $Act['performances'][$Event['id']] = $Event; } $Account['acts'][$Act['id']] = $Act; } $Attendings = AttendeeController::Search(array('account_id' => $Account['id'], 'operator' => 'eq')); foreach ($Attendings as $Attending) { $Event = EventController::Get(array('ids' => $Attending['event_id'])); $Account['attending'][$Event['id']] = $Event; } $data['account'] = $Account; } else { } self::SetData($data); }
public static function Init($params) { DebugManager::Log("Got a logout request!", '@'); $params['start'] = date('c', strtotime($params['start'])); $params['end'] = date('c', strtotime($params['end'])); $Account = SessionManager::GetAccount(); try { $Event = EventController::Create($params); } catch (Exception $e) { return new ResponseObject("Error", 1); } if (isset($params['acts']) && is_array($params['acts'])) { foreach ($params['acts'] as $pos => $act) { try { $Act = ActController::Create(array('title' => $act)); } catch (Exception $e) { $Acts = ActController::Search(array('title' => $act)); $Act = reset($Acts); } try { if (isset($params['slots'][$pos])) { $slot = date('c', strtotime($params['slots'][$pos])); } else { if (isset($slot)) { $slot = date('c', strtotime('+1 hour', $slot)); } else { $slot = date('c', strtotime('+30 minutes', $params['start'])); } } $Performance = PerformanceController::Create(array('act_id' => $Act['id'], 'event_id' => $Event['id'], 'position' => $pos, 'slot' => $slot)); } catch (Exception $e) { } } } if (isset($params['venue'])) { try { $Venue = VenueController::Create(array('title' => $params['venue'])); } catch (Exception $e) { $Venues = VenueController::Search(array('title' => $params['venue'])); $Venue = reset($Venues); } try { $Hoster = HosterController::Create(array('venue_id' => $Venue['id'], 'event_id' => $Event['id'])); } catch (Exception $e) { } } $Attendee = AttendeeController::Create(array('account_id' => $Account['id'], 'event_id' => $Event['id'], 'privilege_level' => 3, 'role' => 3, 'type' => 3)); self::$defaultRedirect = 'event/' . $Event['id']; return new ResponseObject(); }
public static function Init($data) { if (isset($data['page']['params']['id'])) { $Venue = VenueController::Get(array('ids' => $data['page']['params']['id'])); if ($Venue['location_id']) { $Location = LocationController::Get(array('ids' => $Venue['location_id'])); $Location['full'] = $Location['address'] . ', ' . $Location['city'] . ', ' . $Location['state'] . ' ' . $Location['postal'] . ', ' . $Location['country']; $Venue['location'] = $Location; } $Hostings = HosterController::Search(array('venue_id' => $Venue['id'], 'operator' => 'eq')); foreach ($Hostings as $Hosting) { $Event = EventController::Get(array('ids' => $Hosting['event_id'])); $Event['attendees'] = AttendeeController::Search(array('event_id' => $Event['id'], 'state' => '1', 'operator' => 'eq')); $Event['maybees'] = AttendeeController::Search(array('event_id' => $Event['id'], 'state' => '2', 'operator' => 'eq')); $Venue['events'][] = $Event; } $data['venue'] = $Venue; } else { } self::SetData($data); }