本文整理汇总了PHP中Article::getLanguageId方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::getLanguageId方法的具体用法?PHP Article::getLanguageId怎么用?PHP Article::getLanguageId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Article
的用法示例。
在下文中一共展示了Article::getLanguageId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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}");
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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;
}
示例6: 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());
}
示例7: time
$diffSeconds = time() - strtotime($articleObj->getLockTime());
$hours = floor($diffSeconds / 3600);
$diffSeconds -= $hours * 3600;
$minutes = floor($diffSeconds / 60);
$lockUser = new User($articleObj->getLockedByUser());
camp_html_add_msg($translator->trans('Could not save the article. It has been locked by $1 $2 hours and $3 minutes ago.', array('$1' => $lockUser->getRealName(), '$2' => $hours, '$3' => $minutes), 'articles'));
camp_html_goto_page($BackLink);
exit;
}
// Update the article author
$blogService = Zend_Registry::get('container')->getService('blog');
$blogInfo = $blogService->getBlogInfo($g_user);
if (!empty($f_article_author)) {
$em = Zend_Registry::get('container')->getService('em');
$dispatcher = Zend_Registry::get('container')->getService('dispatcher');
$language = $em->getRepository('Newscoop\\Entity\\Language')->findOneById($articleObj->getLanguageId());
$authors = $em->getRepository('Newscoop\\Entity\\ArticleAuthor')->getArticleAuthors($articleObj->getArticleNumber(), $language->getCode())->getArrayResult();
ArticleAuthor::OnArticleLanguageDelete($articleObj->getArticleNumber(), $articleObj->getLanguageId());
foreach ($authors as $author) {
$dispatcher->dispatch("user.set_points", new \Newscoop\EventDispatcher\Events\GenericEvent($this, array('authorId' => $author['fk_author_id'])));
}
$i = 0;
foreach ($f_article_author as $author) {
$authorObj = new Author($author);
$author = trim($author);
if (!$authorObj->exists() && isset($author[0])) {
if ($blogService->isBlogger($g_user)) {
// blogger can't create authors
continue;
}
$authorData = Author::ReadName($author);
示例8: putGS
putGS('You can not schedule opposing events at the same time');
?>
';
parent.$.fancybox.close();
} catch (e) {
}
</script>
<?php
exit;
}
}
}
$articlePublishObj = new ArticlePublish();
$articlePublishObj->create();
$articlePublishObj->setArticleNumber($tmpArticle->getArticleNumber());
$articlePublishObj->setLanguageId($tmpArticle->getLanguageId());
$articlePublishObj->setActionTime($publishTime);
if ($f_publish_action == "P" || $f_publish_action == "U") {
$articlePublishObj->setPublishAction($f_publish_action);
}
if ($f_front_page_action == "S" || $f_front_page_action == "R") {
$articlePublishObj->setFrontPageAction($f_front_page_action);
}
if ($f_section_page_action == "S" || $f_section_page_action == "R") {
$articlePublishObj->setSectionPageAction($f_section_page_action);
}
Log::ArticleMessage($tmpArticle, getGS('Scheduled action added'), $g_user->getUserId(), 37);
}
if ($f_mode == "multi") {
$args = $_REQUEST;
unset($args["f_article_code"]);
示例9: processItem
/**
* Process item
* @param Article $article
* @return array
*/
public function processItem(Article $article)
{
global $g_user, $Campsite;
$translator = \Zend_Registry::get('container')->getService('translator');
return array($article->getArticleNumber(), $article->getLanguageId(), sprintf('
<div class="context-item" langid="%s">
<div class="context-drag-topics"><a href="#" title="drag to sort"></a></div>
<div class="context-item-header">
<div class="context-item-date">%s (%s) (%s)</div>
<a href="#" class="view-article" onClick="viewArticle($(this).parent(\'div\').parent(\'div\').parent(\'td\').parent(\'tr\').attr(\'id\'), $(this).parents(\'.context-item:eq(0)\').attr(\'langid\'));">%s</a>
</div>
<a href="javascript:void(0)" class="corner-button" style="display: none" onClick="removeFromContext($(this).parent(\'div\').parent(\'td\').parent(\'tr\').attr(\'id\'));removeFromContext($(this).parents(\'.item:eq(0)\').attr(\'id\'));toggleDragZonePlaceHolder();"><span class="ui-icon ui-icon-closethick"></span></a>
<div class="context-item-summary">%s</div>
</div>
', $article->getLanguageId(), $article->getLastModified(), $article->getWorkflowDisplayString(), $article->getType(), $translator->trans('View article', array(), 'library'), $article->getName()));
}
示例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: function
});
window.load_events = function(start, end, callback, url) {
// TODO: use start/end to limit the amount of loaded data
callServer(
{
'url': url,
'method': 'GET'
},
{
articleId : "<?php
echo $articleId;
?>
",
languageId : "<?php
echo $article->getLanguageId();
?>
"
},
function(res) {
callback(res);
},
true
);
};
</script>
</head>
<body onLoad="return false;" style="background: none repeat scroll 0 0 #FFFFFF;">
示例12: 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();
}
示例13: getdate
$savedOn = getdate($lastModified);
$savedToday = true;
if ($today['year'] != $savedOn['year'] || $today['mon'] != $savedOn['mon'] || $today['mday'] != $savedOn['mday']) {
$savedToday = FALSE;
}
$sectionObj = null;
$showComments = FALSE;
$showCommentControls = FALSE;
if ($f_publication_id > 0) {
$publicationObj = new Publication($f_publication_id);
if ($publicationObj->exists()) {
$issueObj = new Issue($f_publication_id, $f_language_id, $f_issue_number);
if ($issueObj->exists()) {
$sectionObj = new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);
if ($sectionObj->exists()) {
$languageObj = new Language($articleObj->getLanguageId());
} else {
$sectionObj = null;
}
} else {
$issueObj = null;
}
} else {
$publicationObj = null;
}
$showCommentControls = $publicationObj->commentsEnabled() && $articleType->commentsEnabled();
$showComments = $showCommentControls && $articleObj->commentsEnabled();
}
if ($showComments) {
// $comments = array();
/**
示例14: Article
$f_language_selected = (int) camp_session_get('f_language_selected', 0);
// Fetch article
$articleObj = new Article($f_language_selected, $f_article_number);
if (!$articleObj->exists()) {
camp_html_display_error($translator->trans('No such article.', array(), 'articles'));
exit;
}
//getArticleAuthors()
$articleInfo = array();
$articleData = $articleObj->getArticleData();
// Get article type fields.
$dbColumns = $articleData->getUserDefinedColumns(false, true);
foreach ($dbColumns as $dbColumn) {
if ($dbColumn->getType() == ArticleTypeField::TYPE_SWITCH) {
$value = $articleData->getProperty($dbColumn->getName()) ? $translator->trans('On', array(), 'articles') : $translator->trans('Off', array(), 'articles');
$articleInfo[htmlspecialchars($dbColumn->getDisplayName($articleObj->getLanguageId()))] = $value;
} else {
$articleInfo[htmlspecialchars($dbColumn->getDisplayName($articleObj->getLanguageId()))] = $articleData->getProperty($dbColumn->getName());
}
}
$articleInfo[$translator->trans('Title', array(), 'articles')] = $articleObj->getTitle();
// THIS IS REALLY BAD, NEVER LOCALIZE INTERNALLY
$articleInfo[$translator->trans('Date')] = $articleObj->getCreationDate();
// But I don't know what possibly depends on this so we leave it for now
$articleInfo['title'] = $articleObj->getTitle();
$articleInfo['date'] = $articleObj->getCreationDate();
$authors = ArticleAuthor::GetAuthorsByArticle($articleObj->getArticleNumber(), $articleObj->getLanguageId());
$authorsNames = array();
foreach ($authors as $author) {
$authorsNames[] = $author->getName();
}
示例15: time
exit;
}
// Only users with a lock on the article can change it.
if ($articleObj->isLocked() && $g_user->getUserId() != $articleObj->getLockedByUser()) {
$diffSeconds = time() - strtotime($articleObj->getLockTime());
$hours = floor($diffSeconds / 3600);
$diffSeconds -= $hours * 3600;
$minutes = floor($diffSeconds / 60);
$lockUser = new User($articleObj->getLockedByUser());
camp_html_add_msg($translator->trans('Could not save the article. It has been locked by $1 $2 hours and $3 minutes ago.', array('$1' => $lockUser->getRealName(), '$2' => $hours, '$3' => $minutes), 'articles'));
camp_html_goto_page($BackLink);
exit;
}
// Update the article author
if (!empty($f_article_author)) {
ArticleAuthor::OnArticleLanguageDelete($articleObj->getArticleNumber(), $articleObj->getLanguageId());
$i = 0;
foreach ($f_article_author as $author) {
$authorObj = new Author($author);
if (!$authorObj->exists() && strlen(trim($author)) > 0) {
$authorData = Author::ReadName($author);
$authorObj->create($authorData);
}
// Sets the author type selected
$author_type = $f_article_author_type[$i];
$authorObj->setType($author_type);
// Links the author to the article
$articleAuthorObj = new ArticleAuthor($articleObj->getArticleNumber(), $articleObj->getLanguageId(), $authorObj->getId(), $author_type);
if (!$articleAuthorObj->exists()) {
$articleAuthorObj->create();
}