$gallery = new \models\Galerija(); $images = \db\DAO::getConnection()->getAllImagesInGallery($_GET['id']); $gallery->load($_GET['id']); $title = new \html_library\HTMLTitleElement(); $title->add_child(new \html_library\HTMLTextNode($gallery->__get('title') . ' (' . count($images) . ')')); $body->add_child($title); $body->add_child(new \html_library\HTMLBrElement()); $listElements = new \html_library\HTMLUlElement(); foreach ($images as $image) { $values = get_object_vars($image); $listElement = new \html_library\HTMLLiElement(); $picLink = new \html_library\HTMLAElement(); $picLink->add_attribute(new \html_library\HTMLAttribute('href', "aboutPicture.php?id=" . $values['ID'])); $imgContent = new \html_library\HTMLImageElement(); $imgContent->add_attribute(new \html_library\HTMLAttribute('src', "picture.php?id=" . $values['ID'] . "&size=small")); $picLink->add_child($imgContent); $imgTitle = new \html_library\HTMLTitleElement(3); $imgTitle->add_child(new \html_library\HTMLTextNode($values['title'])); $editLink = new \html_library\HTMLAElement(); $editLink->add_attribute(new \html_library\HTMLAttribute('href', "editphoto.php?id=" . $values['ID'])); $editLink->add_child(new \html_library\HTMLTextNode('Edit photo')); $listElement->add_child($imgTitle); $listElement->add_child(new \html_library\HTMLBrElement()); $listElement->add_child($picLink); $listElement->add_child(new \html_library\HTMLBrElement()); $listElement->add_child($editLink); $listElement->add_child(new \html_library\HTMLBrElement()); $listElements->add_child($listElement); } $body->add_child($listElements); echo $page;
$link1->add_child(new html_library\HTMLTextNode('Create a new gallery')); $body->add_child($link1); $body->add_child(new \html_library\HTMLBrElement()); $title = new \html_library\HTMLTitleElement(); $title->add_child(new \html_library\HTMLTextNode('Your galleries: ')); $body->add_child($title); $body->add_child(new \html_library\HTMLBrElement()); $listElements = new \html_library\HTMLUlElement(); $galleries = \db\DAO::getConnection()->getGalleriesByUserId($_SESSION['user_id']); foreach ($galleries as $gallery) { $values = get_object_vars($gallery); $listElement = new \html_library\HTMLLiElement(); $galleryTitle = new \html_library\HTMLTitleElement(3); $galleryTitle->add_child(new \html_library\HTMLTextNode($values['title'])); $galleryDescription = new \html_library\HTMLTitleElement(5); $galleryDescription->add_child(new \html_library\HTMLTextNode($values['description'])); $visitLink = new \html_library\HTMLAElement(); $visitLink->add_attribute(new \html_library\HTMLAttribute('href', "picturesInGallery.php?id=" . $values['ID'])); $visitLink->add_child(new \html_library\HTMLTextNode('Open gallery')); $editLink = new \html_library\HTMLAElement(); $editLink->add_attribute(new \html_library\HTMLAttribute('href', "editgallery.php?id=" . $values['ID'])); $editLink->add_child(new \html_library\HTMLTextNode('Edit gallery')); $listElement->add_child($galleryTitle); $listElement->add_child(new \html_library\HTMLBrElement()); $listElement->add_child($galleryDescription); $listElement->add_child(new \html_library\HTMLBrElement()); $listElement->add_child($visitLink); $listElement->add_child(new \html_library\HTMLBrElement()); $listElement->add_child($editLink); $listElement->add_child(new \html_library\HTMLBrElement()); $listElements->add_child($listElement);
$body->add_child($title); $body->add_child(new \html_library\HTMLBrElement()); $listElements = new \html_library\HTMLUlElement(); $images = \db\DAO::getConnection()->getImagesByUser($_SESSION['user_id']); foreach ($images as $image) { $values = get_object_vars($image); $listElement = new \html_library\HTMLLiElement(); $picLink = new \html_library\HTMLAElement(); $picLink->add_attribute(new \html_library\HTMLAttribute('href', "aboutPicture.php?id=" . $values['ID'])); $imgContent = new \html_library\HTMLImageElement(); $imgContent->add_attribute(new \html_library\HTMLAttribute('src', "picture.php?id=" . $values['ID'] . "&size=small")); $picLink->add_child($imgContent); $imgTitle = new \html_library\HTMLTitleElement(3); $imgTitle->add_child(new \html_library\HTMLTextNode($values['title'])); $galleryTitle = new \html_library\HTMLTitleElement(5); $galleryTitle->add_child(new \html_library\HTMLTextNode(\db\DAO::getConnection()->getGallery($values['gallery_id'])->title)); $editLink = new \html_library\HTMLAElement(); $editLink->add_attribute(new \html_library\HTMLAttribute('href', "editphoto.php?id=" . $values['ID'])); $editLink->add_child(new \html_library\HTMLTextNode('Edit photo')); $listElement->add_child($imgTitle); $listElement->add_child(new \html_library\HTMLBrElement()); $listElement->add_child($picLink); $listElement->add_child(new \html_library\HTMLBrElement()); $listElement->add_child($galleryTitle); $listElement->add_child(new \html_library\HTMLBrElement()); $listElement->add_child($editLink); $listElement->add_child(new \html_library\HTMLBrElement()); $listElements->add_child($listElement); } $body->add_child($listElements); echo $page;
$body->add_child($link1); $body->add_child(new \html_library\HTMLBrElement()); $title = new \html_library\HTMLTitleElement(); $title->add_child(new \html_library\HTMLTextNode('Your photos: ')); $body->add_child($title); $body->add_child(new \html_library\HTMLBrElement()); $listElements = new \html_library\HTMLUlElement(); $images = DAO::getConnection()->getImagesByUser($_SESSION['user_id']); foreach ($images as $imageId => $image) { $listElement = new \html_library\HTMLLiElement(); $imgContent = new \html_library\HTMLImageElement(); $imgContent->add_attribute(new \html_library\HTMLAttribute('src', "picture.php?id={$imageId}&size=small")); $imgTitle = new \html_library\HTMLTitleElement(3); $imgTitle->add_child(new \html_library\HTMLTextNode($image->getTitle())); $galleryTitle = new \html_library\HTMLTitleElement(5); $galleryTitle->add_child(new \html_library\HTMLTextNode(DAO::getConnection()->getGallery($image->getGalleryId())->getTitle())); $editLink = new \html_library\HTMLAElement(); $editLink->add_attribute(new \html_library\HTMLAttribute('href', "editphoto.php?id={$imageId}")); $editLink->add_child(new \html_library\HTMLTextNode('Edit photo')); $listElement->add_child($imgTitle); $listElement->add_child(new \html_library\HTMLBrElement()); $listElement->add_child($imgContent); $listElement->add_child(new \html_library\HTMLBrElement()); $listElement->add_child($galleryTitle); $listElement->add_child(new \html_library\HTMLBrElement()); $listElement->add_child($editLink); $listElement->add_child(new \html_library\HTMLBrElement()); $listElements->add_child($listElement); } $body->add_child($listElements); echo $page;
////graph rendering $data = implode('&', array_map(function ($v, $k) { return $k . '=' . $v; }, $lastWeek, array_keys($lastWeek))); $imageTag = new \html_library\HTMLImageElement(); $imageTag->add_attribute(new \html_library\HTMLAttribute('src', 'renderGraph.php?' . $data)); $body->add_child($imageTag); $listElements = new \html_library\HTMLUlElement(); $comments = \db\DAO::getConnection()->getCommentsForImage($_GET['id']); foreach ($comments as $comment) { $values = get_object_vars($comment); $listElement = new \html_library\HTMLLiElement(); $username = new \html_library\HTMLTitleElement(3); $username->add_child(new \html_library\HTMLTextNode($values['username'])); $commentData = new \html_library\HTMLTitleElement(5); $commentData->add_child(new \html_library\HTMLTextNode($values['comment_data'])); $listElement->add_child($username); $listElement->add_child($commentData); $listElements->add_child($listElement); } $body->add_child($listElements); $form = new \html_library\HTMLFormElement(); if (isset($_SESSION['user_id'])) { $body->add_child($form); } $form->add_attribute(new \html_library\HTMLAttribute('id', 'comment')); $form->add_attribute(new \html_library\HTMLAttribute('action', '')); $form->add_attribute(new \html_library\HTMLAttribute('method', 'post')); $form->add_attribute(new \html_library\HTMLAttribute('accept-charset', 'UTF-8')); $fieldset = new \html_library\HTMLFieldsetElement(); $form->add_child($fieldset);