function render_options_form() { log_debug("journal_display", "Executing render_options_form()"); // if the user has not configured any default options, display the dropdown // link bar instead of the main options table. if (isset($_SESSION["form"][$this->journalname]["custom_options_active"])) { if ($_SESSION["user"]["shrink_tableoptions"] == "on") { print "<div id=\"" . $this->journalname . "_link\">"; print "<table width=\"100%\" class=\"table_options_dropdown\">"; print "<tr bgcolor=\"#666666\">"; print "<td width=\"100%\" onclick=\"obj_show('" . $this->journalname . "_form'); obj_hide('" . $this->journalname . "_link');\">"; print "<b style=\"color: #ffffff; text-decoration: none\">ADJUST JOURNAL OPTIONS >></b>"; print "</td>"; print "</tr>"; print "</table><br>"; print "</div>"; } } // border table / div object print "<div id=\"" . $this->journalname . "_form\">"; print "<table width=\"100%\" style=\"border: 1px solid #666666;\" bgcolor=\"#e7e7e7\"><tr><td>"; // start the form print "<form method=\"get\" class=\"form_standard\">"; $form = new form_input(); $form->formname = $this->journalname; $form->language = $this->language; // include page name $structure = NULL; $structure["fieldname"] = "page"; $structure["type"] = "hidden"; $structure["defaultvalue"] = $_GET["page"]; $form->add_input($structure); $form->render_field("page"); // include any other fixed options foreach (array_keys($this->option) as $fieldname) { $structure = NULL; $structure["fieldname"] = $fieldname; $structure["type"] = "hidden"; $structure["defaultvalue"] = $this->option[$fieldname]; $form->add_input($structure); $form->render_field($fieldname); } // flag this form as the journal_display_options form $structure = NULL; $structure["fieldname"] = "journal_display_options"; $structure["type"] = "hidden"; $structure["defaultvalue"] = $this->journalname; $form->add_input($structure); $form->render_field("journal_display_options"); print "<table width=\"100%\"><tr>"; /* Filter Options */ print "<td width=\"100%\" valign=\"top\" style=\"padding: 4px; background-color: #e7e7e7;\">"; print "<b>Filter/Search Options:</b><br><br>"; print "<table width=\"100%\">"; if ($this->filter) { foreach (array_keys($this->filter) as $fieldname) { if ($this->filter[$fieldname]["type"] == "dropdown") { $this->filter[$fieldname]["options"]["width"] = 150; } $form->add_input($this->filter[$fieldname]); $form->render_row($fieldname); } } print "</table>"; print "</td>"; // new row print "</tr>"; print "<tr>"; /* Order By Options print "<td width=\"100%\" colspan=\"4\" valign=\"top\" style=\"padding: 4px; background-color: #e7e7e7;\">"; print "<br><b>Order By:</b><br>"; // limit the number of order boxes to 4 $num_cols = count($columns_available); if ($num_cols > 4) $num_cols = 4; for ($i=0; $i < $num_cols; $i++) { // define dropdown $structure = NULL; $structure["fieldname"] = "order_$i"; $structure["type"] = "dropdown"; $structure["options"]["width"] = 150; if ($this->columns_order[$i]) $structure["defaultvalue"] = $this->columns_order[$i]; $structure["values"] = $columns_available; $form->add_input($structure); // display drop down $form->render_field($structure["fieldname"]); if ($i < ($num_cols - 1)) { print " then "; } } print "</td>"; */ /* Submit Row */ print "<tr>"; print "<td colspan=\"1\" valign=\"top\" style=\"padding: 4px; background-color: #e7e7e7;\">"; print "<table>"; print "<tr><td>"; // submit button $structure = NULL; $structure["fieldname"] = "submit"; $structure["type"] = "submit"; $structure["defaultvalue"] = "Apply Options"; $form->add_input($structure); $form->render_field("submit"); print "</form>"; print "</td>"; print "<td>"; /* Include a reset button - this reset button is an independent form which passes any required fixed options and also a reset option back to the page. The load_options_form function then detects this reset value and erases the session data for the options belonging to this table, resetting the options form to the original defaults. */ // start the form print "<form method=\"get\" class=\"form_standard\">"; $form = new form_input(); $form->formname = "reset"; $form->language = $this->language; // include page name $structure = NULL; $structure["fieldname"] = "page"; $structure["type"] = "hidden"; $structure["defaultvalue"] = $_GET["page"]; $form->add_input($structure); $form->render_field("page"); // include any other fixed options foreach (array_keys($this->option) as $fieldname) { $structure = NULL; $structure["fieldname"] = $fieldname; $structure["type"] = "hidden"; $structure["defaultvalue"] = $this->option[$fieldname]; $form->add_input($structure); $form->render_field($fieldname); } // flag as the reset form $structure = NULL; $structure["fieldname"] = "reset"; $structure["type"] = "hidden"; $structure["defaultvalue"] = "yes"; $form->add_input($structure); $form->render_field("reset"); $structure = NULL; $structure["fieldname"] = "submit"; $structure["type"] = "submit"; $structure["defaultvalue"] = "Reset Options"; $form->add_input($structure); $form->render_field("submit"); print "</form></td>"; print "</tr></table>"; print "</td>"; print "</tr>"; // end of structure table print "</table>"; // end of border table print "</td></tr></table><br>"; print "</div>"; // auto-hide options at startup if (!isset($_SESSION["form"][$this->journalname]["custom_options_active"])) { if ($_SESSION["user"]["shrink_tableoptions"] == "on") { print "<script type=\"text/javascript\">"; print "obj_hide('" . $this->journalname . "_form');"; print "</script>"; } } }
function render_options_form() { log_debug("table", "Executing render_options_form()"); // if the user has not configured any default options, display the dropdown // link bar instead of the main options table. if (!isset($_SESSION["form"][$this->tablename]["custom_options_active"])) { if (isset($_SESSION["user"]["shrink_tableoptions"]) && $_SESSION["user"]["shrink_tableoptions"] == "on") { print "<div id=\"" . $this->tablename . "_link\">"; print "<table class=\"table_options_dropdown\">"; print "<tr>"; print "<td onclick=\"obj_show('" . $this->tablename . "_form'); obj_hide('" . $this->tablename . "_link');\">"; print "ADJUST TABLE OPTIONS >>"; print "</td>"; print "</tr>"; print "</table><br>"; print "</div>"; } } // border table / div object print "<div id=\"" . $this->tablename . "_form\">"; print "<table class=\"table_options\"><tr><td>"; // create tmp array to prevent excessive use of array_keys $columns_available = array_keys($this->structure); // get labels for all the columns $labels = language_translate($this->language, $columns_available); // start the form print "<form method=\"get\" class=\"form_standard\">"; $form = new form_input(); $form->formname = $this->tablename; $form->language = $this->language; // include page name $structure = NULL; $structure["fieldname"] = "page"; $structure["type"] = "hidden"; $structure["defaultvalue"] = $_GET["page"]; $form->add_input($structure); $form->render_field("page"); // include any other fixed options foreach (array_keys($this->option) as $fieldname) { $structure = NULL; $structure["fieldname"] = $fieldname; $structure["type"] = "hidden"; $structure["defaultvalue"] = $this->option[$fieldname]; $form->add_input($structure); $form->render_field($fieldname); } // flag this form as the table_display_options form $structure = NULL; $structure["fieldname"] = "table_display_options"; $structure["type"] = "hidden"; $structure["defaultvalue"] = $this->tablename; $form->add_input($structure); $form->render_field("table_display_options"); /* Check box options */ // configure all the checkboxes $num_cols = count($columns_available); $num_cols_half = sprintf("%d", $num_cols / 2); for ($i = 0; $i < $num_cols; $i++) { $column = $columns_available[$i]; // define the checkbox $structure = NULL; $structure["fieldname"] = $column; $structure["type"] = "checkbox"; if (isset($this->structure[$column]["custom"]["label"])) { $structure["options"]["label"] = lang_trans($this->structure[$column]["custom"]["label"]); } if (in_array($column, $this->columns)) { $structure["defaultvalue"] = "on"; } $form->add_input($structure); // split the column options boxes into two different columns if ($i < $num_cols_half) { $column_a1[] = $column; } else { $column_a2[] = $column; } } // structure table print "<table width=\"100%\"><tr>"; print "<td width=\"50%\" valign=\"top\" style=\"padding: 4px;\">"; print "<b>Fields to display:</b><br><br>"; print "<table width=\"100%\">"; print "<td width=\"50%\" valign=\"top\">"; // display the checkbox(s) foreach ($column_a1 as $column) { $form->render_field($column); print "<br>"; } print "</td>"; print "<td width=\"50%\" valign=\"top\">"; // display the checkbox(s) foreach ($column_a2 as $column) { $form->render_field($column); print "<br>"; } print "</td>"; print "</table>"; print "</td>"; /* Filter Options */ print "<td width=\"50%\" valign=\"top\" style=\"padding: 4px;\">"; print "<b>Filter/Search Options:</b><br><br>"; print "<table width=\"100%\">"; if ($this->filter) { foreach (array_keys($this->filter) as $fieldname) { if ($this->filter[$fieldname]["type"] == "dropdown") { $this->filter[$fieldname]["options"]["width"] = 300; } $form->add_input($this->filter[$fieldname]); $form->render_row($fieldname); } } print "</table>"; print "</td>"; // new row print "</tr>"; print "<tr>"; /* Order By Options */ if ($this->columns_order_options) { print "<td width=\"100%\" colspan=\"4\" valign=\"top\" style=\"padding: 4px;\">"; print "<br><b>Order By:</b><br>"; // limit the number of order boxes to 4 $num_cols = count($this->columns_order_options); if ($num_cols > 4) { $num_cols = 4; } for ($i = 0; $i < $num_cols; $i++) { // define dropdown $structure = NULL; $structure["fieldname"] = "order_{$i}"; $structure["type"] = "dropdown"; $structure["options"]["width"] = 150; if (isset($this->columns_order[$i])) { $structure["defaultvalue"] = $this->columns_order[$i]; } $structure["values"] = $this->columns_order_options; $form->add_input($structure); // display drop down $form->render_field($structure["fieldname"]); if ($i < $num_cols - 1) { print " then "; } } print "</td>"; } /* Submit Row */ print "<tr>"; print "<td colspan=\"4\" valign=\"top\" style=\"padding: 4px;\">"; print "<table>"; print "<tr><td>"; // submit button $structure = NULL; $structure["fieldname"] = "submit"; $structure["type"] = "submit"; $structure["defaultvalue"] = "Apply Options"; $form->add_input($structure); $form->render_field("submit"); print "</form>"; print "</td>"; print "<td>"; /* Include a reset button - this reset button is an independent form which passes any required fixed options and also a reset option back to the page. The load_options_form function then detects this reset value and erases the session data for the options belonging to this table, resetting the options form to the original defaults. */ // start the form print "<form method=\"get\" class=\"form_standard\">"; $form = new form_input(); $form->formname = "reset"; $form->language = $this->language; // include page name $structure = NULL; $structure["fieldname"] = "page"; $structure["type"] = "hidden"; $structure["defaultvalue"] = $_GET["page"]; $form->add_input($structure); $form->render_field("page"); // include any other fixed options foreach (array_keys($this->option) as $fieldname) { $structure = NULL; $structure["fieldname"] = $fieldname; $structure["type"] = "hidden"; $structure["defaultvalue"] = $this->option[$fieldname]; $form->add_input($structure); $form->render_field($fieldname); } // flag as the reset form $structure = NULL; $structure["fieldname"] = "reset"; $structure["type"] = "hidden"; $structure["defaultvalue"] = "yes"; $form->add_input($structure); $form->render_field("reset"); $structure = NULL; $structure["fieldname"] = "submit"; $structure["type"] = "submit"; $structure["defaultvalue"] = "Reset Options"; $form->add_input($structure); $form->render_field("submit"); print "</form></td>"; print "</tr></table>"; print "</td>"; print "</tr>"; // end of structure table print "</table>"; // end of border table print "</td></tr></table><br>"; print "</div>"; // auto-hide options at startup if (!isset($_SESSION["form"][$this->tablename]["custom_options_active"])) { if (isset($_SESSION["user"]["shrink_tableoptions"]) && $_SESSION["user"]["shrink_tableoptions"] == "on") { print "<script type=\"text/javascript\">"; print "obj_hide('" . $this->tablename . "_form');"; print "</script>"; } } }