Exemplo n.º 1
0
}
if (!empty($_POST['submitted'])) {
    if (isset($_POST['btnDelete'])) {
        $gallery->delete();
        //TODO: Obrisati i slike iz te galerije
        \db\DAO::getConnection()->removeImagesInGallery($_GET['id']);
        header('Location: mygalleries.php');
        exit;
    }
    $formValidation = new \validation_library\FormValidation();
    $rules = array();
    $rules['title'] = 'required|length[100]';
    $rules['description'] = 'length[500]';
    $formValidation->set_rules($rules);
    if ($formValidation->validate()) {
        $gallery->__set('title', htmlentities($_POST['title']));
        $gallery->__set('description', htmlentities($_POST['description']));
        $gallery->save();
        header('Location: mypictures.php');
        exit;
    } else {
        $formValidation->display_validation_errors();
    }
}
//page rendering
$page = new html_library\HTMLHtmlElement();
$page->add_child(new html_library\HTMLHeadElement());
$body = new html_library\HTMLBodyElement();
$page->add_child($body);
$form = new \html_library\HTMLFormElement();
$body->add_child($form);