/** * die Albenstruktur fuer eine Auswahlbox darstellen und das aktuelle Album vorauswählen * @param int $parentId * @param string $vorschub * @param $photoAlbum * @param $phoId */ function subfolder($parentId, $vorschub, $photoAlbum, $phoId) { global $gDb, $gCurrentOrganization, $photoAlbumsArray; $vorschub = $vorschub . ' '; $sqlConditionParentId = ''; $parentPhotoAlbum = new TablePhotos($gDb); // Erfassen des auszugebenden Albums if ($parentId > 0) { $sqlConditionParentId .= ' AND pho_pho_id_parent = \'' . $parentId . '\' '; } else { $sqlConditionParentId .= ' AND pho_pho_id_parent IS NULL '; } $sql = 'SELECT * FROM ' . TBL_PHOTOS . ' WHERE pho_id <> ' . $photoAlbum->getValue('pho_id') . $sqlConditionParentId . ' AND pho_org_id = ' . $gCurrentOrganization->getValue('org_id'); $childStatement = $gDb->query($sql); while ($adm_photo_child = $childStatement->fetch()) { $parentPhotoAlbum->clear(); $parentPhotoAlbum->setArray($adm_photo_child); // add entry to array of all photo albums $photoAlbumsArray[$parentPhotoAlbum->getValue('pho_id')] = $vorschub . '— ' . $parentPhotoAlbum->getValue('pho_name') . ' (' . $parentPhotoAlbum->getValue('pho_begin', 'Y') . ')'; subfolder($parentPhotoAlbum->getValue('pho_id'), $vorschub, $photoAlbum, $phoId); } //while }
$sql = $sql . ' ORDER BY pho_begin DESC'; $albumStatement = $gDb->query($sql); $albumList = $albumStatement->fetchAll(); // Gesamtzahl der auszugebenden Alben $albumsCount = $albumStatement->rowCount(); // falls zum aktuellen Album Fotos und Unteralben existieren, // dann einen Trennstrich zeichnen if ($photoAlbum->getValue('pho_quantity') > 0 && $albumsCount > 0) { $page->addHtml('<hr />'); } $childPhotoAlbum = new TablePhotos($gDb); $page->addHtml('<div class="row">'); for ($x = $getStart; $x <= $getStart + $gPreferences['photo_albums_per_page'] - 1 && $x < $albumsCount; ++$x) { // Daten in ein Photo-Objekt uebertragen $childPhotoAlbum->clear(); $childPhotoAlbum->setArray($albumList[$x]); // folder of the album $ordner = SERVER_PATH . '/adm_my_files/photos/' . $childPhotoAlbum->getValue('pho_begin', 'Y-m-d') . '_' . $childPhotoAlbum->getValue('pho_id'); // show album if album is not locked or it has child albums or the user has the photo module edit right if (file_exists($ordner) && $childPhotoAlbum->getValue('pho_locked') == 0 || $childPhotoAlbum->hasChildAlbums() || $gCurrentUser->editPhotoRight()) { // Zufallsbild fuer die Vorschau ermitteln $shuffle_image = $childPhotoAlbum->shuffleImage(); // Album angaben if (file_exists($ordner) || $childPhotoAlbum->hasChildAlbums()) { $albumTitle = '<a href="' . $g_root_path . '/adm_program/modules/photos/photos.php?pho_id=' . $childPhotoAlbum->getValue('pho_id') . '">' . $childPhotoAlbum->getValue('pho_name') . '</a><br />'; } else { $albumTitle = $childPhotoAlbum->getValue('pho_name'); } $albumDate = $childPhotoAlbum->getValue('pho_begin', $gPreferences['system_date']); if ($childPhotoAlbum->getValue('pho_end') != $childPhotoAlbum->getValue('pho_begin')) { $albumDate .= ' ' . $gL10n->get('SYS_DATE_TO') . ' ' . $childPhotoAlbum->getValue('pho_end', $gPreferences['system_date']);
// Limit setzen falls gefordert if ($plg_photos_albums != 0) { $sql = $sql . ' LIMIT ' . $plg_photos_albums; } $albumStatement = $gDb->query($sql); $albumList = $albumStatement->fetchAll(); // Variablen initialisieren $i = 0; $picnr = 0; $picpath = ''; $link_text = ''; $album = new TablePhotos($gDb); // Schleife, falls nicht direkt ein Bild gefunden wird, aber auf 20 Durchlaeufe begrenzen while (!file_exists($picpath) && $i < 20 && $albumStatement->rowCount() > 0) { // Ausgewähltendatendatz holen $album->setArray($albumList[mt_rand(0, $albumStatement->rowCount() - 1)]); // Falls gewuensch Bild per Zufall auswaehlen if ($plg_photos_picnr == 0) { $picnr = mt_rand(1, $album->getValue('pho_quantity')); } else { $picnr = $plg_photos_picnr; } // Bilpfad zusammensetzen $picpath = PLUGIN_PATH . '/../adm_my_files/photos/' . $album->getValue('pho_begin', 'Y-m-d') . '_' . $album->getValue('pho_id') . '/' . $picnr . '.jpg'; ++$i; } if (!file_exists($picpath)) { $picpath = THEME_SERVER_PATH . '/images/nopix.jpg'; } // Ermittlung der Original Bildgroesse $bildgroesse = getimagesize($picpath);
// falls zum aktuellen Album Fotos und Unteralben existieren, // dann einen Trennstrich zeichnen if ($photoAlbum->getValue('pho_quantity') > 0 && $albumsCount > 0) { $page->addHtml('<hr />'); } //Dateizeiger auf erstes auszugebendes Element setzen if ($albumsCount > 0) { $gDb->data_seek($result_list, $getStart); } $childPhotoAlbum = new TablePhotos($gDb); $page->addHtml('<div class="row">'); for ($x = $getStart; $x <= $getStart + $gPreferences['photo_albums_per_page'] - 1 && $x < $albumsCount; $x++) { $adm_photo_list = $gDb->fetch_array($result_list); // Daten in ein Photo-Objekt uebertragen $childPhotoAlbum->clear(); $childPhotoAlbum->setArray($adm_photo_list); // folder of the album $ordner = SERVER_PATH . '/adm_my_files/photos/' . $childPhotoAlbum->getValue('pho_begin', 'Y-m-d') . '_' . $childPhotoAlbum->getValue('pho_id'); // show album if album is not locked or it has child albums or the user has the photo module edit right if (file_exists($ordner) && $childPhotoAlbum->getValue('pho_locked') == 0 || $childPhotoAlbum->hasChildAlbums() || $gCurrentUser->editPhotoRight()) { // Zufallsbild fuer die Vorschau ermitteln $shuffle_image = $childPhotoAlbum->shuffleImage(); //Album angaben if (file_exists($ordner) || $childPhotoAlbum->hasChildAlbums()) { $albumTitle = '<a href="' . $g_root_path . '/adm_program/modules/photos/photos.php?pho_id=' . $childPhotoAlbum->getValue('pho_id') . '">' . $childPhotoAlbum->getValue('pho_name') . '</a><br />'; } else { $albumTitle = $childPhotoAlbum->getValue('pho_name'); } $albumDate = $childPhotoAlbum->getValue('pho_begin', $gPreferences['system_date']); if ($childPhotoAlbum->getValue('pho_end') != $childPhotoAlbum->getValue('pho_begin')) { $albumDate .= ' ' . $gL10n->get('SYS_DATE_TO') . ' ' . $childPhotoAlbum->getValue('pho_end', $gPreferences['system_date']);
if ($plg_photos_albums != 0) { $sql = $sql . ' LIMIT ' . $plg_photos_albums; } $result = $gDb->query($sql); // Variablen initialisieren $i = 0; $picnr = 0; $picpath = ''; $link_text = ''; $album = new TablePhotos($gDb); // Schleife, falls nicht direkt ein Bild gefunden wird, aber auf 20 Durchlaeufe begrenzen while (!file_exists($picpath) && $i < 20 && $gDb->num_rows($result) > 0) { //Zeiger per Zufall auf ein Album setzen $gDb->data_seek($result, mt_rand(0, $gDb->num_rows($result) - 1)); //Ausgewähltendatendatz holen $album->setArray($gDb->fetch_array($result)); //Falls gewuensch Bild per Zufall auswaehlen if ($plg_photos_picnr == 0) { $picnr = mt_rand(1, $album->getValue('pho_quantity')); } else { $picnr = $plg_photos_picnr; } //Bilpfad zusammensetzen $picpath = PLUGIN_PATH . '/../adm_my_files/photos/' . $album->getValue('pho_begin', 'Y-m-d') . '_' . $album->getValue('pho_id') . '/' . $picnr . '.jpg'; $i++; } if (!file_exists($picpath)) { $picpath = THEME_SERVER_PATH . '/images/nopix.jpg'; } //Ermittlung der Original Bildgroesse $bildgroesse = getimagesize($picpath);
FROM ' . TBL_PHOTOS . ' pho ' . $additionalTables . ' WHERE ( pho_org_id = ' . $gCurrentOrganization->getValue('org_id') . ' AND pho_locked = 0) ORDER BY pho_timestamp_create DESC LIMIT 10'; $statement = $gDb->query($sql); $photo_album = new TablePhotos($gDb); // ab hier wird der RSS-Feed zusammengestellt // create RSS feed object with channel information $rss = new RSSfeed($gCurrentOrganization->getValue('org_longname') . ' - ' . $getHeadline, $gCurrentOrganization->getValue('org_homepage'), $gL10n->get('PHO_RECENT_ALBUMS_OF_ORGA', $gCurrentOrganization->getValue('org_longname')), $gCurrentOrganization->getValue('org_longname')); // Dem RSSfeed-Objekt jetzt die RSSitems zusammenstellen und hinzufuegen while ($row = $statement->fetch()) { // Daten in ein Photo-Objekt uebertragen $photo_album->clear(); $photo_album->setArray($row); // set data for attributes of this entry // read folder structure to put them together and write to title $parents = ''; $pho_parent_id = $photo_album->getValue('pho_pho_id_parent'); while ($pho_parent_id > 0) { // Erfassen des Eltern Albums $sql = ' SELECT * FROM ' . TBL_PHOTOS . ' WHERE pho_id = ' . $pho_parent_id; $parentsStatement = $gDb->query($sql); $adm_photo_parent = $parentsStatement->fetch(); // Link zusammensetzen $parents = $adm_photo_parent['pho_name'] . ' > ' . $parents; // Elternveranst $pho_parent_id = $adm_photo_parent['pho_pho_id_parent'];