/** * Creates the list of objects. Sets the parameter $p_hasNextElements to * true if this list is limited and elements still exist in the original * list (from which this was truncated) after the last element of this * list. * * @param int $p_start * @param int $p_limit * @param bool $p_hasNextElements * @return array */ protected function CreateList($p_start = 0, $p_limit = 0, array $p_parameters, &$p_count) { $operator = new Operator('is'); $context = CampTemplate::singleton()->context(); if ($context->language->number) { $comparisonOperation = new ComparisonOperation('language_id', $operator, $context->language->number); $this->m_constraints[] = $comparisonOperation; } $comparisonOperation = new ComparisonOperation('_assign_publication_id', $operator, $context->publication->identifier); $this->m_constraints[] = $comparisonOperation; $comparisonOperation = new ComparisonOperation('_assign_issue_nr', $operator, $context->issue->number); $this->m_constraints[] = $comparisonOperation; $comparisonOperation = new ComparisonOperation('_assign_section_nr', $operator, $context->section->number); $this->m_constraints[] = $comparisonOperation; $comparisonOperation = new ComparisonOperation('_assign_article_nr', $operator, $context->article->number); $this->m_constraints[] = $comparisonOperation; $pollsList = Poll::GetList($this->m_constraints, $this->m_item, $this->m_order, $p_start, $p_limit, $p_count); $metaPollsList = array(); foreach ($pollsList as $poll) { $metaPollsList[] = new MetaPoll($poll->getLanguageId(), $poll->getNumber()); } return $metaPollsList; }
/** * Get an array of poll objects * You need to specify the language * * @param unknown_type $p_language_id * @param unknown_type $p_offset * @param unknown_type $p_limit * @return array */ public static function GetPolls($p_constraints = array(), $p_item = null, $p_offset = 0, $p_limit = 20, $p_orderBy = null, $p_filter = null) { $constraints = array(); $operator = new Operator('is'); if (array_key_exists('language_id', $p_constraints) && !empty($p_constraints['language_id'])) { $comparisonOperation = new ComparisonOperation('language_id', $operator, $p_constraints['language_id']); $constraints[] = $comparisonOperation; } if (array_key_exists('publication_id', $p_constraints) && !empty($p_constraints['publication_id'])) { $comparisonOperation = new ComparisonOperation('_assign_publication_id', $operator, $p_constraints['publication_id']); $constraints[] = $comparisonOperation; } if (array_key_exists('issue_nr', $p_constraints) && !empty($p_constraints['issue_nr'])) { $comparisonOperation = new ComparisonOperation('_assign_issue_nr', $operator, $p_constraints['issue_nr']); $constraints[] = $comparisonOperation; } if (array_key_exists('section_nr', $p_constraints) && !empty($p_constraints['section_nr'])) { $comparisonOperation = new ComparisonOperation('_assign_section_nr', $operator, $p_constraints['section_nr']); $constraints[] = $comparisonOperation; } if (array_key_exists('article_nr', $p_constraints) && !empty($p_constraints['article_nr'])) { $comparisonOperation = new ComparisonOperation('_assign_article_nr', $operator, $p_constraints['article_nr']); $constraints[] = $comparisonOperation; } if (array_key_exists('is_extendet', $p_constraints)) { $comparisonOperation = new ComparisonOperation('is_extended', $operator, $p_constraints['is_extended']); $constraints[] = $comparisonOperation; } if (array_key_exists('parent_poll_nr', $p_constraints)) { $comparisonOperation = new ComparisonOperation('parent_poll_nr', $operator, $p_constraints['parent_poll_nr']); $constraints[] = $comparisonOperation; } $order = array($p_orderBy => 'ASC'); return Poll::GetList($constraints, $p_item, $order, $p_offset, $p_limit, $p_count); }