Esempio n. 1
0
 /**
  * Public function that creates a single instance
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
 /**
  * Handle drawing list of Sapphire Waves users.
  *
  * @param array $tag_params
  * @param array $children
  * @return void
  */
 public function tag_UserList($tag_params, $children)
 {
     $manager = SapphireWavesManager::getInstance();
     $conditions = array();
     if (array_key_exists('referral', $tag_params)) {
         $conditions['referral'] = fix_id($tag_params['referral']);
     }
     // load template
     $template = $this->loadTemplate($tag_params, 'user.xml');
     // get user data from the database
     $items = $manager->getItems($manager->getFieldNames(), $conditions);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = array('id' => $item->id, 'type' => $item->type, 'user' => $item->user, 'referral' => $item->referral, 'remaining_time' => $item->remaining_time, 'total_time' => $item->total_time, 'timestamp' => $item->timestamp);
             $template->setLocalParams($params);
             $template->restoreXML();
             $template->parse();
         }
     }
 }