summaryrefslogtreecommitdiff
path: root/modules/gallery/views/form.html.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-05-28 06:07:27 +0800
committerGallery Role Account <gallery@menalto.com>2009-05-28 11:07:06 +0800
commitb245e3475f66c94afb94f8b2287bf0185a343732 (patch)
treea34b000f90311a42cc689af1785bb0586a334de8 /modules/gallery/views/form.html.php
parentb7a193cc19c7ac3ec67fa297b574fcd6caefe617 (diff)
Restructure things so that the application is now just another module.
Kohana makes this type of transition fairly straightforward in that all controllers/helpers/etc are still located in the cascading filesystem without any extra effort, except that I've temporarily added a hack to force modules/gallery into the module path. Rename what's left of "core" to be "application" so that it conforms more closely to the Kohana standard (basically, just application/config/config.php which is the minimal thing that you need in the application directory) There's still considerable work left to be done here. Signed-off-by: Gallery Role Account <gallery@menalto.com>
Diffstat (limited to 'modules/gallery/views/form.html.php')
-rw-r--r--modules/gallery/views/form.html.php75
1 files changed, 75 insertions, 0 deletions
diff --git a/modules/gallery/views/form.html.php b/modules/gallery/views/form.html.php
new file mode 100644
index 00000000..ec2a56a9
--- /dev/null
+++ b/modules/gallery/views/form.html.php
@@ -0,0 +1,75 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<?
+print($open);
+
+// Not sure what to do with these, but at least show that we received them.
+if ($class) {
+ print "<!-- unused class in form.html.php: $class -->";
+}
+if ($title) {
+ print $title;
+}
+
+if (!function_exists("DrawForm")) {
+ function DrawForm($inputs, $level=1) {
+ $error_messages = array();
+ $prefix = str_repeat(" ", $level);
+ $haveGroup = false;
+ // On the first level, make sure we have a group if not add the <ul> tag now
+ if ($level == 1) {
+ foreach ($inputs as $input) {
+ $haveGroup |= $input->type == 'group';
+ }
+ if (!$haveGroup) {
+ print "$prefix<ul>\n";
+ }
+ }
+
+ foreach ($inputs as $input) {
+ if ($input->type == 'group') {
+ print "$prefix<fieldset>\n";
+ print "$prefix <legend>{$input->label}</legend>\n";
+ print "$prefix <ul>\n";
+
+ DrawForm($input->inputs, $level + 2);
+ print "$prefix </ul>\n";
+
+ // Since hidden fields can only have name and value attributes lets just render it now
+ $hidden_prefix = "$prefix ";
+ foreach ($input->hidden as $hidden) {
+ print "$prefix {$hidden->render()}\n";
+ }
+ print "$prefix</fieldset>\n";
+ } else {
+ if ($input->error_messages()) {
+ print "$prefix<li class=\"gError\">\n";
+ } else {
+ print "$prefix<li>\n";
+ }
+
+ if ($input->label()) {
+ print "$prefix {$input->label()}\n";
+ }
+ print "$prefix {$input->render()}\n";
+ if ($input->message()) {
+ print "$prefix <p>{$input->message()}</p>\n";
+ }
+ if ($input->error_messages()) {
+ foreach ($input->error_messages() as $error_message) {
+ print "$prefix <p class=\"gError\">\n";
+ print "$prefix $error_message\n";
+ print "$prefix </p>\n";
+ }
+ }
+ print "$prefix</li>\n";
+ }
+ }
+ if ($level == 1 && !$haveGroup) {
+ print "$prefix</ul>\n";
+ }
+ }
+}
+DrawForm($inputs);
+
+print($close);
+?>