public static function PopulateCatalogueViewModelList($catalogues)
 {
     for ($i = 0; $i < count($catalogues); $i++) {
         $models[$i] = CatalogueHelper::PopulateCatalogueViewModel($catalogues[$i]);
     }
     return $models;
 }
 /**
  * Get a list of templates to call and return a default render with
  */
 public function iid()
 {
     $this->customise(array("ProductImage" => $this->getImageForProduct()));
     $this->extend("onBeforeIID");
     $classes = CatalogueHelper::get_templates_for_class($this->dataRecord->class);
     return $this->renderWith($classes);
 }
 public static function PopulateSectionViewModel($section)
 {
     $model = new SectionViewModel();
     $model->id = $section->section_id;
     $model->name = $section->section_name;
     $model->catalogues = CatalogueHelper::PopulateCatalogueViewModelList($section->catalogues);
     return $model;
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 public function getOptions()
 {
     $hash = md5($this->element);
     if (!isset(static::$options[$hash])) {
         static::$options[$hash] = parent::getOptions();
         /** @noinspection PhpUndefinedClassInspection */
         $options = CatalogueHelper::getAttrDirsOptions();
         static::$options[$hash] = array_merge(static::$options[$hash], $options);
     }
     return static::$options[$hash];
 }
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since    1.6
  */
 protected function addToolbar()
 {
     $canDo = CatalogueHelper::getActions($this->state->get('filter.ctr_id'));
     JToolbarHelper::title(JText::_('COM_COUNTRY_MANAGER'), 'component.png');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('country.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('country.edit');
     }
     if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'countries.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('countries.trash');
     }
     JHtmlSidebar::setAction('index.php?option=com_catalogue&view=countries');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true));
 }
Exemple #6
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since    1.6
  */
 protected function addToolbar()
 {
     /** @noinspection PhpIncludeInspection */
     require_once JPATH_COMPONENT . '/helpers/catalogue.php';
     $canDo = CatalogueHelper::getActions($this->state->get('filter.attr_id'));
     JToolbarHelper::title(JText::_('COM_MANUFACTURER_MANAGER'), 'component.png');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('attrdir.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('attrdir.edit');
     }
     if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'attrdirs.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('attrdirs.trash');
     }
     JHtmlSidebar::setAction('index.php?option=com_catalogue&view=manfacturers');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true));
 }
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since    1.6
  */
 protected function addToolbar()
 {
     /** @noinspection PhpIncludeInspection */
     require_once JPATH_COMPONENT . '/helpers/catalogue.php';
     /** @noinspection PhpUndefinedClassInspection */
     $canDo = CatalogueHelper::getActions();
     JToolbarHelper::title(JText::_('COM_CATALOGUE_MANAGER'), 'component.png');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('item.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('item.edit');
     }
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.state') != 2) {
             JToolbarHelper::publish('item.publish', 'JTOOLBAR_PUBLISH', true);
             JToolbarHelper::unpublish('item.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         }
         if ($this->state->get('filter.state') != -1) {
             if ($this->state->get('filter.published') != 2) {
                 JToolbarHelper::archiveList('item.archive');
             } elseif ($this->state->get('filter.state') == 2) {
                 JToolbarHelper::unarchiveList('item.publish');
             }
         }
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::checkin('item.checkin');
     }
     if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'catalogue.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('catalogue.trash');
     }
     if ($canDo->get('core.admin')) {
         JToolbarHelper::preferences('com_catalogue');
     }
 }
Exemple #8
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  *
  * @see     JViewLegacy::loadTemplate()
  * @since   12.2
  */
 public function display($tpl = null)
 {
     if ($this->getLayout() !== 'modal') {
         CatalogueHelper::addSubmenu('catalogue');
     }
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->authors = $this->get('Authors');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Levels filter.
     $options = array();
     $options[] = JHtml::_('select.option', '1', JText::_('J1'));
     $options[] = JHtml::_('select.option', '2', JText::_('J2'));
     $options[] = JHtml::_('select.option', '3', JText::_('J3'));
     $options[] = JHtml::_('select.option', '4', JText::_('J4'));
     $options[] = JHtml::_('select.option', '5', JText::_('J5'));
     $options[] = JHtml::_('select.option', '6', JText::_('J6'));
     $options[] = JHtml::_('select.option', '7', JText::_('J7'));
     $options[] = JHtml::_('select.option', '8', JText::_('J8'));
     $options[] = JHtml::_('select.option', '9', JText::_('J9'));
     $options[] = JHtml::_('select.option', '10', JText::_('J10'));
     $this->f_levels = $options;
     // We don't need toolbar in the modal window.
     if ($this->getLayout() !== 'modal') {
         $this->addToolbar();
         $this->sidebar = JHtmlSidebar::render();
     }
     parent::display($tpl);
 }
 function action_Item()
 {
     PermissionHelper::Verification('Editor');
     $model = CatalogueHelper::PopulateCatalogueViewModelList(CatalogueService::GetAll());
     $this->view->generate('/Catalog/item_view.php', 'template_view.php', $model);
 }
Exemple #10
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 public function getOptions()
 {
     return CatalogueHelper::getItemsOptions(true);
 }
Exemple #11
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 public function getOptions()
 {
     return CatalogueHelper::getFormsOptions();
 }
 /**
  * Get a list of templates to call and return a default render with
  */
 public function index()
 {
     $this->extend("onBeforeIndex");
     $classes = CatalogueHelper::get_templates_for_class($this->dataRecord->class);
     return $this->renderWith($classes);
 }
 /**
  * Send order.
  *
  * @return  bool.
  *
  * @since   1.5
  */
 public function send()
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $manager_email = $params->get('cart_manager_email');
     $manager_subject = $params->get('cart_manager_email_subject');
     $manager_intro = $params->get('cart_manager_introtext');
     $client_subject = $params->get('cart_client_email_subject');
     $client_intro = $params->get('cart_client_introtext');
     $client_mail_sign = $params->get('cart_email_sign');
     $user_name = $this->input->get('name', '', 'string');
     $user_phone = $this->input->get('phone', '', 'string');
     $user_email = $this->input->get('email', '', 'string');
     $user_msg = $this->input->get('desc', '', 'string');
     $itemId = $this->input->get('id', '', 'string');
     $mail = JFactory::getMailer();
     $mail->IsHTML(true);
     $mailfrom = $app->getCfg('mailfrom');
     $fromname = $app->getCfg('fromname');
     $sitename = $app->getCfg('sitename');
     // Check..
     if ($user_email) {
         if (!preg_match("~^([a-z0-9_\\-\\.])+@([a-z0-9_\\-\\.])+\\.([a-z0-9])+\$~i", $user_email)) {
             $app->redirect('/', JText::_('Некоректный Email'));
             return;
         }
     }
     $body_items = '<table width="550px" cellspacing="5"><tbody><tr><td>Наименование</td><td>Цена</td></tr>';
     $item = CatalogueHelper::getItemById($itemId);
     if ($item) {
         $body_items .= '<tr>';
         $body_items .= '<td>' . $item->item_name . '</td>';
         $body_items .= '<td>' . $item->price . '</td>';
         $body_items .= '</tr>';
     }
     $body_items .= '</table>';
     // ...Get order items
     $mail->addRecipient($manager_email);
     $mail->addReplyTo(array($manager_email, $user_name));
     $mail->setSender(array($mailfrom, $fromname));
     $mail->setSubject($manager_subject);
     $body = strip_tags(str_replace(array('<br />', '<br/>'), "\n", $manager_intro) . "\n");
     $body .= '<br/><br/>';
     if ($user_name) {
         $body .= 'ФИО отправителя: ' . $user_name . "<br/>";
     }
     if ($user_phone) {
         $body .= 'Телефон: ' . $user_phone . "<br/>";
     }
     if ($user_email) {
         $body .= 'E-mail: ' . $user_email . "<br/>";
     }
     if ($user_msg) {
         $body .= 'Сообщение: ' . $user_msg . "<br/>";
     }
     $body .= strip_tags(str_replace(array('<br />', '<br/>'), "\n", $manager_body));
     $body .= '<br/>' . $body_items;
     $body .= 'Страница отправки: ' . $_SERVER['HTTP_REFERER'];
     $mail->setBody($body);
     $sent = $mail->Send();
     if ($user_email) {
         $mail = JFactory::getMailer();
         $mail->addRecipient($user_email);
         if (!$user_name) {
             $user_name = $user_email;
         }
         $mail->addReplyTo(array($user_email, $user_name));
         $mail->setSender(array($mailfrom, $fromname));
         $mail->setSubject($client_subject);
         $body = strip_tags(str_replace(array('<br />', '<br/>'), "\n", $client_intro) . "\n");
         $body .= strip_tags(str_replace(array('<br />', '<br/>'), "\n", $client_mail_sign));
         $mail->setBody($body);
         $sent = $mail->Send();
     }
     $menu = $app->getMenu();
     $page_redirect = $menu->getItem($params->get('cart_form_redirect'))->route;
     if ($sent) {
         $app->redirect($page_redirect, '');
     }
 }
        ?>
">
							<a href="<?php 
        echo $item->item_image;
        ?>
" data-source="<?php 
        echo $item->item_image;
        ?>
"
							   title="<?php 
        echo $item->item_image_desc;
        ?>
">
								<img
									src="<?php 
        echo CatalogueHelper::createThumb($item->id, $item->item_image, $img_width, $img_height, 'cart');
        ?>
"
									width="<?php 
        echo $img_width;
        ?>
" height="<?php 
        echo $img_height;
        ?>
">
							</a>
						</div>
						<div class="cart-item-desc-wrap">
							<div class="item-name">
								<h4><?php 
        echo $item->item_name;
    ?>
						</tbody>
					</table>
				<?php 
}
?>
			</div>
			<div class="tab-pane" id="similar-items">

				<?php 
foreach ($item->assoc as $similar) {
    ?>
					<?php 
    $ilink = JRoute::_(CatalogueHelperRoute::getItemRoute($similar->id, $similar->category_id));
    if (!empty($similar->item_image)) {
        $src = CatalogueHelper::createThumb($similar->id, $similar->item_image, $img_width, $img_height, 'min');
    } else {
        $src = '/templates/blank_j3/img/imgholder.png';
    }
    ?>
					<div class="catalogue-one-item white-box" itemscope="" itemtype="http://schema.org/Product">
						<div class="catalogue-one-item-img">
							<a href="<?php 
    echo $ilink;
    ?>
" title="<?php 
    echo $similar->item_name;
    ?>
">
								<img src="<?php 
    echo $src;
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since    1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     // Since we don't track these assets at the item level, use the category id.
     /** @noinspection PhpUndefinedClassInspection */
     $canDo = CatalogueHelper::getActions($this->item->id, 0);
     JToolbarHelper::title($isNew ? JText::_('COM_CATALOGUE_MANAGER_ITEM_NEW') : JText::_('COM_CATALOGUE_MANAGER_ITEM_EDIT'), 'banners.png');
     // If not checked out, can save the item.
     if (!$checkedOut && $canDo->get('core.edit')) {
         JToolbarHelper::apply('item.apply');
         JToolbarHelper::save('item.save');
         if ($canDo->get('core.create')) {
             JToolbarHelper::save2new('item.save2new');
         }
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('item.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('item.cancel');
     } else {
         JToolbarHelper::cancel('item.cancel', 'JTOOLBAR_CLOSE');
     }
 }