Objekt im Frontend automatisch in einem Verzeichnis ablegen

zedi

Objekt im Frontend automatisch in einem Verzeichnis ablegen

Beitragvon zedi » Di 1. Aug 2006, 16:44

Folgendes Problem :

Habe ein Objekt Kunden und ein Objekt Rapporte. Ich wähle mittels php den Kundennamen vorgängig aus. Innerhalb des Objektes Rapporte Verweise ich auf den Kunden. Nun versuche ich dies mittels <we:userInput name="/Kunden" type="object" value="$kundenpath" hidden="false" /> das Feld in den Rapport zu schreiben. Er erstellt mir ein Objekt Rapport jedoch ohne den Verweis auf den Kunden (Feld ist leer), was mache ich hier falsch? Braucht es den "/" vor dem Feld (/Kunden)?

Weiter schreibt er mir mit <we:write type="object" formname="rapport" forceedit="true" publish="true" classid="1" /> das objekt Rapport immer in das Root Objekte Verzeichnis. Wie kann ich ihm ein Verzeichnis angeben?

Hier ein kleiner Codeausschnitt :

<?php if($kunde<>"") {
// $kunde ist vorgängig auf den kundennamen gesetzt worden
$kundenpath = "/Kunden/$kunde"
;?>
<we:form type="object" name="rapport" method="post" classid="1">
<we:userInput name="/Kunden" type="object" value="$kundenpath" hidden="false" />
<we:userInput name="Datum" type="date" />
Titel: <we:userInput name="Titel" type="object" value="" />

Stunden: <we:userInput name="Stunden" type="object" value="" />


Dienstleistung

<we:userInput type="textarea" inlineedit="true" editable="true" name="Dienstleistung" cols="80" rows="10" autobr="on" wysiwyg="on" />
<input type="submit" class="input" value="senden"> <input type="reset" class="input" value="reset">
</we:form>
<we:write type="object" formname="rapport" forceedit="true" publish="true" classid="1" />

ikbenivo

Beitragvon ikbenivo » Di 1. Aug 2006, 18:09

My german is too bad, so I'll answer in english:

maybe you can try:

Code: Alles auswählen

<input type="text" name="we_ui_we_global_form[Kunden]" value="<?php echo $kundenpath; ?>">
it could be that you'll have to change the we_uit_global_form in something else. (just look in the source of your rendered page to find out what webEdition makes of those userinput tags)

zedi

this does not work

Beitragvon zedi » Mi 2. Aug 2006, 09:42

I tested but the result is again an empty field "Kunden" in object. And the other problem was, how can I tell, in which object directory the object will be saved ?

The field "Kunden" is an object field in the class "Rapporte" which I will create. There is no problem in "backend" but I will a possibility to create this object in Frontend.

ikbenivo

Beitragvon ikbenivo » Mi 2. Aug 2006, 10:13

hmm, maybe I didn't get your german explenation. What exaclty do you want?

Let me think out loud:
Do you want to create new classes? (as far as I know, that's not possible)
Or, objects in objects? That should be possible with the new multiobject tag. But I didn't figure out yet how to write those on front-end.
Each customer is an object, based on a class (kunden). Then you have a class for your 'Rapporte'. With the userinput stuff you can write an object based on that class. But you want that object linked to a customer (kunden object).

Difficult.

I have managed to link objects to a customer, but that is with the customer (PRO) module. When a customer registers, an object is written. In this object there is a (hidden) field called ID. This field is filled with the ID of the customer.

Code: Alles auswählen

<we:sessionField name="ID" type="hidden"/>
<input type="hidden" name="we_ui_we_global_form[ID]" value="<?php echo $_SESSION['webuser']['ID']; ?>">
Maybe you can do something with that?

zedi

Probleme gelöst !

Beitragvon zedi » Mi 2. Aug 2006, 16:59

1. Problem Speicherung in einem vordefinierten Verzeichnis

----------------------------------------
...
<?php if($kunde<>"") {
$yy = "2006";
$dirsearch = "Rapporte/".$kunde."/".$yy;
?>

<we:listview type="object" classid="1">
<we:repeat>
<?php
$pid = $lv->DB_WE->f("OF_ID");
$DB_WE->query("SELECT OF_Path,OF_ParentID,object_2 FROM tblobject_1 WHERE OF_ID = '".$pid."'","OF_Path",$GLOBALS["DB_WE"]);

// hier wird nach dem verzeichnis gesucht und daten wie
// id vom objektverzeichnis oder id vom kunden in variabeln geschrieben
//
while ($DB_WE->next_record()){
$pathobj = $DB_WE->f("0");
$pathdir = substr($pathobj,1,strpos($pathobj,'-')-11);
if ($dirsearch == $pathdir) {
$rappDirID = $DB_WE->f("1");
$rappKundenID = $DB_WE->f("2");
}
}
?>
</we:repeat>
</we:listview>

<we:write type="object" formname="rapport" forceedit="true" publish="true" classid="1" />
<we:form type="object" name="rapport" method="post" classid="1" parentid="$rappDirID">
.....
----------------------------------------



2. Problem mit Angabe des Kundenobjektes innerhalb vom Rapportobjekt
----------------------------------------
...
<input type="text" name="we_ui_rapport[we_object_2]" value="<?php echo $rappKundenID ?>" hidden="false" />
...
----------------------------------------


Zurück zu „DB / Object Module“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 3 Gäste