Cheetah
ChGroupsPageView.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbTwigPageView');
9 
11 {
12  function __construct(&$oMain, &$aDataEntry)
13  {
14  parent::__construct('ch_groups_view', $oMain, $aDataEntry);
15  }
16 
17  function getBlockCode_Info()
18  {
19  return array($this->_blockInfo ($this->aDataEntry, $this->_oTemplate->blockFields($this->aDataEntry), $this->_oMain->_formatLocation($this->aDataEntry, false, true)));
20  }
21 
22  function getBlockCode_Desc()
23  {
24  return array($this->_oTemplate->blockDesc ($this->aDataEntry));
25  }
26 
27  function getBlockCode_Photo()
28  {
29  return $this->_blockPhoto ($this->_oDb->getMediaIds($this->aDataEntry['id'], 'images'), $this->aDataEntry['author_id']);
30  }
31 
32  function getBlockCode_Video()
33  {
34  return $this->_blockVideo ($this->_oDb->getMediaIds($this->aDataEntry['id'], 'videos'), $this->aDataEntry['author_id']);
35  }
36 
37  function getBlockCode_Sound()
38  {
39  return $this->_blockSound ($this->_oDb->getMediaIds($this->aDataEntry['id'], 'sounds'), $this->aDataEntry['author_id']);
40  }
41 
42  function getBlockCode_Files()
43  {
44  return $this->_blockFiles ($this->_oDb->getMediaIds($this->aDataEntry['id'], 'files'), $this->aDataEntry['author_id']);
45  }
46 
47  function getBlockCode_Rate()
48  {
49  ch_groups_import('Voting');
50  $o = new ChGroupsVoting ('ch_groups', (int)$this->aDataEntry['id']);
51  if (!$o->isEnabled()) return '';
52  return array($o->getBigVoting ($this->_oMain->isAllowedRate($this->aDataEntry)));
53  }
54 
56  {
57  ch_groups_import('Cmts');
58  $o = new ChGroupsCmts ('ch_groups', (int)$this->aDataEntry['id']);
59  if (!$o->isEnabled()) return '';
60  return $o->getCommentsFirst ();
61  }
62 
64  {
66 
67  if ($this->_oMain->_iProfileId || $this->_oMain->isAdmin()) {
68  $sCode = '';
69 
71  $aSubscribeButton = $oSubscription->getButton($this->_oMain->_iProfileId, 'ch_groups', '', (int)$this->aDataEntry['id']);
72  $sCode .= $oSubscription->getData();
73 
74  $isFan = $this->_oDb->isFan((int)$this->aDataEntry['id'], $this->_oMain->_iProfileId, 0) || $this->_oDb->isFan((int)$this->aDataEntry['id'], $this->_oMain->_iProfileId, 1);
75 
76  $aInfo = array (
77  'BaseUri' => $this->_oMain->_oConfig->getBaseUri(),
78  'iViewer' => $this->_oMain->_iProfileId,
79  'ownerID' => (int)$this->aDataEntry['author_id'],
80  'ID' => (int)$this->aDataEntry['id'],
81  'URI' => $this->aDataEntry['uri'],
82  'ScriptSubscribe' => $aSubscribeButton['script'],
83  'TitleSubscribe' => $aSubscribeButton['title'],
84  'TitleEdit' => $this->_oMain->isAllowedEdit($this->aDataEntry) ? _t('_ch_groups_action_title_edit') : '',
85  'TitleDelete' => $this->_oMain->isAllowedDelete($this->aDataEntry) ? _t('_ch_groups_action_title_delete') : '',
86  'TitleJoin' => $this->_oMain->isAllowedJoin($this->aDataEntry) ? ($isFan ? _t('_ch_groups_action_title_leave') : _t('_ch_groups_action_title_join')) : '',
87  'IconJoin' => $isFan ? 'sign-out' : 'sign-in',
88  'TitleInvite' => $this->_oMain->isAllowedSendInvitation($this->aDataEntry) ? _t('_ch_groups_action_title_invite') : '',
89  'TitleShare' => $this->_oMain->isAllowedShare($this->aDataEntry) ? _t('_ch_groups_action_title_share') : '',
90  'TitleBroadcast' => $this->_oMain->isAllowedBroadcast($this->aDataEntry) ? _t('_ch_groups_action_title_broadcast') : '',
91  'AddToFeatured' => $this->_oMain->isAllowedMarkAsFeatured($this->aDataEntry) ? ($this->aDataEntry['featured'] ? _t('_ch_groups_action_remove_from_featured') : _t('_ch_groups_action_add_to_featured')) : '',
92  'TitleManageFans' => $this->_oMain->isAllowedManageFans($this->aDataEntry) ? _t('_ch_groups_action_manage_fans') : '',
93  'TitleUploadPhotos' => $this->_oMain->isAllowedUploadPhotos($this->aDataEntry) ? _t('_ch_groups_action_upload_photos') : '',
94  'TitleUploadVideos' => $this->_oMain->isAllowedUploadVideos($this->aDataEntry) ? _t('_ch_groups_action_upload_videos') : '',
95  'TitleUploadSounds' => $this->_oMain->isAllowedUploadSounds($this->aDataEntry) ? _t('_ch_groups_action_upload_sounds') : '',
96  'TitleUploadFiles' => $this->_oMain->isAllowedUploadFiles($this->aDataEntry) ? _t('_ch_groups_action_upload_files') : '',
97  'TitleActivate' => method_exists($this->_oMain, 'isAllowedActivate') && $this->_oMain->isAllowedActivate($this->aDataEntry) ? _t('_ch_groups_admin_activate') : '',
98  );
99 
100  $aInfo['repostCpt'] = $aInfo['repostScript'] = '';
101  if(ChWsbRequest::serviceExists('wall', 'get_repost_js_click')) {
102  $sCode .= ChWsbService::call('wall', 'get_repost_js_script');
103 
104  $aInfo['repostCpt'] = _t('_Repost');
105  $aInfo['repostScript'] = ChWsbService::call('wall', 'get_repost_js_click', array($this->_oMain->_iProfileId, 'ch_groups', 'add', (int)$this->aDataEntry['id']));
106  }
107 
108  $sCodeActions = $oFunctions->genObjectsActions($aInfo, 'ch_groups');
109  if(empty($sCodeActions))
110  return '';
111 
112  return $sCode . $sCodeActions;
113  }
114 
115  return '';
116  }
117 
118  function getBlockCode_Fans()
119  {
120  return parent::_blockFans ($this->_oDb->getParam('ch_groups_perpage_view_fans'), 'isAllowedViewFans', 'getFans');
121  }
122 
124  {
125  return parent::_blockFansUnconfirmed (CH_GROUPS_MAX_FANS);
126  }
127 
128  function getCode()
129  {
130  $this->_oMain->_processFansActions ($this->aDataEntry, CH_GROUPS_MAX_FANS);
131 
132  return parent::getCode();
133  }
134 
135 }
ChWsbTwigPageView\_blockInfo
_blockInfo($aData, $sFields='', $sLocation='')
Definition: ChWsbTwigPageView.php:70
ChWsbRequest\serviceExists
static serviceExists($mixedModule, $sMethod, $sClass="Module")
Definition: ChWsbRequest.php:70
ChGroupsPageView\getBlockCode_Desc
getBlockCode_Desc()
Definition: ChGroupsPageView.php:22
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChWsbTwigPageView
Definition: ChWsbTwigPageView.php:14
ChGroupsPageView\getBlockCode_FansUnconfirmed
getBlockCode_FansUnconfirmed()
Definition: ChGroupsPageView.php:123
php
ch_groups_import
ch_groups_import($sClassPostfix, $aModuleOverwright=array())
Definition: ChGroupsModule.php:8
ChGroupsPageView\getBlockCode_Rate
getBlockCode_Rate()
Definition: ChGroupsPageView.php:47
ChWsbSubscription\getInstance
static getInstance()
Definition: ChWsbSubscription.php:67
ChGroupsPageView\__construct
__construct(&$oMain, &$aDataEntry)
Definition: ChGroupsPageView.php:12
ChGroupsPageView
Definition: ChGroupsPageView.php:11
ChGroupsPageView\getBlockCode_Fans
getBlockCode_Fans()
Definition: ChGroupsPageView.php:118
$oFunctions
$oFunctions
Definition: ChTemplFunctions.php:20
$aInfo
$aInfo
Definition: constants.inc.php:21
ChWsbTwigPageView\_blockSound
_blockSound($aReadyMedia, $iAuthorId, $sPrefix=false)
Definition: ChWsbTwigPageView.php:199
ChGroupsVoting
Definition: ChGroupsVoting.php:11
ChWsbTwigPageView\_blockPhoto
_blockPhoto(&$aReadyMedia, $iAuthorId, $sPrefix=false)
Definition: ChWsbTwigPageView.php:86
ChGroupsPageView\getBlockCode_Info
getBlockCode_Info()
Definition: ChGroupsPageView.php:17
ChGroupsPageView\getBlockCode_Photo
getBlockCode_Photo()
Definition: ChGroupsPageView.php:27
ChWsbTwigPageView\_blockVideo
_blockVideo($aReadyMedia, $iAuthorId, $sPrefix=false)
Definition: ChWsbTwigPageView.php:118
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
CH_GROUPS_MAX_FANS
const CH_GROUPS_MAX_FANS
Definition: ChGroupsModule.php:35
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
ChWsbTwigPageView\$aDataEntry
$aDataEntry
Definition: ChWsbTwigPageView.php:19
ChGroupsPageView\getBlockCode_Sound
getBlockCode_Sound()
Definition: ChGroupsPageView.php:37
ChGroupsPageView\getBlockCode_Actions
getBlockCode_Actions()
Definition: ChGroupsPageView.php:63
ChGroupsPageView\getBlockCode_Comments
getBlockCode_Comments()
Definition: ChGroupsPageView.php:55
ChWsbTwigPageView\_blockFiles
_blockFiles($aReadyMedia, $iAuthorId=0)
Definition: ChWsbTwigPageView.php:156
ChGroupsPageView\getCode
getCode()
Definition: ChGroupsPageView.php:128
ChGroupsCmts
Definition: ChGroupsCmts.php:11
ChGroupsPageView\getBlockCode_Files
getBlockCode_Files()
Definition: ChGroupsPageView.php:42
ChGroupsPageView\getBlockCode_Video
getBlockCode_Video()
Definition: ChGroupsPageView.php:32
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
$o
$o
Definition: cmd.php:193
ChWsbService\call
static call($mixed, $sMethod, $aParams=array(), $sClass='Module')
Definition: ChWsbService.php:32
ChWsbPageView\$sCode
$sCode
Definition: ChWsbPageView.php:102
$oSubscription
$oSubscription
Definition: notifies.php:28