public function getCMSFields()
 {
     $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : Summit::ActiveSummitID();
     Requirements::javascript('summit/javascript/SummitPushNotification.js');
     $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $f->addFieldToTab('Root.Main', $txt = new TextareaField('Message', 'Message'));
     $txt->setAttribute('required', 'true');
     $f->addFieldToTab('Root.Main', $ddl_channel = new DropdownField('Channel', 'Channel', singleton('SummitPushNotification')->dbObject('Channel')->enumValues()));
     $f->addFieldToTab('Root.Main', $ddl_events = new DropdownField('EventID', 'Event', SummitEvent::get()->filter(['Published' => 1, 'SummitID' => $summit_id])->sort('Title', 'ASC')->Map('ID', 'FormattedTitle')));
     $f->addFieldToTab('Root.Main', $ddl_groups = new DropdownField('GroupID', 'Group', Group::get()->sort('Title', 'ASC')->Map('ID', 'Title')));
     $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID'));
     $ddl_channel->setEmptyString('--SELECT A CHANNEL--');
     $ddl_channel->setAttribute('required', 'true');
     $ddl_events->setEmptyString('--SELECT AN EVENT--');
     $ddl_events->addExtraClass('hidden');
     $ddl_groups->setEmptyString('--SELECT A GROUP--');
     $ddl_groups->addExtraClass('hidden');
     $config = GridFieldConfig_RelationEditor::create(50);
     $config->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $config->removeComponentsByType('GridFieldAddNewButton');
     $config->addComponent($auto_completer = new CustomGridFieldAddExistingAutocompleter('buttons-before-right'));
     $auto_completer->setResultsFormat('$Title ($Email)');
     $recipients = new GridField('Recipients', 'Member Recipients', $this->Recipients(), $config);
     $f->addFieldToTab('Root.Main', $recipients);
     return $f;
 }
 /**
  * @return void
  */
 public function run()
 {
     try {
         $init_time = time();
         $summit_id = Summit::ActiveSummitID();
         if (isset($_GET['summit_id'])) {
             $summit_id = intval(trim(Convert::raw2sql($_GET['summit_id'])));
             echo sprintf('summit_id set to %s', $summit_id) . PHP_EOL;
         }
         $manager = Injector::inst()->get('SummitVenueRoomMetricsManager');
         $manager->ingest($summit_id);
         $finish_time = time() - $init_time;
         echo 'time elapsed : ' . $finish_time . ' seconds.' . PHP_EOL;
     } catch (Exception $ex) {
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
     }
 }
Exemplo n.º 3
0
    $event = new SummitEntityEvent();
    $event->EntityClassName = 'MySchedule';
    $event->EntityID = $item->ID;
    $event->Type = 'INSERT';
    $event->OwnerID = $attendee->MemberID;
    $event->SummitID = $summit_id;
    $event->Metadata = $metadata;
    $event->write();
});
PublisherSubscriberManager::getInstance()->subscribe('manymanylist_removed_item', function ($list, $item) {
    if (!$item instanceof ISummitEvent) {
        return;
    }
    $summit_id = $item->getField("SummitID");
    if (is_null($summit_id) || $summit_id == 0) {
        $summit_id = Summit::ActiveSummitID();
    }
    $metadata = '';
    $join_table = $list->getJoinTable();
    if ($join_table !== 'SummitAttendee_Schedule') {
        return;
    }
    $attendee_id = $list->getForeignID();
    $attendee = SummitAttendee::get()->byID($attendee_id);
    $event = new SummitEntityEvent();
    $event->EntityClassName = 'MySchedule';
    $event->EntityID = $item->ID;
    $event->Type = 'DELETE';
    $event->OwnerID = $attendee->MemberID;
    $event->SummitID = $summit_id;
    $event->Metadata = $metadata;