commentsEnabled() public method

Return TRUE if comments are enabled for this article type.
public commentsEnabled ( ) : boolean
return boolean
Example #1
0
 protected function getCommentsEnabled()
 {
     $publicationObj = new Publication($this->m_dbObject->getProperty('IdPublication'));
     $articleTypeObj = new ArticleType($this->m_dbObject->getProperty('Type'));
     return $publicationObj->commentsEnabled()
     && $articleTypeObj->commentsEnabled()
     && $this->m_dbObject->commentsEnabled();
 }
Example #2
0
<?php
$color = 0;
$i = 0;
foreach ($articleTypes as $articleType) {
	$currentArticleType = new ArticleType($articleType);
	if ($currentArticleType->getStatus() == 'hidden') {
		$hideShowText = getGS('show');
		$hideShowStatus = 'show';
		$hideShowImage = "is_hidden.png";
	} else {
		$hideShowText = getGS('hide');
		$hideShowStatus = 'hide';
		$hideShowImage = "is_shown.png";
	}

	if ($currentArticleType->commentsEnabled()) {
		$commentChangeText = getGS('deactivate');
		$commentImage = "is_shown.png";
	} else {
		$commentChangeText = getGS('activate');
		$commentImage = "is_hidden.png";
	}
    ?>
    <TR <?php  if ($color) { $color=0; ?>class="list_row_even"<?php  } else { $color=1; ?>class="list_row_odd"<?php  } ?>>
	<TD>
		<A HREF="/<?php p($ADMIN); ?>/article_types/rename.php?f_name=<?php  print htmlspecialchars($articleType); ?>"><?php print htmlspecialchars($articleType); ?></A>&nbsp;
	</TD>
	<TD ALIGN="CENTER">
		<A HREF="/<?php p($ADMIN); ?>/article_types/fields/?f_article_type=<?php  print urlencode($articleType); ?>"><?php  putGS('Fields'); ?></A>
	</TD>
Example #3
0
    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();
    /**
     * @todoget comments
     */
}
// Automatically switch to "view" mode if user doesnt have permissions
if (!$articleObj->userCanModify($g_user)) {
    $f_edit_mode = 'view';
}
//
// Automatic unlocking
//
<?php

require_once $GLOBALS['g_campsiteDir'] . '/classes/Log.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Article.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php';
$translator = \Zend_Registry::get('container')->getService('translator');
if (!SecurityToken::isValid()) {
    camp_html_display_error($translator->trans('Invalid security token!'));
    exit;
}
// Check permissions
if (!$g_user->hasPermission('ManageArticleTypes')) {
    camp_html_display_error($translator->trans("You do not have the right to rename article types.", array(), 'article_types'));
    exit;
}
$articleTypeName = Input::Get('f_article_type');
$errorMsgs = array();
$articleType = new ArticleType($articleTypeName);
if ($articleType->exists()) {
    $articleType->setCommentsEnabled(!$articleType->commentsEnabled());
    $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
    $cacheService->clearNamespace('article_type');
    \Zend_Registry::get('container')->getService('dispatcher')->dispatch('article_type.comments_management', new \Newscoop\EventDispatcher\Events\GenericEvent($this, array('article_type' => $articleType, 'new_status' => !$articleType->commentsEnabled())));
}
camp_html_goto_page("/{$ADMIN}/article_types/");
<?php
camp_load_translation_strings("article_types");
require_once($GLOBALS['g_campsiteDir'].'/classes/Log.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/Input.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/Article.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/ArticleType.php');

if (!SecurityToken::isValid()) {
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}

// Check permissions
if (!$g_user->hasPermission('ManageArticleTypes')) {
	camp_html_display_error(getGS("You do not have the right to rename article types."));
	exit;
}

$articleTypeName = Input::Get('f_article_type');
$errorMsgs = array();

$articleType = new ArticleType($articleTypeName);
if ($articleType->exists()) {
    $articleType->setCommentsEnabled(!$articleType->commentsEnabled());
}
camp_html_goto_page("/$ADMIN/article_types/");

?>
Example #6
0
 protected function getCommentsEnabled()
 {
     $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
     $cacheKey = $cacheService->getCacheKey(array('are_comments_enabled', $this->m_dbObject->getProperty('IdPublication'), $this->m_dbObject->getProperty('Type'), $this->m_dbObject->getArticleNumber(), $this->m_dbObject->getLanguageId()), 'publication');
     if ($cacheService->contains($cacheKey)) {
         return $cacheService->fetch($cacheKey);
     }
     $publicationObj = new Publication($this->m_dbObject->getProperty('IdPublication'));
     $articleTypeObj = new ArticleType($this->m_dbObject->getProperty('Type'));
     $commentsEnabled = $publicationObj->commentsEnabled() && $articleTypeObj->commentsEnabled() && $this->m_dbObject->commentsEnabled();
     $cacheService->save($cacheKey, $commentsEnabled);
     return $commentsEnabled;
 }