/** * Show details for specified transaction */ private function showTransactionDetails() { $manager = ShopTransactionsManager::getInstance(); $buyer_manager = ShopBuyersManager::getInstance(); $address_manager = ShopDeliveryAddressManager::getInstance(); $id = fix_id($_REQUEST['id']); $transaction = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id)); $buyer = $buyer_manager->getSingleItem($buyer_manager->getFieldNames(), array('id' => $transaction->buyer)); $address = $address_manager->getSingleItem($address_manager->getFieldNames(), array('id' => $transaction->address)); $full_address = "{$address->name}\n\n{$address->street}\n"; $full_address .= "{$address->zip} {$address->city}\n"; if (empty($address->state)) { $full_address .= $address->country; } else { $full_address .= "{$address->state}, {$address->country}"; } $params = array('id' => $transaction->id, 'uid' => $transaction->uid, 'type' => $transaction->type, 'type_string' => '', 'status' => $transaction->status, 'currency' => $transaction->currency, 'handling' => $transaction->handling, 'shipping' => $transaction->shipping, 'timestamp' => $transaction->timestamp, 'delivery_method' => $transaction->delivery_method, 'remark' => $transaction->remark, 'total' => $transaction->total, 'first_name' => $buyer->first_name, 'last_name' => $buyer->last_name, 'email' => $buyer->email, 'address_name' => $address->name, 'address_street' => $address->street, 'address_city' => $address->city, 'address_zip' => $address->zip, 'address_state' => $address->state, 'address_country' => $address->country, 'full_address' => $full_address); $template = new TemplateHandler('transaction_details.xml', $this->path . 'templates/'); // register tag handler $template->registerTagHandler('_item_list', $this, 'tag_TransactionItemList'); $template->registerTagHandler('_transaction_status', $this, 'tag_TransactionStatus'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Show list of discounts */ private function showWarehouses() { $template = new TemplateHandler('warehouse_list.xml', $this->path . 'templates/'); $params = array('warehouse_new' => url_MakeHyperlink($this->_parent->getLanguageConstant('add_warehouse'), window_Open('shop_warehouse_add', 300, $this->_parent->getLanguageConstant('title_warehouse_add'), true, true, backend_UrlMake($this->name, 'warehouses', 'add')))); $template->registerTagHandler('cms:warehouse_list', $this, 'tag_WarehouseList'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * 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(); } } }
/** * Display */ private function showModules() { $template = new TemplateHandler('modules_list.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $params = array(); $template->registerTagHandler('_module_list', $this, 'tag_ModuleList'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Show mailing lists window. */ private function showLists() { // update list $this->updateLists(); // create template $template = new TemplateHandler('lists.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); // create menu links // create template params $params = array(); // register tag handlers $template->registerTagHandler('cms:items', $this, 'tag_ListItems'); // show template $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Show form for changing manufacturer data */ private function changeManufacturer() { $id = fix_id($_REQUEST['id']); $manager = ShopManufacturerManager::getInstance(); $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id)); if (!is_object($item)) { return; } $template = new TemplateHandler('manufacturer_change.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); if (class_exists('gallery')) { $gallery = gallery::getInstance(); $template->registerTagHandler('_image_list', $gallery, 'tag_ImageList'); } $params = array('id' => $item->id, 'name' => $item->name, 'web_site' => $item->web_site, 'logo' => $item->logo, 'form_action' => backend_UrlMake($this->name, 'manufacturers', 'save'), 'cancel_action' => window_Close('shop_manufacturer_change')); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Show form for selecting email templates for notifying users. */ private function showTemplateSelection() { if (class_exists('contact_form')) { // get contact form and show settings $contact_form = contact_form::getInstance(); $template = new TemplateHandler('email_templates.xml', $this->parent->path . 'templates/'); $template->setMappedModule($this->parent->name); $template->registerTagHandler('cms:templates', $contact_form, 'tag_TemplateList'); $params = array('form_action' => backend_UrlMake($this->parent->name, 'email_templates_save'), 'cancel_action' => window_Close('system_users_email_templates')); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } else { // contact form module is not active, show message instead $template = new TemplateHandler('message.xml', $this->parent->path . 'templates/'); $template->setMappedModule($this->parent->name); $params = array('message' => $this->parent->getLanguageConstant('message_no_contact_form'), 'button' => $this->parent->getLanguageConstant('close'), 'action' => window_Close('system_users_email_templates')); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } }
/** * Show form for editing existing field. */ private function editField() { $id = fix_id($_REQUEST['id']); $manager = ContactForm_FormFieldManager::getInstance(); $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id)); if (is_object($item)) { $template = new TemplateHandler('fields_change.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $params = array('id' => $item->id, 'form' => $item->form, 'name' => $item->name, 'type' => $item->type, 'label' => $item->label, 'placeholder' => $item->placeholder, 'min' => $item->min, 'max' => $item->max, 'maxlength' => $item->maxlength, 'value' => $item->value, 'pattern' => $item->pattern, 'disabled' => $item->disabled, 'required' => $item->required, 'autocomplete' => $item->autocomplete, 'form_action' => backend_UrlMake($this->name, 'fields_save'), 'cancel_action' => window_Close('contact_form_fields_edit')); $template->registerTagHandler('cms:field_types', $this, 'tag_FieldTypes'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } }
/** * Show referalls for current affiliate */ private function showReferrals() { $template = new TemplateHandler('referral_list.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); if (isset($_REQUEST['group_by']) && $_REQUEST['group_by'] == 'landing') { $column = $this->getLanguageConstant('column_landing'); } else { $column = $this->getLanguageConstant('column_url'); } $params = array('column_group_by' => $column); $template->registerTagHandler('_referral_list', $this, 'tag_ReferralList'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Handle drawing checkout form * * @param array $tag_params * @param array $children */ public function tag_CheckoutForm($tag_params, $children) { $account_information = array(); $shipping_information = array(); $billing_information = array(); $payment_method = null; $stage = isset($_REQUEST['stage']) ? fix_chars($_REQUEST['stage']) : null; $recurring = isset($_SESSION['recurring_plan']) && !empty($_SESSION['recurring_plan']); // decide whether to include shipping and account information if (isset($tag_params['include_shipping'])) { $include_shipping = fix_id($tag_params['include_shipping']) == 1; } else { $include_shipping = true; } $bad_fields = array(); $info_available = false; // grab user information if (!is_null($stage)) { // get payment method $payment_method = $this->getPaymentMethod($tag_params); if (is_null($payment_method)) { throw new PaymentMethodError('No payment method selected!'); } // get billing information $billing_information = $this->getBillingInformation($payment_method); $billing_required = array('billing_full_name', 'billing_card_type', 'billing_credit_card', 'billing_expire_month', 'billing_expire_year', 'billing_cvv'); $bad_fields = $this->checkFields($billing_information, $billing_required, $bad_fields); // get shipping information if ($include_shipping && $stage == 'set_info') { $shipping_information = $this->getShippingInformation(); $shipping_required = array('name', 'email', 'street', 'city', 'zip', 'country'); $bad_fields = $this->checkFields($shipping_information, $shipping_required, $bad_fields); } } $info_available = count($bad_fields) == 0 && !is_null($payment_method); if ($info_available) { $address_manager = ShopDeliveryAddressManager::getInstance(); $currency_manager = ShopCurrenciesManager::getInstance(); // get fields for payment method $return_url = url_Make('checkout_completed', 'shop', array('payment_method', $payment_method->get_name())); $cancel_url = url_Make('checkout_canceled', 'shop', array('payment_method', $payment_method->get_name())); // get currency info $currency = $this->settings['default_currency']; $currency_item = $currency_manager->getSingleItem(array('id'), array('currency' => $currency)); if (is_object($currency_item)) { $transaction_data['currency'] = $currency_item->id; } // get buyer $buyer = $this->getUserAccount(); if ($include_shipping) { $address = $this->getAddress($buyer, $shipping_information); } else { $address = null; } // update transaction $transaction_type = $recurring ? TransactionType::SUBSCRIPTION : TransactionType::SHOPPING_CART; $summary = $this->updateTransaction($transaction_type, $payment_method, '', $buyer, $address); // emit signal and return if handled if ($stage == 'set_info') { Events::trigger('shop', 'before-checkout', $payment_method->get_name(), $return_url, $cancel_url); foreach ($result_list as $result) { if ($result) { $this->showCheckoutRedirect(); return; } } } // create new payment if ($recurring) { // recurring payment $checkout_fields = $payment_method->new_recurring_payment($_SESSION['recurring_plan'], $billing_information, $return_url, $cancel_url); } else { // regular payment $checkout_fields = $payment_method->new_payment($transaction_data, $billing_information, $summary['items_for_checkout'], $return_url, $cancel_url); } // load template $template = $this->loadTemplate($tag_params, 'checkout_form.xml'); $template->registerTagHandler('cms:checkout_items', $this, 'tag_CheckoutItems'); $template->registerTagHandler('cms:delivery_methods', $this, 'tag_DeliveryMethodsList'); // parse template $params = array('checkout_url' => $payment_method->get_url(), 'checkout_fields' => $checkout_fields, 'checkout_name' => $payment_method->get_title(), 'currency' => $this->getDefaultCurrency(), 'recurring' => $recurring, 'include_shipping' => $include_shipping); // for recurring plans add additional params if ($recurring) { $plans = $payment_method->get_recurring_plans(); $plan_name = $_SESSION['recurring_plan']; $plan = $plans[$plan_name]; $params['plan_name'] = $plan['name']; $params['plan_description'] = $this->formatRecurring(array('price' => $plan['price'], 'period' => $plan['interval_count'], 'period' => $plan['interval_count'], 'unit' => $plan['interval'], 'setup' => $plan['setup_price'], 'trial_period' => $plan['trial_count'], 'trial_unit' => $plan['trial'])); } else { $params['sub-total'] = number_format($summary['total'], 2); $params['shipping'] = number_format($summary['shipping'], 2); $params['handling'] = number_format($summary['handling'], 2); $params['total_weight'] = number_format($summary['weight'], 2); $params['total'] = number_format($summary['total'] + $summary['shipping'] + $summary['handling'], 2); } $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } else { // no information available, show form $template = new TemplateHandler('buyer_information.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $template->registerTagHandler('cms:card_type', $this, 'tag_CardType'); // get fixed country if set $fixed_country = ''; if (isset($this->settings['fixed_country'])) { $fixed_country = $this->settings['fixed_country']; } $params = array('include_shipping' => $include_shipping, 'fixed_country' => $fixed_country, 'bad_fields' => $bad_fields, 'recurring' => $recurring); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } }
/** * Show content of feedback form in backend. */ private function showFeedback() { $template = new TemplateHandler('list.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $template->registerTagHandler('cms:list', $this, 'tag_FeedbackList'); $params = array(); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Display channel management form */ private function chatSettings() { $template = new TemplateHandler('channel_list.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $params = array('link_new' => window_OpenHyperlink($this->getLanguageConstant('add_channel'), 'chat_settings_add_channel', 400, $this->getLanguageConstant('title_channel_add'), true, false, $this->name, 'chat_channel_add')); $template->registerTagHandler('_channel_list', $this, 'tag_ChannelList'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Container tag handler * * @param array $tag_params * @param array $children */ public function tag_Container($tag_params, $children) { if (!isset($tag_params['id'])) { return; } $id = fix_id($tag_params['id']); $manager = GalleryContainerManager::getInstance(); $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $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('container.xml', $this->path . 'templates/'); } $template->setMappedModule($this->name); $template->registerTagHandler('_image', $this, 'tag_Image'); $template->registerTagHandler('_image_list', $this, 'tag_ImageList'); $template->registerTagHandler('_group', $this, 'tag_Group'); $template->registerTagHandler('_group_list', $this, 'tag_GroupList'); if (is_object($item)) { $params = array('id' => $item->id, 'text_id' => $item->text_id, 'name' => $item->name, 'description' => $item->description, 'image' => $this->getContainerImage($item)); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } }
/** * Show form for changing an existing plan. */ private function changePlan() { $id = fix_id($_REQUEST['id']); $shop = shop::getInstance(); $manager = PayPal_PlansManager::getInstance(); $plan = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id)); if (is_object($plan)) { $template = new TemplateHandler('plans_change.xml', $this->path . 'templates/'); $template->registerTagHandler('cms:cycle_unit', $shop, 'tag_CycleUnit'); $template->setMappedModule($this->name); $params = array('id' => $plan->id, 'text_id' => $plan->text_id, 'name' => $plan->name, 'trial' => $plan->trial, 'trial_count' => $plan->trial_count, 'interval' => $plan->interval, 'interval_count' => $plan->interval_count, 'price' => $plan->price, 'setup_price' => $plan->setup_price, 'start_time' => $plan->start_time, 'group_name' => $plan->group_name, 'form_action' => backend_UrlMake($this->name, 'recurring_plans_save'), 'cancel_action' => window_Close('paypal_recurring_plans_change')); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } }
/** * Show video selection form */ private function groupVideos() { $id = fix_id($_REQUEST['id']); $template = new TemplateHandler('group_videos.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $params = array('group' => $id, 'form_action' => backend_UrlMake($this->name, 'group_videos_save'), 'cancel_action' => window_Close($this->name . '_group_videos')); $template->registerTagHandler('_group_videos', $this, 'tag_GroupVideos'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Show search results for various backend tools */ private function showSearchResults() { $query = fix_chars($_REQUEST['query']); $template = new TemplateHandler('search_results.xml', $this->path . 'templates/'); $params = array('query' => $query); // register tag handler $template->registerTagHandler('_item_list', $this, 'tag_ItemList'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Show list of prices for specified method */ private function showPrices() { $manager = ShopDeliveryMethodPricesManager::getInstance(); $id = fix_id($_REQUEST['id']); $params = array('method' => $id, 'link_new' => url_MakeHyperlink($this->_parent->getLanguageConstant('add_delivery_price'), window_Open('shop_delivery_price_add', 370, $this->_parent->getLanguageConstant('title_delivery_method_price_add'), true, true, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'delivery_methods'), array('sub_action', 'add_price'), array('id', $id))))); $template = new TemplateHandler('delivery_method_prices_list.xml', $this->path . 'templates/'); // register tag handler $template->registerTagHandler('_delivery_prices', $this, 'tag_DeliveryPricesList'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Show form for setting/changing API key. */ private function setApiKey() { $template = new TemplateHandler('set_api_key.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $params = array('api_key' => isset($this->settings['api_key']) ? $this->settings['api_key'] : '', 'form_action' => backend_UrlMake($this->name, 'save_api_key'), 'cancel_action' => window_Close('page_speed_set_api_key')); $template->registerTagHandler('_module_list', $this, 'tag_ModuleList'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Tag handler for feed tag * * @param array $tag_params * @param array $children */ public function tag_Feed($tag_params, $children) { $id = isset($tag_params['id']) ? $tag_params['id'] : null; if (is_null($id)) { $id = isset($_REQUEST['id']) ? fix_id($_REQUEST['id']) : null; } if (is_null($id)) { return; } $manager = NewsFeedManager::getInstance(); $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id)); if (is_object($item)) { if (!$item->active) { return; } // if item is not active, just exit // create template parser $template = new TemplateHandler('feed_base.xml', $this->path . 'templates/'); // get build date $membership_manager = NewsMembershipManager::getInstance(); $membership_list = $membership_manager->getItems(array('news'), array('group' => $item->group)); // get guild date only if there are news items in group if (count($membership_list) > 0) { $id_list = array(); foreach ($membership_list as $membership) { $id_list[] = $membership->news; } $news_manager = NewsManager::getInstance(); $news = $news_manager->getSingleItem(array('timestamp'), array('id' => $id_list), array('timestamp'), false); if (is_object($news)) { $build_date = strtotime($news->timestamp); } } else { // drop to default build date, 1970 ^^ $build_date = 0; } // prepare params $params = array('title' => $item->title, 'description' => $item->description, 'group' => $item->group, 'news_count' => $item->news_count, 'build_date' => $build_date); $template->registerTagHandler('_news_list', $this, 'tag_NewsList'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } }
/** * 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(); } } }
/** * Show tips management form */ private function showTips() { $template = new TemplateHandler('list.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $params = array('link_new' => window_OpenHyperlink($this->getLanguageConstant('new'), 'tips_new', 400, $this->getLanguageConstant('title_tips_new'), true, false, $this->name, 'tips_new')); $template->registerTagHandler('_tip_list', $this, 'tag_TipList'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Show form for setting default currency */ private function setDefault() { $template = new TemplateHandler('currency_set_default.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $params = array('default' => $this->_parent->getDefaultCurrency(), 'form_action' => backend_UrlMake($this->name, 'currencies', 'save_default'), 'cancel_action' => window_Close('shop_currencies_set_default')); $template->registerTagHandler('_currency_list', $this, 'tag_CurrencyList'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Show item size values management form */ private function showValues() { $template = new TemplateHandler('values_list.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $params = array('link_new' => url_MakeHyperlink($this->_parent->getLanguageConstant('add_size_value'), window_Open('shop_item_size_values_add', 370, $this->_parent->getLanguageConstant('title_size_value_add'), true, true, url_Make('transfer_control', 'backend_module', array('backend_action', 'sizes'), array('sub_action', 'value_add'), array('module', $this->_parent->name), array('definition', fix_id($_REQUEST['definition'])))))); // register tag handler $template->registerTagHandler('_value_list', $this, 'tag_ValueList'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Show for for changing existing category */ private function changeCategory() { $id = fix_id($_REQUEST['id']); $manager = ShopCategoryManager::getInstance(); $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id)); if (is_object($item)) { // create template $template = new TemplateHandler('category_change.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); // register tag handlers $template->registerTagHandler('_category_list', $this, 'tag_CategoryList'); if (class_exists('gallery')) { $gallery = gallery::getInstance(); $template->registerTagHandler('_image_list', $gallery, 'tag_ImageList'); } // prepare parameters $params = array('id' => $item->id, 'parent' => $item->parent, 'image' => $item->image, 'title' => $item->title, 'text_id' => $item->text_id, 'description' => $item->description, 'form_action' => backend_UrlMake($this->name, 'categories', 'save'), 'cancel_action' => window_Close('shop_category_change')); // parse template $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } }
/** * Show form for adding new gallery to specified page */ private function pageItems_AddGallery() { $page_id = fix_id($_REQUEST['page']); $template = new TemplateHandler('page_add_gallery.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); // add tag handler from gallery if (class_exists('gallery')) { $module = gallery::getInstance(); $template->registerTagHandler('_gallery_list', $module, 'tag_GroupList'); } $params = array('page' => $page_id, 'form_action' => backend_UrlMake($this->name, 'page_items_save'), 'cancel_action' => window_Close('user_pages_add_gallery')); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Show form for changing specified interval. */ private function change_interval() { $id = fix_id($_REQUEST['id']); $manager = IntervalManager::getInstance(); // get interval $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id)); if (!is_object($item)) { return; } // show template $template = new TemplateHandler('change.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $template->registerTagHandler('cms:days', $this, 'tag_Days'); $template->registerTagHandler('cms:times', $this, 'tag_Times'); $params = array('id' => $item->id, 'days' => $item->days, 'enabled' => $item->enabled, 'form_action' => backend_UrlMake($this->name, 'intervals_save'), 'cancel_action' => window_Close('delivery_intervals_change')); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Show settings form */ private function showSettings() { $template = new TemplateHandler('settings.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); $params = array('form_action' => backend_UrlMake($this->name, 'save'), 'cancel_action' => window_Close('page_settings')); $template->registerTagHandler('cms:analytics_versions', $this, 'tag_AnalyticsVersions'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); }
/** * Present a form for changing license data */ private function changeLicense() { $id = fix_id($_REQUEST['id']); $manager = LicenseManager::getInstance(); // grab license from database $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id)); // create template $template = new TemplateHandler('change.xml', $this->path . 'templates/'); $template->setMappedModule($this->name); if (is_object($item)) { $params = array('id' => $item->id, 'license' => $item->license, 'domain' => $item->domain, 'active' => $item->active, 'form_action' => backend_UrlMake($this->name, 'save'), 'cancel_action' => window_Close('licenses_change')); $template->registerTagHandler('_module_list', $this, 'tag_ModuleList'); $template->restoreXML(); $template->setLocalParams($params); $template->parse(); } }