本文整理汇总了PHP中Article::getPublicationId方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::getPublicationId方法的具体用法?PHP Article::getPublicationId怎么用?PHP Article::getPublicationId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Article
的用法示例。
在下文中一共展示了Article::getPublicationId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ArticleMessage
/**
* Log article related event.
*
* @param Article $p_article
* @param string $p_text
* @param int $p_userId
* @param int $p_eventId
* @param bool $p_short
*
* @return void
*/
public static function ArticleMessage(Article $p_article, $p_text, $p_userId = NULL, $p_eventId = 0, $p_short = FALSE)
{
ob_start();
$translator = \Zend_Registry::get('container')->getService('translator');
echo $translator->trans('Article'), ': ', $p_article->getTitle();
if (!$p_short) {
// add publication, issue, section
echo ' (';
echo $translator->trans('Publication'), ': ', $p_article->getPublicationId();
echo ', ';
echo $translator->trans('Issue'), ': ', $p_article->getIssueNumber();
echo ', ';
echo $translator->trans('Section'), ': ', $p_article->getSectionNumber();
echo ")\n";
}
// generate url
$url = ShortURL::GetURL($p_article->getPublicationId(), $p_article->getLanguageId(), $p_article->getIssueNumber(), $p_article->getSectionNumber(), $p_article->getArticleNumber());
if (strpos($url, 'http') !== FALSE) {
// no url for deleted
echo $translator->trans('Article URL', array(), 'api'), ': ', $url, "\n";
}
echo $translator->trans('Article Number', array(), 'api'), ': ', $p_article->getArticleNumber(), "\n";
echo $translator->trans('Language'), ': ', $p_article->getLanguageName(), "\n";
echo "\n";
echo $translator->trans('Action') . ': ', $p_text;
$message = ob_get_clean();
self::Message(substr($message, 0, 254), $p_userId, $p_eventId);
}
示例2: ArticleMessage
/**
* Log article related event.
*
* @param Article $p_article
* @param string $p_text
* @param int $p_userId
* @param int $p_eventId
* @param bool $p_short
*
* @return void
*/
public static function ArticleMessage(Article $p_article, $p_text, $p_userId = NULL, $p_eventId = 0, $p_short = FALSE)
{
ob_start();
echo getGS('Article'), ': ', $p_article->getTitle();
if (!$p_short) {
// add publication, issue, section
echo ' (';
echo getGS('Publication'), ': ', $p_article->getPublicationId();
echo ', ';
echo getGS('Issue'), ': ', $p_article->getIssueNumber();
echo ', ';
echo getGS('Section'), ': ', $p_article->getSectionNumber();
echo ")\n";
}
// generate url
$url = ShortURL::GetURL($p_article->getPublicationId(), $p_article->getLanguageId(), $p_article->getIssueNumber(), $p_article->getSectionNumber(), $p_article->getArticleNumber());
if (strpos($url, 'http') !== FALSE) {
// no url for deleted
echo getGS('Article URL'), ': ', $url, "\n";
}
echo getGS('Article Number'), ': ', $p_article->getArticleNumber(), "\n";
echo getGS('Language'), ': ', $p_article->getLanguageName(), "\n";
echo "\n";
echo getGS('Action') . ': ', $p_text;
$message = ob_get_clean();
self::Message($message, $p_userId, $p_eventId);
}
示例3: getArticleLink
private function getArticleLink(Article $article)
{
$params = array('f_publication_id' => $article->getPublicationId(), 'f_issue_number' => $article->getIssueNumber(), 'f_section_number' => $article->getSectionNumber(), 'f_article_number' => $article->getArticleNumber(), 'f_language_id' => $article->getLanguageId(), 'f_language_selected' => $article->getLanguageId());
$queryString = implode('&', array_map(function ($property) use($params) {
return $property . '=' . $params[$property];
}, array_keys($params)));
return $this->view->baseUrl("/admin/articles/edit.php?{$queryString}");
}
示例4: getEditLink
/**
* Get article edit link
*
* @param Article $article
* @return string
*/
public function getEditLink($article)
{
$params = array('f_publication_id' => $article->getPublicationId(), 'f_issue_number' => $article->getIssueNumber(), 'f_section_number' => $article->getSectionNumber(), 'f_article_number' => $article->getArticleNumber(), 'f_language_id' => $article->getLanguageId(), 'f_language_selected' => $article->getLanguageId());
$paramsStrings = array();
foreach ($params as $key => $val) {
$paramsStrings[] = "{$key}={$val}";
}
return '/admin/articles/edit.php?' . implode('&', $paramsStrings);
}
示例5: saveAction
public function saveAction()
{
global $_SERVER;
$this->_helper->layout->disableLayout();
$parameters = $this->getRequest()->getParams();
$errors = array();
$auth = Zend_Auth::getInstance();
$article = new Article($parameters['f_language'], $parameters['f_article_number']);
$publication = new Publication($article->getPublicationId());
if ($auth->getIdentity()) {
$acceptanceRepository = $this->getHelper('entity')->getRepository('Newscoop\\Entity\\Comment\\Acceptance');
$userRepository = $this->getHelper('entity')->getRepository('Newscoop\\Entity\\User');
$user = $userRepository->find($auth->getIdentity());
$userIp = getIp();
if ($acceptanceRepository->checkParamsBanned($user->getName(), $user->getEmail(), $userIp, $article->getPublicationId())) {
$errors[] = $this->view->translate('You have been banned from writing comments.');
}
} else {
$errors[] = $this->view->translate('You are not logged in.');
}
if (!array_key_exists('f_comment_subject', $parameters) || empty($parameters['f_comment_subject'])) {
//$errors[] = getGS('The comment subject was not filled in.');
$errors[] = $this->view->translate('The comment subject was not filled in.');
}
if (!array_key_exists('f_comment_content', $parameters) || empty($parameters['f_comment_content'])) {
$errors[] = $this->view->translate('The comment content was not filled in.');
}
if (empty($errors)) {
$commentRepository = $this->getHelper('entity')->getRepository('Newscoop\\Entity\\Comment');
$comment = new Comment();
$values = array('user' => $auth->getIdentity(), 'name' => $parameters['f_comment_nickname'], 'subject' => $parameters['f_comment_subject'], 'message' => $parameters['f_comment_content'], 'language' => $parameters['f_language'], 'thread' => $parameters['f_article_number'], 'ip' => $_SERVER['REMOTE_ADDR'], 'status' => 'approved', 'time_created' => new DateTime(), 'recommended' => '0');
$commentRepository->save($comment, $values);
$commentRepository->flush();
$this->view->response = 'OK';
} else {
$errors = implode('<br>', $errors);
$errors = $this->view->translate('Following errors have been found:') . '<br>' . $errors;
$this->view->response = $errors;
}
$this->getHelper('contextSwitch')->addActionContext('save', 'json')->initContext();
}
示例6: clearpageCache
/**
* Send request to refresh article cache on Facebook
*
* @param int $number
* @param int $languageId
*
* @return mixed response from Facebook about url, or array with error message
*/
private function clearpageCache($number, $languageId)
{
$article = new \Article($languageId, $number);
if (!$article->isPublished()) {
return array('message' => $this->get('translator')->trans('fb.label.errornot'));
}
$url = \ShortURL::GetURL($article->getPublicationId(), $article->getLanguageId(), $article->getIssueNumber(), $article->getSectionNumber(), $article->getArticleNumber());
try {
$curlClient = new \Buzz\Client\Curl();
$curlClient->setTimeout(10000);
$browser = new \Buzz\Browser($curlClient);
$result = $browser->post('https://graph.facebook.com/?id=' . $url . '&scrape=true');
$urlInfo = json_decode($result->getContent(), true);
} catch (\Buzz\Exception\ClientException $e) {
return array('message' => $this->get('translator')->trans('fb.label.error'));
}
return $urlInfo;
}
示例7: Article
function test_article() {
$article = new Article(9000001,9000002,9000003,9000004);
// Test create
$article->create("Unit Test Long Name",
"Unit Test Short Name",
"fastnews");
$this->assertTrue($article->exists());
// Test SET functions
$article->setTitle("Unit Test New Title");
$article->setCreatorId(9000005);
$article->setOnFrontPage(true);
$article->setOnSection(true);
$article->setWorkflowStatus('Y');
$article->setKeywords("Unit, Test");
$article->setIsIndexed(true);
// Test GET functions
$articleCopy = new Article(9000001, 9000002, 9000003, 9000004, $article->getArticleId());
$this->assertEquals(9000001, $articleCopy->getPublicationId());
$this->assertEquals(9000002, $articleCopy->getIssueNumber());
$this->assertEquals(9000003, $articleCopy->getSectionNumber());
$this->assertEquals(9000004, $articleCopy->getLanguageId());
$this->assertEquals(9000005, $articleCopy->getCreatorId());
$this->assertEquals("Unit Test New Title", $articleCopy->getTitle());
$this->assertEquals(true, $articleCopy->onFrontPage());
$this->assertEquals(true, $articleCopy->onSection());
$this->assertEquals('Y', $articleCopy->getWorkflowStatus());
$this->assertEquals("Unit, Test", $articleCopy->getKeywords());
$this->assertEquals(true, $articleCopy->isIndexed());
// Test DELETE functions
$article->delete();
$this->assertFalse($article->exists());
}
示例8: isUsersArticle
/**
* Test if given article is from users blog
*
* @param Article $article
* @param Newscoop\Entity\User $user
* @return bool
*/
public function isUsersArticle(\Article $article, User $user)
{
$section = $this->getSection($user);
return $section->getSectionNumber() == $article->getSectionNumber() && $section->getPublicationId() == $article->getPublicationId() && $section->getIssueNumber() == $article->getIssueNumber() && $section->getLanguageId() == $article->getLanguageId();
}
示例9: Article
$articleObj = new Article($languageId, $articleNumber);
if (!$articleObj->exists()) {
camp_html_display_error(getGS('Article does not exist.'));
exit;
}
$translationLanguageObj = new Language($f_translation_language);
if (!$translationLanguageObj->exists()) {
camp_html_display_error(getGS('Language does not exist.'));
exit;
}
$translationArticle = new Article($f_translation_language, $articleNumber);
if ($translationArticle->exists()) {
camp_html_add_msg(getGS("The article has already been translated into \$1.", $translationLanguageObj->getNativeName()));
camp_html_goto_page($backLink);
}
$f_publication_id = $articleObj->getPublicationId();
// Only create the translated issue and section if the article has been
// categorized.
if ($f_publication_id > 0) {
$publicationObj = new Publication($f_publication_id);
if (!$publicationObj->exists()) {
camp_html_display_error(getGS('Publication does not exist.'), $backLink);
exit;
}
$f_issue_number = $articleObj->getIssueNumber();
$issueObj = new Issue($f_publication_id, $f_language_id, $f_issue_number);
if (!$issueObj->exists()) {
camp_html_display_error(getGS('No such issue.'), $backLink);
exit;
}
//$translationIssueObj = new Issue($f_publication_id, $f_translation_language, $f_issue_number);
示例10: explode
$f_issue_number = Input::Get('f_issue_number', 'int', 0, true);
$f_section_number = Input::Get('f_section_number', 'int', 0, true);
$f_language_id = Input::Get('f_language_id', 'int', 0, true);
$f_article_code = Input::Get('f_article_code', 'string', 0);
$BackLink = Input::Get('Back', 'string', "/{$ADMIN}/articles/?f_publication_id={$f_publication_id}&f_issue_number={$f_issue_number}&f_section_number={$f_section_number}&f_language_id={$f_language_id}", true);
list($articleNumber, $languageId) = explode("_", $f_article_code);
if (!Input::IsValid()) {
camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $BackLink);
exit;
}
$articleObj = new Article($languageId, $articleNumber);
if (!$articleObj->exists()) {
camp_html_display_error(getGS('Article does not exist.'), $BackLink);
exit;
}
$f_publication_id = $f_publication_id > 0 ? $f_publication_id : $articleObj->getPublicationId();
$f_issue_number = $f_issue_number > 0 ? $f_issue_number : $articleObj->getIssueNumber();
$f_section_number = $f_section_number > 0 ? $f_section_number : $articleObj->getSectionNumber();
if ($f_publication_id > 0) {
$publicationObj = new Publication($f_publication_id);
if (!$publicationObj->exists()) {
camp_html_display_error(getGS('Publication does not exist.'), $BackLink);
exit;
}
$issueObj = new Issue($f_publication_id, $f_language_id, $f_issue_number);
if (!$issueObj->exists()) {
camp_html_display_error(getGS('No such issue.'), $BackLink);
exit;
}
$sectionObj = new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);
if (!$sectionObj->exists()) {
示例11: getGS
camp_html_add_msg(getGS("\$1 toggled.", """ . getGS("On Section Page") . """), "ok");
break;
case "toggle_comments":
foreach ($articleCodes as $articleCode) {
$articleObj = new Article($articleCode['language_id'], $articleCode['article_id']);
if ($articleObj->userCanModify($g_user)) {
$articleObj->setCommentsEnabled(!$articleObj->commentsEnabled());
}
}
camp_html_add_msg(getGS("\$1 toggled.", """ . getGS("Comments") . """), "ok");
break;
case "copy":
foreach ($groupedArticleCodes as $articleNumber => $languageArray) {
$languageId = camp_array_peek($languageArray);
$articleObj = new Article($languageId, $articleNumber);
$articleObj->copy($articleObj->getPublicationId(), $articleObj->getIssueNumber(), $articleObj->getSectionNumber(), $g_user->getUserId(), $languageArray);
camp_html_add_msg(getGS("Article(s) duplicated."), "ok");
}
camp_session_set($offsetVarName, 0);
break;
case "copy_interactive":
$args = $_REQUEST;
unset($args[SecurityToken::SECURITY_TOKEN]);
unset($args["f_article_code"]);
$argsStr = camp_implode_keys_and_values($args, "=", "&");
$argsStr .= "&f_mode=multi&f_action=duplicate";
foreach ($_REQUEST["f_article_code"] as $code) {
$argsStr .= "&f_article_code[]={$code}";
}
camp_session_set($offsetVarName, 0);
camp_html_goto_page("/{$ADMIN}/articles/duplicate.php?" . $argsStr);
示例12: camp_html_article_url
/**
* Create a link to an article.
*
* @param Article $p_articleObj
* The article we want to display.
*
* @param int $p_sectionLanguageId
* The language ID for the publication/issue/section.
*
* @param string $p_targetFileName
* Which file in the "articles" directory to call.
*
* @param string $p_backLink
* A URL to get back to the previous page the user was on.
*
* @param string $p_extraParams
*/
function camp_html_article_url($p_articleObj, $p_sectionLanguageId, $p_targetFileName = "", $p_backLink = "", $p_extraParams = null, $p_securityParameter = false)
{
global $ADMIN;
$str = "/{$ADMIN}/articles/" . $p_targetFileName . "?f_publication_id=" . $p_articleObj->getPublicationId() . "&f_issue_number=" . $p_articleObj->getIssueNumber() . "&f_section_number=" . $p_articleObj->getSectionNumber() . "&f_article_number=" . $p_articleObj->getArticleNumber() . "&f_language_id=" . $p_sectionLanguageId . "&f_language_selected=" . $p_articleObj->getLanguageId();
if ($p_securityParameter) {
$str .= '&' . SecurityToken::URLParameter();
}
if ($p_backLink != "") {
$str .= "&Back=" . urlencode($p_backLink);
}
if (!is_null($p_extraParams)) {
$str .= $p_extraParams;
}
return $str;
}
示例13: Section
if (!$issueObj->exists()) {
camp_html_display_error($translator->trans('Issue does not exist.'));
exit;
}
$sectionObj = new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);
if (!$sectionObj->exists()) {
camp_html_display_error($translator->trans('Section does not exist.'));
exit;
}
$articleObj = new Article($f_article_language, $f_article_number);
if (!$articleObj->exists()) {
camp_html_display_error($translator->trans('Article does not exist.'));
exit;
}
switch ($f_move) {
case 'up_rel':
$articleObj->positionRelative('up', 1);
break;
case 'down_rel':
$articleObj->positionRelative('down', 1);
break;
case 'abs':
$articleObj->positionAbsolute($f_position);
break;
default:
}
$cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
$cacheService->clearNamespace('article');
$url = "/{$ADMIN}/articles/index.php" . "?f_publication_id=" . $articleObj->getPublicationId() . "&f_issue_number=" . $articleObj->getIssueNumber() . "&f_section_number=" . $articleObj->getSectionNumber() . "&f_article_number=" . $articleObj->getArticleNumber() . "&f_language_selected={$f_language_selected}" . "&f_language_id=" . $f_language_id;
camp_html_add_msg($translator->trans("Article order changed.", array(), 'articles'), "ok");
camp_html_goto_page($url);
示例14: Article
camp_html_add_msg(getGS("$1 toggled.", """.getGS("On Section Page")."""), "ok");
break;
case "toggle_comments":
foreach ($articleCodes as $articleCode) {
$articleObj = new Article($articleCode['language_id'], $articleCode['article_id']);
if ($articleObj->userCanModify($g_user)) {
$articleObj->setCommentsEnabled(!$articleObj->commentsEnabled());
}
}
camp_html_add_msg(getGS("$1 toggled.", """.getGS("Comments")."""), "ok");
break;
case "copy":
foreach ($groupedArticleCodes as $articleNumber => $languageArray) {
$languageId = camp_array_peek($languageArray);
$articleObj = new Article($languageId, $articleNumber);
$articleObj->copy($articleObj->getPublicationId(),
$articleObj->getIssueNumber(),
$articleObj->getSectionNumber(),
$g_user->getUserId(),
$languageArray);
camp_html_add_msg(getGS("Article(s) duplicated."), "ok");
}
camp_session_set($offsetVarName, 0);
break;
case "copy_interactive":
$args = $_REQUEST;
unset($args[SecurityToken::SECURITY_TOKEN]);
unset($args["f_article_code"]);
$argsStr = camp_implode_keys_and_values($args, "=", "&");
$argsStr .= "&f_mode=multi&f_action=duplicate";
foreach ($_REQUEST["f_article_code"] as $code) {
示例15: processItem
/**
* Process item
* @param Article $article
* @return array
*/
public function processItem(Article $article)
{
global $g_user, $Campsite;
$articleLinkParams = '?f_publication_id=' . $article->getPublicationId() . '&f_issue_number=' . $article->getIssueNumber() . '&f_section_number=' . $article->getSectionNumber() . '&f_article_number=' . $article->getArticleNumber() . '&f_language_id=' . $article->getLanguageId() . '&f_language_selected=' . $article->getLanguageId();
$articleLinkParamsTranslate = $articleLinkParams . '&f_action=translate&f_action_workflow=' . $article->getWorkflowStatus() . '&f_article_code=' . $article->getArticleNumber() . '_' . $article->getLanguageId();
$articleLink = $Campsite['WEBSITE_URL'] . '/admin/articles/edit.php' . $articleLinkParams;
$previewLink = $Campsite['WEBSITE_URL'] . '/admin/articles/preview.php' . $articleLinkParams;
$htmlPreviewLink = '<a href="' . $previewLink . '" target="_blank" title="' . getGS('Preview') . '">' . getGS('Preview') . '</a>';
$translateLink = $Campsite['WEBSITE_URL'] . '/admin/articles/translate.php' . $articleLinkParamsTranslate;
$htmlTranslateLink = '<a href="' . $translateLink . '" target="_blank" title="' . getGS('Translate') . '">' . getGS('Translate') . '</a>';
$lockInfo = '';
$lockHighlight = false;
$timeDiff = camp_time_diff_str($article->getLockTime());
if ($article->isLocked() && $timeDiff['days'] <= 0) {
$lockUser = new User($article->getLockedByUser());
if ($timeDiff['hours'] > 0) {
$lockInfo = getGS('The article has been locked by $1 ($2) $3 hour(s) and $4 minute(s) ago.', htmlspecialchars($lockUser->getRealName()), htmlspecialchars($lockUser->getUserName()), $timeDiff['hours'], $timeDiff['minutes']);
} else {
$lockInfo = getGS('The article has been locked by $1 ($2) $3 minute(s) ago.', htmlspecialchars($lockUser->getRealName()), htmlspecialchars($lockUser->getUserName()), $timeDiff['minutes']);
}
if ($article->getLockedByUser() != $g_user->getUserId()) {
$lockHighlight = true;
}
}
$tmpUser = new User($article->getCreatorId());
$tmpArticleType = new ArticleType($article->getType());
$tmpAuthor = new Author();
$articleAuthors = ArticleAuthor::GetAuthorsByArticle($article->getArticleNumber(), $article->getLanguageId());
foreach ((array) $articleAuthors as $author) {
if (strtolower($author->getAuthorType()->getName()) == 'author') {
$tmpAuthor = $author;
break;
}
}
if (!$tmpAuthor->exists() && isset($articleAuthors[0])) {
$tmpAuthor = $articleAuthors[0];
}
$onFrontPage = $article->onFrontPage() ? getGS('Yes') : getGS('No');
$onSectionPage = $article->onSectionPage() ? getGS('Yes') : getGS('No');
$imagesNo = (int) ArticleImage::GetImagesByArticleNumber($article->getArticleNumber(), true);
$topicsNo = (int) ArticleTopic::GetArticleTopics($article->getArticleNumber(), true);
$commentsNo = '';
if ($article->commentsEnabled()) {
global $controller;
$repositoryComments = $controller->getHelper('entity')->getRepository('Newscoop\\Entity\\Comment');
$filter = array('thread' => $article->getArticleNumber(), 'language' => $article->getLanguageId());
$params = array('sFilter' => $filter);
$commentsNo = $repositoryComments->getCount($params);
} else {
$commentsNo = 'No';
}
// get language code
$language = new Language($article->getLanguageId());
return array($article->getArticleNumber(), $article->getLanguageId(), $article->getOrder(), sprintf('%s <a href="%s" title="%s %s">%s</a>', $article->isLocked() ? '<span class="ui-icon ui-icon-locked' . (!$lockHighlight ? ' current-user' : '') . '" title="' . $lockInfo . '"></span>' : '', $articleLink, getGS('Edit'), htmlspecialchars($article->getName() . " ({$article->getLanguageName()})"), htmlspecialchars($article->getName() . (empty($_REQUEST['language']) ? " ({$language->getCode()})" : ''))), htmlspecialchars($article->getSection()->getName()), $article->getWebcode(), htmlspecialchars($tmpArticleType->getDisplayName()), htmlspecialchars($tmpUser->getRealName()), htmlspecialchars($tmpAuthor->getName()), $article->getWorkflowStatus(), $onFrontPage, $onSectionPage, $imagesNo, $topicsNo, $commentsNo, (int) $article->getReads(), Geo_Map::GetArticleMapId($article) != NULL ? getGS('Yes') : getGS('No'), (int) sizeof(Geo_Map::GetLocationsByArticle($article)), $article->getCreationDate(), $article->getPublishDate(), $article->getLastModified(), $htmlPreviewLink, $htmlTranslateLink);
}