$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()); //gallery $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('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')); $submitInput->add_attribute(new \html_library\HTMLAttribute('name', 'btnSubmit')); $submitInput->add_attribute(new \html_library\HTMLAttribute('value', 'Save changes')); $fieldset->add_child($submitInput); $deleteInput = new \html_library\HTMLInputElement(); $deleteInput->add_attribute(new \html_library\HTMLAttribute('type', 'submit'));
$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); $fieldset->add_child(new \html_library\HTMLBrElement()); //gallery $galleries = 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 $key => $value) { $option = new \html_library\HTMLOptionElement(); $option->add_attribute(new \html_library\HTMLAttribute('value', $key)); $option->add_child(new \html_library\HTMLTextNode($value->getTitle())); $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); //submit $inputSubmit = new \html_library\HTMLInputElement(); $inputSubmit->add_attribute(new \html_library\HTMLAttribute('type', 'submit')); $inputSubmit->add_attribute(new \html_library\HTMLAttribute('name', 'Submit')); $inputSubmit->add_attribute(new \html_library\HTMLAttribute('value', 'Submit')); $fieldset->add_child($inputSubmit); $link1 = new html_library\HTMLAElement();