本文整理汇总了PHP中Article::GetArticles方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::GetArticles方法的具体用法?PHP Article::GetArticles怎么用?PHP Article::GetArticles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Article
的用法示例。
在下文中一共展示了Article::GetArticles方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBlogInfo
/**
* Get blog info article
*
* @param Newscoop\Entity\User $user
* @return Article|null
*/
public function getBlogInfo(User $user)
{
$articles = \Article::GetArticles($this->config['publication'], $this->config['issue'], null, null, null, false, array("Type = '" . $this->config['type'] . "'"));
foreach ($articles as $article) {
$data = $article->getArticleData();
$authors = array_map('trim', explode(self::SEPARATOR, $data->getFieldValue('loginname')));
if (in_array($user->getUsername(), $authors)) {
return $article;
}
}
return null;
}
示例2: array
$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>
<script type="text/javascript" src="js/campsiteinternallink.js"></script>
<link href="css/campsiteinternallink.css" rel="stylesheet" type="text/css" />
<base target="_self" />
示例3: doAction
/**
* Execute the action.
* @return void
*/
public function doAction()
{
$publicationId = $this->m_data['fk_publication_id'];
$issueId = $this->m_data['fk_issue_id'];
$languageId = $this->m_data['fk_language_id'];
$publishAction = $this->m_data['publish_action'];
$publishArticlesAction = $this->m_data['do_publish_articles'];
$articleState = $publishAction == 'P' ? 'Y' : 'S';
if ($publishArticlesAction == 'Y') {
$articles = Article::GetArticles(null, $issueId, null, $languageId);
foreach ($articles as $article) {
$article->setWorkflowStatus($articleState);
}
}
$issueState = $publishAction == 'P' ? 'Y' : 'N';
$issue = new Issue($publicationId, $languageId, $issueId);
$issue->setWorkflowStatus($issueState);
$this->setCompleted();
}
示例4: foreach
<?php
if ($g_user->hasPermission('DeleteSection')) {
?>
<TD ALIGN="LEFT" VALIGN="TOP"><?php
echo $translator->trans("Delete");
?>
</TD>
<?php
}
?>
</TR>
<?php
foreach ($allSections as $section) {
$numberOfArticles = Article::GetArticles($section->getPublicationId(), $section->getIssueNumber(), $section->getSectionNumber(), $section->getLanguageId(), null, true);
$whereOptions = array("Published='Y'");
$numberOfPublishedArticles = Article::GetArticles($section->getPublicationId(), $section->getIssueNumber(), $section->getSectionNumber(), $section->getLanguageId(), null, true, $whereOptions);
?>
<TR <?php
if ($color) {
$color = 0;
?>
class="list_row_even"<?php
} else {
$color = 1;
?>
class="list_row_odd"<?php
}
?>
>
<TD ALIGN="RIGHT">
<?php
示例5: array
exit;
}
$allArticleLanguages = $issueObj->getLanguages();
if (!in_array($f_language_selected, DbObjectArray::GetColumn($allArticleLanguages, 'Id'))) {
$f_language_selected = 0;
}
$sqlOptions = array("LIMIT" => array("START" => $f_article_offset, "MAX_ROWS" => $ArticlesPerPage));
if ($f_language_selected) {
// Only show a specific language.
$totalArticles = Article::GetArticles($f_publication_id, $f_issue_number, $f_section_number, $f_language_selected, null, true);
$allArticles = Article::GetArticles($f_publication_id, $f_issue_number, $f_section_number, $f_language_selected, $sqlOptions);
$numUniqueArticles = $totalArticles;
$numUniqueArticlesDisplayed = count($allArticles);
} else {
// Show articles in all languages.
$totalArticles = Article::GetArticles($f_publication_id, $f_issue_number, $f_section_number, null, null, true);
$allArticles = Article::GetArticlesGrouped($f_publication_id, $f_issue_number, $f_section_number, null, $f_language_id, $sqlOptions);
$numUniqueArticles = Article::GetArticlesGrouped($f_publication_id, $f_issue_number, $f_section_number, null, null, null, true);
$numUniqueArticlesDisplayed = count(array_unique(DbObjectArray::GetColumn($allArticles, 'Number')));
}
$numArticlesThisPage = count($allArticles);
$previousArticleNumber = 0;
$pagerUrl = "index.php?f_publication_id=" . $f_publication_id . "&f_issue_number=" . $f_issue_number . "&f_section_number=" . $f_section_number . "&f_language_id=" . $f_language_id . "&f_language_selected=" . $f_language_selected . "&";
$pager = new SimplePager($numUniqueArticles, $ArticlesPerPage, $offsetVarName, $pagerUrl);
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj, 'Section' => $sectionObj);
camp_html_content_top(getGS('Article List') . ': ' . $this->view->escape($sectionObj->getName()), $topArray);
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">
<TR>
<TD><A HREF="/<?php
echo $ADMIN;
示例6: camp_html_display_error
require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/issues/issue_common.php";
require_once $GLOBALS['g_campsiteDir'] . '/classes/Article.php';
$translator = \Zend_Registry::get('container')->getService('translator');
// Check permissions
if (!$g_user->hasPermission('DeleteIssue')) {
camp_html_display_error($translator->trans('You do not have the right to delete issues.', array(), 'issues'));
exit;
}
$f_publication_id = Input::Get('f_publication_id', 'int');
$f_issue_number = Input::Get('f_issue_number', 'int');
$f_language_id = Input::Get('f_language_id', 'int');
if (!Input::IsValid()) {
camp_html_display_error($translator->trans('Invalid Input: $1', array('$1' => Input::GetErrorString()), 'issues'));
exit;
}
$numArticles = count(Article::GetArticles($f_publication_id, $f_issue_number, null, $f_language_id));
$publicationObj = new Publication($f_publication_id);
$issueObj = new Issue($f_publication_id, $f_language_id, $f_issue_number);
camp_html_content_top($translator->trans('Delete issue', array(), 'issues'), array('Pub' => $publicationObj, 'Issue' => $issueObj));
?>
<P>
<FORM METHOD="POST" ACTION="/<?php
echo $ADMIN;
?>
/issues/do_del.php">
<?php
echo SecurityToken::FormParameter();
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
<TD COLSPAN="2">
示例7: testPublishPackageMainWithSidebars
public function testPublishPackageMainWithSidebars()
{
$this->saveNewsItem(self::TEXT_XML);
$picture = $this->saveNewsItem(self::PICTURE_XML);
$xml = simplexml_load_file(APPLICATION_PATH . '/../tests/fixtures/' . self::PACKAGE_MAIN_SIDEBARS_XML);
$item = PackageItem::createFromXml($xml->itemSet->packageItem);
$feed = new TestFeed();
$item->setFeed($feed);
$picture->setFeed($feed);
$this->service->publish($item);
$this->assertTrue($item->isPublished());
$articles = \Article::GetArticles();
$this->assertEquals(1, count($articles));
$main = array_pop($articles);
$this->assertEquals('S&P piles pressure on Franco-German EU budget plan', $main->getTitle());
$images = \ArticleImage::GetImagesByArticleNumber($main->getArticleNumber());
$this->assertEquals(1, count($images));
}
示例8: camp_html_display_error
}
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('f_publication_id', 'int', 0);
$f_issue_number = Input::Get('f_issue_number', 'int', 0);
$f_language_id = Input::Get('f_language_id', 'int', 0);
$f_section_number = Input::Get('f_section_number', 'int', 0);
$f_delete_all_section_translations = Input::Get('f_delete_all_section_translations', 'string', '', true);
$f_delete_all_articles_translations = Input::Get('f_delete_all_articles_translations', 'string', '', true);
$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);
$sectionName = $sectionObj->getName();
$articles = Article::GetArticles($f_publication_id, $f_issue_number, $f_section_number, $f_language_id);
$numArticles = count($articles);
$numArticlesDeleted = 0;
$f_delete_all_section_translations = $f_delete_all_section_translations == 'Y' ? true : false;
$f_delete_all_articles_translations = $f_delete_all_articles_translations == 'Y' ? true : false;
if ($f_delete_all_section_translations == false) {
$numArticlesDeleted = $sectionObj->delete(true, $f_delete_all_articles_translations);
$cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
$cacheService->clearNamespace('section');
} else {
$sectionTranslations = Section::GetSections($f_publication_id, $f_issue_number, null, null, $sectionObj->getName(), null);
foreach ($sectionTranslations as $key => $sectionTranslation) {
$numArticlesDeleted += $sectionTranslation->delete(true, $f_delete_all_articles_translations);
}
}
$offsetVarName = 'SectOffs_' . $f_publication_id . '_' . $f_issue_number . '_' . $f_language_id;
示例9: delete
/**
* Delete the section, and optionally the articles. If you are
* deleting the articles, the default is to only delete the articles
* with the same language as this section. If you want to delete
* all article translations, set the second parameter to TRUE.
*
* @param boolean $p_deleteArticles
* @param boolean $p_deleteArticleTranslations
* @return int
* Return the number of articles deleted.
*/
public function delete($p_deleteArticles = false, $p_deleteArticleTranslations = false)
{
$numArticlesDeleted = 0;
if ($p_deleteArticles) {
$languageId = null;
if (!$p_deleteArticleTranslations) {
$languageId = $this->m_data['IdLanguage'];
}
$articles = Article::GetArticles($this->m_data['IdPublication'],
$this->m_data['NrIssue'],
$this->m_data['Number'],
$languageId);
$numArticlesDeleted = count($articles);
foreach ($articles as $deleteMe) {
$deleteMe->delete();
}
}
$tmpData = $this->m_data;
$success = parent::delete();
if ($success) {
if (function_exists("camp_load_translation_strings")) {
camp_load_translation_strings("api");
}
$logtext = getGS('Section "$1" ($2) deleted. (Publication: $3, Issue: $4)',
$tmpData['Name'], $tmpData['Number'],
$tmpData['IdPublication'], $tmpData['NrIssue']);
Log::Message($logtext, null, 22);
}
return $numArticlesDeleted;
} // fn delete
示例10: delete
/**
* Delete the section, and optionally the articles. If you are
* deleting the articles, the default is to only delete the articles
* with the same language as this section. If you want to delete
* all article translations, set the second parameter to TRUE.
*
* @param boolean $p_deleteArticles
* @param boolean $p_deleteArticleTranslations
* @return int
* Return the number of articles deleted.
*/
public function delete($p_deleteArticles = false, $p_deleteArticleTranslations = false)
{
$numArticlesDeleted = 0;
if ($p_deleteArticles) {
$languageId = null;
if (!$p_deleteArticleTranslations) {
$languageId = $this->m_data['IdLanguage'];
}
$articles = Article::GetArticles($this->m_data['IdPublication'], $this->m_data['NrIssue'], $this->m_data['Number'], $languageId);
$numArticlesDeleted = count($articles);
foreach ($articles as $deleteMe) {
$deleteMe->delete();
}
}
$tmpData = $this->m_data;
$success = parent::delete();
if ($success) {
$outputSettingSections = $this->getOutputSettingSectionService()->findBySection($tmpData['id']);
foreach ($outputSettingSections as $outputSet) {
$this->getOutputSettingSectionService()->delete($outputSet);
}
}
return $numArticlesDeleted;
}
示例11: get_bloginfo
/**
* Get related bloginfo
*
* @return Article|null
*/
public function get_bloginfo()
{
if (NULL === $this->bloginfo) {
$infos = \Article::GetArticles($this->m_dbObject->getPublicationId(), $this->m_dbObject->getIssueNumber(), $this->m_dbObject->getSectionNumber(), null, null, false, array("Type = 'bloginfo'"));
if (!empty($infos)) {
$this->bloginfo = new self($infos[0]->getLanguageId(), $infos[0]->getArticleNumber());
}
}
return $this->bloginfo;
}