本文整理汇总了PHP中Section::GetSections方法的典型用法代码示例。如果您正苦于以下问题:PHP Section::GetSections方法的具体用法?PHP Section::GetSections怎么用?PHP Section::GetSections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::GetSections方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_set_section
/**
* Campsite set_section function plugin
*
* Type: function
* Name: set_section
* Purpose:
*
* @param array
* $p_params[name] The Name of the section to be set
* $p_params[number] The Number of the section to be set
* @param object
* $p_smarty The Smarty object
*/
function smarty_function_set_section($p_params, &$p_smarty)
{
// gets the context variable
$campsite = $p_smarty->getTemplateVars('gimme');
if (isset($p_params['number'])) {
$attrName = 'number';
$attrValue = $p_params['number'];
$sectionNumber = intval($p_params['number']);
} elseif (isset($p_params['name'])) {
$sections = Section::GetSections($campsite->publication->identifier, $campsite->issue->number, $campsite->language->number, null, $p_params['name']);
if (isset($sections[0])) {
$attrName = 'name';
$attrValue = $p_params['name'];
$sectionNumber = intval($sections[0]->getSectionNumber());
} else {
$campsite->section->trigger_invalid_value_error($attrName, $attrValue, $p_smarty);
return false;
}
} else {
$property = array_shift(array_keys($p_params));
CampTemplate::singleton()->trigger_error("invalid parameter '{$property}' in set_section");
return false;
}
if ($campsite->section->defined && $campsite->section->number == $sectionNumber) {
return;
}
$sectionObj = new MetaSection($campsite->publication->identifier, $campsite->issue->number, $campsite->language->number, $sectionNumber);
if ($sectionObj->defined) {
$campsite->section = $sectionObj;
}
}
示例2: camp_session_get
$translator = \Zend_Registry::get('container')->getService('translator');
$Pub = Input::Get('Pub', 'int', 0);
$Issue = Input::Get('Issue', 'int', 0);
$Language = Input::Get('Language', 'int', 0);
$SectOffs = camp_session_get("SectOffs_" . $Pub . "_" . $Issue . "_" . $Language, 0);
if ($SectOffs < 0) {
$SectOffs = 0;
}
$ItemsPerPage = 15;
if (!Input::IsValid()) {
camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), $_SERVER['REQUEST_URI']);
exit;
}
$publicationObj = new Publication($Pub);
$issueObj = new Issue($Pub, $Language, $Issue);
$allSections = Section::GetSections($Pub, $Issue, $Language, null, null, array('ORDER BY' => 'Number', 'LIMIT' => array('START' => $SectOffs, 'MAX_ROWS' => $ItemsPerPage)), true);
$totalSections = Section::GetTotalSections($Pub, $Issue, $Language);
$pager = new SimplePager($totalSections, $ItemsPerPage, "SectOffs_" . $Pub . "_" . $Issue . "_" . $Language, "index.php?Pub={$Pub}&Issue={$Issue}&Language={$Language}&");
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj);
camp_html_content_top($translator->trans('Section List'), $topArray);
$controller->view->headTitle($translator->trans('Section List') . ' - Newscoop Admin', 'SET');
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">
<TR>
<TD><A HREF="/<?php
echo $ADMIN;
?>
/issues/?Pub=<?php
p($Pub);
?>
"><IMG SRC="<?php
示例3: camp_array_peek
$singlePublication = camp_array_peek($publications);
$f_destination_publication_id = $singlePublication->getPublicationId();
}
$allIssues = array();
if ($f_destination_publication_id > 0) {
$allIssues = Issue::GetIssues($f_destination_publication_id, $f_article_language, null, null, null, false, array("ORDER BY" => array("Number" => "DESC")), true);
if (count($allIssues) == 1) {
$singleIssue = camp_array_peek($allIssues);
$f_destination_issue_number = $singleIssue->getIssueNumber();
$f_article_language = $singleIssue->getLanguageId();
}
}
$allSections = array();
if ($f_destination_issue_number > 0) {
$selectedIssue = new Issue($f_destination_publication_id, $f_article_language, $f_destination_issue_number);
$allSections = Section::GetSections($f_destination_publication_id, $f_destination_issue_number, $f_article_language, null, null, array("ORDER BY" => array("Name" => "ASC")), true);
if (count($allSections) == 1) {
$singleSection = camp_array_peek($allSections);
$f_destination_section_number = $singleSection->getSectionNumber();
}
}
$allArticleTypes = ArticleType::GetArticleTypes();
$allLanguages = Language::GetLanguages(null, null, null, array(), array(), true);
$crumbs = array();
$crumbs[] = array($translator->trans("Actions"), "");
$crumbs[] = array($translator->trans("Add new article"), "");
echo camp_html_breadcrumbs($crumbs);
?>
<?php
if (sizeof($allArticleTypes) == 0) {
示例4: _getSection
/**
* Get section
*
* @param string $name
* @param MetaIssue $issue
* @param MetaLanguage $language
* @param MetaPublication $publication
* @return MetaSection
*/
private function _getSection($name, MetaIssue $issue, MetaLanguage $language, MetaPublication $publication)
{
if (empty($name)) {
return null;
}
$cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
$cacheKey = $cacheService->getCacheKey(array('getSection', $name, $issue->id, $language->number, $publication->identifier), 'section');
if ($cacheService->contains($cacheKey)) {
$metaSection = $cacheService->fetch($cacheKey);
} else {
$sections = Section::GetSections($publication->identifier, $issue->number, $language->number, $name);
if (is_array($sections) && sizeof($sections) == 1) {
$metaSection = new MetaSection($publication->identifier, $issue->number, $language->number, $sections[0]->getSectionNumber());
$cacheService->save($cacheKey, $metaSection);
} else {
throw new InvalidArgumentException("Invalid section identifier in URL.", self::INVALID_SECTION);
}
}
return $metaSection;
}
示例5: getFilterSections
public function getFilterSections()
{
global $ADMIN_DIR, $g_user;
require_once $GLOBALS['g_campsiteDir'] . '/classes/Publication.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Issue.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Section.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Topic.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Author.php';
foreach ($_REQUEST['args'] as $arg) {
$_REQUEST[$arg['name']] = $arg['value'];
}
if ($_REQUEST['publication'] > 0) {
$publication = $_REQUEST['publication'];
} else {
$publication = NULL;
}
$language = NULL;
if ($_REQUEST['issue'] > 0) {
$issueArray = explode("_", $_REQUEST['issue']);
$issue = $issueArray[1];
if (isset($issueArray[2])) {
$language = $issueArray[2];
}
} else {
$issue = NULL;
}
if ($_REQUEST['language'] > 0) {
$language = $_REQUEST['language'];
}
// get sections
$sections = array();
$section_objects = Section::GetSections($publication, $issue, $language);
foreach ($section_objects as $section) {
if (!isset($sections[$section->getSectionNumber()])) {
$sections[$section->getSectionNumber()] = $section;
}
}
$newSections = array();
foreach ($sections as $section) {
$newSections[] = array('val' => $section->getPublicationId() . '_' . $section->getIssueNumber() . '_' . $section->getLanguageId() . '_' . $section->getSectionNumber(), 'name' => $section->getName());
}
$sectionsNo = is_array($newSections) ? sizeof($newSections) : 0;
$menuSectionTitle = $sectionsNo > 0 ? getGS('All Sections') : getGS('No sections found');
$returns = array();
$returns['items'] = $newSections;
$returns['itemsNo'] = $sectionsNo;
$returns['menuItemTitle'] = $menuSectionTitle;
return json_encode($returns);
}
示例6: require_once
<?PHP
require_once($GLOBALS['g_campsiteDir']."/classes/Publication.php");
require_once($GLOBALS['g_campsiteDir']."/classes/Issue.php");
require_once($GLOBALS['g_campsiteDir']."/classes/Section.php");
global $Campsite;
/**
* $Campsite["issues"] in indexed by publication ID.
* $Campsite["sections"] is indexed by publication ID, issue number, and issue language.
*/
$Campsite["publications"] = Publication::GetPublications();
$Campsite["issues"] = array();
$Campsite["sections"] = array();
foreach ($Campsite["publications"] as $publication) {
$Campsite["issues"][$publication->getPublicationId()] =
Issue::GetIssues($publication->getPublicationId(), null, null, null, $publication->getLanguageId(),
false, array('ORDER BY'=>array('Number'=>'DESC'), 'LIMIT' => '5'), true);
foreach ($Campsite["issues"][$publication->getPublicationId()] as $issue) {
$Campsite["sections"][$issue->getPublicationId()][$issue->getIssueNumber()][$issue->getLanguageId()] =
Section::GetSections($issue->getPublicationId(),
$issue->getIssueNumber(), $issue->getLanguageId(),
null, null, array('ORDER BY'=>array('Number'=>'ASC'), 'LIMIT' => '10'), true);
}
}
?>
示例7: camp_html_display_error
exit;
}
$Pub = Input::Get('Pub', 'int');
if (!Input::IsValid()) {
camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $_SERVER['REQUEST_URI']);
exit;
}
$doDelete = true;
$publicationObj = new Publication($Pub);
$issuesRemaining = Issue::GetNumIssues($Pub);
$errorMsgs = array();
if ($issuesRemaining > 0) {
$errorMsgs[] = getGS('There are $1 issue(s) left.', $issuesRemaining);
$doDelete = false;
}
$sectionsRemaining = Section::GetSections($Pub, null, null, null, null, null, true);
if (count($sectionsRemaining) > 0) {
$errorMsgs[] = getGS('There are $1 section(s) left.', count($sectionsRemaining));
$doDelete = false;
}
$articlesRemaining = Article::GetNumUniqueArticles($Pub);
if ($articlesRemaining > 0) {
$errorMsgs[] = getGS('There are $1 article(s) left.', $articlesRemaining);
$doDelete = false;
}
$subscriptionsRemaining = Subscription::GetNumSubscriptions($Pub);
if ($subscriptionsRemaining > 0) {
$errorMsgs[] = getGS('There are $1 subscription(s) left.', $subscriptionsRemaining);
$doDelete = false;
}
if ($doDelete) {
示例8: 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()) {
$sections = Section::GetSections($this->getPublicationId(), $this->getIssueNumber());
if (count($sections) > 0) {
return $sections[0];
}
}
return $section;
} // fn getSection
示例9: array
}
// Gets all issues
$allIssues = array();
if ($f_publication_id > 0) {
$allIssues = Issue::GetIssues($f_publication_id, $f_article_language_id, null, null, null, false, array("LIMIT" => 300, "ORDER BY" => array("Number" => "DESC")), true);
// Automatically selects the issue if there is only one
if (count($allIssues) == 1) {
$tmpIssue = camp_array_peek($allIssues);
$f_issue_number = $tmpIssue->getIssueNumber();
}
}
// Gets all the sections
$allSections = array();
if ($f_issue_number > 0) {
$destIssue = new Issue($f_publication_id);
$allSections = Section::GetSections($f_publication_id, $f_issue_number, $f_article_language_id, null, null, array("ORDER BY" => array("Number" => "DESC")), true);
// Automatically selects the section if there is only one
if (count($allSections) == 1) {
$tmpSection = camp_array_peek($allSections);
$f_section_number = $tmpSection->getSectionNumber();
}
}
$crumbs = array();
$crumbs[] = array($translator->trans("Actions"), "");
$crumbs[] = array($translator->trans("Import XML", array(), 'articles'), "");
echo camp_html_breadcrumbs($crumbs);
$controller->view->headTitle($translator->trans("Import XML", array(), 'articles') . ' - Newscoop Admin', 'SET');
?>
<?php
camp_html_display_msgs();
示例10: camp_html_display_error
require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/sections/section_common.php";
require_once $GLOBALS['g_campsiteDir'] . '/classes/Article.php';
$translator = \Zend_Registry::get('container')->getService('translator');
if (!$g_user->hasPermission('DeleteSection')) {
camp_html_display_error($translator->trans('You do not have the right to delete sections.', array(), 'sections'));
exit;
}
$f_publication_id = Input::Get('Pub', 'int', 0);
$f_issue_number = Input::Get('Issue', 'int', 0);
$f_language_id = Input::Get('Language', 'int', 0);
$f_section_number = Input::Get('Section', 'int', 0);
$numArticles = count(Article::GetArticles($f_publication_id, $f_issue_number, $f_section_number, $f_language_id));
$publicationObj = new Publication($f_publication_id);
$issueObj = new Issue($f_publication_id, $f_language_id, $f_issue_number);
$sectionObj = new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);
$sectionTranslations = Section::GetSections($f_publication_id, $f_issue_number, null, null, $sectionObj->getName(), null);
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj, 'Section' => $sectionObj);
camp_html_content_top($translator->trans('Delete section', array(), 'sections'), $topArray);
?>
<P>
<FORM METHOD="POST" ACTION="/<?php
echo $ADMIN;
?>
/sections/do_del.php">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<?php
echo SecurityToken::FormParameter();
?>
<TR>
<TD COLSPAN="2" align="center"><?php
echo $translator->trans('There are $1 articles in this section.', array('$1' => '<b>' . $numArticles . '</b>'), 'sections');
示例11: __copy
/**
* Copy this issue and all sections.
* @param int $p_destPublicationId
* @param int $p_destIssueId
* @param int $p_destLanguageId
* @return Issue
*/
private function __copy($p_destPublicationId, $p_destIssueId, $p_destLanguageId)
{
global $g_ado_db;
// Copy the issue
$newIssue = new Issue($p_destPublicationId, $p_destLanguageId, $p_destIssueId);
$columns = array();
$columns['Name'] = $g_ado_db->escape($this->getName());
$columns['IssueTplId'] = $this->m_data['IssueTplId'];
$columns['SectionTplId'] = $this->m_data['SectionTplId'];
$columns['ArticleTplId'] = $this->m_data['ArticleTplId'];
$created = $newIssue->create($p_destIssueId, $columns);
if ($created) {
// Copy the sections in the issue
$sections = Section::GetSections($this->m_data['IdPublication'], $this->m_data['Number'], $this->m_data['IdLanguage']);
$queryStr = "SELECT id FROM Issues WHERE IdPublication={$p_destPublicationId} AND Number={$p_destIssueId} AND IdLanguage={$p_destLanguageId}";
$issueId = $g_ado_db->GetOne($queryStr);
$issue = $this->getIssueService()->findById($issueId);
$outputSettings = $this->getOutputSettingIssueService()->findByIssue($this->getIssueId());
foreach ($outputSettings as $outSet) {
$newOutSet = new OutputSettingsIssue();
$outSet->copyTo($newOutSet);
$newOutSet->setIssue($issue);
$this->getOutputSettingIssueService()->insert($newOutSet);
}
foreach ($sections as $section) {
$section->copy($p_destPublicationId, $p_destIssueId, $p_destLanguageId, null, false);
}
return $newIssue;
} else {
return null;
}
}
示例12: setURL
/**
* Sets the URL values.
*
* Algorithm:
* - identify object (e.g.: publication, language, issue, section, article)
* - object defined
* - valid object?
* - yes: set
* - no: return error
* - object undefined
* - has default value?
* - yes: set
* - no:
* - object mandatory?
* - yes: return error
* - no: continue
*
* @return PEAR_Error
*
*/
private function setURL()
{
$this->setQueryVar('acid', null);
$this->m_publication = null;
$this->m_language = null;
$this->m_issue = null;
$this->m_section = null;
$this->m_article = null;
// gets the publication object based on site name (URI host)
$alias = preg_replace('/^'.$this->getScheme().':\/\//', '', $this->getBase());
$aliasObj = new Alias($alias);
if ($aliasObj->exists()) {
$this->m_publication = new MetaPublication($aliasObj->getPublicationId());
}
if (is_null($this->m_publication) || !$this->m_publication->defined()) {
return new PEAR_Error("Invalid site name '$alias' in URL.", self::INVALID_SITE_NAME);
}
// reads parameters values if any
$params = str_replace($this->m_config->getSetting('SUBDIR'), '', $this->getPath());
$cParams = explode('/', trim($params, '/'));
$cParamsSize = sizeof($cParams);
if ($cParamsSize >= 1) {
$cLangCode = $cParams[0];
}
if ($cParamsSize >= 2) {
$cIssueSName = $cParams[1];
}
if ($cParamsSize >= 3) {
$cSectionSName = $cParams[2];
}
if ($cParamsSize >= 4) {
$cArticleSName = $cParams[3];
}
// gets the language identifier and sets the language code
if (!empty($cLangCode)) {
$langArray = Language::GetLanguages(null, $cLangCode);
if (is_array($langArray) && sizeof($langArray) == 1) {
$this->m_language = new MetaLanguage($langArray[0]->getLanguageId());
}
} else {
$this->m_language = new MetaLanguage($this->m_publication->default_language->number);
}
if (is_null($this->m_language) || !$this->m_language->defined()) {
return new PEAR_Error("Invalid language identifier in URL.", self::INVALID_LANGUAGE);
}
// gets the issue number and sets the issue short name
if (!empty($cIssueSName)) {
$publishedOnly = !$this->m_preview;
$issueArray = Issue::GetIssues($this->m_publication->identifier,
$this->m_language->number, null, $cIssueSName, null, $publishedOnly);
if (is_array($issueArray) && sizeof($issueArray) == 1) {
$this->m_issue = new MetaIssue($this->m_publication->identifier,
$this->m_language->number,
$issueArray[0]->getIssueNumber());
} else {
return new PEAR_Error("Invalid issue identifier in URL.", self::INVALID_ISSUE);
}
} else {
$issueObj = Issue::GetCurrentIssue($this->m_publication->identifier,
$this->m_language->number);
$this->m_issue = new MetaIssue($this->m_publication->identifier,
$this->m_language->number, $issueObj->getIssueNumber());
if (!$this->m_issue->defined()) {
return new PEAR_Error("No published issue was found.", self::INVALID_ISSUE);
}
}
// gets the section number and sets the section short name
if (!empty($cSectionSName)) {
$sectionArray = Section::GetSections($this->m_publication->identifier,
$this->m_issue->number,
$this->m_language->number,
$cSectionSName);
if (is_array($sectionArray) && sizeof($sectionArray) == 1) {
$this->m_section = new MetaSection($this->m_publication->identifier,
//.........这里部分代码省略.........
示例13: camp_array_peek
$destPublicationObj = camp_array_peek($allPublications);
}
$allIssues = array();
if ($f_dest_publication_id > 0) {
// Get the most recent 50 Issues...if they want something farther back, we are in trouble.
$sqlOptions = array("LIMIT" => 50, "ORDER BY" => array("Number" => "DESC"));
$allIssues = Issue::GetIssues($f_dest_publication_id, $f_language_id, null, null, null, false, $sqlOptions, true);
if (count($allIssues) == 1) {
$f_dest_issue_number = $f_src_issue_number;
}
}
$allSections = array();
$destIssueObj = null;
if ($f_dest_issue_number > 0) {
$destIssueObj = new Issue($f_dest_publication_id, $sectionObj->getLanguageId(), $f_dest_issue_number);
$allSections = Section::GetSections($f_dest_publication_id, $f_dest_issue_number, $sectionObj->getLanguageId(), null, null, null, true);
}
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj, 'Section' => $sectionObj);
camp_html_content_top(getGS('Duplicate section'), $topArray, true, true);
?>
<script>
function CustomValidator_DuplicateSection(form) {
// Verify radio button checked
if (!form.section_chooser[0].checked && !form.section_chooser[1].checked) {
alert("<?php
putGS("Please select either '\$1' or '\$2'.", getGS('Existing Section'), getGS('New Section'));
?>
");
return false;
}
示例14: array
// Get the most recent issues.
$allIssues = array();
if ($f_destination_publication_id > 0) {
$allIssues = Issue::GetIssues($f_destination_publication_id, $firstArticle->getLanguageId(), null, null, null, false, array("LIMIT" => 300, "ORDER BY" => array("Number" => "DESC")), true);
// Automatically select the issue if there is only one.
if (count($allIssues) == 1) {
$tmpIssue = camp_array_peek($allIssues);
$f_destination_issue_number = $tmpIssue->getIssueNumber();
}
}
// Get all the sections.
$allSections = array();
if ($f_destination_issue_number > 0) {
$destIssue = new Issue($f_destination_publication_id);
$allSections = Section::GetSections($f_destination_publication_id, $f_destination_issue_number, $firstArticle->getLanguageId(), null, null, array("ORDER BY" => array("Number" => "DESC")), true);
// Automatically select the section if there is only one.
if (count($allSections) == 1) {
$tmpSection = camp_array_peek($allSections);
$f_destination_section_number = $tmpSection->getSectionNumber();
} else {
$tmpSection = new Section($f_destination_publication_id, $f_destination_issue_number,
$firstArticle->getLanguageId(), $f_destination_section_number);
if (!$tmpSection->exists()) {
$f_destination_section_number = 0;
}
}
}
// Special case:
示例15: array
require_once $GLOBALS['g_campsiteDir'] . '/classes/Article.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
$maxSelectLength = 60;
$languageId = Input::get('IdLanguage', 'int', 0, true);
$publicationId = Input::get('IdPublication', 'int', 0, true);
$sectionId = Input::get('NrSection', 'int', 0, true);
$issueId = Input::get('NrIssue', 'int', 0, true);
$articleId = Input::get('NrArticle', 'int', 0, true);
$target = Input::get('targetlist', 'string', '', true);
$languages = Language::GetLanguages(null, null, null, array(), array(), true);
$publications = Publication::GetPublications();
if ($languageId != 0 && $publicationId != 0) {
$issues = Issue::GetIssues($publicationId, $languageId, null, null, null, false, null, true);
}
if ($languageId != 0 && $publicationId != 0 && $issueId != 0) {
$sections = Section::GetSections($publicationId, $issueId, $languageId, null, null, null, true);
}
if ($languageId != 0 && $publicationId != 0 && $issueId != 0 && $sectionId != 0) {
$articles = Article::GetArticles($publicationId, $issueId, $sectionId, $languageId);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{#campsiteinternallink_dlg.title}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="../../utils/mctabs.js"></script>
<script type="text/javascript" src="../../utils/form_utils.js"></script>
<script type="text/javascript" src="../../utils/validate.js"></script>