public function __viewIndex()
 {
     $this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Events'))));
     $this->appendSubheading(__('Events'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . '/new/', array('title' => __('Create a new event'), 'class' => 'create button')));
     $eTableHead = array(array(__('Name'), 'col'), array(__('Destination'), 'col'), array(__('Type'), 'col'), array(__('Used By'), 'col'));
     $eTableBody = array();
     $colspan = count($eTableHead);
     $iterator = new EventIterator();
     if (!$iterator->valid()) {
         $eTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), array('class' => 'inactive', 'colspan' => $colspan))), array('class' => 'odd')));
     } else {
         //	Load Views so we can determine what Datasources are attached
         if (!self::$_loaded_views) {
             foreach (new ViewIterator() as $view) {
                 self::$_loaded_views[$view->guid] = array('title' => $view->title, 'handle' => $view->handle, 'events' => $view->{'events'});
             }
         }
         foreach ($iterator as $pathname) {
             $event = Event::load($pathname);
             $view_mode = $event->allowEditorToParse() == true ? 'edit' : 'info';
             $handle = Event::getHandleFromFilename($pathname);
             $col_name = Widget::TableData(Widget::Anchor($event->about()->name, ADMIN_URL . "/blueprints/events/{$view_mode}/{$handle}/", array('title' => $event->parameters()->pathname)));
             $col_name->appendChild(Widget::Input("items[{$handle}]", null, 'checkbox'));
             // Destination
             $col_destination = $event->prepareDestinationColumnValue();
             // Used By
             $fragment_views = $this->createDocumentFragment();
             foreach (self::$_loaded_views as $view) {
                 if (is_array($view['events']) && in_array($handle, $view['events'])) {
                     if ($fragment_views->hasChildNodes()) {
                         $fragment_views->appendChild(new DOMText(', '));
                     }
                     $fragment_views->appendChild(Widget::Anchor($view['title'], ADMIN_URL . "/blueprints/views/edit/{$view['handle']}/"));
                 }
             }
             if (!$fragment_views->hasChildNodes()) {
                 $col_views = Widget::TableData(__('None'), array('class' => 'inactive'));
             } else {
                 $col_views = Widget::TableData($fragment_views);
             }
             // Type
             if (is_null($event->getType())) {
                 $col_type = Widget::TableData(__('Unknown'), array('class' => 'inactive'));
             } else {
                 $col_type = Widget::TableData($this->types[$event->getType()]->name);
             }
             $eTableBody[] = Widget::TableRow(array($col_name, $col_destination, $col_type, $col_views));
         }
     }
     $table = Widget::Table(Widget::TableHead($eTableHead), null, Widget::TableBody($eTableBody), array('id' => 'events-list'));
     $this->Form->appendChild($table);
     $tableActions = $this->createElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete')));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
示例#2
0
 public static function clearCachedFiles()
 {
     self::$events = array();
 }