$li3 = new \html_library\HTMLLiElement(); $ul->add_child($li1); $ul->add_child($li2); $ul->add_child($li3); //username $labelUsername = new \html_library\HTMLLabelElement(); $labelUsername->add_attribute(new \html_library\HTMLAttribute('for', 'username')); $labelUsername->add_child(new \html_library\HTMLTextNode('Username')); $inputUsername = new \html_library\HTMLInputElement(); $inputUsername->add_attribute(new \html_library\HTMLAttribute('type', 'text')); $inputUsername->add_attribute(new \html_library\HTMLAttribute('name', 'username')); $inputUsername->add_attribute(new \html_library\HTMLAttribute('required', null)); $li1->add_child($labelUsername); $li1->add_child($inputUsername); //password $labelPassword = new \html_library\HTMLLabelElement(); $labelPassword->add_attribute(new \html_library\HTMLAttribute('for', 'password')); $labelPassword->add_child(new \html_library\HTMLTextNode('Password')); $inputPassword = new \html_library\HTMLInputElement(); $inputPassword->add_attribute(new \html_library\HTMLAttribute('type', 'password')); $inputPassword->add_attribute(new \html_library\HTMLAttribute('name', 'password')); $inputPassword->add_attribute(new \html_library\HTMLAttribute('placeholder', 'password')); $inputPassword->add_attribute(new \html_library\HTMLAttribute('required', null)); $li2->add_child($labelPassword); $li2->add_child($inputPassword); $inputSubmit = new \html_library\HTMLInputElement(); $inputSubmit->add_attribute(new \html_library\HTMLAttribute('type', 'submit')); $inputSubmit->add_attribute(new \html_library\HTMLAttribute('value', 'Login')); $li3->add_child($inputSubmit); $homePageLink = new \html_library\HTMLAElement(); $homePageLink->add_attribute(new \html_library\HTMLAttribute('href', 'index.php'));
//title $labelTitle = new \html_library\HTMLLabelElement(); $labelTitle->add_attribute(new \html_library\HTMLAttribute('for', 'name')); $labelTitle->add_child(new \html_library\HTMLTextNode('Title*: ')); $fieldset->add_child($labelTitle); $inputTitle = new \html_library\HTMLInputElement(); $inputTitle->add_attribute(new \html_library\HTMLAttribute('type', 'text')); $inputTitle->add_attribute(new \html_library\HTMLAttribute('name', 'name')); $inputTitle->add_attribute(new \html_library\HTMLAttribute('id', 'name')); $inputTitle->add_attribute(new \html_library\HTMLAttribute('maxlength', 100)); $inputTitle->add_attribute(new \html_library\HTMLAttribute('placeholder', 'Name of your gallery')); $inputTitle->add_attribute(new \html_library\HTMLAttribute('required', null)); $fieldset->add_child($inputTitle); $fieldset->add_child(new \html_library\HTMLBrElement()); //description $labelDescription = new \html_library\HTMLLabelElement(); $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', 'new_gallery')); $textArea->add_attribute(new \html_library\HTMLAttribute('maxlength', 500)); $fieldset->add_child($textArea); $fieldset->add_child(new \html_library\HTMLBrElement()); //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);
$body = new html_library\HTMLBodyElement(); $page->add_child($body); $form = new \html_library\HTMLFormElement(); $body->add_child($form); $form->add_attribute(new \html_library\HTMLAttribute('name', 'search')); $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')); $input = new html_library\HTMLInputElement(); $input->add_attribute(new \html_library\HTMLAttribute('type', 'hidden')); $input->add_attribute(new \html_library\HTMLAttribute('name', 'submitted')); $input->add_attribute(new \html_library\HTMLAttribute('id', 'submitted')); $input->add_attribute(new \html_library\HTMLAttribute('value', '1')); $form->add_child($input); //search tags $labelTags = new \html_library\HTMLLabelElement(); $labelTags->add_attribute(new \html_library\HTMLAttribute('for', 'tags')); $labelTags->add_child(new \html_library\HTMLTextNode('Tags to search image for')); $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'));
$fieldset->add_child($inputTitle); $fieldset->add_child(new \html_library\HTMLBrElement()); //description $labelDescription = new \html_library\HTMLLabelElement(); $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);
//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()); //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);
$fieldset->add_child(new \html_library\HTMLBrElement()); //password $labelPassword = new \html_library\HTMLLabelElement(); $labelPassword->add_attribute(new \html_library\HTMLAttribute('for', 'password')); $labelPassword->add_child(new \html_library\HTMLTextNode('Password*: ')); $fieldset->add_child($labelPassword); $inputPassword = new \html_library\HTMLInputElement(); $inputPassword->add_attribute(new \html_library\HTMLAttribute('type', 'password')); $inputPassword->add_attribute(new \html_library\HTMLAttribute('name', 'password')); $inputPassword->add_attribute(new \html_library\HTMLAttribute('id', 'password')); $inputPassword->add_attribute(new \html_library\HTMLAttribute('maxlength', 50)); $inputPassword->add_attribute(new \html_library\HTMLAttribute('required', null)); $fieldset->add_child($inputPassword); $fieldset->add_child(new \html_library\HTMLBrElement()); //confirm password $labelConfirmPassword = new \html_library\HTMLLabelElement(); $labelConfirmPassword->add_attribute(new \html_library\HTMLAttribute('for', 'password')); $labelConfirmPassword->add_child(new \html_library\HTMLTextNode('Confirm password*: ')); $fieldset->add_child($labelConfirmPassword); $inputConfirmPassword = new \html_library\HTMLInputElement(); $inputConfirmPassword->add_attribute(new \html_library\HTMLAttribute('type', 'password')); $inputConfirmPassword->add_attribute(new \html_library\HTMLAttribute('name', 'confirm_password')); $inputConfirmPassword->add_attribute(new \html_library\HTMLAttribute('id', 'confirm_password')); $inputConfirmPassword->add_attribute(new \html_library\HTMLAttribute('maxlength', 50)); $inputConfirmPassword->add_attribute(new \html_library\HTMLAttribute('required', null)); $fieldset->add_child($inputConfirmPassword); $fieldset->add_child(new \html_library\HTMLBrElement()); //submit $inputSubmit = new \html_library\HTMLInputElement(); $inputSubmit->add_attribute(new \html_library\HTMLAttribute('type', 'submit')); $inputSubmit->add_attribute(new \html_library\HTMLAttribute('name', 'Submit'));