Ejemplo n.º 1
0
<?php

require_once "Forus.php";
$ID = isset($ID) ? $ID : 1;
$s = newObject("post", $p_id);
$foro_id = isset($foro_id) ? $foro_id : 1;
$p = newObject("post", $ID);
$leido = isset($leido) ? $leido : 1;
$a = newObject("post", $leido);
$p->title = $s->title;
$p->user = BILO_username();
if ($p->title != "") {
    $p->resp = "readonly=\"true\"";
}
$p->p_id = isset($p_id) ? $p_id : 0;
$p->foro_id = $foro_id;
formAction("action_save.php?ID={$ID}&foro_id={$p->foro_id}&leido=", "footer", "editForm");
$p->boton0 = gfxBotonAction("Guardar", "getElementById('editForm').submit()", True);
plantHTML($p, "post");
formClose();
?>

Ejemplo n.º 2
0
 public function build()
 {
     $HTML = NULL;
     $hide = FALSE;
     $option = FALSE;
     foreach ($this->columns as $column) {
         if (!in_array($column["Field"], $this->hide)) {
             if (count($this->hide) > 0) {
                 if ($this->hideString and !$hide) {
                     $attributes = array("type" => "hidden", "name" => "_hide", "value" => base64_encode($this->hideString));
                     $HTML .= formInput($attributes);
                     unset($attributes);
                     $hide = TRUE;
                 }
             }
             if ($this->type($column["Type"]) === "string") {
                 $attributes = array("type" => "text", "name" => $column["Field"], "class" => "input", "field" => $this->rename($column["Field"]), "p" => TRUE, "value" => !$this->success ? recoverPOST($column["Field"]) : NULL);
                 if (isset($this->options)) {
                     if (!$option) {
                         $HTML .= formInput(array("type" => "hidden", "name" => "_options", "value" => base64_encode(serialize($this->options))));
                         $option = TRUE;
                     }
                     if (isset($this->options[$column["Field"]])) {
                         if ($this->options[$column["Field"]]["type"] === "select") {
                             $attrs = array("name" => $column["Field"], "class" => "select", "field" => $this->rename($column["Field"]), "p" => TRUE);
                             $HTML .= formSelect($attrs, $this->options[$column["Field"]]["options"]);
                             unset($attrs);
                         } elseif ($this->options[$column["Field"]]["type"] === "radio") {
                             $attrs = array("name" => $column["Field"], "class" => "radio", "field" => $this->rename($column["Field"]), "p" => TRUE);
                             $HTML .= formRadio($attrs, $this->options[$column["Field"]]["options"]);
                             unset($attrs);
                         } elseif ($this->options[$column["Field"]]["type"] === "password") {
                             $attrs = array("name" => $column["Field"], "type" => "password", "class" => "input", "field" => $this->rename($column["Field"]), "p" => TRUE);
                             $HTML .= formInput($attrs);
                             unset($attrs);
                         } elseif ($this->options[$column["Field"]]["type"] === "hidden") {
                             $attrs = array("name" => $column["Field"], "type" => "hidden", "value" => isset($this->options[$column["Field"]]["value"]) ? $this->options[$column["Field"]]["value"] : NULL);
                             $HTML .= formInput($attrs);
                             unset($attrs);
                         }
                     } else {
                         $HTML .= formInput($attributes);
                     }
                 } else {
                     $HTML .= formInput($attributes);
                 }
                 unset($attributes);
             } elseif ($this->type($column["Type"]) === "text") {
                 $attributes = array("name" => $column["Field"], "class" => "editor textarea", "field" => $this->rename($column["Field"]), "p" => TRUE, "value" => !$this->success ? recoverPOST($column["Field"]) : NULL);
                 $HTML .= formTextarea($attributes);
             }
         }
     }
     $HTML .= p(TRUE, "center");
     $attributes = array("type" => "submit", "name" => "save", "value" => __("Save"), "class" => "submit");
     $HTML .= formInput($attributes);
     unset($attributes);
     $attributes = array("type" => "submit", "name" => "cancel", "value" => __("Cancel"), "class" => "submit");
     $HTML .= formInput($attributes);
     unset($attributes);
     $HTML .= p(FALSE);
     $HTML .= formClose();
     return $HTML;
 }
Ejemplo n.º 3
0
$position = isset($data) ? recoverPOST("position", $data[0]["Position"]) : recoverPOST("position");
$code = isset($data) ? recoverPOST("code", $data[0]["Code"]) : recoverPOST("code");
$time = isset($data) ? recoverPOST("time", $data[0]["Time"]) : recoverPOST("time");
$situation = isset($data) ? recoverPOST("situation", $data[0]["Situation"]) : recoverPOST("situation");
$principal = isset($data) ? recoverPOST("principal", $data[0]["Principal"]) : recoverPOST("principal");
$edit = isset($data) ? TRUE : FALSE;
$action = isset($data) ? "edit" : "save";
$href = isset($data) ? path(whichApplication() . "cpanel/{$action}/{$ID}/") : path(whichApplication() . "cpanel/add/");
print div("add-form", "class");
print formOpen($href, "form-add", "form-add");
print p(__(_(ucfirst(whichApplication()))), "resalt");
print isset($alert) ? $alert : NULL;
print formInput(array("name" => "title", "class" => "span10 required", "field" => __(_("Title")), "p" => TRUE, "value" => $title));
if (isset($banner)) {
    print __(_("If you change the banner image, this image will be deleted")) . "<br />";
    print img(path($banner, TRUE), array("alt" => "Banner", "class" => "no-border", "style" => "max-width: 780px;"));
    print formInput(array("name" => "banner", "type" => "hidden", "value" => $banner));
}
print formInput(array("type" => "file", "name" => "image", "class" => "required", "field" => __(_("Image")), "p" => TRUE));
$options = array(0 => array("value" => "Top", "option" => __(_("Top")) . " (960x100px)", "selected" => $position === "Top" ? TRUE : FALSE), 1 => array("value" => "Left", "option" => __(_("Left")) . " (120x600px, 250x250px)", "selected" => $position === "Left" ? TRUE : FALSE), 2 => array("value" => "Right", "option" => __(_("Right")) . " (120x600px, 250x250px)", "selected" => $position === "Right" ? TRUE : FALSE), 3 => array("value" => "Bottom", "option" => __(_("Bottom")) . " (960x100px)", "selected" => $position === "Bottom" ? TRUE : FALSE), 4 => array("value" => "Center", "option" => __(_("Center")) . " (600x100px)", "selected" => $position === "Center" ? TRUE : FALSE));
print formSelect(array("name" => "position", "class" => "required", "p" => TRUE, "field" => __(_("Position"))), $options);
print formInput(array("name" => "URL", "class" => "span10 required", "field" => __(_("URL")), "p" => TRUE, "value" => $URL));
print formTextarea(array("name" => "code", "class" => "span10 required", "style" => "height: 150px;", "field" => __(_("Code")), "p" => TRUE, "value" => $code));
$options = array(0 => array("value" => 1, "option" => __(_("Yes")), "selected" => (int) $principal === 1 ? TRUE : FALSE), 1 => array("value" => 0, "option" => __(_("No")), "selected" => (int) $principal === 0 ? TRUE : FALSE));
print formSelect(array("name" => "principal", "class" => "required", "p" => TRUE, "field" => __(_("Principal"))), $options);
$options = array(0 => array("value" => "Active", "option" => __(_("Active")), "selected" => $situation === "Active" ? TRUE : FALSE), 1 => array("value" => "Inactive", "option" => __(_("Inactive")), "selected" => $situation === "Inactive" ? TRUE : FALSE));
print formSelect(array("name" => "situation", "class" => "required", "p" => TRUE, "field" => __(_("Situation"))), $options);
print formSave($action);
print formInput(array("name" => "ID", "type" => "hidden", "value" => $ID));
print formClose();
print div(FALSE);
Ejemplo n.º 4
0
function eavCreateForm($form_id, array $attributes, $action = '')
{
    // Print form javascript to View object
    print eavCreateFormValidationJS($form_id, $attributes);
    if (empty($action)) {
        $action = uriFull();
    }
    // Print open tag
    print formOpen($action, array('id' => $form_id, 'class' => '-i-form', 'method' => 'POST'));
    // Print form fields
    foreach ($attributes as $field) {
        // Create form field
        if ($field->backend_object != null) {
            // Parse helper name and function name
            $field_helper = explode('/', $field->backend_object, 2);
            if (isset($field_helper[0]) and isset($field_helper[1])) {
                // Load required helper
                Helper::load($field_helper[0]);
                if (function_exists($field_helper[1])) {
                    // And execute the function
                    print call_user_func($field_helper[1], $field);
                }
            }
        }
    }
    // Print submit
    print formSubmit(array('class' => '-b-button', 'name' => 'submit', 'value' => __('Save')));
    // Close form
    print formClose();
}