function process() { global $page_action; if ($page_action == "INSERT") { for ($i = 1; $i < 18; $i++) { addInsert($this->table, "quantity" . $i, $this->values[$i][0], "TEXT"); addInsert($this->table, "ingredient" . $i, $this->values[$i][1], "TEXT"); } } if ($page_action == "UPDATE") { for ($i = 1; $i < 18; $i++) { addUpdate($this->table, "quantity" . $i, $this->values[$i][0], $this->cond, "TEXT"); addUpdate($this->table, "ingredient" . $i, $this->values[$i][1], $this->cond, "TEXT"); } } }
/** * Checks, wheter a page is actually in INSERT or UPDATE mode an creates the corresponding * Saveset. */ function process() { global $page_action; $this->posFilter = str_replace("<chcat>", "CHID = " . getvar("chsel"), $this->posFilter); $pos = getDBCell($this->table, $this->column, $this->posFilter . " AND " . $this->column . "=" . $this->value); if ($pos != "") { freeRowPosition($this->table, $this->column, $this->value, $this->posFilter); } if ($page_action == "INSERT") { addInsert($this->table, $this->column, $this->value, $this->datatype); } else { if ($page_action == "UPDATE") { addUpdate($this->table, $this->column, $this->value, $this->row_identifier, $this->datatype); } } }
/** * generates and executes the Insert-Statement towards the database. */ function execute() { global $db, $errors, $temp_oid, $form; if ($this->pkval == "") { $nextId = nextGUID(); $temp_oid = $nextId; $keys = "($this->pk"; $vals = "($nextId"; $commaflag = true; } else { addInsert($this->table, $this->pk, $this->pkval, $this->pkdatatype); $keys = "("; $vals = "("; $commaflag = false; } $str = "INSERT INTO $this->table "; for ($i = 0; $i < $this->counter; $i++) { if ($commaflag) { $keys .= ", "; $vals .= ", "; } $keys .= $this->columns[$i]; $vals .= $this->values[$i]; $commaflag = true; } $str .= $keys . ") VALUES " . $vals . ")"; global $debug; if ($debug == true) echo "SQL: $str <br>"; $query = new query($db, $str); if (trim($db->error()) != "0:") $errors .= "-DBInsert"; return $nextId; }
/** * Standard Constructor * * @param string Name to display on top. * @param string Table where the FK is saved in * @param string Column where the FK id saved in to reference the plugin. * @param string Where-Clause to select a FK * @param string Name of the plugin. * @param string A reference to the form ýou are using. * @param boolean show preview of the plugin. * @param string style of the control. */ function PluginInput($label, $table, $column, $cond, $pgnname, & $form, $showpreview=false, $style="standard") { global $page_state, $page_action; $this->label = $label; $this->table = $table; $this->column = $column; $this->cond = $cond; $this->pgnname = $pgnname; $this->style = $style; $this->form = &$form; $this->v_label = new Label("lbl_".$column, $label, $this->style,2); //now retrieve the values.... $this->pgntypeid = getDBCell("modules", "MODULE_ID", "UPPER(MODULE_NAME) = '".strtoupper($pgnname)."'"); if ($this->pgntypeid =="") { $this->errortext = "<center> The Plugin $pgnname is not installed. </center>"; } else { includePGNSource($this->pgntypeid); $form->add($this->v_label); if ($page_action == "UPDATE") { $fkid = getDBCell($table, $column, $cond); if ($fkid !="") { $ref = createPGNRef($this->pgntypeid, $fkid); if ($showpreview) { $preview = $ref->preview(); $this->form->add(new Label("lbl", $preview, "", 2)); } $ref->edit($this->form); } } else { $fkid=value("PGFK".$this->table.$this->column, "NUMERIC"); if ($fkid=="0") { $fkid = nextGUID(); $ref = createPGNRef($this->pgntypeid, $fkid); } else { $ref = createPGNRef($this->pgntypeid, $fkid); } $ref->edit($this->form); $this->form->add(new Hidden("PGFK".$this->table.$this->column, $fkid)); global $page_state; if ($page_state == "processing") { // was commented out somewhat. addInsert($ref->management_table, $ref->pk_name, $fkid, "NUMBER"); addInsert($table, $column, $fkid, "NUMBER"); } } } // plugin does exist }
/** * Checks, wheter a page is actually in INSERT or UPDATE mode an creates the corresponding * Saveset. */ function process() { global $page_action; if ($page_action == "INSERT") { addInsert($this->table, $this->lng, $this->vlng, "NUMBER"); addInsert($this->table, $this->lat, $this->vlat, "NUMBER"); } else { if ($page_action == "UPDATE") { addUpdate($this->table, $this->lng, $this->vlng, $this->row_identifier, "NUMBER"); addUpdate($this->table, $this->lat, $this->vlat, $this->row_identifier, "NUMBER"); } } }
/** * Set the Primary Key and the table of one of the form objects. * As result you will get a where-condition, you can use as row_identifier * with your DBO objects. Does not the system-vars check. * @param string Name of the table, you want to process * @param string Name of the Primary Key. * @return string where condition for row_identifier. */ function setExPK($table, $key) { global $page_action, $oid, $temp_oid; if (($page_action == "INSERT") && ! $this->avoidPKGeneration) { addInsert($table, $key, "", "NUMBER"); //2.12.2001: changed: saving temp_oid to oid for processing InsertHandlers. $oid = $temp_oid; return "1"; } else { if (! is_numeric($oid)) { $where = "$key = '$oid'"; } else { $where = "$key = $oid"; } return $where; } }
/** * Checks, wheter a page is actually in INSERT or UPDATE mode an creates the corresponding * Saveset. */ function process() { global $page_action, $c; $parser = new HTML2NX(); $this->cleanTags(); $value = $parser->parseText($this->value); if ($page_action == "INSERT") addInsert($this->table, $this->column, $value, $this->datatype); if ($page_action == "UPDATE") { if (! isset($c[$this->name])) { addUpdate($this->table, $this->column, $value, $this->row_identifier, $this->datatype); } else { $this->v_wuiobject->value = $c[$this->name]; } } }