Beispiel #1
0
 /**
  * Handle drawing of license list
  *
  * @param array $tag_param
  * @param array $children
  */
 public function tag_LicenseList($tag_param, $children)
 {
     $manager = LicenseManager::getInstance();
     $items = $manager->getItems($manager->getFieldNames(), array());
     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/');
     }
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('license' => $item->license, 'domain' => $item->domain, 'active' => $item->active, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('licenses_change', 400, $this->getLanguageConstant('title_licenses_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('licenses_delete', 400, $this->getLanguageConstant('title_licenses_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();
         }
     }
 }
Beispiel #2
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();
         }
     }
 }
 /**
  * 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();
         }
     }
 }
Beispiel #4
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();
         }
     }
 }
Beispiel #5
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();
         }
     }
 }
Beispiel #6
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);
     }
 }
Beispiel #7
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();
         }
     }
 }
Beispiel #8
0
 /**
  * Container list tag handler
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_ContainerList($tag_params, $children)
 {
     global $language;
     $manager = GalleryContainerManager::getInstance();
     $conditions = array();
     $order_by = array('name_' . $language);
     $order_asc = true;
     // grab parameters
     if (isset($tag_params['exclude'])) {
         $conditions['text_id'] = array('operator' => 'NOT IN', 'value' => fix_chars(explode(',', $tag_params['exclude'])));
     }
     $items = $manager->getItems($manager->getFieldNames(), $conditions, $order_by, $order_asc);
     $template = $this->loadTemplate($tag_params, 'containers_list_item.xml');
     $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');
     $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, 'name' => $item->name, 'description' => $item->description, 'image' => $this->getContainerImage($item), 'selected' => $selected, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('gallery_containers_change', 400, $this->getLanguageConstant('title_containers_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'containers_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('gallery_containers_delete', 400, $this->getLanguageConstant('title_containers_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'containers_delete'), array('id', $item->id)))), 'item_groups' => url_MakeHyperlink($this->getLanguageConstant('container_groups'), window_Open('gallery_containers_groups', 400, $this->getLanguageConstant('title_containers_groups'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'containers_groups'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Beispiel #9
0
 /**
  * Tag handler for admin lists
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_AdminList($tag_params, $children)
 {
     $manager = ChatAdminManager::getInstance();
     $user_manager = ChatUserManager::getInstance();
     $room_manager = ChatRoomManager::getInstance();
     $conditions = array();
     // if room was specified, print only admins for that room
     if (isset($tag_params['room']) && !empty($tag_params['room'])) {
         $room = escape_chars($tag_params['room']);
         if (is_numeric($room)) {
             $room_id = $room;
         } else {
             $room_id = $room_manger->getItemValue('id', array('text_id' => $room));
         }
         $conditions['room'] = $room_id;
     }
     $items = $manager->getItems($manager->getFieldNames(), $conditions, array('user', 'room'));
     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('admins_list_item.xml', $this->path . 'templates/');
     }
     if (count($items) > 0) {
         foreach ($items as $item) {
             $user = $user_manager->getSingleItem(array('display_name'), array('id' => $item->user));
             $room = $room_manager->getSingleItem(array('name'), array('id' => $item->room));
             $params = array('id' => $item->id, 'user' => $item->user, 'room' => $item->room, 'display_name' => $user->display_name, 'room_name' => $room->name, 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('chat_admins_delete', 400, $this->getLanguageConstant('title_chat_admins_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'admins_delete'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Beispiel #10
0
 /**
  * Tag handler for drawing multiple plans.
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_PlanList($tag_params, $children)
 {
     $manager = PayPal_PlansManager::getInstance();
     $conditions = array();
     $template = $this->loadTemplate($tag_params, 'plans_list_item.xml');
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'text_id' => $item->text_id, 'name' => $item->name, 'trial' => $item->trial, 'trial_count' => $item->trial_count, 'interval' => $item->interval, 'interval_count' => $item->interval_count, 'price' => $item->price, 'setup_price' => $item->setup_price, 'start_time' => $item->start_time, 'group_name' => $item->group_name, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('paypal_recurring_plans_change', 405, $this->getLanguageConstant('title_recurring_plans_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'recurring_plans_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('paypal_recurring_plans_delete', 400, $this->getLanguageConstant('title_recurring_plans_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'recurring_plans_delete'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
 /**
  * Handle tag list tag drawing
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_WarehouseList($tag_params, $children)
 {
     $manager = ShopWarehouseManager::getInstance();
     $conditions = array();
     $template = $this->_parent->loadTemplate($tag_params, 'warehouse_list_item.xml');
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('name' => $item->name, 'street' => $item->street, 'street2' => $item->street2, 'city' => $item->city, 'zip' => $item->zip, 'country' => $item->country, 'state' => $item->state, 'item_change' => url_MakeHyperlink($this->_parent->getLanguageConstant('change'), window_Open('shop_warehouse_change', 300, $this->_parent->getLanguageConstant('title_warehouse_change'), true, true, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'warehouses'), array('sub_action', 'change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->_parent->getLanguageConstant('delete'), window_Open('shop_warehouse_delete', 400, $this->_parent->getLanguageConstant('title_warehouse_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'warehouses'), array('sub_action', 'delete'), array('id', $item->id)))));
             $template->setLocalParams($params);
             $template->restoreXML();
             $template->parse();
         }
     }
 }
Beispiel #12
0
 /**
  * Handle group list tag parsing
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_GroupList($tag_params, $children)
 {
     $manager = YouTube_GroupManager::getInstance();
     $conditions = array();
     // gather all the parameters
     if (isset($tag_params['visible_only'])) {
         $conditions['text_id'] = fix_chars($tag_params['text_id']);
     }
     // get items from database
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     // create template handler
     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('group_item.xml', $this->path . 'templates/');
     }
     $template->setMappedModule($this);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'name' => $item->name, 'description' => $item->description, 'visible' => $item->visible, 'visible_char' => $item->visible == 1 ? CHAR_CHECKED : CHAR_UNCHECKED, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open($this->name . '_group_change', 400, $this->getLanguageConstant('title_group_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'group_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open($this->name . '_group_delete', 300, $this->getLanguageConstant('title_group_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'group_delete'), array('id', $item->id)))), 'item_videos' => url_MakeHyperlink($this->getLanguageConstant('videos'), window_Open($this->name . '_group_videos', 400, $this->getLanguageConstant('title_group_videos'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'group_videos'), array('id', $item->id)))));
             $template->restoreXML();
             $template->setLocalParams($params);
             $template->parse();
         }
     }
 }
Beispiel #13
0
 /**
  * Handle tag _module_list used to display list of all modules on the system
  *
  * @param array $params
  * @param array $children
  */
 public function tag_ModuleList($params, $children)
 {
     global $module_path;
     $list = array();
     $raw_list = $this->getModuleList();
     $manager = ModuleManager::getInstance();
     $modules_in_use = $manager->getItems(array('id', 'order', 'name', 'preload', 'active'), array(), array('preload', 'order'));
     // add modules from database
     foreach ($modules_in_use as $module) {
         if (in_array($module->name, $raw_list)) {
             // module in database exists on disk
             if ($module->active) {
                 $list[$module->name] = array('status' => 'active');
             } else {
                 $list[$module->name] = array('status' => 'inactive');
             }
         } else {
             // module does not exist on disk
             $list[$module->name] = array('status' => 'missing');
         }
         $list[$module->name]['active'] = $module->active;
         $list[$module->name]['preload'] = $module->preload;
         $list[$module->name]['order'] = $module->order;
     }
     // add missing modules available on drive
     foreach ($raw_list as $module_name) {
         if (!array_key_exists($module_name, $list)) {
             $list[$module_name] = array('status' => 'not_initialized', 'active' => 0, 'preload' => 0, 'order' => '');
         }
     }
     $template = new TemplateHandler(isset($params['template']) ? $params['template'] : 'module.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     foreach ($list as $name => $definition) {
         $icon_file = _BASEPATH . '/' . $module_path . $name . '/images/icon.svg';
         if (file_exists($icon_file)) {
             $icon = url_GetFromFilePath($icon_file);
         } else {
             $icon = url_GetFromFilePath($this->path . 'images/icons/16/modules.svg');
         }
         $params = array('name' => $name, 'icon' => $icon, 'status' => $definition['status'], 'active' => $definition['active'], 'active_symbol' => $definition['active'] ? CHAR_CHECKED : CHAR_UNCHECKED, 'preload' => $definition['preload'], 'preload_symbol' => $definition['preload'] ? CHAR_CHECKED : CHAR_UNCHECKED, 'order' => $definition['order'], 'item_activate' => url_MakeHyperlink($this->getLanguageConstant('activate'), window_Open($this->name . '_module_dialog', 300, $this->getLanguageConstant('title_module_activate'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'module_activate'), array('module_name', $name)))), 'item_deactivate' => url_MakeHyperlink($this->getLanguageConstant('deactivate'), window_Open($this->name . '_module_dialog', 300, $this->getLanguageConstant('title_module_deactivate'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'module_deactivate'), array('module_name', $name)))), 'item_initialise' => url_MakeHyperlink($this->getLanguageConstant('initialise'), window_Open($this->name . '_module_dialog', 300, $this->getLanguageConstant('title_module_initialise'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'module_initialise'), array('module_name', $name)))), 'item_disable' => url_MakeHyperlink($this->getLanguageConstant('disable'), window_Open($this->name . '_module_dialog', 300, $this->getLanguageConstant('title_module_disable'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'module_disable'), array('module_name', $name)))));
         $template->restoreXML();
         $template->setLocalParams($params);
         $template->parse();
     }
 }
Beispiel #14
0
 /**
  * Handle drawing list of activities.
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_ActivityList($tag_params, $children)
 {
     $manager = ActivityManager::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) {
             $params = array('id' => $item->id, 'activity' => $item->activity, 'function' => $item->function, 'timeout' => $item->timeout, 'ignore_address' => $item->ignore_address, 'ignore_address_char' => $item->ignore_address ? CHAR_CHECKED : CHAR_UNCHECKED, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('activities_change', 400, $this->getLanguageConstant('title_activity_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('activities_delete', 400, $this->getLanguageConstant('title_activity_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();
         }
     }
 }
Beispiel #15
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();
         }
     }
 }
Beispiel #16
0
 /**
  * Tag handler for feedback list.
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_FeedbackList($tag_params, $children)
 {
     $manager = FeedbackManager::getInstance();
     $user_manager = UserManager::getInstance();
     $conditions = array();
     // load template
     $template = $this->loadTemplate($tag_params, 'list_item.xml');
     // get items from the database
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     // parse template
     if (count($items) > 0) {
         foreach ($items as $item) {
             $timestamp = strtotime($item->timestamp);
             $date = date($this->getLanguageConstant('format_date_short'), $timestamp);
             $time = date($this->getLanguageConstant('format_time_short'), $timestamp);
             $user = $user_manager->getSingleItem(array('fullname'), array('id' => $item->user));
             $user_name = $item->user;
             if (is_object($user)) {
                 $user_name = $user->fullname;
             }
             $params = array('id' => $item->id, 'user' => $item->user, 'user_name' => $user_name, 'timestamp' => $item->timestamp, 'time' => $time, 'date' => $date, 'message' => $item->message, 'url' => $item->url, 'status' => $item->status, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('feedback_change', 430, $this->getLanguageConstant('title_feedback_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'feedback_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('feedback_delete', 400, $this->getLanguageConstant('title_feedback_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'feedback_delete'), array('id', $item->id)))));
             $template->setLocalParams($params);
             $template->restoreXML();
             $template->parse();
         }
     }
 }
Beispiel #17
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();
         }
     }
 }
Beispiel #18
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);
}
 /**
  * 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();
         }
     }
 }
 /**
  * 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();
         }
     }
 }
Beispiel #21
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();
         }
     }
 }
Beispiel #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();
         }
     }
 }
Beispiel #23
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();
         }
     }
 }
 /**
  * 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();
         }
     }
 }
Beispiel #25
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();
         }
     }
 }
 /**
  * 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();
         }
     }
 }
 /**
  * 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();
         }
     }
 }
Beispiel #28
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();
         }
     }
 }
Beispiel #29
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();
         }
     }
 }
Beispiel #30
0
 /**
  * Handle drawing types tag
  *
  * @param array $tag_params
  * @param array $children
  */
 public function tag_TypesList($tag_params, $children)
 {
     $manager = LeadsTypesManager::getInstance();
     $conditions = array();
     $selected = -1;
     // get items from database
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     // get selected item if specified
     if (isset($tag_params['selected'])) {
         $selected = fix_id($tag_params['selected']);
     }
     // load template
     $template = $this->loadTemplate($tag_params, 'types_list_item.xml');
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'name' => $item->name, 'fields' => $item->fields, 'selected' => $item->id == $selected ? 1 : 0, 'item_change' => url_MakeHyperlink($this->getLanguageConstant('change'), window_Open('leads_types_change', 350, $this->getLanguageConstant('title_types_change'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'types_change'), array('id', $item->id)))), 'item_delete' => url_MakeHyperlink($this->getLanguageConstant('delete'), window_Open('leads_types_delete', 300, $this->getLanguageConstant('title_types_delete'), false, false, url_Make('transfer_control', 'backend_module', array('module', $this->name), array('backend_action', 'types_delete'), array('id', $item->id)))));
             $template->setLocalParams($params);
             $template->restoreXML();
             $template->parse();
         }
     }
 }