public function onPreInit($param)
 {
     $this->getResponse()->appendHeader("Content-Type:" . $this->header);
     $mShort = array(1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'Mai', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug', 9 => 'Sep', 10 => 'Okt', 11 => 'Nov', 12 => 'Dez');
     //error_reporting(E_ALL ^ E_NOTICE);
     $idtm_organisation = $_GET['idtm_organisation'];
     echo '<?xml version="1.0" ?><tree id="0">';
     $SQLJahr = "SELECT YEAR(auf_tdate) AS idtm_aufgaben FROM vv_aufgaben WHERE (auf_tabelle = 'tm_organisation' AND auf_id='" . $idtm_organisation . "') OR (auf_idtm_organisation = '" . $idtm_organisation . "' OR idtm_organisation = '" . $idtm_organisation . "') AND NOT ISNULL(auf_tdate) GROUP BY YEAR(auf_tdate)";
     $ResultJahr = AufgabenView::finder()->findAllBySQL($SQLJahr);
     foreach ($ResultJahr as $RJahr) {
         echo "<item id='DAT_" . $RJahr->idtm_aufgaben . "' text='" . $RJahr->idtm_aufgaben . "'>";
         $SQLMonate = "SELECT MONTH(auf_tdate) AS idtm_aufgaben FROM vv_aufgaben WHERE ((auf_tabelle = 'tm_organisation' AND auf_id='" . $idtm_organisation . "') OR auf_idtm_organisation = '" . $idtm_organisation . "' OR idtm_organisation = '" . $idtm_organisation . "') AND YEAR(auf_tdate) = '" . $RJahr->idtm_aufgaben . "' GROUP BY MONTH(auf_tdate)";
         $ResultMonate = AufgabenView::finder()->findAllBySQL($SQLMonate);
         foreach ($ResultMonate as $RMonat) {
             echo "<item id='DAT_" . $RJahr->idtm_aufgaben . '_' . $RMonat->idtm_aufgaben . "' text='" . $mShort[$RMonat->idtm_aufgaben] . ' ' . $RJahr->idtm_aufgaben . "'>";
             $SQLAufgaben = "SELECT idtm_aufgaben, LEFT(auf_name,30) AS auf_name FROM vv_aufgaben WHERE ((auf_tabelle = 'tm_organisation' AND auf_id='" . $idtm_organisation . "') OR idtm_organisation = '" . $idtm_organisation . "' OR auf_idtm_organisation = '" . $idtm_organisation . "') AND YEAR(auf_tdate) = '" . $RJahr->idtm_aufgaben . "' AND MONTH(auf_tdate)= '" . $RMonat->idtm_aufgaben . "'";
             $ResultAufgaben = AufgabenView::finder()->findAllBySQL($SQLAufgaben);
             foreach ($ResultAufgaben as $RAufgaben) {
                 echo "<item id='" . $RAufgaben->idtm_aufgaben . "' text='" . htmlspecialchars($RAufgaben->auf_name) . "'>";
                 echo "</item>";
             }
             echo "</item>";
         }
         echo "</item>";
     }
     //        for ($i=0; $i<sizeof($data); $i++){
     //            echo "<item id='arra_".$data[$i]."' text='arra ".$data[$i]."'>";
     //               for ($j=0; $j<$data[$i]; $j++)
     //                    echo "<item id='arra_".$i."_".$j."' text='arra ".$i." ".$j."'></item>";
     //            echo "</item>";
     //        }
     echo '</tree>';
     exit;
 }
 private function LetterContent($idtm_organisation)
 {
     $SQL = "SELECT * FROM `vv_aufgaben` ";
     $SQL .= " WHERE idtm_organisation = " . $idtm_organisation;
     $SQL .= " OR (auf_tabelle = 'tm_organisation' AND auf_id = " . $idtm_organisation . ")";
     $SQL .= " ORDER BY auf_done ASC, auf_tdate ASC";
     $AufgabenDetails = AufgabenView::finder()->findAllBySQL($SQL);
     $this->pdf->Ln(10);
     //$this->pdf->SetX(20);
     $this->pdf->SetFillColor(234, 242, 220);
     $this->pdf->SetDrawColor(234, 242, 220);
     $this->pdf->SetFont('Arial', 'B', 12);
     $this->pdf->Cell(185, 6, utf8_decode('Aktivitäten: '), 1, 0, 'B', 1);
     $this->pdf->Ln(7);
     foreach ($AufgabenDetails as $AufgabenDetail) {
         //$this->pdf->SetX(20);
         $this->pdf->SetFont('Arial', '', 9);
         $this->pdf->SetFillColor(116, 145, 97);
         $this->pdf->SetDrawColor(116, 145, 97);
         $this->pdf->Cell(15, 6, $AufgabenDetail->idtm_aufgaben, 1, 0, 'C', 1);
         $this->pdf->SetFillColor(255, 255, 255);
         $this->pdf->SetDrawColor(234, 242, 220);
         $this->pdf->Cell(170, 6, utf8_decode($AufgabenDetail->auf_name), 1, 0, '', 1);
         $this->pdf->Ln(7);
         //$this->pdf->SetX(28);
         $this->pdf->SetFillColor(255, 255, 255);
         $this->pdf->WriteHTML($AufgabenDetail->auf_beschreibung);
         $this->pdf->Ln(8);
         //$this->pdf->SetX(20);
         //$this->pdf->SetX(20);
         $this->pdf->Cell(125, 5, 'Wer', 1, 0, '', 1);
         $this->pdf->Cell(30, 5, 'Bis', 1, 0, '', 1);
         $this->pdf->Cell(30, 5, 'Erledigt', 1, 0, '', 1);
         $this->pdf->Ln();
         $this->pdf->Cell(125, 6, utf8_decode($AufgabenDetail->org_responsible), 1, '');
         $this->pdf->Cell(30, 6, $AufgabenDetail->auf_tdate, 1, 'L', 0);
         $this->pdf->Cell(30, 6, $AufgabenDetail->auf_done == 1 ? $AufgabenDetail->auf_ddate : '-', 1, 'L', 0);
         $this->pdf->Ln(8);
     }
 }
 public function bindListTAValue($idtm_aufgaben = "0")
 {
     //diese kontrolle brauche ich, falls sender und param uerbergeben werden
     is_Object($idtm_aufgaben) ? $idtm_aufgaben = 0 : '';
     $this->initAufOrganisation();
     $criteria = new TActiveRecordCriteria();
     if ($idtm_aufgaben == 0) {
         $this->Tedidtm_aufgaben_single->Text = 0;
         //einschraenken auf jahr
         $criteria->Condition = "YEAR(auf_tdate) = :suchtext4 AND auf_deleted = 0";
         $criteria->Parameters[':suchtext4'] = $this->CCAufgabenContainerOrganisationYear->Text;
         if ($this->CCAufgabenContainerOrganisationMonth->Text != 0) {
             $criteria->Condition .= " AND MONTH(auf_tdate) = :suchtext8";
             $criteria->Parameters[':suchtext8'] = $this->CCAufgabenContainerOrganisationMonth->Text;
         }
         if ($this->Tedauf_tabelle->Text == 'tm_none') {
             //the personalisation part
             if ($this->Tedauf_user_id->Text >= 1) {
                 $criteria->Condition .= " AND idtm_organisation = :suchtext3";
                 $criteria->Parameters[':suchtext3'] = $this->Tedauf_user_id->Text;
             } else {
                 $criteria->Condition .= " AND auf_tabelle = :suchtext1";
                 $criteria->Parameters[':suchtext1'] = $this->Tedauf_tabelle->Text;
             }
         } else {
             $criteria->Condition .= " AND ((auf_tabelle = :suchtext1 AND auf_id = :suchtext2) OR (auf_idtm_organisation=:suchtext5) OR (idtm_organisation=:suchtext6))";
             $criteria->Parameters[':suchtext1'] = $this->Tedauf_tabelle->Text;
             $criteria->Parameters[':suchtext2'] = $this->Tedauf_id->Text;
             $criteria->Parameters[':suchtext5'] = $this->Tedauf_id->Text;
             $criteria->Parameters[':suchtext6'] = $this->Tedauf_id->Text;
         }
         if ($this->CBAufgabeDone->Text < 2) {
             $criteria->Condition .= " AND auf_done = :suchtext7";
             // AND auf_name IS NOT NULL";
             $criteria->Parameters[':suchtext7'] = $this->CBAufgabeDone->Text;
         }
         $criteria->Condition .= " AND ((auf_beschreibung = '' AND auf_tabelle='tm_protokoll_detail') IS FALSE)";
         // AND auf_name IS NOT NULL";
         $criteria->OrdersBy['auf_tdate'] = 'DESC';
         $this->CCAufgabenRepeater->VirtualItemCount = AufgabenView::finder()->count($criteria);
         //->page->AufgabenContainerOrganisation
         $criteria->setLimit($this->CCAufgabenContainerPageSize->Text);
         $criteria->setOffset($this->CCAufgabenContainerPageSize->Text * $this->CCAufgabenRepeater->CurrentPageIndex);
         if ($this->CCAufgabenContainerPageSize->Text <= 1) {
             $this->CCAufgabenRepeater->PageSize = 5;
         } else {
             $this->CCAufgabenRepeater->PageSize = 1 * $this->CCAufgabenContainerPageSize->Text;
         }
     } else {
         $this->Tedidtm_aufgaben_single->Text = 1;
         $this->Tedidtm_aufgaben->Text = $idtm_aufgaben;
         $criteria->Condition = "idtm_aufgaben = :suchtext8";
         $criteria->Parameters[':suchtext8'] = $idtm_aufgaben;
         $this->CCAufgabenRepeater->VirtualItemCount = AufgabenView::finder()->count($criteria);
     }
     $this->CCAufgabenRepeater->DataSource = AufgabenView::finder()->findAll($criteria);
     $this->CCAufgabenRepeater->dataBind();
 }