mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-30 16:40:28 +01:00
115 lines
3.1 KiB
PHP
115 lines
3.1 KiB
PHP
|
<?php
|
||
|
|
||
|
include ("_gen/widget.gen.geschaeftsbrief_vorlagen.php");
|
||
|
|
||
|
class WidgetGeschaeftsbrief_vorlagen extends WidgetGenGeschaeftsbrief_vorlagen
|
||
|
{
|
||
|
private $app;
|
||
|
function __construct($app,$parsetarget)
|
||
|
{
|
||
|
$this->app = $app;
|
||
|
$this->parsetarget = $parsetarget;
|
||
|
parent::__construct($app,$parsetarget);
|
||
|
$this->ExtendsForm();
|
||
|
}
|
||
|
function ExtendsForm()
|
||
|
{
|
||
|
//firma
|
||
|
$this->app->Secure->POST["firma"]=$this->app->User->GetFirma();
|
||
|
$field = new HTMLInput("firma","hidden",$this->app->User->GetFirma());
|
||
|
$this->form->NewField($field);
|
||
|
|
||
|
$this->app->YUI->CkEditor("text","internal");
|
||
|
|
||
|
$this->app->YUI->AutoComplete("projekt","projektname",1);
|
||
|
|
||
|
$this->form->ReplaceFunction("projekt",$this,"ReplaceProjekt");
|
||
|
$id = $this->app->Secure->GetGET('id');
|
||
|
$sprachenOptions = $this->app->erp->GetSprachenSelect($id?$this->app->DB->Select("SELECT sprache FROM geschaeftsbrief_vorlagen WHERE id = '$id' LIMIT 1"):null);
|
||
|
|
||
|
$field = new HTMLSelect("sprache",0,"sprache",false,false,"1");
|
||
|
//$field->onchange="onchange_typ(this.form.typ.options[this.form.typ.selectedIndex].value);";
|
||
|
$field->AddOptionsSimpleArray($sprachenOptions);
|
||
|
$this->form->NewField($field);
|
||
|
//$this->app->Tpl->Set(DATUM_BUCHUNG,
|
||
|
// "<img src=\"./themes/[THEME]/images/kalender.png\" onclick=\"displayCalendar(document.forms[0].datum,'dd.mm.yyyy',this)\">");
|
||
|
|
||
|
}
|
||
|
function ReplaceProjekt($db,$value,$fromform)
|
||
|
{
|
||
|
return $this->app->erp->ReplaceProjekt($db,$value,$fromform);
|
||
|
}
|
||
|
|
||
|
|
||
|
function ReplaceDecimal($db,$value,$fromform)
|
||
|
{
|
||
|
//value muss hier vom format ueberprueft werden
|
||
|
|
||
|
return str_replace(",",".",$value);
|
||
|
}
|
||
|
|
||
|
function ReplaceDatum($db,$value,$fromform)
|
||
|
{
|
||
|
//value muss hier vom format ueberprueft werden
|
||
|
$dbformat = 0;
|
||
|
if(strpos($value,'-') > 0) $dbformat = 1;
|
||
|
|
||
|
// wenn ziel datenbank
|
||
|
if($db)
|
||
|
{
|
||
|
if($dbformat) return $value;
|
||
|
else return $this->app->String->Convert($value,"%1.%2.%3","%3-%2-%1");
|
||
|
}
|
||
|
// wenn ziel formular
|
||
|
else
|
||
|
{
|
||
|
if($dbformat) return $this->app->String->Convert($value,"%1-%2-%3","%3.%2.%1");
|
||
|
else return $value;
|
||
|
}
|
||
|
}
|
||
|
function ReplaceAdresse($db,$value,$fromform)
|
||
|
{
|
||
|
//value muss hier vom format ueberprueft werden
|
||
|
$dbformat = 0;
|
||
|
if(!$fromform) {
|
||
|
$dbformat = 1;
|
||
|
$id = $value;
|
||
|
$abkuerzung = $this->app->DB->Select("SELECT name FROM adresse WHERE id='$id' AND geloescht=0 LIMIT 1");
|
||
|
} else {
|
||
|
$dbformat = 0;
|
||
|
$abkuerzung = $value;
|
||
|
$id = $this->app->DB->Select("SELECT id FROM adresse WHERE name='$value' AND geloescht=0 LIMIT 1");
|
||
|
}
|
||
|
|
||
|
// wenn ziel datenbank
|
||
|
if($db)
|
||
|
{
|
||
|
return $id;
|
||
|
}
|
||
|
// wenn ziel formular
|
||
|
else
|
||
|
{
|
||
|
return $abkuerzung;
|
||
|
}
|
||
|
}
|
||
|
function Table()
|
||
|
{
|
||
|
$this->app->YUI->TableSearch('INHALT',"geschaeftsbrief_vorlagenlist");
|
||
|
$this->app->Tpl->Parse($this->parsetarget,"rahmen70.tpl");
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
public function Search()
|
||
|
{
|
||
|
//$this->app->Tpl->Set($this->parsetarget,"suchmaske");
|
||
|
//$this->app->Table(
|
||
|
//$table = new OrderTable("veranstalter");
|
||
|
//$table->Heading(array('Name','Homepage','Telefon'));
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
?>
|