Thanks for your help, this was very useful, but i think i need a bit more help…
I hope this post is not too long, but i do not know what i should do without your help
here is my code and i hope you can show me what i am doing wrong concerning the preserv argument
(i deletet all comments, to trim it a bit :))
<?php
function edit($content,$id='')
{
print_r($preserv);
if (is_array($content)) // not first call from index
{
if ($content['id'] > 0)
{
$this->read($content);
}
$this->data_merge($content);
if (isset($content['search']))
{
// Search function, deletet because its not necessary, i think
}
else if (isset($content['entry']['journal']))
{
list($id) = each($content['entry']['journal']); // note its not only ['entry'] !!!
if ($id > 0)
{
$this->so_sql('phpgwapi','egw_addressbook',null,'contact_',true);
$name = $this->search(array('contact_id'=>$id),False,'contact_id,n_family,n_given');
$this->so_sql('schuelerakte','egw_schuelerakte_journal');
$data = $this->search(array('id'=>$id),False);
$this->so_sql('schuelerakte','egw_schuelerakte_journal_subjects');
$subjects = $this->search(array('id'=>$id),False,'nr');
$content = array(
'id' => $id,
'_pname' => $name[0]['n_given']." ".$name[0]['n_family'],
'_pschool' => $data[0]['school'],
'_pclass' => $data[0]['class'],
'_pteacher' => $data[0]['teacher'],
'_pdate' => $data[0]['date'],
'_psubject1' => $subjects[0]['subject'],
'_psubject1_teacher' => $subjects[0]['teacher'],
'_psubject1_mark' => $subjects[0]['mark'],
'_psubject1_problems' => $subjects[0]['problems'],
'_psubject2' => $subjects[1]['subject'],
'_psubject2_teacher' => $subjects[1]['teacher'],
'_psubject2_mark' => $subjects[1]['mark'],
'_psubject2_problems' => $subjects[1]['problems'],
'_psubject3' => $subjects[2]['subject'],
'_psubject3_teacher' => $subjects[2]['teacher'],
'_psubject3_mark' => $subjects[2]['mark'],
'_psubject3_problems' => $subjects[2]['problems'],
'_pproblems' => $data[0]['problems'],
'_ptargets' => $data[0]['targets'],
'_pnote' => $data[0]['note'],
);
$this->tmpl = new etemplate('schuelerakte.journal');
$this->tmpl->exec('schuelerakte.ui_schuelerakte.edit',$content,'','',array('id'=>$content['id']));
}
}
else if (isset($content['_psave']))
{
$this->so_sql('schuelerakte','egw_schuelerakte_journal');
$data = $this->so_sql('schuelerakte','egw_schuelerakte_journal');
$content['name'] = $content['_pname'];
$content['school'] = $content['_pschool'];
$content['class'] = $content['_pclass'];
$content['teacher'] = $content['_pteacher'];
$content['date'] = $content['_pdate'];
$content['id'] = $preserv['id'];//$currentpupil;
$content['note'] = $content['_pnote'];
$content['problems'] = $content['_pproblems'];
$content['targets'] = $content['_ptargets'];
$this->data_merge($content);
$this->save();
$this->tmpl->exec('schuelerakte.ui_schuelerakte.edit',$content,'','',array('id'=>$preserv['id']));
}
}
$content = $this->data + array(
'id' => $content['id']
);
$sel_options = array(
'type' => $this->types
);
$this->tmpl->exec('schuelerakte.ui_schuelerakte.edit',$content,'','',array('id'=>$content['id']));
}
}
at the and i want you to know, that im very happy that you try to help me and that you are so patient
Equinox