Exemplo n.º 1
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $path = $app->getPathway();
     $document = JFactory::getDocument();
     $this->params = JComponentHelper::getParams('com_ksenmart');
     $shop_name = $this->params->get('shop_name', 'магазине');
     $pref = $this->params->get('path_separator', '-');
     $doc_title = $shop_name . $pref . 'Отзывы';
     $id = $app->input->get('id', 0, 'int');
     $layout = $this->getLayout();
     $document->setTitle($doc_title);
     $document->addStyleSheet(JURI::base() . 'components/com_ksenmart/css/shop_reviews.css');
     switch ($layout) {
         case 'comments':
             if (!JFactory::getConfig()->get('config.caching', 0)) {
                 $path->addItem(JText::_('KSM_REVIEWS_LIST_PATH_TITLE'));
             }
             $comments = $this->get('comments');
             $pagination = $this->get('Pagination');
             $this->assignRef('pagination', $pagination);
             $this->assignRef('rows', $comments);
             break;
         case 'comment':
             if ($id > 0) {
                 if (!JFactory::getConfig()->get('config.caching', 0)) {
                     $path->addItem(JText::_('KSM_REVIEWS_LIST_PATH_TITLE'), 'index.php?option=com_ksenmart&view=comments&layout=comments&Itemid=' . KSSystem::getShopItemid());
                     $path->addItem(JText::_('KSM_REVIEW_ITEM_PATH_TITLE'));
                 }
                 $comment = $this->get('Comment');
                 if (!$comment) {
                     JError::raiseError(404, 'Page not found');
                     return false;
                 }
                 $this->assignRef('comment', $comment);
             } else {
                 JError::raiseError(404, 'Page not found');
                 return false;
             }
             break;
         case 'reviews':
             if (!JFactory::getConfig()->get('config.caching', 0)) {
                 $path->addItem(JText::_('KSM_SHOP_REVIEWS_PATH_TITLE'));
             }
             $reviews = $this->get('ShopReviewsList');
             $user = KSUsers::getUser();
             $isset_review = KSSystem::issetReview($user->id);
             $this->assignRef('reviews', $reviews);
             $this->assignRef('user', $user);
             $this->assignref('show_shop_review', $isset_review);
             break;
         case 'review':
             if ($id > 0) {
                 $user = KSUsers::getUser();
                 $this->params = JComponentHelper::getParams('com_ksenmart');
                 $model = $this->getModel();
                 $review = $model->getShopReviewById($id);
                 if (!$review) {
                     JError::raiseError(404, 'Page not found');
                     return false;
                 }
                 $isset_review = KSSystem::issetReview($user->id);
                 $this->assignRef('review', $review);
                 $this->assignRef('user', $user);
                 $this->assignref('show_shop_review', $isset_review);
                 $document->setTitle(JText::sprintf('KSM_SHOP_REVIEW_PATH_TITLE_TEXT', $review->user->name, $shop_name));
                 if (!JFactory::getConfig()->get('config.caching', 0)) {
                     $path->addItem(JText::_('KSM_SHOP_REVIEWS_PATH_TITLE'), 'index.php?option=com_ksenmart&view=comments&layout=reviews&Itemid=' . KSSystem::getShopItemid());
                     $path->addItem(JText::sprintf('KSM_SHOP_REVIEW_PATH_TITLE_TEXT', $review->user->name, $shop_name));
                 }
             } else {
                 JError::raiseError(404, 'Page not found');
                 return false;
             }
             break;
     }
     parent::display($tpl);
 }
Exemplo n.º 2
0
 public function display($tpl = null)
 {
     $user = JFactory::getUser();
     $layout = $this->getLayout();
     if ($user->id == 0 && $layout != 'registration' && $layout != 'module_shipping') {
         header('Location:/');
     }
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $this->params = JComponentHelper::getParams('com_ksenmart');
     $path = $app->getPathway();
     $names_komponent = $this->params->get('shop_name', '');
     $pref = $this->params->get('path_separator', '');
     $doc_title = $names_komponent . $pref . JText::_('KSM_PROFILE_PATHWAY_ITEM');
     if (!JFactory::getConfig()->get('config.caching', 0) && $layout != 'registration') {
         $path->addItem(JText::_('KSM_PROFILE_PATHWAY_ITEM'), '');
     }
     $document->setTitle($doc_title);
     $this->assign('params', $this->params);
     switch ($layout) {
         case 'registration':
             $doc_title = $names_komponent . $pref . JText::_('KSM_PROFILE__REGISTRATION_PATHWAY_ITEM');
             $document->setTitle($doc_title);
             if (!JFactory::getConfig()->get('config.caching', 0)) {
                 $path->addItem(JText::_('KSM_PROFILE__REGISTRATION_PATHWAY_ITEM'), '');
             }
             $this->fields = KSUsers::getFields();
             $this->setLayout('profile_registration');
             break;
         case 'profile_order':
             $id = JRequest::getVar('id', 0);
             if (!JFactory::getConfig()->get('config.caching', 0)) {
                 $path->addItem(JText::_('profile_orders'), 'index.php?option=com_ksenmart&view=profile&layout=profile_orders');
                 $path->addItem('Заказ №' . $id);
             }
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/profile_order.js', 'text/javascript', false);
             $order = $this->get('Order');
             $fields = KSUsers::getFields();
             $regions = $this->get('Regions');
             $this->assign('order', $order);
             $this->assign('fields', $fields);
             $this->assign('regions', $regions);
             $this->setLayout('profile_order');
             break;
         case 'module_shipping':
             break;
         default:
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/jquery.inputmask.js', 'text/javascript', false);
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/jquery.bind-first-0.1.min.js', 'text/javascript', false);
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/jquery.inputmask-multi.js', 'text/javascript', false);
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/jquery.Jcrop.min.js', 'text/javascript', true);
             $document->addScript(JURI::base() . 'components/com_ksenmart/js/profile.js', 'text/javascript', false);
             $document->addStyleSheet(JURI::base() . 'components/com_ksenmart/css/map.css');
             $document->addStyleSheet(JURI::base() . 'components/com_ksenmart/css/jquery.Jcrop.min.css');
             $model = $this->getModel('profile');
             $user = KSUsers::getUser();
             $fields = KSUsers::getFields();
             $regions = $this->get('Regions');
             $favorities = $this->get('Favorities');
             $watched = $this->get('Watched');
             $orders = $this->get('Orders');
             $addresses = $this->get('Addresses');
             $reviews = $this->get('Comments');
             $pagination = $this->get('Pagination');
             $user_review = $model->getShopReview($user->id);
             $this->assign('user', $user);
             $this->assign('fields', $fields);
             $this->assign('regions', $regions);
             $this->assign('favorities', $favorities);
             $this->assign('watched', $watched);
             $this->assign('orders', $orders);
             $this->assign('addresses', $addresses);
             $this->assign('reviews', $reviews);
             $this->assign('user_review', $user_review);
             $this->assign('pagination', $pagination);
             $this->assign('model_profile', $model);
             $this->assign('show_shop_review', KSSystem::issetReview($user->id));
             $this->setLayout('profile');
             break;
     }
     parent::display($tpl);
 }