<? endif; ?> <? if ($editable): ?> <div class='page_edit' <? if (empty($action) || $action != 'new'): ?>style="display:none;"<? endif; ?>> <input type="button" name="submit" class='button' onclick="lightning.page.save()" value="Save" /><br /> <? if (!empty($action) && $action == 'new'): ?> <input type="hidden" name="action" id='page_action' value="submit_new" class="button" /> <? else: ?> <input type="hidden" name="action" id='page_action' value="update_page" class="button" /> <? endif; ?> <input type="hidden" name="page_id" id='page_id' value="<?php echo !empty($full_page['page_id']) ? $full_page['page_id'] : 0; ?> " /> <?php echo \Lightning\Tools\Form::renderTokenInput(); ?> <table border='0' width="100%"> <tr><td>Title:</td><td><input type="text" name="title" id='page_title' value="<?php echo $full_page['title']; ?> " /></td></tr> <tr><td>URL:</td><td><input type="text" name="url" id='page_url' value="<?php echo $full_page['url']; ?> " /></td></tr> <tr><td>Description:</td><td><input type="text" name="description" id='page_description' value="<?php echo $full_page['description']; ?> " /></td></tr> <tr><td>Keywords:</td><td><input type="text" name="keywords" id='page_keywords' value="<?php
</table> <input type="hidden" name="action" value="reset" /> <input type="hidden" name="redirect" value="<?php echo !empty($redirect) ? $redirect : ''; ?> " /> <input type="submit" name="submit" value="Reset" class="button" /> </form> </fieldset> <? endif; ?> <? if (!empty($action) && $action == "set_password"): ?> <fieldset> <legend>Set your new password:</legend> <form action="/user" method="post" class="validate"> <?php echo Form::renderTokenInput(); ?> <table class="small-12"> <tr><td>New Password:</td><td><input type='password' name='password' id='password' class="required" /></td></tr> <tr><td>Confirm Password:</td><td><input type='password' name='password2' class="required" /></td></tr> </table> <input type="hidden" name="key" value="<?php echo $key; ?> " /> <input type="hidden" name="action" value="set_password" /> <input type="submit" name="submit" value="Set Password" class="button" /> </form> </fieldset> <? endif; ?>
/** * Build the contact form. */ public function get() { Form::requiresToken(); }
/** * Render the entire edit/create form. * * @param boolean $return * Whether to return the ouptut or send it to the user. * * @return null|string * The fully rendered HTML content. */ function render_form($return = false) { if (isset($this->custom_templates[$this->action . '_item'])) { $template = $this->load_template($this->custom_template_directory . $this->custom_templates[$this->action . '_item']); foreach ($this->fields as $field) { switch ($this->which_field($field)) { case 'edit': $template = str_replace('{' . $field['field'] . '}', $this->renderEditField($field, $this->list), $template); break; case 'display': $template = str_replace('{' . $field['field'] . '}', $this->print_field_value($field, $this->list), $template); break; case false: $template = str_replace('{' . $field['field'] . '}', '', $template); } } $template = $this->template_item_vars($template, $this->id); if ($return) { return $template; } else { echo $template; } } else { // show form if ($this->action == "view") { } if ($this->action == "new") { $new_action = "insert"; } else { $new_action = "update"; } if ($this->action != "view") { $multipart_header = $this->hasUploadfield() ? "enctype='multipart/form-data'" : ''; echo "<form action='" . $this->createUrl() . "' id='form_{$this->table}' method='POST' {$multipart_header}><input type='hidden' name='action' id='action' value='{$new_action}' />"; echo Form::renderTokenInput(); if ($return = Request::get('return', 'urlencoded')) { echo Hidden::render('table_return', $return); } } // use the ID if we are editing a current one if ($this->action == "edit") { echo '<input type="hidden" name="id" id="id" value="' . $this->id . '" />'; } if ($this->action == "view" && !$this->readOnly) { if ($this->editable !== false) { echo "<a href='" . $this->createUrl('edit', $this->id) . "'><img src='/images/lightning/edit.png' border='0' /></a>"; } if ($this->deleteable !== false) { echo "<a href='" . $this->createUrl('delete', $this->id) . "'><img src='/images/lightning/remove.png' border='0' /></a>"; } } $style = !empty($this->styles['form_table']) ? "style='{$this->styles['form_table']}'" : ''; echo "<table class='table_form_table' {$style}>"; unset($style); if (is_array($this->field_order)) { foreach ($this->field_order as $f) { echo $this->render_form_row($this->fields[$f], $this->list); } } else { foreach ($this->fields as $f => $field) { echo $this->render_form_row($this->fields[$f], $this->list); } } $this->render_form_linked_tables(); // Render all submission buttons $this->renderButtons($new_action); } }