Cheetah
ChBlogsCmts.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChTemplCmtsView');
9 
11 {
15  function __construct($sSystem, $iId)
16  {
17  parent::__construct($sSystem, $iId);
18  }
19 
20  function getMain()
21  {
22  $aPathInfo = pathinfo(__FILE__);
23  require_once ($aPathInfo['dirname'] . '/ChBlogsSearchUnit.php');
24  return (new ChBlogsSearchUnit())->getBlogsMain();
25  }
26 
27  function getBaseUrl()
28  {
29  $oMain = $this->getMain();
30  $aEntry = $oMain->_oDb->getPostInfo($this->getId());
31  if(empty($aEntry) || !is_array($aEntry))
32  return '';
33 
34  return $oMain->genUrl($aEntry['ID'], $aEntry['PostUri'], 'entry');
35  }
36 
37  function isPostReplyAllowed($isPerformAction = false)
38  {
39  if (!parent::isPostReplyAllowed($isPerformAction))
40  return false;
41 
42  $oMain = $this->getMain();
43  $aBlogPost = $oMain->_oDb->getPostInfo($this->getId(), 0, true);
44  return $oMain->isAllowedComments($aBlogPost);
45  }
46 
47  function isEditAllowedAll()
48  {
49  $oMain = $this->getMain();
50  $aBlogPost = $oMain->_oDb->getPostInfo($this->getId(), 0, true);
51  if ($oMain->isAllowedCreatorCommentsDeleteAndEdit($aBlogPost))
52  return true;
53  return parent::isEditAllowedAll();
54  }
55 
56  function isRemoveAllowedAll()
57  {
58  $oMain = $this->getMain();
59  $aBlogPost = $oMain->_oDb->getPostInfo($this->getId(), 0, true);
60  if ($oMain->isAllowedCreatorCommentsDeleteAndEdit($aBlogPost))
61  return true;
62  return parent::isRemoveAllowedAll();
63  }
64 }
$aPathInfo
$aPathInfo
Definition: cmd.php:12
ChBlogsCmts\getBaseUrl
getBaseUrl()
Definition: ChBlogsCmts.php:27
ChBlogsCmts\isPostReplyAllowed
isPostReplyAllowed($isPerformAction=false)
Definition: ChBlogsCmts.php:37
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
php
$iId
$iId
Definition: license.php:15
ChWsbCmts\getId
getId()
Definition: ChWsbCmts.php:228
ChBlogsCmts\isRemoveAllowedAll
isRemoveAllowedAll()
Definition: ChBlogsCmts.php:56
ChBlogsSearchUnit
Definition: ChBlogsSearchUnit.php:20
ChBlogsCmts
Definition: ChBlogsCmts.php:11
ChTemplCmtsView
Definition: ChTemplCmtsView.php:14
ChBlogsCmts\getMain
getMain()
Definition: ChBlogsCmts.php:20
ChBlogsCmts\__construct
__construct($sSystem, $iId)
Definition: ChBlogsCmts.php:15
ChBlogsCmts\isEditAllowedAll
isEditAllowedAll()
Definition: ChBlogsCmts.php:47
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7