20 $this->_oMain = &$oMain;
21 $this->_oTemplate = $oMain->_oTemplate;
22 $this->_oDb = $oMain->_oDb;
23 $this->_oConfig = $oMain->_oConfig;
25 parent::__construct(
'ch_store_my');
30 if (!$this->_oMain->_iProfileId || !$this->_aProfile)
34 switch (
ch_get(
'ch_store_filter')) {
38 case 'manage_products':
41 case 'pending_products':
48 $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
"browse/my";
50 _t(
'_ch_store_block_submenu_main') => array(
'href' => $sBaseUrl,
'active' => !
ch_get(
'ch_store_filter')),
51 _t(
'_ch_store_block_submenu_add_product') => array(
'href' => $sBaseUrl .
'&ch_store_filter=add_product',
'active' =>
'add_product' ==
ch_get(
'ch_store_filter')),
52 _t(
'_ch_store_block_submenu_manage_products') => array(
'href' => $sBaseUrl .
'&ch_store_filter=manage_products',
'active' =>
'manage_products' ==
ch_get(
'ch_store_filter')),
53 _t(
'_ch_store_block_submenu_pending_products') => array(
'href' => $sBaseUrl .
'&ch_store_filter=pending_products',
'active' =>
'pending_products' ==
ch_get(
'ch_store_filter')),
62 $o->aCurrent[
'rss'] = 0;
64 $o->sBrowseUrl =
"browse/my";
65 $o->aCurrent[
'title'] =
_t(
'_ch_store_page_title_my_store');
71 if (
$s =
$o->processing()) {
72 $this->_oTemplate->addCss (array(
'unit.css',
'twig.css',
'main.css'));
81 $iActive = $this->_oDb->getCountByAuthorAndStatus($this->_aProfile[
'ID'],
'approved');
82 $iPending = $this->_oDb->getCountByAuthorAndStatus($this->_aProfile[
'ID'],
'pending');
83 $sBaseUrl = CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
"browse/my";
84 $aVars = array (
'msg' =>
'');
86 $aVars[
'msg'] = sprintf(
_t(
'_ch_store_msg_you_have_pending_approval_products'), $sBaseUrl .
'&ch_store_filter=pending_products', $iPending);
88 $aVars[
'msg'] = sprintf(
_t(
'_ch_store_msg_you_have_no_products'), $sBaseUrl .
'&ch_store_filter=add_product');
90 $aVars[
'msg'] = sprintf(
_t(
'_ch_store_msg_you_have_some_products'), $sBaseUrl .
'&ch_store_filter=manage_products', $iActive, $sBaseUrl .
'&ch_store_filter=add_product');
91 return $this->_oTemplate->parseHtmlByName(
'my_store_main',
$aVars);
96 if (!$this->_oMain->isAllowedAdd()) {
100 $this->_oMain->_addForm(CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'browse/my');
101 $aVars = array (
'form' => ob_get_clean(),
'id' =>
'');
102 $this->_oTemplate->addCss (
'forms_extra.css');
103 return $this->_oTemplate->parseHtmlByName(
'my_store_create_product',
$aVars);
108 $sForm = $this->_oMain->_manageEntries (
'my_pending',
'',
false,
'ch_store_pending_user_form', array(
109 'action_delete' =>
'_ch_store_admin_delete',
110 ),
'ch_store_my_pending',
false, 7);
113 $aVars = array (
'form' =>
$sForm,
'id' =>
'ch_store_my_pending');
114 return $this->_oTemplate->parseHtmlByName(
'my_store_manage',
$aVars);
120 'action_delete' =>
'_ch_store_admin_delete',
121 ),
'ch_store_my_active',
true, 7);
122 $aVars = array (
'form' =>
$sForm,
'id' =>
'ch_store_my_active');
123 return $this->_oTemplate->parseHtmlByName(
'my_store_manage',
$aVars);