Formatted event archive list
Returns the entries for the current page.
@return \Generator|void
354628
public function eventArchiveList()
    {
        $entries = $this->eventManager()->archive();
        foreach ($entries as $entry) {
            yield $this->eventFormatShort($entry);
        }
    }
967119
public function getTotalPages()
    {
        if (!isset($this->pages)) {
            $recordCount = $this->getTotalRecordCount();
            if ($this->max > 0) {
                $this->pages = ceil($recordCount / $this->max);
            } else {
                $this->pages = 0;
            }
        }

        return $this->pages;
    }
641109
public function index()
    {
        // For single-item display only, redirect to the relevant show/edit page
        if ($this->modelInformation->single) {
            return $this->returnViewForSingleDisplay();
        }

        $this->resetStateBeforeIndexAction()
             ->checkListParents()
             ->applyListParentContext()
             ->checkActiveSort()
             ->checkScope()
             ->checkFilters()
             ->checkActivePage();

        $totalCount  = $this->getTotalCount();
        $scopeCounts = $this->getScopeCounts();

        $this->applySort()
             ->applyScope($this->modelRepository);

        $query = $this->getModelRepository()->query();

        $this->applyFilter($query)
             ->applyListParentToQuery($query);

        $records = $query->paginate($this->getActualPageSize(), ['*'], 'page', $this->getActualPage());

        // Check and whether page is out of bounds and adjust
        if ($this->getActualPage() > $records->lastPage()) {
            $records = $query->paginate($this->getActualPageSize(), ['*'], 'page', $records->lastPage());
        }

        $currentCount = method_exists($records, 'total') ? $records->total() : 0;

        return view($this->getIndexView(), [
            'moduleKey'           => $this->moduleKey,
            'routePrefix'         => $this->routePrefix,
            'permissionPrefix'    => $this->permissionPrefix,
            'model'               => $this->modelInformation,
            'records'             => $records,
            'recordReferences'    => $this->getReferenceRepository()->getReferencesForModels($records->items()),
            'totalCount'          => $totalCount,
            'currentCount'        => $currentCount,
            'listStrategies'      => $this->getListColumnStrategyInstances(),
            'sortColumn'          => $this->getActualSort(),
            'sortDirection'       => $this->getActualSortDirection(),
            'pageSize'            => $this->getActualPageSize(),
            'pageSizeOptions'     => $this->getPageSizeOptions(),
            'filterStrategies'    => $this->renderedListFilterStrategies($this->getActiveFilters()),
            'activeScope'         => $this->getActiveScope(),
            'scopeCounts'         => $scopeCounts,
            'unconditionalDelete' => $this->isUnconditionallyDeletable(),
            'defaultRowAction'    => $this->getDefaultRowActionInstance(),
            'hasActiveListParent' => (bool) $this->listParentRelation,
            'listParents'         => $this->listParents,
            'topListParentOnly'   => $this->showsTopParentsOnly(),
            'draggableOrderable'  => $this->isListOrderDraggable($totalCount, $currentCount),
            'availableExportKeys' => $this->getAvailableExportStrategyKeys(),
        ]);
    }
75391
public function listAnnouncementsAction()
    {
        $this->checkStaticTemplateIsIncluded();
        $this->checkSettings();

        $this->slotExtendedAssignMultiple([
            self::VIEW_VARIABLE_ASSOCIATION_ID => $this->settings[self::SETTINGS_ASSOCIATION_ID],
            self::VIEW_VARIABLE_FILTER => $this->getAnnouncementsFilter(),
        ], __CLASS__, __FUNCTION__);

        return $this->view->render();
    }
508917
protected function get_legacy_eventdata() {
        global $USER;

        $workshop = $this->get_record_snapshot('workshop', $this->objectid);
        $course   = $this->get_record_snapshot('course', $this->courseid);
        $cm       = $this->get_record_snapshot('course_modules', $this->contextinstanceid);
        $workshop = new \workshop($workshop, $cm, $course);
        return (object)array('workshop' => $workshop, 'user' => $USER);
    }
514344
protected function getListReportEvent()
    {
        $conditions = $this->query_filter;
        $conditions['limit'] = $this->data_limit;

        $list = (array) $this->report->getList($conditions);
        $this->prepareListReportEvent($list);
        return $list;
    }
1182604
protected function listActiveEvent($reload = false)
    {
        if (!isset($this->dispatcher) || (isset($this->activeEvents) && !$reload)) {
            return $this;
        }

        $this->activeEvents = [];
        $eventList          = FlowEvent::getEventList();
        $sortedListeners    = $this->dispatcher->getListeners();
        foreach ($sortedListeners as $eventName => $listeners) {
            if (isset($eventList[$eventName]) && !empty($listeners)) {
                $this->activeEvents[$eventName] = 1;
            }
        }

        return $this;
    }
753544
protected function _getCurrentPages()
    {
        $ret = array();
        $p = $this->getData()->getPage();
        while ($p) {
            $ret[] = $p;
            $p = $p->getParentPage();
        }
        return $ret;
    }
675281
public function extractRecordedEvents()
    {
        $eventCollection = $this->eventCollection();
        $eventStream = $eventCollection->stream();
        $eventCollection->commit();
        $this->committedVersion = $eventCollection->committedSequence();

        return $eventStream;
    }
207347
protected function getMinTimeArchiveProcessed()
    {
        $endDateTimestamp = self::determineIfArchivePermanent($this->params->getDateEnd());
        $isArchiveTemporary = ($endDateTimestamp === false);
        $this->temporaryArchive = $isArchiveTemporary;

        if ($endDateTimestamp) {
            // Permanent archive
            return $endDateTimestamp;
        }

        $dateStart = $this->params->getDateStart();
        $period    = $this->params->getPeriod();
        $segment   = $this->params->getSegment();
        $site      = $this->params->getSite();

        // Temporary archive
        return Rules::getMinTimeProcessedForTemporaryArchive($dateStart, $period, $segment, $site);
    }
1170409
public static function current_archived_stage()
    {
        $parts = explode('.', Versioned::get_reading_mode());
        if (sizeof($parts) === 3 && $parts[0] == 'Archive') {
            return $parts[2];
        }
        return static::DRAFT;
    }
1015716
public function Entries()
    {
        $output = new ArrayList();

        if (isset($this->entries)) {
            foreach ($this->entries as $entry) {
                $output->push(
                    RSSFeed_Entry::create($entry, $this->titleField, $this->descriptionField, $this->authorField)
                );
            }
        }
        return $output;
    }
1232137
protected function pages_prepare_prev(){
		if($this->page_prev>=0){
			$url=$this->generateurl($this->page_prev);
			$this->pages[]=(object)array(
				'name'=>'&lt;',
				'url'=>$url,
				'active'=>($this->page_prev==$this->page_active),
				'disabled'=>false
				);
			}else{
			$this->pages[]=(object)array(
				'name'=>'&lt;',
				'url'=>'',
				'active'=>false,
				'disabled'=>true
				);
			}
		}
709144
public function listAction()
    {
        $params = $this->params();
        $page   = (int) $params->fromRoute( 'page' );
        $mode   = $params->fromRoute( 'mode' );
        $all    = $mode == 'all';
        $tags   = array_map(
            'rawurldecode',
            explode( '/', $params->fromRoute( 'tags' ) )
        );

        $paginator = $this->getServiceLocator()
                          ->get( 'Grid\Paragraph\Model\Paragraph\Model' )
                          ->getContentPaginatorByTags( $tags, $all );

        $this->paragraphLayout();

        return array(
            'paginator'         => $paginator,
            'page'              => $page,
            'mode'              => $mode,
            'tags'              => $tags,
        );
    }
944499
public function listAction()
	{
		$this->denyAccessUnlessGranted('ROLE_ADMIN', null, 'Unable to access this page !');
		
		$postManager = $this->get('asf_document.post.manager');
		
		// Define DataGrid Source
		$source = new Entity($postManager->getClassName());
		
		// Get datagrid
		$grid = $this->get('grid');
		$grid instanceof Grid;
		$grid->setSource($source);
		$tableAlias = $source->getTableAlias();
		$postClassName = $postManager->getShortClassName();
		
		$source->manipulateQuery(function($query) use ($tableAlias, $postClassName) {
			$query instanceof QueryBuilder;
			
			// Get all original version of each posts
			$query2 = $query->getEntityManager()->createQueryBuilder();
			$query2->select('post.id')
				->from($postClassName, 'post')
				->where('post.original IS NULL');
			$result = $query2->getQuery()->getResult();
			
			// Search versions for each original posts
			if (count($result)) {
				$ids = array();
				foreach($result as $original) {
					$qb = $query->getEntityManager()->createQueryBuilder();
					$qb->select('p')->from($postClassName, 'p')
						->where('p.original=:original_id')
						->orderBy('p.createdAt', 'DESC')
						->setParameter('original_id', $original['id']);
					$r = $qb->getQuery()->setMaxResults(1)->getResult();
					
					if ( count($r) ) {
						$ids[] = $r[0]->getId();
					} else {
						$ids[] = $original['id'];
					}
				}
				
				// Create query for datagird
				$query->add('where', $query->expr()->in($tableAlias.'.id', $ids));
			}
			
			if ( count($query->getDQLPart('orderBy')) == 0) {
				$query->orderBy($tableAlias.'.createdAt', 'DESC');
			}
		});
		
		// Grid Columns configuration
		$this->get('event_dispatcher')->dispatch(DocumentEvents::POST_GRID_CONFIG, new PostGridEvent($grid, $source));
		
		$grid->getColumn('id')->setVisible(false);
		$grid->getColumn('title')->setTitle($this->get('translator')->trans('Post title', array(), 'asf_document'));
		$grid->getColumn('content')->setVisible(false);
		$grid->getColumn('slug')->setTitle($this->get('translator')->trans('Slug', array(), 'asf_document'));
		$grid->getColumn('state')->setTitle($this->get('translator')->trans('State', array(), 'asf_document'))
			->setFilterType('select')->setSelectFrom('values')->setOperatorsVisible(false)
			->setDefaultOperator('eq')->setValues(array(
				DocumentModel::STATE_DRAFT => $this->get('translator')->trans('Draft', array(), 'asf_document'),
				DocumentModel::STATE_WAITING => $this->get('translator')->trans('Waiting', array(), 'asf_document'),
				DocumentModel::STATE_PUBLISHED => $this->get('translator')->trans('Published', array(), 'asf_document')
			));
		$grid->getColumn('createdAt')->setTitle($this->get('translator')->trans('Created at', array(), 'asf_document'));
		$grid->getColumn('updatedAt')->setTitle($this->get('translator')->trans('Updated at', array(), 'asf_document'));
		
		$edit_action = new RowAction('btn_edit', 'asf_document_post_edit');
		$edit_action->setRouteParameters(array('id'));
		$grid->addRowAction($edit_action);
		
		$delete_action = new RowAction('btn_delete', 'asf_document_post_delete', true);
		$delete_action->setRouteParameters(array('id'))
			->setConfirmMessage($this->get('translator')->trans('Do you want to delete this post?', array(), 'asf_document'));
		$grid->addRowAction($delete_action);
		
		$grid->setNoDataMessage($this->get('translator')->trans('No post was found.', array(), 'asf_document'));
		
		return $grid->getGridResponse('ASFDocumentBundle:Post:list.html.twig', array('grid' => $grid));
	}
122356
public function onGetNewsModules()
    {
        $modules = [];
        $records = $this->db->fetchAll("SELECT m.id, m.name, t.name AS theme FROM tl_module m LEFT JOIN tl_theme t ON m.pid=t.id WHERE m.type IN ('newslist', 'newsarchive') ORDER BY t.name, m.name");

        foreach ($records as $record) {
            $modules[$record['theme']][$record['id']] = \sprintf('%s (ID %s)', $record['name'], $record['id']);
        }

        return $modules;
    }
528181
private function _show_previous() {

        $output = '';

        // if "always_show_navigation" is TRUE or
        // if the number of total pages available is greater than the number of selectable pages
        // it means we can show the "previous page" link
        if ($this->_properties['always_show_navigation'] || $this->_properties['total_pages'] > $this->_properties['selectable_pages']) {

            // CSS classes to be applied to the list item, if any
            $css_classes = isset($this->_properties['css_classes']['list_item']) && $this->_properties['css_classes']['list_item'] != '' ? array(trim($this->_properties['css_classes']['list_item'])) : array();

            // if we're on the first page, the link is disabled
            if ($this->_properties['page'] == 1) $css_classes[] = 'disabled';

            // generate markup
            $output = '<li' .

                // add CSS classes to the list item, if necessary
                (!empty($css_classes) ? ' class="' . implode(' ', $css_classes) . '"' : '') . '><a href="' .

                // the href is different if we're on the first page
                ($this->_properties['page'] == 1 ? 'javascript:void(0)' : $this->_build_uri($this->_properties['page'] - 1)) . '"' .

                // add CSS classes to the anchor, if necessary
                (isset($this->_properties['css_classes']['anchor']) && $this->_properties['css_classes']['anchor'] != '' ? ' class="' . trim($this->_properties['css_classes']['anchor']) . '"' : '') .

                // good for SEO
                // http://googlewebmastercentral.blogspot.de/2011/09/pagination-with-relnext-and-relprev.html
                ' rel="prev">' .

                ($this->_properties['reverse'] ? $this->_properties['next'] : $this->_properties['previous']) . '</a></li>';

        }

        // return the resulting string
        return $output;

    }