Ejemplo n.º 1
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section, $action;
     parent::__construct(__FILE__);
     // register backend
     if (class_exists('backend')) {
         $backend = backend::getInstance();
         $import_menu = $backend->getMenu('shop_import');
         if (!is_null($import_menu)) {
             $import_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_import_items'), url_GetFromFilePath($this->path . 'images/import.svg'), window_Open('shop_import_items', 350, $this->getLanguageConstant('title_import_items'), true, true, backend_UrlMake($this->name, 'import')), 6));
             $import_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_import_english'), url_GetFromFilePath($this->path . 'images/import.svg'), window_Open('shop_import_items', 350, $this->getLanguageConstant('title_import_items'), true, true, backend_UrlMake($this->name, 'import_english')), 6));
         }
     }
     // register delivery method and create menu items
     if (ModuleHandler::is_loaded('backend') && ModuleHandler::is_loaded('shop')) {
         require_once 'units/method.php';
         require_once 'units/pickup_method.php';
         Paid_DeliveryMethod::getInstance($this);
         Pickup_DeliveryMethod::getInstance($this);
     }
     if (ModuleHandler::is_loaded('head_tag') && $section == 'shop' && $action == 'checkout') {
         $head_tag = head_tag::getInstance();
         $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/pikaday.js'), 'type' => 'text/javascript'));
         $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/pikaday.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
         $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/checkout.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
     }
     if (ModuleHandler::is_loaded('backend') && ModuleHandler::is_loaded('head_tag') && $section == 'backend') {
         $head_tag = head_tag::getInstance();
         $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/backend.js'), 'type' => 'text/javascript'));
     }
     // connect transaction handling event
     Events::connect('shop', 'transaction-completed', 'on_transaction_completed', $this);
 }
Ejemplo n.º 2
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section;
     parent::__construct(__FILE__);
     // register backend
     if ($section == 'backend' && class_exists('backend')) {
         $backend = backend::getInstance();
         $comments_menu = new backend_MenuItem($this->getLanguageConstant('menu_comments'), url_GetFromFilePath($this->path . 'images/icon.svg'), 'javascript:void(0);', $level = 5);
         $comments_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_administration'), url_GetFromFilePath($this->path . 'images/administration.svg'), window_Open('links_list', 730, $this->getLanguageConstant('title_links_manage'), true, true, backend_UrlMake($this->name, 'links_list')), $level = 5));
         $comments_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_settings'), url_GetFromFilePath($this->path . 'images/settings.svg'), window_Open('comments_settings', 400, $this->getLanguageConstant('title_settings'), true, true, backend_UrlMake($this->name, 'settings')), $level = 5));
         $backend->addMenu($this->name, $comments_menu);
     }
 }
Ejemplo n.º 3
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section;
     parent::__construct(__FILE__);
     // register mailer
     if (class_exists('contact_form')) {
         $mailer = new Mandrill_Mailer($this->language, $this->settings['api_key']);
         $contact_form = contact_form::getInstance();
         $contact_form->registerMailer('mandrill', $mailer);
     }
     // register backend
     if (class_exists('backend') && $section == 'backend') {
         $backend = backend::getInstance();
         $mandrill_menu = new backend_MenuItem($this->getLanguageConstant('menu_mandrill'), url_GetFromFilePath($this->path . 'images/icon.svg'), window_Open('mandrill_settings', 370, $this->getLanguageConstant('title_settings'), true, true, backend_UrlMake($this->name, 'settings')), $level = 5);
         $backend->addMenu($this->name, $mandrill_menu);
     }
 }
Ejemplo n.º 4
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section;
     parent::__construct(__FILE__);
     // register backend
     if (class_exists('backend')) {
         $backend = backend::getInstance();
         $callbox_menu = new backend_MenuItem($this->getLanguageConstant('menu_callbox'), url_GetFromFilePath($this->path . 'images/icon.svg'), 'javascript:void(0);', $level = 5);
         $callbox_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_settings'), url_GetFromFilePath($this->path . 'images/settings.svg'), window_Open('callbox_settings', 400, $this->getLanguageConstant('title_settings'), true, true, backend_UrlMake($this->name, 'settings')), $level = 5));
         $backend->addMenu($this->name, $callbox_menu);
     }
     if (class_exists('head_tag') && $section != 'backend' && $this->settings['include_code']) {
         $head_tag = head_tag::getInstance();
         $url = str_replace('{id}', $this->settings['account_id'], '//{id}.tctm.co/t.js');
         $head_tag->addTag('script', array('src' => $url, 'type' => 'text/javascript', 'async' => ''));
     }
 }
Ejemplo n.º 5
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section;
     parent::__construct(__FILE__);
     // register backend
     if (class_exists('backend') && class_exists('shop')) {
         $backend = backend::getInstance();
         $method_menu = $backend->getMenu('shop_delivery_methods');
         if (!is_null($method_menu)) {
             $method_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_fedex'), url_GetFromFilePath($this->path . 'images/icon.png'), window_Open('fedex', 350, $this->getLanguageConstant('title_settings'), true, true, backend_UrlMake($this->name, 'settings')), $level = 5));
         }
     }
     // register delivery method
     if (class_exists('shop')) {
         require_once 'units/fedex_delivery_method.php';
         FedEx_DeliveryMethod::getInstance($this);
     }
 }
Ejemplo n.º 6
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section;
     parent::__construct(__FILE__);
     // register backend
     if (class_exists('backend')) {
         $backend = backend::getInstance();
         $menu = $backend->getMenu($backend->name);
         if (!is_null($menu)) {
             $menu->insertChild(new backend_MenuItem($this->getLanguageConstant('menu_page_speed'), url_GetFromFilePath($this->path . 'images/icon.svg'), window_Open('page_speed', 670, $this->getLanguageConstant('title_page_speed'), true, false, backend_UrlMake($this->name, 'show')), $level = 5), 1);
         }
         // add style for backend
         if (class_exists('head_tag') && $section == 'backend') {
             $head_tag = head_tag::getInstance();
             $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/page_speed.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
         }
     }
 }
Ejemplo n.º 7
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section;
     parent::__construct(__FILE__);
     // register backend
     if (class_exists('backend') && class_exists('shop')) {
         $backend = backend::getInstance();
         $method_menu = $backend->getMenu('shop_payment_methods');
         if (!is_null($method_menu)) {
             $method_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_google_checkout'), url_GetFromFilePath($this->path . 'images/icon.png'), window_Open('paypal', 650, $this->getLanguageConstant('title_settings'), true, true, backend_UrlMake($this->name, 'settings')), $level = 5));
         }
     }
     // register payment method
     if (class_exists('shop')) {
         require_once "units/google_checkout_payment_method.php";
         GoogleCheckout_PaymentMethod::getInstance($this);
     }
 }
Ejemplo n.º 8
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section, $db_use;
     parent::__construct(__FILE__);
     // let the browser/crawler know we have different desktop/mobile styles
     if ($_SERVER['SERVER_PROTOCOL'] == 'HTTP/1.1') {
         header('Vary: User-Agent');
     }
     // change powered by header
     header('X-Powered-By: Caracal/' . _VERSION);
     // send encoding
     header('Content-Type: text/html; charset=UTF-8');
     // register backend
     if ($section == 'backend' && class_exists('backend')) {
         $backend = backend::getInstance();
         $menu = $backend->getMenu($backend->name);
         if (!is_null($menu)) {
             $menu->insertChild(new backend_MenuItem($this->getLanguageConstant('menu_page_info'), url_GetFromFilePath($this->path . 'images/icon.svg'), window_Open('page_settings', 400, $this->getLanguageConstant('title_page_info'), true, false, backend_UrlMake($this->name, 'show')), $level = 5), 1);
         }
     }
 }
Ejemplo n.º 9
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section;
     parent::__construct(__FILE__);
     // load module style and scripts
     if (class_exists('head_tag')) {
         $head_tag = head_tag::getInstance();
         $head_tag->addTag('script', array('src' => 'https://js.stripe.com/v2/', 'type' => 'text/javascript'));
     }
     // register backend
     if (class_exists('backend') && class_exists('shop')) {
         $backend = backend::getInstance();
         $method_menu = $backend->getMenu('shop_payment_methods');
         if (!is_null($method_menu)) {
             $method_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_stripe'), url_GetFromFilePath($this->path . 'images/icon.png'), window_Open('stripe', 350, $this->getLanguageConstant('title_settings'), true, true, backend_UrlMake($this->name, 'show_settings')), $level = 5));
         }
     }
     // register payment method
     if (class_exists('shop')) {
         require_once "units/stripe_payment_method.php";
         Stripe_PaymentMethod::getInstance($this);
     }
 }
Ejemplo n.º 10
0
 /**
  * Handle drawing user list
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_UserList($tag_params, $children)
 {
     $admin_manager = UserManager::getInstance();
     // make sure lower levels can't edit others
     if ($_SESSION['level'] < 5) {
         $conditions = array('id' => $_SESSION['uid']);
     } else {
         $conditions = array();
     }
     // create template
     if (isset($tag_params['template'])) {
         if (isset($tag_params['local']) && $tag_params['local'] == 1) {
             $template = new TemplateHandler($tag_params['template'], $this->parent->path . 'templates/');
         } else {
             $template = new TemplateHandler($tag_params['template']);
         }
     } else {
         $template = new TemplateHandler('users_list_item.xml', $this->parent->path . 'templates/');
     }
     $template->setMappedModule($this->parent->name);
     // get users from database
     $users = $admin_manager->getItems($admin_manager->getFieldNames(), $conditions);
     // draw users
     if (count($users) > 0) {
         foreach ($users as $user) {
             $params = array('id' => $user->id, 'fullname' => $user->fullname, 'username' => $user->username, 'level' => $user->level, 'verified' => $user->verified, 'verified_char' => $user->verified ? CHAR_CHECKED : CHAR_UNCHECKED, 'agreed' => $user->agreed, 'agreed_char' => $user->agreed ? CHAR_CHECKED : CHAR_UNCHECKED, 'selected' => isset($tag_params['selected']) && $tag_params['selected'] == $user->id, 'item_change' => url_MakeHyperlink($this->parent->getLanguageConstant('change'), window_Open('system_users_change', 370, $this->parent->getLanguageConstant('title_users_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->parent->name), array('backend_action', 'users_change'), array('id', $user->id)))), 'item_delete' => url_MakeHyperlink($this->parent->getLanguageConstant('delete'), window_Open('system_users_delete', 400, $this->parent->getLanguageConstant('title_users_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->parent->name), array('backend_action', 'users_delete'), array('id', $user->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Ejemplo n.º 11
0
 /**
  * Tag handler for tip list
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_TipList($tag_params, $children)
 {
     $manager = TipManager::getInstance();
     $conditions = array();
     $limit = null;
     $order_by = array('id');
     $order_asc = true;
     if (isset($tag_params['only_visible']) && $tag_params['only_visible'] == 1) {
         $conditions['visible'] = 1;
     }
     if (isset($tag_params['order_by'])) {
         $order_by = explode(',', fix_chars($tag_params['order_by']));
     }
     if (isset($tag_params['order_asc'])) {
         $order_asc = $tag_params['order_asc'] == '1' || $tag_params['order_asc'] == 'yes';
     }
     if (isset($tag_params['limit'])) {
         $limit = fix_id($tag_params['limit']);
     }
     $template = $this->loadTemplate($tag_params, 'list_item.xml');
     $template->setMappedModule($this->name);
     // get items
     $items = $manager->getItems($manager->getFieldNames(), $conditions, $order_by, $order_asc, $limit);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'content' => $item->content, 'visible' => $item->visible, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('tips_change', 400, $this->getLanguageConstant('title_tips_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'tips_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('tips_delete', 400, $this->getLanguageConstant('title_tips_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'tips_delete'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Ejemplo n.º 12
0
 /**
  * Tag handler for printing code lists
  *
  * @param array $params
  * @param array $children
  */
 public function tag_CodeList($params, $children)
 {
     $manager = CodeManager::getInstance();
     $conditions = array();
     $items = $manager->getItems($manager->getFieldNames(), $conditions, array('id'));
     $template = new TemplateHandler('list_item.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'code' => $item->code, 'url' => $item->url, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('codes_change', 400, $this->getLanguageConstant('title_codes_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'codes_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('codes_delete', 400, $this->getLanguageConstant('title_codes_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'codes_delete'), array('id', $item->id)))), 'item_open' => url_MakeHyperlink($this->getLanguageConstant('open'), $item->url, '', '', '_blank'));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Ejemplo n.º 13
0
 /**
  * Handle rendering list of submissions.
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_SubmissionList($tag_params, $children)
 {
     $field_manager = ContactForm_FormFieldManager::getInstance();
     $submission_manager = ContactForm_SubmissionManager::getInstance();
     $submission_field_manager = ContactForm_SubmissionFieldManager::getInstance();
     $fields = array();
     $conditions = array();
     // get parameters
     $conditions['form'] = -1;
     if (isset($tag_params['form'])) {
         $conditions['form'] = fix_id($tag_params['form']);
     }
     // load template
     $template = $this->loadTemplate($tag_params, 'submissions_list_item.xml');
     $template->registerTagHandler('cms:fields', $this, 'tag_SubmissionFields');
     // get submissions
     $items = $submission_manager->getItems($submission_manager->getFieldNames(), $conditions);
     // load field definitions
     if ($conditions['form'] != -1) {
         $field_definitions = $field_manager->getItems($field_manager->getFieldNames(), array('form' => $conditions['form']));
         if (count($field_definitions) > 0) {
             foreach ($field_definitions as $field) {
                 $fields[$field->id] = $field;
             }
         }
     }
     // parse template
     if (count($items) > 0) {
         foreach ($items as $item) {
             // get submitted fields
             $submitted_data = $submission_field_manager->getItems($submission_field_manager->getFieldNames(), array('submission' => $item->id));
             $field_data = array();
             if (count($submitted_data) > 0) {
                 foreach ($submitted_data as $record) {
                     $field_data[] = array('submission' => $record->submission, 'field' => $record->field, 'value' => $record->value, 'label' => $fields[$record->field]->label, 'placeholder' => $fields[$record->field]->placeholder, 'type' => $fields[$record->field]->type);
                 }
             }
             // prepare timestamps
             $timestamp = strtotime($item->timestamp);
             $date = date($this->getLanguageConstant('format_date_short'), $timestamp);
             $time = date($this->getLanguageConstant('format_time_short'), $timestamp);
             $params = array('id' => $item->id, 'form' => $item->form, 'timestamp' => $item->timestamp, 'time' => $time, 'date' => $date, 'address' => $item->address, 'fields' => $field_data, 'item_details' => url_MakeHyperlink($this->getLanguageConstant('details'), window_Open('contact_form_submission_details' . $item->id, 400, $this->getLanguageConstant('title_submission_details'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'submission_details'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Ejemplo n.º 14
0
 /**
  * Tag handler for feed list
  *
  * @param array $params
  * @param array $children
  */
 public function tag_FeedList($params, $children)
 {
     $manager = NewsFeedManager::getInstance();
     $group_manager = NewsGroupManager::getInstance();
     $items = $manager->getItems($manager->getFieldNames(), array());
     // create template parser
     $template = new TemplateHandler('feed_list_item.xml', $this->path . 'templates/');
     if (count($items) > 0) {
         foreach ($items as $item) {
             $group = $group_manager->getSingleItem(array('title'), array('id' => $item->group));
             $params = array('id' => $item->id, 'group' => $item->group, 'news_count' => $item->news_count, 'title' => $item->title, 'group_title' => $group->title, 'description' => $item->description, 'active' => $item->active, 'active_char' => $item->active ? CHAR_CHECKED : CHAR_UNCHECKED, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('news_feeds_change', 390, $this->getLanguageConstant('title_news_feed_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'feed_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('news_feeds_delete', 390, $this->getLanguageConstant('title_news_feed_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'feed_delete'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Ejemplo n.º 15
0
 /**
  * Tag handler for category list
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_CategoryList($tag_params, $children)
 {
     global $language;
     $manager = ShopCategoryManager::getInstance();
     $conditions = array();
     $order_by = array();
     $order_asc = true;
     $item_category_ids = array();
     $item_id = isset($tag_params['item_id']) ? fix_id($tag_params['item_id']) : null;
     // create conditions
     if (isset($tag_params['parent_id'])) {
         // set parent from tag parameter
         $conditions['parent'] = fix_id($tag_params['parent_id']);
     } else {
         if (isset($tag_params['parent'])) {
             // get parent id from specified text id
             $text_id = fix_chars($tag_params['parent']);
             $parent = $manager->getSingleItem(array('id'), array('text_id' => $text_id));
             if (is_object($parent)) {
                 $conditions['parent'] = $parent->id;
             } else {
                 $conditions['parent'] = -1;
             }
         } else {
             if (!isset($tag_params['show_all'])) {
                 $conditions['parent'] = 0;
             }
         }
     }
     if (isset($tag_params['level'])) {
         $level = fix_id($tag_params['level']);
     } else {
         $level = 0;
     }
     if (isset($tag_params['exclude'])) {
         $list = fix_id(explode(',', $tag_params['exclude']));
         $conditions['id'] = array('operator' => 'NOT IN', 'value' => $list);
     }
     if (!is_null($item_id)) {
         $membership_manager = ShopItemMembershipManager::getInstance();
         $membership_items = $membership_manager->getItems(array('category'), array('item' => $item_id));
         if (count($membership_items) > 0) {
             foreach ($membership_items as $membership) {
                 $item_category_ids[] = $membership->category;
             }
         }
     }
     // get order list
     if (isset($tag_params['order_by'])) {
         $order_by = fix_chars(split(',', $tag_params['order_by']));
     } else {
         $order_by = array('title_' . $language);
     }
     if (isset($tag_params['order_ascending'])) {
         $order_asc = $tag_params['order_asc'] == '1' or $tag_params['order_asc'] == 'yes';
     } else {
         // get items from database
         $items = $manager->getItems($manager->getFieldNames(), $conditions, $order_by, $order_asc);
     }
     // create template handler
     $template = $this->_parent->loadTemplate($tag_params, 'category_list_item.xml');
     $template->registerTagHandler('_children', $this, 'tag_CategoryList');
     // initialize index
     $index = 0;
     // parse template
     if (count($items) > 0) {
         foreach ($items as $item) {
             $image_url = '';
             $thumbnail_url = '';
             if (class_exists('gallery')) {
                 $gallery = gallery::getInstance();
                 $gallery_manager = GalleryManager::getInstance();
                 $image = $gallery_manager->getSingleItem(array('filename'), array('id' => $item->image));
                 if (!is_null($image)) {
                     $image_url = $gallery->getImageURL($image);
                     $thumbnail_url = $gallery->getThumbnailURL($image);
                 }
             }
             $params = array('id' => $item->id, 'index' => $index++, 'item_id' => $item_id, 'parent' => $item->parent, 'image_id' => $item->image, 'image' => $image_url, 'thumbnail' => $thumbnail_url, 'text_id' => $item->text_id, 'title' => $item->title, 'description' => $item->description, 'level' => $level, 'in_category' => in_array($item->id, $item_category_ids) ? 1 : 0, 'selected' => isset($tag_params['selected']) ? fix_id($tag_params['selected']) : 0, 'item_change' => url_MakeHyperlink($this->_parent->getLanguageConstant('change'), window_Open('shop_category_change', 400, $this->_parent->getLanguageConstant('title_category_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'categories'), array('sub_action', 'change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->_parent->getLanguageConstant('delete'), window_Open('shop_category_delete', 270, $this->_parent->getLanguageConstant('title_category_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'categories'), array('sub_action', 'delete'), array('id', $item->id)))), 'item_add' => url_MakeHyperlink($this->_parent->getLanguageConstant('add'), window_Open('shop_category_add', 400, $this->_parent->getLanguageConstant('title_category_add'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'categories'), array('sub_action', 'add'), array('parent', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Ejemplo n.º 16
0
 /**
  * Display list of items associated with page and of specified type
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_ItemList($tag_params, $children, $type)
 {
     $manager = UserPageItemsManager::getInstance();
     $page_id = isset($tag_params['page']) ? fix_id($tag_params['page']) : null;
     // create query conditions
     $conditions = array();
     if (!is_null($page_id)) {
         $conditions['page'] = $page_id;
     }
     $conditions['type'] = $type;
     // get items from database
     $items = $manager->getItems(array('id', 'item'), $conditions);
     if ($type == user_page::VIDEO) {
         // create template
         $template = $this->loadTemplate($tag_params, 'page_items_video.xml');
         // connect tag handlers
         if (class_exists('youtube')) {
             $module = youtube::getInstance();
             $template->registerTagHandler('_video', $module, 'tag_Video');
         }
     } else {
         // create template
         $template = $this->loadTemplate($tag_params, 'page_items_gallery.xml');
         // connect tag handlers
         if (class_exists('gallery')) {
             $module = gallery::getInstance();
             $template->registerTagHandler('_gallery', $module, 'tag_Group');
         }
     }
     // parse items
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('item' => $item->item, 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('user_pages_items_delete', 400, $this->getLanguageConstant('title_delete_page'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'page_items_delete'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Ejemplo n.º 17
0
function window_OpenHyperlink($text, $id, $width, $title, $can_close, $can_minimize, $module, $action)
{
    $url = url_Make('transfer_control', _BACKEND_SECTION_, array('backend_action', $action), array('module', $module));
    return url_MakeHyperlink($text, window_Open($id, $width, $title, $can_close, $can_minimize, $url), $text);
}
Ejemplo n.º 18
0
 /**
  * Show list of transactions
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_TransactionList($tag_params, $children)
 {
     $manager = ShopTransactionsManager::getInstance();
     $conditions = array();
     // load template
     $template = $this->_parent->loadTemplate($tag_params, 'transaction_list_item.xml');
     // get items from database
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $title = $this->_parent->getLanguageConstant('title_transaction_details');
             $title .= ' ' . $item->uid;
             $window = 'shop_transation_details_' . $item->id;
             $params = array('buyer' => $item->buyer, 'address' => $item->address, 'uid' => $item->uid, 'type' => $item->type, 'type_value' => '', 'status' => $item->status, 'status_value' => '', 'currency' => $item->currency, 'currency_value' => '', 'handling' => $item->handling, 'shipping' => $item->shipping, 'total' => $item->total, 'delivery_method' => $item->delivery_method, 'remark' => $item->remark, 'timestamp' => $item->timestamp, 'item_details' => url_MakeHyperlink($this->_parent->getLanguageConstant('details'), window_Open($window, 800, $title, true, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'transactions'), array('sub_action', 'details'), array('id', $item->id)))));
             $template->setLocalParams($params);
             $template->restoreXML();
             $template->parse();
         }
     }
 }
Ejemplo n.º 19
0
 /**
  * Tag handler for article group list
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_GroupList($tag_params, $children)
 {
     $manager = ArticleGroupManager::getInstance();
     $conditions = array();
     if (isset($tag_params['only_visible']) && $tag_params['only_visible'] == 'yes') {
         $conditions['visible'] = 1;
     }
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     // load template
     $template = $this->loadTemplate($tag_params, 'group_list_item.xml');
     $template->setMappedModule($this->name);
     $template->registerTagHandler('_article_list', $this, 'tag_ArticleList');
     // give the ability to limit number of links to display
     if (isset($tag_params['limit'])) {
         $items = array_slice($items, 0, $tag_params['limit'], true);
     }
     $selected = isset($tag_params['selected']) ? fix_id($tag_params['selected']) : -1;
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'text_id' => $item->text_id, 'title' => $item->title, 'description' => $item->description, 'selected' => $selected, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('article_groups_change', 400, $this->getLanguageConstant('title_article_groups_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'groups_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('article_groups_delete', 400, $this->getLanguageConstant('title_article_groups_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'groups_delete'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Ejemplo n.º 20
0
 /**
  * Handle _downloads_list tag
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_DownloadsList($tag_params, $children)
 {
     $manager = DownloadsManager::getInstance();
     $conditions = array();
     if (!isset($tag_params['show_invisible'])) {
         $conditions['visible'] = 1;
     }
     // get items from database
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     if (isset($tag_params['template'])) {
         if (isset($tag_params['local']) && $tag_params['local'] == 1) {
             $template = new TemplateHandler($tag_params['template'], $this->path . 'templates/');
         } else {
             $template = new TemplateHandler($tag_params['template']);
         }
     } else {
         $template = new TemplateHandler('list_item.xml', $this->path . 'templates/');
     }
     $template->setMappedModule($this->name);
     $template->registerTagHandler('_download', $this, 'tag_Download');
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'name' => $item->name, 'description' => $item->description, 'filename' => $item->filename, 'size' => $item->size, 'count' => $item->count, 'visible' => $item->visible, 'timestamp' => $item->timestamp, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('downloads_change', 400, $this->getLanguageConstant('title_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('downloads_delete', 400, $this->getLanguageConstant('title_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'delete'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Ejemplo n.º 21
0
 /**
  * Tag handler for interval list.
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_IntervalList($tag_params, $children)
 {
     $manager = IntervalManager::getInstance();
     $conditions = array();
     // get intervals
     $intervals = $manager->getItems($manager->getFieldNames(), $conditions);
     // load template
     $template = $this->loadTemplate($tag_params, 'list_item.xml');
     $template->registerTagHandler('cms:days', $this, 'tag_Days');
     $template->registerTagHandler('cms:times', $this, 'tag_Times');
     // parse template
     if (count($intervals) > 0) {
         foreach ($intervals as $interval) {
             $params = array('id' => $interval->id, 'days' => $interval->days, 'enabled' => $interval->enabled, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('delivery_intervals_change', 500, $this->getLanguageConstant('title_interval_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'intervals_change'), array('id', $interval->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('delivery_intervals_delete', 400, $this->getLanguageConstant('title_interval_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'intervals_delete'), array('id', $interval->id)))));
             $template->setLocalParams($params);
             $template->restoreXML();
             $template->parse();
         }
     }
 }
Ejemplo n.º 22
0
 /**
  * Tag handler for printing link groups
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_GroupList($tag_params, $children)
 {
     $manager = LinkGroupsManager::getInstance();
     $link_manager = LinksManager::getInstance();
     $membership_manager = LinkMembershipManager::getInstance();
     // save some CPU time by getting this early
     if (class_exists('gallery')) {
         $use_images = true;
         $gallery = gallery::getInstance();
         $gallery_manager = GalleryManager::getInstance();
     } else {
         $use_images = false;
     }
     $conditions = array();
     if (isset($tag_params['sponsored']) && $tag_params['sponsored'] == '1') {
         $conditions['sponsored'] = 1;
     }
     $items = $manager->getItems($manager->getFieldNames(), $conditions, array('id'));
     if (isset($tag_params['template'])) {
         if (isset($tag_params['local']) && $tag_params['local'] == 1) {
             $template = new TemplateHandler($tag_params['template'], $this->path . 'templates/');
         } else {
             $template = new TemplateHandler($tag_params['template']);
         }
     } else {
         $template = new TemplateHandler('groups_item.xml', $this->path . 'templates/');
     }
     $template->setMappedModule($this->name);
     $template->registerTagHandler('_link', $this, 'tag_Link');
     $template->registerTagHandler('_link_list', $this, 'tag_LinkList');
     if (count($items) > 0) {
         foreach ($items as $item) {
             $thumbnail = '';
             if ($use_images) {
                 $first_link_id = $membership_manager->getItemValue('link', array('group' => $item->id));
                 // we have some links assigned to the group, get thumbnail
                 if (!empty($first_link_id)) {
                     $image_id = $link_manager->getItemValue('image', array('id' => $first_link_id));
                     if (!empty($image_id)) {
                         $image = $gallery_manager->getSingleItem($gallery_manager->getFieldNames(), array('id' => $image_id));
                         $thumbnail = $gallery->getThumbnailURL($image);
                     }
                 }
             }
             $params = array('id' => $item->id, 'name' => $item->name, 'text_id' => $item->text_id, 'thumbnail' => $thumbnail, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('groups_change', 400, $this->getLanguageConstant('title_groups_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'groups_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('groups_delete', 400, $this->getLanguageConstant('title_groups_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'groups_delete'), array('id', $item->id)))), 'item_links' => url_MakeHyperlink($this->getLanguageConstant('links'), window_Open('groups_links', 400, $this->getLanguageConstant('title_groups_links'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'groups_links'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Ejemplo n.º 23
0
 /**
  * Handle item size values tag
  * 
  * @param array $tag_params
  * @param array $childen
  */
 public function tag_ValueList($tag_params, $children)
 {
     $manager = ShopItemSizeValuesManager::getInstance();
     $conditions = array();
     // create conditions
     if (isset($tag_params['definition'])) {
         $conditions['definition'] = fix_id($tag_params['definition']);
     }
     // get items from database
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     // create template
     $template = $this->_parent->loadTemplate($tag_params, 'values_list_item.xml');
     $template->setMappedModule($this->name);
     // parse template
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'value' => $item->value, 'item_change' => url_MakeHyperlink($this->_parent->getLanguageConstant('change'), window_Open('shop_item_size_values_change', 370, $this->_parent->getLanguageConstant('title_size_value_change'), true, true, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'sizes'), array('sub_action', 'value_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->_parent->getLanguageConstant('delete'), window_Open('shop_item_size_values_delete', 400, $this->_parent->getLanguageConstant('title_size_value_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'sizes'), array('sub_action', 'value_delete'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Ejemplo n.º 24
0
 /**
  * Tag handler for affiliate list.
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_AffiliateList($tag_params, $children)
 {
     $manager = AffiliatesManager::getInstance();
     $conditions = array();
     // get items from database
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     // load template
     $template = $this->loadTemplate($tag_params, 'list_item.xml');
     // parse template
     if (count($items) > 0) {
         foreach ($items as $item) {
             if ($item->clicks > 0) {
                 $rate = round(100 * $item->conversions / $item->clicks, 2);
             } else {
                 $rate = 0;
             }
             $params = array('id' => $item->id, 'uid' => $item->uid, 'name' => $item->name, 'clicks' => $item->clicks, 'conversions' => $item->conversions, 'rate' => $rate, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('affiliates_change', 370, $this->getLanguageConstant('title_affiliates_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'affiliate_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('affiliates_delete', 400, $this->getLanguageConstant('title_affiliates_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'affiliate_delete'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Ejemplo n.º 25
0
 /**
  * Handle drawing list of manufacturers tag
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_ManufacturerList($tag_params, $children)
 {
     $manager = ShopManufacturerManager::getInstance();
     $conditions = array();
     $selected = -1;
     if (class_exists('gallery')) {
         $use_images = true;
         $gallery = gallery::getInstance();
         $gallery_manager = GalleryManager::getInstance();
     } else {
         $use_images = false;
     }
     if (isset($tag_params['selected'])) {
         $selected = fix_id($tag_params['selected']);
     }
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     $template = $this->_parent->loadTemplate($tag_params, 'manufacturer_list_item.xml');
     if (count($items) > 0) {
         foreach ($items as $item) {
             // get image
             $image = '';
             if ($use_images && !empty($item->logo)) {
                 $image_item = $gallery_manager->getSingleItem($gallery_manager->getFieldNames(), array('id' => $item->logo));
                 if (is_object($image_item)) {
                     $image = $gallery->getImageURL($image_item);
                 }
             }
             // prepare parameters
             $params = array('id' => $item->id, 'name' => $item->name, 'web_site' => $item->web_site, 'logo' => $image, 'selected' => $selected == $item->id ? 1 : 0, 'item_change' => url_MakeHyperlink($this->_parent->getLanguageConstant('change'), window_Open('shop_manufacturer_change', 360, $this->_parent->getLanguageConstant('title_manufacturer_change'), true, true, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'manufacturers'), array('sub_action', 'change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->_parent->getLanguageConstant('delete'), window_Open('shop_manufacturer_delete', 400, $this->_parent->getLanguageConstant('title_manufacturer_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'manufacturers'), array('sub_action', 'delete'), array('id', $item->id)))));
             // parse template
             $template->setLocalParams($params);
             $template->restoreXML();
             $template->parse();
         }
     }
 }
Ejemplo n.º 26
0
 /**
  * Tag handler for all questions.
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_QuestionList($tag_params, $children)
 {
     $manager = QuestionManager::getInstance();
     $conditions = array();
     // get items from database
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     // load template
     $template = $this->loadTemplate($tag_params, 'list_item.xml');
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'question' => $item->question, 'answer' => $item->answer, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('faq_change', 730, $this->getLanguageConstant('title_question_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('faq_delete', 400, $this->getLanguageConstant('title_question_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'delete'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
 /**
  * Handle drawing list of delivery method prices
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_DeliveryPricesList($tag_params, $children)
 {
     $manager = ShopDeliveryMethodPricesManager::getInstance();
     $conditions = array();
     $relations = array();
     // prepare filtering conditions
     if (isset($tag_params['method'])) {
         $conditions['method'] = fix_id($tag_params['method']);
     }
     if (isset($_REQUEST['method'])) {
         $conditions['method'] = fix_id($_REQUEST['method']);
     }
     // get relations with shop item
     if (isset($tag_params['item'])) {
         $relations_manager = ShopDeliveryItemRelationsManager::getInstance();
         $item_id = fix_id($tag_params['item']);
         $raw_relations = $relations_manager->getItems(array('price'), array('item' => $item_id));
         if (count($raw_relations) > 0) {
             foreach ($raw_relations as $relation) {
                 $relations[] = $relation->price;
             }
         }
     }
     // get template
     $template = $this->_parent->loadTemplate($tag_params, 'delivery_method_prices_list_item.xml');
     // get items from database
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'value' => $item->value, 'method' => isset($conditions['method']) ? $conditions['method'] : 0, 'selected' => in_array($item->id, $relations) ? 1 : 0, 'item_change' => url_MakeHyperlink($this->_parent->getLanguageConstant('change'), window_Open('shop_delivery_price_change', 370, $this->_parent->getLanguageConstant('title_delivery_method_price_change'), true, true, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'delivery_methods'), array('sub_action', 'change_price'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->_parent->getLanguageConstant('delete'), window_Open('shop_delivery_price_delete', 400, $this->_parent->getLanguageConstant('title_delivery_method_price_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'delivery_methods'), array('sub_action', 'delete_price'), array('id', $item->id)))));
             $template->setLocalParams($params);
             $template->restoreXML();
             $template->parse();
         }
     }
 }
Ejemplo n.º 28
0
 /**
  * Handle displaying list of stored currencies
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_CurrencyList($tag_params, $children)
 {
     $manager = ShopCurrenciesManager::getInstance();
     $conditions = array();
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     // create template
     $template = $this->_parent->loadTemplate($tag_params, 'currency_list_item.xml');
     $template->setMappedModule($this->name);
     $selected = isset($tag_params['selected']) ? fix_id($tag_params['selected']) : -1;
     // parse template
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = $this->getCurrencyForCode($item->currency);
             $params['selected'] = $selected;
             // add delete link to params
             $params['item_delete'] = url_MakeHyperlink($this->_parent->getLanguageConstant('delete'), window_Open('shop_currencies_delete', 270, $this->_parent->getLanguageConstant('title_currencies_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'currencies'), array('sub_action', 'delete'), array('id', $item->id))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Ejemplo n.º 29
0
 /**
  * Handle drawing item list
  *
  * @param array $tag_params
  * @param array $chilren
  */
 public function tag_ItemList($tag_params, $children)
 {
     global $language;
     $manager = ShopItemManager::getInstance();
     $conditions = array();
     $page_switch = null;
     $order_by = array('id');
     $order_asc = true;
     $limit = null;
     // create conditions
     if (isset($tag_params['category'])) {
         if (is_numeric($tag_params['category'])) {
             $category_id = fix_id($tag_params['category']);
         } else {
             // specified id is actually text_id, get real one
             $category_manager = ShopCategoryManager::getInstance();
             $category = $category_manager->getSingleItem(array('id'), array('text_id' => fix_chars($tag_params['category'])));
             if (!is_object($category)) {
                 return;
             }
             $category_id = $category->id;
         }
         $membership_manager = ShopItemMembershipManager::getInstance();
         $membership_items = $membership_manager->getItems(array('item'), array('category' => $category_id));
         $item_ids = array();
         if (count($membership_items) > 0) {
             foreach ($membership_items as $membership) {
                 $item_ids[] = $membership->item;
             }
         }
         if (count($item_ids) > 0) {
             $conditions['id'] = $item_ids;
         } else {
             $conditions['id'] = -1;
         }
         // make sure nothing is returned if category is empty
     }
     if (isset($tag_params['related'])) {
         $relation_manager = ShopRelatedItemsManager::getInstance();
         $item_id = fix_id($tag_params['related']);
         $related_items = $relation_manager->getItems(array('related'), array('item' => $item_id));
         $related_item_ids = array();
         if (count($related_items) > 0) {
             foreach ($related_items as $relationship) {
                 $related_item_ids[] = $relationship->related;
             }
         }
         if (count($related_item_ids) > 0) {
             $conditions['id'] = $related_item_ids;
         } else {
             $conditions['id'] = -1;
         }
     }
     if (!(isset($tag_params['show_deleted']) && $tag_params['show_deleted'] == 1)) {
         // force hiding deleted items
         $conditions['deleted'] = 0;
     }
     if (isset($tag_params['filter']) && !empty($tag_params['filter'])) {
         // filter items with name matching
         $conditions['name_' . $language] = array('operator' => 'LIKE', 'value' => '%' . fix_chars($tag_params['filter']) . '%');
     }
     if (isset($tag_params['paginate'])) {
         $per_page = is_numeric($tag_params['paginate']) ? $tag_params['paginate'] : 10;
         $param = isset($tag_params['page_param']) ? fix_chars($tag_params['page_param']) : null;
         $item_count = $manager->getItemValue('COUNT(id)', $conditions);
         $page_switch = new PageSwitch($param);
         $page_switch->setCurrentAsBaseURL();
         $page_switch->setItemsPerPage($per_page);
         $page_switch->setTotalItems($item_count);
         // get filter params
         $limit = $page_switch->getFilterParams();
     }
     if (isset($tag_params['order_by'])) {
         $order_by = array(fix_chars($tag_params['order_by']));
     }
     // get items
     $items = $manager->getItems($manager->getFieldNames(), $conditions, $order_by, $order_asc, $limit);
     // create template
     $template = $this->_parent->loadTemplate($tag_params, 'item_list_item.xml');
     $template->registerTagHandler('_color_list', $this, 'tag_ColorList');
     if (count($items) > 0) {
         $gallery = null;
         if (class_exists('gallery')) {
             $gallery = gallery::getInstance();
         }
         $manufacturer_manager = ShopManufacturerManager::getInstance();
         foreach ($items as $item) {
             if (!is_null($gallery)) {
                 // get manufacturer logo
                 $manufacturer_logo_url = '';
                 if ($item->manufacturer != 0) {
                     $manufacturer = $manufacturer_manager->getSingleItem($manufacturer_manager->getFieldNames(), array('id' => $item->manufacturer));
                     if (is_object($manufacturer)) {
                         $manufacturer_logo_url = $gallery->getImageURL($manufacturer->logo);
                     }
                 }
                 // get urls for image and thumbnail
                 $image_url = $gallery->getGroupThumbnailURL($item->gallery, true);
                 $thumbnail_url = $gallery->getGroupThumbnailURL($item->gallery);
             } else {
                 // default values if gallery is not enabled
                 $image_url = '';
                 $thumbnail_url = '';
                 $manufacturer_logo_url = '';
             }
             $rating = 0;
             $params = array('id' => $item->id, 'uid' => $item->uid, 'name' => $item->name, 'description' => $item->description, 'gallery' => $item->gallery, 'size_definition' => $item->size_definition, 'colors' => $item->colors, 'image' => $image_url, 'thumbnail' => $thumbnail_url, 'manufacturer_logo_url' => $manufacturer_logo_url, 'author' => $item->author, 'views' => $item->views, 'price' => $item->price, 'tax' => $item->tax, 'currency' => $this->_parent->settings['default_currency'], 'weight' => $item->weight, 'votes_up' => $item->votes_up, 'votes_down' => $item->votes_down, 'rating' => $rating, 'priority' => $item->priority, 'timestamp' => $item->timestamp, 'visible' => $item->visible, 'deleted' => $item->deleted, 'item_change' => url_MakeHyperlink($this->_parent->getLanguageConstant('change'), window_Open('shop_item_change', 505, $this->_parent->getLanguageConstant('title_item_change'), true, true, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'items'), array('sub_action', 'change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->_parent->getLanguageConstant('delete'), window_Open('shop_item_delete', 400, $this->_parent->getLanguageConstant('title_item_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'items'), array('sub_action', 'delete'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
     // draw page switch if needed
     if (!is_null($page_switch)) {
         $params = array();
         $children = array();
         // pick up parameters from original array
         foreach ($tag_params as $key => $value) {
             if (substr($key, 0, 12) == 'page_switch_') {
                 $params[substr($key, 12)] = $value;
             }
         }
         $page_switch->tag_PageSwitch($params, $children);
     }
 }
Ejemplo n.º 30
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section;
     parent::__construct(__FILE__);
     // create methods storage
     $this->payment_methods = array();
     $this->delivery_methods = array();
     // create events
     Events::register('shop', 'shopping-cart-changed');
     Events::register('shop', 'before-checkout');
     Events::register('shop', 'transaction-completed');
     Events::register('shop', 'transaction-canceled');
     // register recurring events
     foreach (RecurringPayment::$signals as $status => $signal_name) {
         Events::register('shop', $signal_name);
     }
     // load module style and scripts
     if (class_exists('head_tag') && $section != 'backend') {
         $head_tag = head_tag::getInstance();
         $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/checkout.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
         $head_tag->addTag('link', array('href' => url_GetFromFilePath($this->path . 'include/shopping_cart.css'), 'rel' => 'stylesheet', 'type' => 'text/css'));
         $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/shopping_cart.js'), 'type' => 'text/javascript'));
     }
     // register backend
     if (class_exists('backend') && $section == 'backend') {
         $head_tag = head_tag::getInstance();
         $backend = backend::getInstance();
         if (class_exists('head_tag')) {
             $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/multiple_images.js'), 'type' => 'text/javascript'));
             $head_tag->addTag('script', array('src' => url_GetFromFilePath($this->path . 'include/backend.js'), 'type' => 'text/javascript'));
         }
         $shop_menu = new backend_MenuItem($this->getLanguageConstant('menu_shop'), url_GetFromFilePath($this->path . 'images/icon.svg'), 'javascript:void(0);', 5);
         $shop_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_items'), url_GetFromFilePath($this->path . 'images/items.svg'), window_Open('shop_items', 580, $this->getLanguageConstant('title_manage_items'), true, true, backend_UrlMake($this->name, 'items')), 5));
         $recurring_plans_menu = new backend_MenuItem($this->getLanguageConstant('menu_recurring_plans'), url_GetFromFilePath($this->path . 'images/recurring_plans.svg'), 'javascript: void(0);', 5);
         $shop_menu->addChild('shop_recurring_plans', $recurring_plans_menu);
         $shop_menu->addSeparator(5);
         $shop_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_categories'), url_GetFromFilePath($this->path . 'images/categories.svg'), window_Open('shop_categories', 490, $this->getLanguageConstant('title_manage_categories'), true, true, backend_UrlMake($this->name, 'categories')), 5));
         $shop_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_item_sizes'), url_GetFromFilePath($this->path . 'images/item_sizes.svg'), window_Open('shop_item_sizes', 400, $this->getLanguageConstant('title_manage_item_sizes'), true, true, backend_UrlMake($this->name, 'sizes')), 5));
         $shop_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_manufacturers'), url_GetFromFilePath($this->path . 'images/manufacturers.svg'), window_Open('shop_manufacturers', 400, $this->getLanguageConstant('title_manufacturers'), true, true, backend_UrlMake($this->name, 'manufacturers')), 5));
         // delivery methods menu
         $delivery_menu = new backend_MenuItem($this->getLanguageConstant('menu_delivery_methods'), url_GetFromFilePath($this->path . 'images/delivery.svg'), 'javascript: void(0);', 5);
         $shop_menu->addChild('shop_delivery_methods', $delivery_menu);
         $shop_menu->addSeparator(5);
         $shop_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_special_offers'), url_GetFromFilePath($this->path . 'images/special_offers.svg'), window_Open('shop_special_offers', 490, $this->getLanguageConstant('title_special_offers'), true, true, backend_UrlMake($this->name, 'special_offers')), 5));
         $shop_menu->addSeparator(5);
         // payment methods menu
         $methods_menu = new backend_MenuItem($this->getLanguageConstant('menu_payment_methods'), url_GetFromFilePath($this->path . 'images/payment_methods.svg'), 'javascript: void(0);', 5);
         $shop_menu->addChild('shop_payment_methods', $methods_menu);
         $shop_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_currencies'), url_GetFromFilePath($this->path . 'images/currencies.svg'), window_Open('shop_currencies', 350, $this->getLanguageConstant('title_currencies'), true, true, backend_UrlMake($this->name, 'currencies')), 5));
         $shop_menu->addSeparator(5);
         $shop_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_transactions'), url_GetFromFilePath($this->path . 'images/transactions.svg'), window_Open('shop_transactions', 590, $this->getLanguageConstant('title_transactions'), true, true, backend_UrlMake($this->name, 'transactions')), 5));
         $shop_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_warehouses'), url_GetFromFilePath($this->path . 'images/warehouse.svg'), window_Open('shop_warehouses', 490, $this->getLanguageConstant('title_warehouses'), true, true, backend_UrlMake($this->name, 'warehouses')), 5));
         $shop_menu->addChild(null, new backend_MenuItem($this->getLanguageConstant('menu_stocks'), url_GetFromFilePath($this->path . 'images/stock.svg'), window_Open('shop_stocks', 490, $this->getLanguageConstant('title_stocks'), true, true, backend_UrlMake($this->name, 'stocks')), 5));
         $shop_menu->addSeparator(5);
         $shop_menu->addChild('', new backend_MenuItem($this->getLanguageConstant('menu_settings'), url_GetFromFilePath($this->path . 'images/settings.svg'), window_Open('shop_settings', 400, $this->getLanguageConstant('title_settings'), true, true, backend_UrlMake($this->name, 'settings')), $level = 5));
         $backend->addMenu($this->name, $shop_menu);
     }
     // register search
     if (class_exists('search')) {
         $search = search::getInstance();
         $search->registerModule('shop', $this);
     }
 }