コード例 #1
0
$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);
    $listElement->add_child(new \html_library\HTMLBrElement());
    $listElements->add_child($listElement);
}
コード例 #2
0
$page = new html_library\HTMLHtmlElement();
$page->add_child(new html_library\HTMLHeadElement());
$body = new html_library\HTMLBodyElement();
$page->add_child($body);
$link5 = new html_library\HTMLAElement();
$link5->add_attribute(new html_library\HTMLAttribute('href', 'registration.php'));
$link5->add_child(new html_library\HTMLTextNode('Register'));
$link6 = new html_library\HTMLAElement();
$link6->add_attribute(new html_library\HTMLAttribute('href', 'login.php'));
$link6->add_child(new html_library\HTMLTextNode('Login'));
$body->add_child($link5);
$body->add_child($link6);
$body->add_child(new \html_library\HTMLBrElement());
$image = new \models\Slika();
$counter = 0;
$numOfPicToShow = 2;
while ($counter < $numOfPicToShow) {
    try {
        $image->load(rand(1, 10));
        $counter++;
        $picLink = new \html_library\HTMLAElement();
        $picLink->add_attribute(new \html_library\HTMLAttribute('href', "aboutPicture.php?id=" . $image->__get('ID')));
        $imgContent = new \html_library\HTMLImageElement();
        $imgContent->add_attribute(new \html_library\HTMLAttribute('src', "picture.php?id=" . $image->__get('ID') . "&size=small"));
        $picLink->add_child($imgContent);
        $body->add_child($picLink);
    } catch (Exception $e) {
        $counter = $counter <= 0 ? 0 : $counter--;
    }
}
echo $page;
コード例 #3
0
ファイル: editphoto.php プロジェクト: Cibale/sofascoreEDU
            echo "Error while updateing data";
        }
    } else {
        $formValidation->display_validation_errors();
    }
}
$pictureId = htmlentities($_GET['id']);
$picture = DAO::getConnection()->getImage($pictureId);
$pictureTitle = $picture->getTitle();
$pictureDescription = $picture->getDescription();
//page rendering
$page = new html_library\HTMLHtmlElement();
$page->add_child(new html_library\HTMLHeadElement());
$body = new html_library\HTMLBodyElement();
$page->add_child($body);
$imagePrint = new \html_library\HTMLImageElement();
$imagePrint->add_attribute(new \html_library\HTMLAttribute('src', "picture.php?id={$pictureId}&size=original"));
$body->add_child($imagePrint);
$form = new \html_library\HTMLFormElement();
$body->add_child($form);
$form->add_attribute(new \html_library\HTMLAttribute('id', 'pic_upload'));
$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);
$legend = new html_library\HTMLLegendElement();
$legend->add_child(new \html_library\HTMLTextNode('Edit your picture'));
$fieldset->add_child($legend);
$submitInput = new \html_library\HTMLInputElement();
$submitInput->add_attribute(new \html_library\HTMLAttribute('type', 'hidden'));
コード例 #4
0
ファイル: mypictures.php プロジェクト: Cibale/sofascoreEDU
$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 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);
コード例 #5
0
ファイル: aboutPicture.php プロジェクト: Cibale/sofascoreEDU
$imgContent = new \html_library\HTMLImageElement();
$imgContent->add_attribute(new \html_library\HTMLAttribute('src', "picture.php?id=" . $_GET['id'] . "&size=original"));
$body->add_child($imgContent);
$body->add_child(new \html_library\HTMLBrElement());
$body->add_child(new \html_library\HTMLTextNode("Total times visited: " . \db\DAO::getConnection()->totalCountImageVisited($_GET['id'])));
$body->add_child(new \html_library\HTMLBrElement());
$lastWeek = \db\DAO::getConnection()->lastWeekImageVisited($_GET['id']);
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);
}