Esempio n. 1
0
 /**
  * getArchives function.
  *
  * @access public
  * @return object
  */
 public function getArchives()
 {
     if (count($this->items) > 0) {
         return \Photoalbums2ArchiveModel::findMultipleByIds($this->items);
     }
     return null;
 }
Esempio n. 2
0
 /**
  * Delete old files and generate all feeds
  */
 public function generateFeeds()
 {
     $this->removeOldFeeds();
     $objArchive = \Photoalbums2ArchiveModel::findBy(array('makeFeed=1', 'protected!=1'), array());
     if ($objArchive !== null) {
         while ($objArchive->next()) {
             $objArchive->feedName = $objArchive->alias != '' ? $objArchive->alias : 'pa2' . $objArchive->id;
             $this->generateFiles($objArchive->row());
             $this->log('Generated pa2 feed "' . $objArchive->feedName . '.xml"', 'Pa2 generateFeeds()', TL_CRON);
         }
     }
 }
Esempio n. 3
0
 /**
  * Get all archives from photoalbums2 and return them as array
  * @return array
  */
 public function getPhotoalbums2Albums()
 {
     if (!$this->User->isAdmin && !is_array($this->User->photoalbums2s)) {
         return array();
     }
     $arrArchives = array();
     $objArchives = \Photoalbums2ArchiveModel::findAll(array('order' => 'title'));
     if ($objArchives !== null) {
         while ($objArchives->next()) {
             if ($this->User->isAdmin || $this->User->hasAccess($objArchives->id, 'photoalbums2s')) {
                 $objAlbums = \Photoalbums2AlbumModel::findBy('pid', $objArchives->id, array('order' => 'title'));
                 if ($objAlbums !== null) {
                     while ($objAlbums->next()) {
                         $arrArchives[$objArchives->title][$objAlbums->id] = $objAlbums->title;
                     }
                 }
             }
         }
     }
     return $arrArchives;
 }
 /**
  * addComments function.
  *
  * @access public
  * @return void
  */
 public function addComments($objAlbum)
 {
     // HOOK: comments extension required
     if ($objAlbum->noComments || !in_array('comments', $this->Template->Config->getActiveModules())) {
         $this->Template->allowComments = false;
         return;
     }
     // Check whether comments are allowed
     $objArchive = \Photoalbums2ArchiveModel::findByPk($objAlbum->pid);
     if ($objArchive === null || !$objArchive->allowComments) {
         $this->Template->allowComments = false;
         return;
     }
     $this->Template->allowComments = true;
     // Adjust the comments headline level
     $intHl = min(intval(str_replace('h', '', $this->hl)), 5);
     $this->Template->hlc = 'h' . ($intHl + 1);
     $this->import('Comments');
     $arrNotifies = array();
     // Notify system administrator
     if ($objArchive->notify != 'notify_author') {
         $arrNotifies[] = $GLOBALS['TL_ADMIN_EMAIL'];
     }
     // Notify author
     if ($objArchive->notify != 'notify_admin') {
         $objAuthor = \UserModel::findByPk($objAlbum->author);
         if ($objAuthor !== null) {
             $arrNotifies[] = $objAuthor->email;
         }
     }
     $objConfig = new \stdClass();
     $objConfig->perPage = $objArchive->perPage;
     $objConfig->order = $objArchive->sortOrder;
     $objConfig->template = $this->com_template;
     $objConfig->requireLogin = $objArchive->requireLogin;
     $objConfig->disableCaptcha = $objArchive->disableCaptcha;
     $objConfig->bbcode = $objArchive->bbcode;
     $objConfig->moderate = $objArchive->moderate;
     $this->Comments->addCommentsToTemplate($this->Template, $objConfig, 'tl_photoalbums2_album', $objAlbum->id, $arrNotifies);
 }