本文整理汇总了PHP中Section::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP Section::GetList方法的具体用法?PHP Section::GetList怎么用?PHP Section::GetList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::GetList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 array $p_parameters
* @param int &$p_count
* @return array
*/
protected function CreateList($p_start = 0, $p_limit = 0, array $p_parameters, &$p_count)
{
$sectionsList = Section::GetList($this->m_constraints, $this->m_order, $p_start, $p_limit, $p_count);
$metaSectionsList = array();
foreach ($sectionsList as $section) {
$metaSectionsList[] = new MetaSection($section->getPublicationId(),
$section->getIssueNumber(),
$section->getLanguageId(),
$section->getSectionNumber()
);
}
return $metaSectionsList;
}
示例2: 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 array $p_parameters
* @param int &$p_count
* @return array
*/
protected function CreateList($p_start = 0, $p_limit = 0, array $p_parameters, &$p_count)
{
$cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
$cacheKey = $cacheService->getCacheKey(array('metaSectionList', implode('-', $this->m_constraints), implode('-', $this->m_order), $p_start, $p_limit, $p_count), 'section');
if ($cacheService->contains($cacheKey)) {
return $cacheService->fetch($cacheKey);
}
$sectionsList = Section::GetList($this->m_constraints, $this->m_order, $p_start, $p_limit, $p_count);
$metaSectionsList = array();
foreach ($sectionsList as $section) {
$metaSectionsList[] = new MetaSection($section->getPublicationId(), $section->getIssueNumber(), $section->getLanguageId(), $section->getSectionNumber());
}
$cacheService->save($cacheKey, $metaSectionsList);
return $metaSectionsList;
}
示例3: getGS
$correct= false;
$f_number = ($f_number + 0);
$errors[] = getGS('You must fill in the $1 field.','"'.getGS('Number').'"');
}
if ($f_url_name == "") {
$correct = false;
$errors[] = getGS('You must fill in the $1 field.','"'.getGS('URL Name').'"');
}
if (!$isValidShortName && trim($f_url_name) != "") {
$correct = false;
$errors[] = getGS('The $1 field may only contain letters, digits and underscore (_) character.', '"' . getGS('URL Name') . '"');
}
$sectionsConstraints = array(new ComparisonOperation('idpublication', new Operator('is'), $f_publication_id),
new ComparisonOperation('nrissue', new Operator('is'), $f_issue_number),
new ComparisonOperation('number', new Operator('is'), $f_number));
$sections = Section::GetList($sectionsConstraints, null, 0, 0, $sectionsCount, true);
if ($sectionsCount > 0) {
$correct = false;
$errors[] = getGS('The section number $1 was already in use.', $f_number);
}
if ($correct) {
$newSection = new Section($f_publication_id, $f_issue_number, $f_language_id, $f_number);
$columns = array();
$columns['Description'] = $f_description;
$created = $newSection->create($f_name, $f_url_name, $columns);
if ($created) {
if ($f_add_subscriptions) {
$numSubscriptionsAdded = Subscription::AddSectionToAllSubscriptions($f_publication_id, $f_number);
if ($numSubscriptionsAdded == -1) {
$errors[] = getGS('Error updating subscriptions.');
}
示例4: testGetListBadParameter
public function testGetListBadParameter()
{
global $g_ado_db;
// builds the constraint
$leftOperand = 'ShortName';
$rightOperand = 'opensource';
$operator = new Operator('is', 'sql');
$comparisonOperationObj = new ComparisonOperation($leftOperand,
$operator,
$rightOperand);
// sets the params for Section::GetList()
$params = array($comparisonOperationObj);
$order = array('Name' => 'DESC');
$limitStart = 0;
$limitOffset = 0;
$this->assertEquals(null, Section::GetList($params, $order, $limitStart, $limitOffset));
} // fn testGetListBadParameter
示例5: smarty_function_camp_select
//.........这里部分代码省略.........
$html = '<select name="subscription_language[]" multiple size="3" ';
if ($subsType == 'paid') {
$html .= 'onchange="update_subscription_payment();" ';
}
$html .= 'id="select_language" ' . $p_params['html_code'] . '>';
} elseif ($attribute == 'alllanguages') {
$html = '<input type="checkbox" name="subs_all_languages" '
.'onchange="ToggleElementEnabled(\'select_language\');';
if ($subsType == 'paid') {
$html .= ' update_subscription_payment();';
}
$html .= '" ' . $p_params['html_code'] . ' />';
} elseif ($attribute == 'section') {
if ($campsite->subs_by_type == 'publication') {
$html = '<input type="hidden" name="cb_subs[]" value="'
.$campsite->section->number.'" />';
} elseif ($campsite->subs_by_type == 'section') {
$html = '<input type="checkbox" name="cb_subs[]" value="'
.$campsite->section->number.'" '
.'onchange="update_subscription_payment();" '
. $p_params['html_code'] . ' />';
}
}
break;
case 'search':
if ($attribute == 'mode') {
$html = '<input type="checkbox" name="f_match_all" '
. $p_params['html_code'] . ' />';
} elseif ($attribute == 'level') {
require_once($GLOBALS['g_campsiteDir'] . '/admin-files/localizer/Localizer.php');
if (!isGS('Publication')) {
camp_load_translation_strings("globals", $campsite->language->code);
}
$html = '<select name="f_search_'.$attribute.'" ' . $p_params['html_code'] . '>'
.'<option value="1" selected="selected">' . getGS('Publication') . '</option>'
.'<option value="2">' . getGS('Issue') . '</option>'
.'<option value="3">' . getGS('Section') . '</option>'
.'</select>';
} elseif ($attribute == 'section') {
require_once($GLOBALS['g_campsiteDir'] . '/admin-files/localizer/Localizer.php');
$constraints = array();
$operator = new Operator('is', 'integer');
if ($campsite->publication->defined) {
$constraints[] = new ComparisonOperation('IdPublication', $operator, $campsite->publication->identifier);
}
if ($campsite->language->defined) {
$constraints[] = new ComparisonOperation('IdLanguage', $operator, $campsite->language->number);
}
if ($campsite->issue->defined) {
$constraints[] = new ComparisonOperation('NrIssue', $operator, $campsite->issue->number);
}
$sectionsList = Section::GetList($constraints, array('Name'=>'ASC'), 0, 0, $count);
if (!isGS('-- ALL SECTIONS --')) {
camp_load_translation_strings("user_subscription_sections", $campsite->language->code);
}
$html = '<select name="f_search_section" ' . $p_params['html_code'] . '>';
$html .= '<option value="0" selected="selected">' . getGS('-- ALL SECTIONS --') . '</option>';
foreach ($sectionsList as $section) {
$html .= '<option value="' . $section->getSectionNumber() . '">'
. htmlspecialchars($section->getName()) . '</option>';
}
$html .= '</select>';
} elseif ($attribute == 'issue') {
$constraints = array();
$operator = new Operator('is', 'integer');
if ($campsite->publication->defined) {
$constraints[] = new ComparisonOperation('IdPublication', $operator, $campsite->publication->identifier);
}
if ($campsite->language->defined) {
$constraints[] = new ComparisonOperation('IdLanguage', $operator, $campsite->language->number);
}
$constraints[] = new ComparisonOperation('published', $operator, 'true');
$issuesList = Issue::GetList($constraints,
array(array('field'=>'bynumber', 'dir'=>'DESC')),
0, 0, $count);
$html = '<select name="f_search_issue" ' . $p_params['html_code'] . '>';
$html .= '<option value="0" selected="selected"> </option>';
foreach ($issuesList as $issue) {
$issueDesc = $issue->getIssueNumber() . '. '
. $issue->getName()
. ' ('. $issue->getPublicationDate() . ')';
$html .= '<option value="' . $issue->getIssueNumber() . '">'
. htmlspecialchars($issueDesc) . '</option>';
}
$html .= '</select>';
}
}
if ($selectTag == true) {
$html.= smarty_function_html_options(array('output' => $output,
'values' => $values,
'selected' => $fieldValue,
'print_result' => false),
$p_smarty);
$html.= '</select>';
}
return $html;
} // fn smarty_function_camp_select
示例6: getSection
/**
* Get the section that this article is in.
* @return object
*/
public function getSection()
{
$section = new Section($this->getPublicationId(), $this->getIssueNumber(), $this->getLanguageId(), $this->getSectionNumber());
if (!$section->exists()) {
$params = array(new ComparisonOperation('idpublication', new Operator('is', 'integer'), $this->getPublicationId()), new ComparisonOperation('idlanguage', new Operator('is', 'integer'), $this->getLanguageId()), new ComparisonOperation('number', new Operator('is', 'integer'), $this->getSectionNumber()));
if ($this->getIssueNumber()) {
$params[] = new ComparisonOperation('nrissue', new Operator('is', 'integer'), $this->getIssueNumber());
}
$sections = Section::GetList($params, null, 0, 1, $count = 0);
if (!empty($sections)) {
return $sections[0];
}
}
return $section;
}