/**
  * Public function that creates a single instance
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Пример #2
0
 /**
  * Get container image
  *
  * @param resource $container
  * @return string
  */
 private function getContainerImage($container)
 {
     $result = '';
     $group_manager = GalleryGroupManager::getInstance();
     $membership_manager = GalleryGroupMembershipManager::getInstance();
     $items = $membership_manager->getItems(array('group'), array('container' => $container->id), array('RAND()'));
     if (count($items) > 0) {
         $membership = $items[array_rand($items)];
         $id = $membership->group;
         $group = $group_manager->getSingleItem(array('id', 'thumbnail'), array('id' => $id));
         if (is_object($group)) {
             $result = $this->getGroupImage($group);
         }
     }
     return $result;
 }