Esempio n. 1
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();
         }
     }
 }