$link1 = new html_library\HTMLAElement();
$link1->add_attribute(new html_library\HTMLAttribute('href', 'new_gallery.php'));
$link1->add_child(new html_library\HTMLTextNode('Create a new gallery'));
$body->add_child($link1);
$body->add_child(new \html_library\HTMLBrElement());
$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);
Example #2
0
$inputTags = new \html_library\HTMLInputElement();
$inputTags->add_attribute(new \html_library\HTMLAttribute('type', 'text'));
$inputTags->add_attribute(new \html_library\HTMLAttribute('name', 'tags'));
$inputTags->add_attribute(new \html_library\HTMLAttribute('maxlength', 500));
$inputTags->add_attribute(new \html_library\HTMLAttribute('required', null));
$form->add_child($labelTags);
$form->add_child($inputTags);
$inputSubmit = new \html_library\HTMLInputElement();
$inputSubmit->add_attribute(new \html_library\HTMLAttribute('type', 'submit'));
$inputSubmit->add_attribute(new \html_library\HTMLAttribute('value', 'Search'));
$form->add_child($inputSubmit);
$homePageLink = new \html_library\HTMLAElement();
$homePageLink->add_attribute(new \html_library\HTMLAttribute('href', 'index.php'));
$homePageLink->add_child(new \html_library\HTMLTextNode('Home page'));
$body->add_child($homePageLink);
$body->add_child(new \html_library\HTMLBrElement());
if (!empty($results)) {
    $listElements = new \html_library\HTMLUlElement();
    foreach ($results as $imageId) {
        $listElement = new \html_library\HTMLLiElement();
        $picLink = new \html_library\HTMLAElement();
        $picLink->add_attribute(new \html_library\HTMLAttribute('href', "aboutPicture.php?id=" . $imageId));
        $imgContent = new \html_library\HTMLImageElement();
        $imgContent->add_attribute(new \html_library\HTMLAttribute('src', "picture.php?id=" . $imageId . "&size=small"));
        $picLink->add_child($imgContent);
        $listElement->add_child($picLink);
        $listElements->add_child($listElement);
    }
    $body->add_child($listElements);
}
echo $page;
Example #3
0
$body->add_child($link2);
$body->add_child(new \html_library\HTMLBrElement());
$link1 = new html_library\HTMLAElement();
$link1->add_attribute(new html_library\HTMLAttribute('href', 'new_gallery.php'));
$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);
Example #4
0
foreach ($lastWeek as $key => $value) {
    $body->add_child(new \html_library\HTMLTextNode($key . ': ' . $value));
    $body->add_child(new \html_library\HTMLBrElement());
}
////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', ''));