function render()
 {
     // get the page from the request
     $this->_page = $this->getCurrentPageFromRequest();
     // and the current album
     $galleryAlbums = new GalleryAlbums();
     $galleryResources = new GalleryResources();
     if ($this->_albumId > ROOT_ALBUM_ID && $this->_page > 0) {
         $album = $galleryAlbums->getAlbum($this->_albumId, $this->_blogInfo->getId());
         if (!$album || $album == "") {
             $this->_albumId = ROOT_ALBUM_ID;
         } else {
             //$resources = $album->getResources();
             $resources = $galleryResources->getUserResources($this->_blogInfo->getId(), $this->_albumId, $this->_resourceType, $this->_page, DEFAULT_ITEMS_PER_PAGE);
             $numResources = $galleryResources->getNumUserResources($this->_blogInfo->getId(), $this->_albumId, $this->_resourceType);
         }
     } else {
         $albums = $galleryAlbums->getChildAlbums($this->_albumId, $this->_blogInfo->getId());
         $resources = array();
     }
     // get a list with the nested albums
     $userAlbums = $galleryAlbums->getNestedAlbumList($this->_blogInfo->getId());
     // event about the albums we just loaded
     $this->notifyEvent(EVENT_ALBUMS_LOADED, array("albums" => &$userAlbums));
     $this->setValue("albumsList", $userAlbums);
     // fetch some statistics and continue
     $quotaUsage = GalleryResourceQuotas::getBlogResourceQuotaUsage($this->_blogInfo->getId());
     $totalResources = $galleryResources->getNumResources($this->_blogInfo->getId());
     $currentQuota = GalleryResourceQuotas::getBlogResourceQuota($this->_blogInfo->getId());
     $this->setValue("quotausage", $quotaUsage);
     $this->setValue("totalresources", $totalResources);
     $this->setValue("quota", $currentQuota);
     // and now export info about the albums and so on but only
     // if we're browsing the first page only (albums do not appear anymore after the first page)
     $this->setValue("album", $album);
     if ($this->_albumId > ROOT_ALBUM_ID && $this->_page < 2) {
         $this->setValue("albums", $album->getChildren());
     } else {
         $this->setValue("albums", $albums);
     }
     // event about the resources
     $this->notifyEvent(EVENT_RESOURCES_LOADED, array("resources" => &$resources));
     $this->setValue("resources", $resources);
     // finally, create and export the pager
     $pager = new Pager($this->_pagerUrl, $this->_page, $numResources, DEFAULT_ITEMS_PER_PAGE);
     $this->setValue("pager", $pager);
     parent::render();
 }
 /**
  * returns whether the blog would be over its allocated quota
  * if we are to add a file of the given size
  *
  * @param blogId
  * @param fileSize
  * @return
  * @static
  */
 function isBlogOverResourceQuota($blogId, $fileSize)
 {
     // current allocated quota
     $blogQuota = GalleryResourceQuotas::getBlogResourceQuota($blogId);
     // but if the quota is 0, then for sure we won't be over the quota :)
     if ($blogQuota == 0) {
         return false;
     }
     // if not, calculate how many bytes we currently have
     $currentBytes = GalleryResourceQuotas::getBlogResourceQuotaUsage($blogId);
     if ($currentBytes + $fileSize > $blogQuota) {
         return true;
     } else {
         return false;
     }
 }