Example #1
0
$labelDescription->add_attribute(new \html_library\HTMLAttribute('for', 'description'));
$labelDescription->add_child(new \html_library\HTMLTextNode('Description: '));
$fieldset->add_child($labelDescription);
$textArea = new \html_library\HTMLTextAreaElement();
$textArea->add_attribute(new \html_library\HTMLAttribute('name', 'description'));
$textArea->add_attribute(new \html_library\HTMLAttribute('form', 'pic_upload'));
$textArea->add_attribute(new \html_library\HTMLAttribute('maxlength', 500));
$fieldset->add_child($textArea);
$textArea->add_child(new \html_library\HTMLTextNode($pictureDescription));
$fieldset->add_child(new \html_library\HTMLBrElement());
//gallery
$labelGallery = new \html_library\HTMLLabelElement();
$labelGallery->add_attribute(new \html_library\HTMLAttribute('for', 'gallery'));
$labelGallery->add_child(new \html_library\HTMLTextNode('Gallery: '));
$fieldset->add_child($labelGallery);
$selectGallery = new \html_library\HTMLSelectElement();
$selectGallery->add_attribute(new \html_library\HTMLAttribute('name', 'galleryOption'));
$galleries = DAO::getConnection()->getGalleriesByUserId($_SESSION['user_id']);
//napravi izbor korisnikovih galerija
foreach ($galleries as $galleryId => $gallery) {
    $option = new \html_library\HTMLOptionElement();
    $option->add_attribute(new \html_library\HTMLAttribute('value', $galleryId));
    $option->add_child(new \html_library\HTMLTextNode($gallery->getTitle()));
    if ($galleryId === $picture->getGalleryId()) {
        $option->add_attribute(new \html_library\HTMLAttribute('selected', 'selected'));
    }
    $selectGallery->add_child($option);
}
$fieldset->add_child($selectGallery);
$submitInput = new \html_library\HTMLInputElement();
$submitInput->add_attribute(new \html_library\HTMLAttribute('type', 'submit'));
Example #2
0
$galleries = \db\DAO::getConnection()->getGalleriesByUserId($_SESSION['user_id']);
//ako nema ni jednu galeriju dosad - nek ju napravi
if (empty($galleries)) {
    header('Location: new_gallery.php');
    exit;
}
//napravi izbor korisnikovih galerija
$options = new \html_library\HTMLCollection();
foreach ($galleries as $gallery) {
    $values = get_object_vars($gallery);
    $option = new \html_library\HTMLOptionElement();
    $option->add_attribute(new \html_library\HTMLAttribute('value', $values['ID']));
    $option->add_child(new \html_library\HTMLTextNode($values['title']));
    $options->add($option);
}
$input = new \html_library\HTMLSelectElement();
$input->add_attribute(new \html_library\HTMLAttribute('name', 'galleryOption'));
$input->add_children($options);
$fieldset->add_child($input);
$fieldset->add_child(new \html_library\HTMLBrElement());
//image tag textfield
$labelDescription = new \html_library\HTMLLabelElement();
$labelDescription->add_attribute(new \html_library\HTMLAttribute('for', 'tags'));
$labelDescription->add_child(new \html_library\HTMLTextNode('Tags (separated by space): '));
$fieldset->add_child($labelDescription);
$textArea = new \html_library\HTMLTextAreaElement();
$textArea->add_attribute(new \html_library\HTMLAttribute('name', 'img_tag'));
$textArea->add_attribute(new \html_library\HTMLAttribute('form', 'pic_upload'));
$textArea->add_attribute(new \html_library\HTMLAttribute('maxlength', 500));
$fieldset->add_child($textArea);
$fieldset->add_child(new \html_library\HTMLBrElement());