本文整理汇总了PHP中Article::getSectionNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::getSectionNumber方法的具体用法?PHP Article::getSectionNumber怎么用?PHP Article::getSectionNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Article
的用法示例。
在下文中一共展示了Article::getSectionNumber方法的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();
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);
}
示例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();
$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);
}
示例3: GetURI
public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null)
{
$translator = \Zend_Registry::get('container')->getService('translator');
$languageObj = new Language($p_languageId);
if (!$languageObj->exists()) {
return new PEAR_Error($translator->trans('Language does not exist.'));
}
$uri = '/' . $languageObj->getCode() . '/';
if (!is_null($p_issueNo) && is_null($p_articleNo)) {
$issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
if (!$issueObj->exists()) {
return new PEAR_Error($translator->trans('Issue does not exist.'));
}
$uri .= $issueObj->getUrlName() . '/';
}
if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
$sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
if (!$sectionObj->exists()) {
return new PEAR_Error($translator->trans('Section does not exist.'));
}
$uri .= $sectionObj->getUrlName() . '/';
}
if (!is_null($p_articleNo)) {
$articleObj = new Article($p_languageId, $p_articleNo);
if (!$articleObj->exists()) {
return new PEAR_Error($translator->trans('Article does not exist.'));
}
$issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
$sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber());
$uri .= $issueObj->getUrlName() . '/';
$uri .= $sectionObj->getUrlName() . '/';
$uri .= $articleObj->getUrlName() . '/';
}
return $uri;
}
示例4: GetURI
public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null)
{
$languageObj = new Language($p_languageId);
if (!$languageObj->exists()) {
return new PEAR_Error(getGS('Language does not exist.'));
}
$uri = $GLOBALS['Campsite']['SUBDIR'] . '/' . $languageObj->getCode() . '/';
if (!is_null($p_issueNo) && is_null($p_articleNo)) {
$issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
if (!$issueObj->exists()) {
return new PEAR_Error(getGS('Issue does not exist.'));
}
$uri .= $issueObj->getUrlName() . '/';
}
if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
$sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
if (!$sectionObj->exists()) {
return new PEAR_Error(getGS('Section does not exist.'));
}
$uri .= $sectionObj->getUrlName() . '/';
}
if (!is_null($p_articleNo)) {
$articleObj = new Article($p_languageId, $p_articleNo);
if (!$articleObj->exists()) {
return new PEAR_Error(getGS('Article does not exist.'));
}
$issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
$sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber());
$uri .= $issueObj->getUrlName() . '/';
$uri .= $sectionObj->getUrlName() . '/';
$uri .= $articleObj->getUrlName() . '/';
}
return $uri;
}
示例5: 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}");
}
示例6: 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);
}
示例7: 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;
}
示例8: 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());
}
示例9: 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);
示例10: 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;
}
示例11: getGS
} else {
$notAffectedArticles += 1;
}
}
$message = getGS("$1 Article(s) unlocked", $affectedArticles);
$errorMessage = getGS("$1 Article(s) not unlocked", $notAffectedArticles);
break;
case 'duplicate':
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);
$success = true;
$affectedArticles += 1;
}
$message = getGS("$1 Article(s) duplicated", $affectedArticles);
break;
case 'duplicate_interactive':
case 'move':
$args = array_merge($_REQUEST, $f_params);
unset($args["f_article_code"]);
$argsStr = camp_implode_keys_and_values($args, "=", "&");
示例12: returnJson
break;
case 'Published':
$f_value = 'Y';
break;
case 'Submitted':
$f_value = 'S';
break;
}
$access = false;
// A publisher can change the status in any way he sees fit.
// Someone who can change an article can submit/unsubmit articles.
// A user who owns the article may submit it.
if ($g_user->hasPermission('Publish') || $g_user->hasPermission('ChangeArticle') && $f_value != 'Y' || $articleObj->userCanModify($g_user) && $f_value == 'S') {
$access = true;
}
// If the article is not yet categorized, force it to be before publication.
if ($f_action_workflow == "Y" && ($articleObj->getPublicationId() == 0 || $articleObj->getIssueNumber() == 0 || $articleObj->getSectionNumber() == 0)) {
//$args = $_REQUEST;
//$argsStr = camp_implode_keys_and_values($_REQUEST, "=", "&");
//$argsStr .= "&f_article_code[]=".$f_article_number."_".$f_language_selected;
//$argsStr .= "&f_mode=single&f_action=publish";
//camp_html_goto_page("/$ADMIN/articles/duplicate.php?".$argsStr);
}
$success = $articleObj->setWorkflowStatus($f_value);
$message = $translator->trans("Article status set to \$1", array('$1' => $articleObj->getWorkflowDisplayString($f_value)), 'library');
}
}
if ($affectedArticles == 0 && $success) {
$affectedArticles = 1;
}
return returnJson($affectedArticles, $message, $notAffectedArticles, $errorMessage, $hiperlink);
示例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: explode
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);
示例15: Article
}
$articleObj = new Article($f_article_language, $f_article_number);
if (!$articleObj->exists()) {
camp_html_display_error(getGS('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: ;
}
$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(getGS("Article order changed."), "ok");
camp_html_goto_page($url);
?>