コード例 #1
0
 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);
 }
コード例 #2
0
 public static function Init($data)
 {
     $data['events'] = EventController::Search(array('limit' => 10000, 'activated' => 1));
     foreach ($data['events'] as &$Event) {
         $startTimestamp = strtotime($Event['start']);
         $startDate = date('Y-m-d', $startTimestamp);
         $startTime = date('H-i-s', $startTimestamp);
         $Event['start'] = date('Y-m-d H:i:s', $startTimestamp);
         $Event['end'] = date('Y-m-d H:i:s', $startTimestamp);
         $Hostings = HosterController::Search(array('event_id' => $Event['id'], 'operator' => 'eq'));
         foreach ($Hostings as $Hosting) {
             $Venue = VenueController::Get(array('ids' => $Hosting['venue_id']));
             $Event['venues'][$Venue['id']] = $Venue;
         }
         $Performances = PerformanceController::Search(array('event_id' => $Event['id'], 'operator' => 'eq'));
         foreach ($Performances as $Performance) {
             $Act = ActController::Get(array('ids' => $Performance['act_id']));
             $Act['slot'] = $Performance['slot'];
             $Event['acts'][$Act['slot']] = $Act;
         }
         $data['dates'][$startDate][$startTime] = $Event['id'];
     }
     ksort($data['dates']);
     foreach ($data['dates'] as &$times) {
         ksort($times);
     }
     self::SetData($data);
 }
コード例 #3
0
 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();
 }
コード例 #4
0
 public static function Init($data)
 {
     if (isset($data['page']['params']['id'])) {
         $Event = EventController::Get(array('ids' => $data['page']['params']['id']));
         $Hostings = HosterController::Search(array('event_id' => $Event['id'], 'operator' => 'eq'));
         foreach ($Hostings as $Hosting) {
             $Venue = VenueController::Get(array('ids' => $Hosting['venue_id']));
             $Event['venues'][$Venue['id']] = $Venue;
         }
         $Performances = PerformanceController::Search(array('event_id' => $Event['id'], 'operator' => 'eq'));
         foreach ($Performances as $Performance) {
             $Act = ActController::Get(array('ids' => $Performance['act_id']));
             $Act['slot'] = $Performance['slot'];
             $Event['acts'][$Act['slot']] = $Act;
         }
         $data['event'] = $Event;
     } else {
     }
     self::SetData($data);
 }