Zum Inhalt springen

jm_gallery anzahl von kommentaren in der albumansicht

Erstellt am 11. Februar 2008 · 3 Antworten · letzte Antwort am 1. Mai 2008

Tags: Bilder, Frage

Skyhead ·

Ist es irgendwie möglich, schon in der Albumansicht zu sehen, wie viele Kommentare geschreiben wurden, so wie man auch sehen kann, wie oft das Bild schon aufgerufen wurde.

Wenn ja wie?

Mfg Skyhead

P.S. vielleicht kann mir jemand auch eine bessere Gallerie nennen, die einfach zu implementieren ist.

Skyhead ·

So, ich hab jetzt den Quellcode gefunden, der die Anzahl der Kommentare ausgibt: class.tx_jmgallery_view_Comments.php

require_once(PATH_tslib.'class.tslib_pibase.php');
require_once(t3lib_extMgm::extPath('jm_gallery').'pi1/class.tx_jmgallery_view_Base.php');

class tx_jmgallery_view_Comments extends tx_jmgallery_view_Base {

    

    /* initial call */
    function display() {
        
        $template = $this->cObj->getSubpart($this->templateCode,  '###COMMENT_LIST###');
        
        $marks = array();
        $marks['###IMAGE_COMMENTS_COUNT###'] = sizeof($this->input);
        $marks['###LL_COMMENTS###'] = $this->pi_getLL('commentsComment');
        $marks['###LL_SAYS###']    = $this->pi_getLL('commentsSays');;
                            
        $comments = '';
        for ($i = 0; $i < sizeof($this->input); $i++) {
            $comments .= $this->wrapCommentInHTML($template, 'IMAGE_COMMENT_ENTRY', $this->input[$i], $i);
        }
        $template = $this->cObj->substituteSubpart($template,'###IMAGE_COMMENT_ENTRY###', $comments);
                            
        $template = $this->cObj->substituteMarkerArray($template, $marks);
        return $template;
    }
    
    
    /* Section H: Helper functions ----------------------------------------- */
    
    
    function wrapCommentInHTML($template, $code, $object, $num) {
        $code = $this->cObj->getSubpart($template, '###'.$code.'###');
        $marks = array();
        $marks['###IMAGE_COMMENT_NUM###'] = $num;
        $marks['###IMAGE_COMMENTER_FIRSTNAME###'] =     $object->getFirstname();
        $marks['###IMAGE_COMMENTER_SURNAME###']    = $object->getSurname();
        $marks['###IMAGE_COMMENT_DATE###'] = strftime($this->conf['dateFormat'], $object->getTimestamp());
        $marks['###IMAGE_COMMENT_MESSAGE###'] = htmlspecialchars($object->getMessage(), ENT_QUOTES);
        $marks['###IMAGE_COMMENT_HOMEPAGE###'] = $object->getHomepage();
        $marks['###IMAGE_COMMENT_PLACE###'] = $object->getPlace();
        $marks['###IMAGE_COMMENT_EMAIL###'] = $object->getEMail();
        return $this->cObj->substituteMarkerArray($code, $marks);
    }

}

könnte mir vielleicht irgendwer sagen, was ich jetzt in der PHP datei fü die albumsansicht einfügen muss???

Hier nochmal die PHP datei: class.tx_jmgallery_view_Album.php

require_once(PATH_tslib.'class.tslib_pibase.php');
require_once(t3lib_extMgm::extPath('jm_gallery').'pi1/class.tx_jmgallery_model_Category.php');
require_once(t3lib_extMgm::extPath('jm_gallery').'pi1/class.tx_jmgallery_view_Base.php');

class tx_jmgallery_view_Album extends tx_jmgallery_view_Base {


    var $page = 1;
    
    /* set page for pagebrowser */
    function setPage($page) {
        $this->page = $page;
    }
    

    /* initial call */
    function display() {

        $template = $this->cObj->getSubpart($this->templateCode, '###ALBUM_TEMPLATE###');
        
        $album = $this->input;
        
        $pagebrowser = '';
        $imagecount = $album->getImageCount();
            
        /* check if a pagebrowser is needed */
        if (!empty($this->conf['display.']['ALBUM.']['pagebrowser.']['limit']) && $this->conf['display.']['ALBUM.']['pagebrowser.']['enable'] == 1) {
            
            if ($imagecount > $this->conf['display.']['ALBUM.']['pagebrowser.']['limit']) {
                
                /* we need a pagebrowser */
                $pages = ceil ($imagecount / $this->conf['display.']['ALBUM.']['pagebrowser.']['limit']);
                $browsertemplate = $this->cObj->getSubpart($template, '###PAGEBROWSER_TEMPLATE###');
                $linkstemplate = $this->cObj->getSubpart($browsertemplate, '###PAGELINKS###');
                
                for ($i = 1; $i <= $pages; $i++) {
                    $marks = array();
                    if ($i == $this->page) {
                        $marks['###PAGE_LINK###'] = $i;
                    } else {
                        $marks['###PAGE_LINK###'] = $this->pi_linkTP_keepPIvars($i, array('albumUid' => $album->getUid(), 'page' => $i), $this->conf['allowCaching'], 1, $this->conf['album_pid']);
                    }
                    $pagebrowser .= $this->cObj->substituteMarkerArray($linkstemplate,$marks);
                }
                
                $pagebrowser = $this->cObj->substituteSubpart($browsertemplate, '###PAGELINKS###',$pagebrowser);
                
                /* if we show all images */
                if ($this->page == 0) {
                    $pagebrowser = $this->cObj->substituteMarkerArray($pagebrowser,array('###DISPLAY_ALL_LINK###' => $this->pi_getLL('displayAll')));
                    $offset = 0;
                    $loops = $imagecount;
                } else { /* if we show a selected page */
                    $pagebrowser = $this->cObj->substituteMarkerArray($pagebrowser,array('###DISPLAY_ALL_LINK###' => $this->pi_linkTP_keepPIvars($this->pi_getLL('displayAll'), array('albumUid' => $album->getUid(), 'page' => 0,), $this->conf['allowCaching'], 1, $this->conf['album_pid'])));
                    $offset = ($this->page - 1) * $this->conf['display.']['ALBUM.']['pagebrowser.']['limit'];
                    $loops = ($imagecount - $offset) < $this->conf['display.']['ALBUM.']['pagebrowser.']['limit']
                                    ? ($imagecount - $offset) : $this->conf['display.']['ALBUM.']['pagebrowser.']['limit'];
                }
                
            } else {
                $offset = 0;
                $loops = $imagecount;
            }
        } else {
            $offset = 0;
            $loops = $imagecount;
        }
        
        /* insert the pagebrowser */
        $template = $this->cObj->substituteSubpart($template, '###PAGEBROWSER_TEMPLATE###', "");    
        
        /* substitute album description */
        $marks = array();
        $marks['###PAGEBROWSER###'] = $pagebrowser;
        $marks['###ALBUM_UID###'] = $this->_GP["albumUid"];
        $marks['###ALBUM_NAME###'] = htmlspecialchars($this->cObj->stdWrap($album->getName(), $this->conf['display.']['ALBUM.']['albumNameWrap.']), ENT_QUOTES);
        $marks['###ALBUM_CRDATE###'] = $this->cObj->stdWrap($album->getDatum(), $this->conf['display.']['LIST.']['dateWrap.']);
        $marks['###ALBUM_PICTURECOUNT###'] = $album->getImageCount();
        $marks['###LL_PAGES###'] = $this->pi_getLL('pagesText');
        $marks['###GALLERY_PAGE_LINK###'] = $this->pi_linkTP_keepPIvars_url(array(), $this->conf['allowCaching'], 1, $this->conf['list_pid']);
        $marks['###ALBUM_DESCRIPTION###'] = htmlspecialchars($this->cObj->stdWrap($album->getDescription(), $this->conf['display.']['ALBUM.']['albumDescriptionWrap.']), ENT_QUOTES);
        $marks['###LL_LIST_PAGE###'] = $this->pi_getLL('galleryIndexLinkTitle');

        $template = $this->cObj->substituteMarkerArray($template,$marks);
        
        /* finally show images */
        $images = $album->getImages();
        
        /* 'jump' to offset */
        for ($i = 0; $i < $offset; $i++)
                list (, $image) = each ($images);
        
        if ($this->conf['display.']['ALBUM.']['alternate.']['enable'] == 0) {
            for ($i = 0; $i < $loops; $i++) {
                list (, $image) = each ($images);
                $imageCode .= $this->wrapImageInHTML($template, 'IMAGE_ENTRY', $image);
            }
            $template = $this->cObj->substituteSubpart ($template, '###IMAGE_ROW###', $imageCode);
        } else {
        
            $subCode = "";
            $imageCode = "";
            $rowCode = $this->cObj->getSubpart($template, '###IMAGE_ROW###');
            $i = 0;
            $k = 0;
            $max = $this->conf['display.']['ALBUM.']['alternate.']['oddRows'];
        
            for ($l = 0; $l < $loops; $l++) {
                list (, $image) = each ($images);
                if ($i < $max) {
                    $imageCode .= $this->wrapImageInHTML($template, 'IMAGE_ENTRY', $image);
                    $i++;
                } else {
                    $subCode .= $this->cObj->substituteSubpart ($rowCode, '###IMAGE_ENTRY###', $imageCode);
                    $rowCode = $this->cObj->getSubpart($template, '###IMAGE_ROW###');
                    $imageCode = $this->wrapImageInHTML($template, 'IMAGE_ENTRY', $image);
                    $i = 1;
                    if ($k == 1) {
                        $max = $this->conf['display.']['ALBUM.']['alternate.']['oddRows'];
                        $k = 0;
                    } else {
                        $max = $this->conf['display.']['ALBUM.']['alternate.']['evenRows'];
                        $k = 1;
                    }
                }
            }
            $subCode .= $this->cObj->substituteSubpart ($rowCode, '###IMAGE_ENTRY###', $imageCode);
            $template = $this->cObj->substituteSubpart ($template, '###IMAGE_ROW###', $subCode);
        }
        
        return $template;
    }
        
    
    /* Section H: Helper functions ----------------------------------------- */
    
    function wrapImageInHTML($template, $code, $object) {
        $code = $this->cObj->getSubpart($template, '###'.$code.'###');
        $album = $object->getAlbum();
        $marks = array();
        $marks['###IMAGE_FILENAME###'] = $object->getFilename();
        $marks['###IMAGE_FILESIZE###'] = (int) (filesize($object->getImageLocation()) / 1024);
        $marks['###IMAGE_RESOLUTION###'] = $object->getResolution();
        $marks['###IMAGE_UID###'] = $object->getUid();
        $marks['###IMAGE_THUMBNAIL###'] = $object->getDefaultThumbnailLocation();
        $marks['###IMAGE_CAPTION###'] = htmlspecialchars($this->cObj->stdWrap($object->getCaption(), $this->conf['display.']['ALBUM.']['imageCaptionWrap.']), ENT_QUOTES);
        $marks['###IMAGE_VIEWS###'] = $object->getViews();
        $marks['###IMAGE_DATE###'] = $object->getDatum();
        $marks['###ALBUM_UID###'] = $album->getUid();
        $marks['###IMAGE_PAGE_LINK###'] = $this->pi_linkTP_keepPIvars_url(array('albumUid' => $album->getUid(), 'imageUid' => $object->getUid()), $this->conf['allowCaching'], 1, $this->conf['single_pid']);
        $marks['###LL_HITS###']    = $this->pi_getLL('Hits');
        $marks['###LL_INFORMATION###'] = $this->pi_getLL('adminImageInformation');
        $marks['###LL_CAPTION###'] = $this->pi_getLL('adminImageCaption');
        $marks['###BACK_GALLERY_INDEX###'] = $this->pi_getLL('galleryIndexLinkTitle');
        return $this->cObj->substituteMarkerArray($code, $marks);
    }
}

vielleicht kann mir je jemand helfen!

Mfg Skyhead