/** * Draw the Category Overview */ function draw() { $categories = createNameValueArrayEx("categories", "CATEGORY_NAME", "CATEGORY_ID", "PARENT_CATEGORY_ID=" . $this->parentCat, "order by CATEGORY_NAME"); if (count($categories) > 0) { Container::draw(); echo '<tr><td colspan="' . $this->columns . '">'; echo '<table width="100%" cellpadding="0" cellspacing="0" border="0">'; $style = ' style="border-bottom:1px solid #cccccc;cursor:pointer;padding-top:2px; padding-bottom:2px;" '; for ($i = 0; $i < count($categories); $i++) { echo "<tr class=\"grid\" onMouseOver='this.style.backgroundColor=\"#ffffcc\";' onMouseOut='this.style.backgroundColor=\"#e8eef7\";' onClick='document.location.href=\"" . $this->editAction . $categories[$i][1] . "\";'>"; echo "<td {$style}> " . $categories[$i][0] . '</td>'; echo "</tr>"; } echo '</table>'; echo '</td></tr>'; } return $this->columns; }
function draw() { echo $this->prepareErrorstring(); echo "<br>"; Container::draw(); }
/** * draw the form for creating new items. * May be overwritten if standard Display should not be used! */ function draw_new() { global $db, $lang, $go, $oid, $newitem, $errors, $page_action; $newitem = value("newitem"); $oid = value("oid", "NUMERIC"); $go = value("go", "NOSPACES"); //needed for uniqueness checks. $page_action = "INSERT"; $go = "UPDATE"; $container = new Container(4); $container->add(new Label("lbl", $lang->get("selectobject"), "informationheader", 3)); $container->add(new Cell("clc", "cwhite", 1, 20,10)); $container->add(new Cell("clc", "cwhite", 1, 150,10)); $container->add(new Cell("clc", "cwhite", 1, 350,10)); // what data should be displayed // check if item is selected. $stdStyle = "standardlight"; if ($this->state == creating && $newitem == "0") { $errors .= "-MANDATORY"; $stdStyle = "error"; $container->add(new Label("lbl", $lang->get("selectone"), "error", 3)); } $sql = "SELECT " . $this->new_pkname . ", " . $this->new_name . ", " . $this->new_description . " FROM " . $this->new_table . " ORDER BY " . $this->new_name; $query = new query($db, $sql); while ($query->getrow()) { $pk = $query->field($this->new_pkname); $checked = false; if (value("newitem", "NUMERIC") == $pk) $checked = true; $container->add(new Radio("newitem", $pk, $stdStyle, $checked)); $container->add(new Label("name", $query->field($this->new_name), "standard", 2)); $container->add(new Cell("clc", "standard", 1)); $container->add(new Label("desc", $query->field($this->new_description), "description", 2)); } $nameinput = new TextInput($lang->get("name"), $this->item_table, $this->item_name, "1", "type:text,size:32,width:200", "UNIQUE&MANDATORY"); $nameinput->setFilter($this->item_parentKeyName . " = $oid"); $positioninput = new TextInput($lang->get("position"), $this->item_table, "POSITION", "1", "type:text,size:3,width:30", "MANDATORY", "NUMBER"); if ($this->state == "creating") { $nameinput->check(); $positioninput->check(); } $container->add(new Cell("cll", "standard", 3, 10, 10)); $container->add(new Cell("cll", $nameinput->std_style, 1, 10, 1)); $container->add($nameinput); $container->add(new Cell("cll", $positioninput->std_style, 1, 10, 1)); $container->add($positioninput); // drawing. echo drawSpacer(1,1)."</td><td>".drawSpacer(1,1)."</td></tr>"; // cleanup the shit. echo "<tr><td colspan=\"2\"><br>"; echo '<table width="100%" cellpadding="0" cellspacing="0" border="0">'; $container->draw(); echo '</table>'; echo '</td></tr>'; echo '<tr><td colspan="2" align="right">'; echo '<br/>'; $resetbutton = new Button("reset", $lang->get("reset"), "navelement", "reset"); $resetbutton->draw(); echo drawSpacer(50,1); $backbutton = new Button("back", $lang->get("back"), "navelement", "submit"); $backbutton->draw(); echo ' '; $submitbutton = new Button("neu", $lang->get("create"), "navelement", "submit"); $submitbutton->draw(); retain("oid", $oid); retain("action", "editobject"); }