8 require_once(CH_DIRECTORY_PATH_CLASSES .
'ChWsbPageView.php');
21 parent::__construct(
'ch_sites_profile');
24 $this->_oSites = &$oSites;
25 $this->_oDb = $oSites->_oDb;
26 $this->_oTemplate = $oSites->_oTemplate;
27 $this->_oConfig = $oSites->_oConfig;
29 $this->_sSubMenu = $sSubMenu;
36 switch ($this->_sSubMenu) {
55 $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'browse/my';
58 _t(
'_ch_sites_block_submenu_main') => array(
'href' => $sBaseUrl,
'active' => !$this->_sSubMenu),
59 _t(
'_ch_sites_block_submenu_add_site') => array(
'href' => $sBaseUrl .
'/add',
'active' => $this->_sSubMenu ==
'add'),
60 _t(
'_ch_sites_block_submenu_manage_sites') => array(
'href' => $sBaseUrl .
'/manage',
'active' => $this->_sSubMenu ==
'manage'),
61 _t(
'_ch_sites_block_submenu_pending_sites') => array(
'href' => $sBaseUrl .
'/pending',
'active' => $this->_sSubMenu ==
'pending'),
72 if (
$s = $oSearchResult->displayResultBlock(
true))
80 $iActive = $this->_oDb->getCountByOwnerAndStatus($this->_aProfile[
'ID'],
'approved');
81 $iPending = $this->_oDb->getCountByOwnerAndStatus($this->_aProfile[
'ID'],
'pending');
82 $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
"browse/my";
83 $aVars = array (
'msg' =>
'');
86 $sActive = sprintf(
_t(
'_ch_sites_msg_you_have_active_sites'), $sBaseUrl .
'/manage', $iActive);
88 $sPending = ($iActive ?
', ' :
'') . sprintf(
_t(
'_ch_sites_msg_you_have_pending_sites'), $sBaseUrl .
'/pending', $iPending);
90 if (isset($sActive) || isset($sPending))
91 $aVars[
'msg'] = sprintf(
_t(
'_ch_sites_msg_you_have_sites'),
92 isset($sActive) ? $sActive :
'', isset($sPending) ? $sPending :
'');
94 $aVars[
'msg'] =
_t(
'_ch_sites_msg_no_sites');
96 if ($this->_oSites->isAllowedAdd())
97 $aVars[
'msg'] .= (strlen(
$aVars[
'msg']) ?
' ' :
'') . sprintf(
_t(
'_ch_sites_msg_add_more_sites'), $sBaseUrl .
'/add');
99 return $this->_oTemplate->parseHtmlByName(
'my_sites_main.html',
$aVars);
105 if ($this->_oSites->isAllowedAdd())
106 return $this->_oSites->_addSiteForm();
108 return MsgBox(
_t(
'_ch_sites_msg_access_denied'));
114 if ($_POST[
'action_delete'] && is_array($_POST[
'entry']))
115 foreach ($_POST[
'entry']
as $iSiteId)
116 $this->_oSites->deleteSite($iSiteId);
118 if ($_POST[
'action_refresh_thumb'] && is_array($_POST[
'entry']))
119 foreach ($_POST[
'entry']
as $iSiteId)
120 $this->_oSites->refreshSiteThumb($iSiteId);
123 'action_delete' =>
'_ch_sites_admin_delete',
126 if (
getParam(
'ch_sites_redo') ==
'on' &&
getParam(
'ch_sites_account_type') ==
'Enabled') {
127 $aButtons[
'action_refresh_thumb'] =
'_ch_sites_admin_refresh_thumb';
130 $sForm = $this->_oSites->_manageSites(
'user', $this->_aProfile[
'NickName'], $aButtons);
133 return $this->_oTemplate->parseHtmlByName(
'my_sites_manage.html',
$aVars);
139 if ($_POST[
'action_delete'] && is_array($_POST[
'entry']))
140 foreach ($_POST[
'entry']
as $iSiteId)
141 $this->_oSites->deleteSite($iSiteId);
144 'action_delete' =>
'_ch_sites_admin_delete'
146 $sForm = $this->_oSites->_manageSites(
'my_pending',
'', $aButtons);
149 return $this->_oTemplate->parseHtmlByName(
'my_sites_manage.html',
$aVars);