1
0
This repository has been archived on 2021-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
gallery3-contrib/3.0/modules/auto_date/controllers/admin_auto_date.php
Mike Miller 0fc6a6ba01 New module to automatically tag items without EXIF information with a
capture date based on the filename (using a user specified template).
2013-02-18 12:48:45 +02:00

46 lines
1.4 KiB
PHP

<?php defined("SYSPATH") or die("No direct script access.") ?><?php
class Admin_Auto_Date_Controller extends Admin_Controller {
public function index() {
$form = $this->_get_form();
if (request::method() == "post") {
access::verify_csrf();
if ($form->validate()) {
module::set_var("auto_date", "template", $_POST['template']);
message::success(t("Settings have been saved"));
url::redirect("admin/auto_date");
} else {
message::error(t("There was a problem with the submitted form. Please check your values and try again."));
}
}
print $this->_get_view();
}
private function _get_view($form = null) {
$v = new Admin_View("admin.html");
$v->page_title = t("Gallery 3 :: Set Template for unknown items");
$v->content = new View("admin_auto_date.html");
$v->content->form = empty($form) ? $this->_get_form() : $form;
return $v;
}
private function _get_form() {
$form = new Forge("admin/auto_date", "", "post", array("id" => "g-admin-auto_date-form"));
$group = $form->group("auto_date")->label(t("Default filename convention(php's <a href=\"http://php.net/manual/en/function.strptime.php\">strptime() format</a>)"));
$group->input("template")
->id("template")
->label(t("Template:"))
->value(module::get_var("auto_date", "template"));
$form->submit("submit")->value(t("Save"));
return $form;
}
}