本文整理汇总了PHP中Poll::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP Poll::GetList方法的具体用法?PHP Poll::GetList怎么用?PHP Poll::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poll
的用法示例。
在下文中一共展示了Poll::GetList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateList
/**
* 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;
}
示例2: GetPolls
/**
* 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);
}