makeSimpleHTML($Title, "$File has been generated successfully."); } function content_of_directory($Directory_Name) { // GIBT DIE DATEIEN EINES VERZEICHNISSES ZURÜCK! //echo "$Directory_Name"; $filepointer = @opendir ($Directory_Name); //$filepointer = @opendir ("./pics"); if (!$filepointer) { echo "FEHLER!"; } while ($Content = @readdir ($filepointer)) { if ($Content != "." && $Content != "..") { if (!is_dir ($Content)) { $files[count($files)] = $Content; } } } @closedir ($filepointer); return $files; } function give_out_Date($give_out = "no") { $actual_date = getdate(); if($give_out == "yes") { echo $actual_date[mday] . " " . $actual_date[month] . " " . $actual_date[year] . " - " . $actual_date[hours] . ":" . $actual_date[minutes] . ":" . $actual_date[seconds]; } else { return $actual_date[mday] . " " . $actual_date[month] . " " . $actual_date[year] . " - " . $actual_date[hours] . ":" . $actual_date[minutes] . ":" . $actual_date[seconds]; } } function makeSimpleHTML($Title = "default", $OutputText = "default") { echo ""; echo "$Title"; if(count($OutputText) == 1) { echo $OutputText; } else { echo_Array_HTML($OutputText); } echo ""; } function remove_empty_Strings_of_StringArray($String_Array) // Entfernt alle leeren ( Zeilenumbruch, Einschub, Leerzeichen) beginnende // Strings eines Stringarrays. { $i = count($String_Array); $u = 0; while($u < $i) { $String_Array[$u] = ltrim($String_Array[$u]); $u++; } $u = 0; while($u < $i) { if(ord($String_Array[$u]) != 0) { $cleaned_Array[count($cleaned_Array)] = $String_Array[$u]; } $u++; } return $cleaned_Array; } function makeLatexTable($Title = "default", $TableData = "default", $File = "default", $Content = array("Quantity", "Term", "Discription", "Single price", "Complete price")) { /******************************************** SO MUSS DIE FUNKTION AUFGERUFEN WERDEN: $s->makeLatexTable("Test",$Data_Field,"TESTPDF.tex",array("Anzahl","Leistung","Beschreibung","Einzelpreis","Gesamtpreis")); *********************************************/ /* Bei der Funktion lässt sich noch viel verbessern: z.B. dass sie selber erkennt wieviele Spalten erstellt werden müssen Dazu muss man halt die Größe der ersten Dimension des Daten Arrys bestimmen (Hätte den Forteil, das es mit Input gut zusammenarbeitet) */ $Document[0] = "\documentclass[a4paper,10pt]{letter}\usepackage[latin1]{inputenc}"; $Document[1] = "\usepackage{ngerman}\usepackage[dvips]{graphics}\\thispagestyle{empty}"; $Document[2] = "\setlength{\oddsidemargin}{0cm}\setlength{\evensidemargin}{0cm}"; $Document[3] = "\setlength{\\textwidth}{1.4\\textwidth}\setlength{\footskip}{0cm}"; $Document[4] = "\setlength{\\topmargin}{0cm}\setlength{\headheight}{0cm}"; $Document[5] = "\setlength{\\textheight}{22cm}\begin{document}\begin{center}"; $Document[6] = "\\textbf{} \\\[8cm]\begin{tabular}{ | r | }\hline\makebox[16cm]{} \\\ "; $Document[7] = "\begin{tabular}{ c }\makebox[15.21cm]{Rechnung} \\\ \end{tabular} \\\ \\\ "; $Document[8] = "\fbox{ "; $Document[9] = "\begin{tabular}{ | c || c | l | c | c | }\hline "; $Document[10] = "\makebox[2cm]{{$Content[0]}} & \makebox[2cm]{{$Content[1]}} & \makebox[5cm]{{$Content[2]}} & \makebox[2cm]{{$Content[3]}} & \makebox[2cm]{{$Content[4]}} \\\ \hline \hline "; $i = count($TableData); $u = 0; while($u < $i) { $Document[11+$u] = "\makebox[2cm]{{$TableData[$u][0]}} & \makebox[2cm]{{$TableData[$u][1]}} & \makebox[2cm]{{$TableData[$u][2]}} & \makebox[2cm]{{$TableData[$u][3]}} & \makebox[2cm]{{$TableData[$u++][4]}} \\\ \hline "; } $Document[count($Document)] = "\end{tabular} "; $Document[count($Document)] = "} \\\[27pt]\hline\end{tabular}\end{center}\end{document}"; $this->write_File($File,$Document); } function makeLatexEnumeration($Title = "Default", $Author = "Auto-Generated", $Data = array("default"), $File = "default.tex" ) { $Document[0] = "\documentclass[a4paper,10pt]{article}"; $Document[1] = "\usepackage[latin1]{inputenc}"; $Document[2] = "\usepackage{ngerman}"; $Document[3] = "\setlength{\oddsidemargin}{0cm}"; $Document[4] = "\setlength{\evensidemargin}{0cm}"; $Document[5] = "\setlength{\\textwidth}{1.4\\textwidth}" ; $Document[6] = "\setlength{\footskip}{0cm}"; $Document[7] = "\setlength{\\topmargin}{0cm}"; $Document[8] = "\setlength{\headheight}{0cm}"; $Document[9] = "\setlength{\\textheight}{22cm}"; $Document[10] = "\\title{{$Title}}"; $Document[11] = "\author{{$Author}}"; $Document[12] = "\begin{document}"; $Document[13] = "\maketitle"; $Document[14] = "\begin{itemize}"; $Document[15] = ""; $x = count($Data); if($i == 1) { // Es wurde nur ein String übergeben! $Document[16] = "\item {$Data}"; } else { while($x > 0) { $Document[15+$x--] = "\item {$Data[$x]}"; } } // INTERESSANT: Die count($Array[x]) Funktion berücksichtigt nicht das Zaun Problem, da sie die absolute Anzahl des Inhaltes zurückgibt. $Document[count($Document)] = "\end{itemize}"; $Document[count($Document)] = "\end{document}"; return $Document; } function read_File($Filename = "default.txt") { $filepointer = @fopen ($Filename, "r") or die("Fehler beim oeffnen des Dokuments!"); $i = 0; $File_Array = array(); while ($line = @fgets ($filepointer, 1024)) { $File_Array[$i] = $line; $i++; } @fclose($filepointer) or die("Fehler beim schliessen des Dokuments!"); return $File_Array; } function echo_Array_HTML($Any_Array) { $i = count($Any_Array); $u = 0; while ($u < $i) { echo $Any_Array[$u]; echo "\n
\n"; $u++; } } function echo_Array($Any_Array) { $i = count($Any_Array); $u = 0; while ($u < $i) { echo $Any_Array[$u]; $u++; } } function dismiss_specific_Line_of_Array($Array, $Number_of_Line) { // Wenn die angegebene Nummer nicht da ist, wird das ignoriert $i = count($Array); $u = 0; while($u < $i) { if($u != $Number_of_Line) { $cleaned_Array[count($cleaned_Array)] = $Array[$u]; } $u++; } return $cleaned_Array; } function replace_specific_Line_of_Array($Array, $Number_of_Line, $content) { // return $this->add_specific_Line_to_Array($this->dismiss_specific_Line_of_Array($Array, $Number_of_Line), $Number_of_Line, $content); $Array[$Number_of_Line] = $content; return $Array; } function add_specific_Line_to_Array($Array, $Number_of_Line, $content) { // Wenn die angegebene Nummer mehr als 1 größer als das Array ist, // wird abgebrochen, damit hier nicht versteckt Daten missed gehen $i = count($Array); if($Number_of_Line > $i + 1) { return -1; } $u = 0; $z = 0; while($z <= $i) { if($z != $Number_of_Line) { $added_Array[count($added_Array)] = $Array[$u]; $u++; } else { $added_Array[count($added_Array)] = $content; } $z++; } return $added_Array; } function write_File($Filename = "default.txt", $Data = "Default") { // !!!!!!!!!!!!!!!!!!TODO: DIESE FUNKTION ZUM LAUFEN BRINGEN: Schreibt Scheiße // dh. zuviele Leerzeichen -> hat was mit Zeilenumbruch zu tun! $filepointer = @fopen ($Filename, "w+b", 1024) or die("Unable to open document!"); $Data = $this->remove_empty_Strings_of_StringArray($Data); $i = count($Data); $u = 0; if($i == 1) { @fputs ($filepointer, $Data); } else { while($u < $i-1) { $Data[$u] = $Data[$u] . "\n"; //@fputs ($filepointer, "\n"); //@fputs ($filepointer, chr(13)); //@fputs ($filepointer, chr(10)); $u++; } $u = 0; while($u < $i-1) { @fputs ($filepointer, $Data[$u]); //@fputs ($filepointer, "\n"); //@fputs ($filepointer, chr(13)); //@fputs ($filepointer, chr(10)); $u++; } @fputs ($filepointer, $Data[$u++]); } @fclose($filepointer) or die("Unable to close document!"); } function write_File_ERRORS($Filename = "default.txt", $Data = "Default") { $filepointer = fopen ($Filename, "w+") or die("Unable to open document!"); $Data = $this->remove_empty_Strings_of_StringArray($Data); $i = count($Data); $u = 0; if($i == 1) { fputs ($filepointer, $Data); } else { while($u < $i-1) { fputs ($filepointer, $Data[$u++]); fputs ($filepointer, chr(13)); fputs ($filepointer, chr(10)); } fputs ($filepointer, $Data[$u++]); } fclose($filepointer) or die("Unable to close document!"); } function echoArray($Array_to_echo = array()) { $i = count($Array_to_echo); $u = 0; while ($u < $i) { echo $Array_to_echo[$u++]; echo "
\n"; } } } class inputForLatex { // Ich werde einfach eine Klasse erzeugen, die man in das entsprechende // PHP File einbinden kann, das aufgerufen wird. // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Die Daten des Hauptfeldes das später zu den Items wird müssen im ein Array! // gehaut werden. Und dann kann ichs weiterverwerten. ! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! function inputForLatex($name_of_File_to_give_out) { echo "
\n
\n"; echo "\n
\n"; echo "\n
\n"; echo "\n
\n"; echo "
"; } } class inputForPersonalData { function inputForPersonalData($howToArrangeAll = "default", $howToArrangeDiscription = "default") { if($howToArrangeAll != "default" xor $howToArrangeAll == "c") { $howToArrangeAll = "default"; } if($howToArrangeDiscription !="t" && $howToArrangeDiscription !="r" && $howToArrangeDiscription !="d" && $howToArrangeDiscription !="l") { // Soll als Default Wert down stehen? $howToArrangeDiscription = "d"; } // Hier beginnt der Output-Teil! if($howToArrangeAll == "c") { echo "
"; } switch ($howToArrangeDiscription) { case "d": // UNTEN echo "

"; echo "
"; echo "Name
"; echo "
"; echo "Straße und Hausnummer
"; echo "
"; echo "Postleitzahl und Stadt
"; echo "
"; echo "Telefonnummer für Rückfragen
"; echo "
"; echo "E-Mail Adresse

"; echo "
"; echo ""; echo "
"; break; case "t": // OBEN echo "

"; echo "Name
"; echo "
"; echo "Straße und Hausnummer
"; echo "
"; echo "Postleitzahl und Stadt
"; echo "
"; echo "Telefonnummer für Rückfragen
"; echo "
"; echo "E-Mail Adresse
"; echo "

"; echo "
"; echo ""; echo "
"; break; case "r": // RECHTS echo "

"; echo ""; echo "Name
"; echo ""; echo "Straße und Hausnummer
"; echo ""; echo "Postleitzahl und Stadt
"; echo ""; echo "Telefonnummer für Rückfragen
"; echo ""; echo "E-Mail Adresse

"; echo "
"; echo ""; echo "
"; break; case "l": // LINKS echo "

"; echo "Name"; echo "
"; echo "Straße und Hausnummer"; echo "
"; echo "Postleitzahl und Stadt"; echo "
"; echo "Telefonnummer für Rückfragen"; echo "
"; echo "E-Mail Adresse"; echo "

"; echo "
"; echo ""; echo "
"; break; } if($howToArrangeAll == "c") { echo "
"; } } } class Mailer { function Mailer($eMail = "", $from_whom, $subject = "", $message = "", $optional_Information = "") { if($eMail != "") { $this->mail_advanced($eMail, $from_whom, $subject, $message, $optional_Information); } else { echo "You have to permitt an E-Mail Adress!"; } } function mail_advanced($eMail, $from_whom, $subject, $message, $optional_Information = "") { $from_whom = "From: {$from_whom}"; $optional_Information .= $from_whom; if(count($message) != 1) { $message = $this->convertArrayToString($message); } if($eMail != "") { mail($eMail, $subject, $message, $optional_Information); } else { echo "You have to permitt an E-Mail Adress!"; } } function convertArrayToString($String_to_convert) { $i = count($String_to_convert); $u = 0; // $String_to_Return = ""; while($u < $i) { if($u == 0) { $String_to_Return = $String_to_convert[$u++]; $String_to_Return .= "\n"; } elseif($u == $i - 1) { $String_to_Return .= $String_to_convert[$u++]; } else { $String_to_Return .= $String_to_convert[$u++]; $String_to_Return .= "\n"; } } return $String_to_Return; } } class inputForData { // Sendet das Stringfeld $data_field an ein PHP Dokument function inputForData($numberOfCols , $numberOfRows , $sizeOfFields, $name_of_File_to_give_out = "default") { $i = 0; $u = 0; echo "
\n"; while($i < $numberOfCols) { while($u < $numberOfRows) { $this->_new_Imput($i,$u, $sizeOfFields); $u++; } echo "
"; $u = 0; $i++; } echo "
"; echo "
\n"; } function _new_Imput($Cols, $Rows, $sizeOfFields) { // Damits auch symetrisch ist echo "\n"; } } class filled_inputForData { // Sendet das Stringfeld $data_field an ein PHP Dokument function filled_inputForData($Array_of_Data, $name_of_File_to_give_out = "default") { $i = 0; $u = 0; echo "
\n"; while($i < count($Array_of_Data)) { //"{$Name} | {$Name_of_ImageFile} | {$Price} | {$number} | {$Discription}"; while($u < count($Array_of_Data[0])) { if($u == 0) { // VERBESSERN: Die Größe des Elements über eine count Funktion bestimmen! $this->_new_Imput($i,$u, 10,$Array_of_Data[$i][$u] ); } $u++; } echo "
"; $u = 0; $i++; } echo "
"; echo "
\n"; } function _new_Imput($Cols, $Rows, $sizeOfFields, $value) { // Damits auch symetrisch ist echo "\n"; } } class pictureModificator{ // BEI CENTER STRING: AUTOMATISCHE AUSGABE DES BILDES RAUS; EIGENE FUNKTION DAFÜR function pictureModificator($Filename = 0) { } function scale_picture($Filename, $percent_of_origin=100) { if(file_exists($Filename)) { $image_info = GetImageSize($Filename); list($image_width, $image_height, $image_type) = $image_info; $im = ImageCreateFromJpeg($Filename); $new_im = ImageCreate($image_width * $percent_of_origin / 100, $image_height * $percent_of_origin / 100); imagecopyresized($new_im, $im, 0, 0, 0, 0, $image_width * $percent_of_origin / 100, $image_height * $percent_of_origin / 100, $image_width, $image_height); //imagecopyresized; if($image_type == 1) { echo "Sorry, as there is no legal GIF implemantation in PHP at the time (14.2.2002), GIF - Files are not supported!"; } elseif($image_type == 2) { ImageJpeg($new_im, "{$Filename}" . SCALED_FILE_EXTENSION . ".jpg"); } elseif($image_type == 3) { ImagePng($new_im, "{$Filename}" . SCALED_FILE_EXTENSION . ".png"); } } else { // Währe zu überdenken, bei allen File - Routinen die E-Mail // Möglichkeit bei Fehlern zu geben. echo "Fehler! (function scale_picture) File does not exist!"; } } // DIE FUNTION IST NUR AUF DEN SHOP EINGESTELLT!!!! function scale_jpg_with_max_Height($Filename, $max_Height, $Optional_FileName, $Image_NAME = 0) { if(file_exists($Filename)) { $size=getimagesize("$Filename"); $breite=$size[0]; $hoehe=$size[1]; // HIER MUSS MASSIV VERBESSERT WERDEN!!! DIE MASSE SIND AUF DIE ENDER // SEITE ANGEPASST!!!!!!! if($hoehe >= $breite) { $neueHoehe=$max_Height - 55; $neueBreite=intval($hoehe*$neueHoehe/$hoehe); $altesBild=ImageCreateFromJPEG("$Filename"); $neuesBild=imageCreate($neueBreite,$neueHoehe); imageCopyResized($neuesBild,$altesBild,0,0,0,0,$neueBreite,$neueHoehe,$breite,$hoehe); } else { $neueBreite=$max_Height; $neueHoehe=intval($hoehe*$neueBreite/$breite); $altesBild=ImageCreateFromJPEG("$Filename"); $neuesBild=imageCreate($neueBreite,$neueHoehe); imageCopyResized($neuesBild,$altesBild,0,0,0,0,$neueBreite,$neueHoehe,$breite,$hoehe); } /************************************************************************* * BEI GELEGENHEIT: WAS PASSIERT IN DIESER FUNKTION??? * *************************************************************************/ //echo $Optional_FileName . "
"; if($Optional_FileName == 0) { //echo $neuesBild, $Filename . $Optional_FileName . ".jpg"; imageJPEG($neuesBild, SCALED_PICTURE_FILE_DIRECTORY . $Image_NAME . $Optional_FileName . ".jpg"); return SCALED_PICTURE_FILE_DIRECTORY . $Image_NAME . $Optional_FileName . ".jpg"; } else { //echo "In Normal!"; imageJPEG($neuesBild, $Filename . SCALED_FILE_EXTENSION . ".jpg"); return $Filename . SCALED_FILE_EXTENSION . ".jpg"; } } else { // Währe zu überdenken, bei allen File - Routinen die E-Mail // Möglichkeit bei Fehlern zu geben. echo "Fehler! (function scale_picture) File does not exist!"; } } function centerString($Filename,$String_Array, $Color_of_String = array(255,255,255)) // $Color_of_String ist eine Farb Variabe der Form (ROT, GRÜN, BLAU) { if(file_exists($Filename)) { // JPG HAT NUR BEGRENZT FARBEN; // BEI EINER VORHANDENEN DATEI KÖNNEN DIE // SCHON ALLE VERBRAUCHT SEIN -> Es wird zufällig eine // Farbe ersetzt! $im = ImageCreateFromJpeg($Filename); $width = $this->_get_width_of_picture($Filename); $height = $this->_get_height_of_picture($Filename); $numberofColors = ImageColorsTotal($im); $u = 0; // $Color_Field[count($Color_Field)+1] = ImageColorAllocate($im, 255,255,255); ImageColorDeAllocate($im, 10); $white = ImageColorAllocate($im, $Color_of_String[0], $Color_of_String[1], $Color_of_String[2]); $i = count($String_Array); $u = 0; while($u < $i) { ImageString($im,5,$width/2-25,$width/2-(($i-$u)*10),$String_Array[$u], $white) ; $u++; } ImageJpeg($im, "{$Filename} . _NEW"); echo "
"; ImageDestroy($im); } else { // FEHLER !!!! echo "File does not exist!"; } } function makePicture($width,$height,$Filename) { $im = ImageCreate($width,$height); $white = ImageColorAllocate($im, 255,255,255); ImageJpeg($im, $Filename); ImageDestroy($im); } function _get_height_of_picture($Filename) { $info_of_picture = GetImageSize($Filename); list($i,$height,$u,$o) = $info_of_picture; return $height; } function _get_width_of_picture($Filename) { $info_of_picture = GetImageSize($Filename); list($width,$i,$u,$o) = $info_of_picture; return $width; } } class Products_Line{ // Die Align Funktion dieser Klasse ist nicht wirklich umfangreich. // Wenn ich mal Zeit habe, könnte man darangehen. // (Z.B. mit Wurzel automatisch gleichviele Elemente in Höhe und Breite // anordnen). function Products_Line($maxNumberOfProducts = 0, $case, $align, $Name, $Name_of_ImageFile, $Price, $number,$Discription, $Person_Name, $Street, $Town, $Phone, $Email, $Directory ) { // $maxNumberOfProducts ist da um evtl. ein maximum an products (pro Seite) // zu machen! if($case == 0) { $case = "1"; } if($case == "1") // all products will be given out, but as thumbs // DIE FORMATIERUNG MUSS NOCH AUTOMATISIERT WERDEN: // JETZT MACH ICH ERSTMAL STANDART AUSRICHTUNGEN!!! { $Interpreter = new _Data_of_Products; $Data_of_ConfigFile = $Interpreter->return_DataOfProducts_Array(); if($maxNumberOfProducts == 0) { $NumberOfProducts = count($Data_of_ConfigFile); } else { if($maxNumberOfProducts <= count($Data_of_ConfigFile)) { $NumberOfProducts = $maxNumberOfProducts; } else { $NumberOfProducts = count($Data_of_ConfigFile); } } $u = 0; $i = 0; // HIER BEGINNT DIE FPORMATIERUNG echo ""; while($u < $NumberOfProducts) { echo ""; while($i < 2 && $u < $NumberOfProducts) { echo ""; //Spacer!!! echo ""; $u++; $i++; } echo ""; $i = 0; } echo "
"; $Array_of_all_products[$u] = new _small_product ($Data_of_ConfigFile[$u][0], $Data_of_ConfigFile[$u][1],$Data_of_ConfigFile[$u][2], $Data_of_ConfigFile[$u][3],$Data_of_ConfigFile[$u][4]); echo " 
"; // ENDE DER FORMATIERUNG } elseif($case == "2") // one single large_product will be give out { $big_Product = new _large_product($Name, $Name_of_ImageFile, $Price, $number,$Discription); } elseif($case == "3") // Input to order via E-mail { // PRÜFEN OB'S SCHON VERKAUFT IST $input = new _shop_personal_input($Name, $Name_of_ImageFile, $Price, $number,$Discription, $Person_Name, $Street, $Town, $Phone, $Email); } elseif($case == "4") { /******************************************************** Hier muss der Anzahl der Produkte 1 Subtrahiert werden *********************************************************/ $Confirm = new _confirm_inputs($Name, $Name_of_ImageFile, $Price, $number,$Discription, $Person_Name, $Street, $Town, $Phone, $Email); } elseif($case == "5") { echo "
An dieser Stelle wird dann eine Bestellung aufgegeben. Hier endet der Onlinetest!"; // $Order = new _order_and_give_confirmation($Name, $Name_of_ImageFile, $Price, $number,$Discription, $Person_Name, $Street, $Town, $Phone, $Email); // AUFTRAGSAusführung.. } elseif($case == "10") { // Evtl. View large Picture File } } } class _order_and_give_confirmation{ function _order_and_give_confirmation($Name, $Name_of_ImageFile, $Price, $number,$Discription, $Person_Name, $Street, $Town, $Phone, $Email) { $Mail_Buyer = new Mailer($Email, NAME_OF_CONTACT_PERSON , SUBJECT_OF_CONFIRMATION_MAIL, $this-> _make_Mail_For_Buyer($Name, $Name_of_ImageFile, $Price, $number,$Discription, $Person_Name, $Street, $Town, $Phone, $Email)); if(TESTING == "YES") { $Mail_Seller = new Mailer("root", NAME_OF_CONTACT_PERSON , SUBJECT_OF_CONFIRMATION_MAIL, $this-> _make_Mail_For_Seller($Name, $Name_of_ImageFile, $Price, $number,$Discription, $Person_Name, $Street, $Town, $Phone, $Email)); } else { $Mail_Seller = new Mailer(EMAIL_OF_CONTACT_PERSON, NAME_OF_CONTACT_PERSON , SUBJECT_OF_CONFIRMATION_MAIL, $this-> _make_Mail_For_Seller($Name, $Name_of_ImageFile, $Price, $number,$Discription, $Person_Name, $Street, $Town, $Phone, $Email)); } echo "Die Bestellung wurde erfolgreich durchgeführt."; //zurück Button echo "
"; echo "\n"; echo "
\n"; } function _make_Mail_For_Buyer($Name, $Name_of_ImageFile, $Price, $number,$Discription, $Person_Name, $Street, $Town, $Phone, $Email) { $Mail_Content[0] = "Ihre Bestellung:\n"; $Mail_Content[count($Mail_Content)] = "Name: {$Person_Name}\n"; $Mail_Content[count($Mail_Content)] = "Straße: {$Street}\n"; $Mail_Content[count($Mail_Content)] = "Wohnort: {$Town}\n"; $Mail_Content[count($Mail_Content)] = "Telefon: {$Phone}\n"; $Mail_Content[count($Mail_Content)] = "E-Mail: {$Email}\n"; $Mail_Content[count($Mail_Content)] = "Produktname: {$Name}\n"; $Mail_Content[count($Mail_Content)] = "Beschreibung: {$Discription}\n"; $Mail_Content[count($Mail_Content)] = "Preis: {$Price} Euro\n"; $Mail_Content[count($Mail_Content)] = " "; $Mail_Content[count($Mail_Content)] = ADDITIONAL_TEXT_OF_CONFIRMATION_MAIL; $Mail_Content[count($Mail_Content)] = HEADER_OF_CONFIRMATION_MAIL; $Mail_Content[count($Mail_Content)] = "\n\n--- This is a automatically generated Email. No response please! ---" ; return $Mail_Content; } function _make_Mail_For_Seller($Name, $Name_of_ImageFile, $Price, $number,$Discription, $Person_Name, $Street, $Town, $Phone, $Email) { $Mail_Content[0] = "Es wurde eine Bestellung aufgegeben:\n"; $Mail_Content[count($Mail_Content)] = "Name: {$Person_Name}\n"; $Mail_Content[count($Mail_Content)] = "Straße: {$Street}\n"; $Mail_Content[count($Mail_Content)] = "Wohnort: {$Town}\n"; $Mail_Content[count($Mail_Content)] = "Telefon: {$Phone}\n"; $Mail_Content[count($Mail_Content)] = "E-Mail: {$Email}\n"; $Mail_Content[count($Mail_Content)] = "Bildname: {$Name}\n"; $Mail_Content[count($Mail_Content)] = "Beschreibung: {$Discription}\n"; $Mail_Content[count($Mail_Content)] = "Preis: {$Price} Euro\n"; return $Mail_Content; } } class _confirm_inputs{ function _proof_Personal_Data($Person_Name, $Street, $Town, $Phone, $Email) { // DIESE STELLE KANN NOCH MASSIV VERBESSERT WERDEN!!!! if($Person_Name == "") { echo "Dateneingabe fehlerhaft; Bitte überprüfen Sie Ihre Eingabe:"; echo "Name
"; } if($Street == "") { echo "Dateneingabe fehlerhaft; Bitte überprüfen Sie Ihre Eingabe:"; echo "Straße
"; } if($Town == "") { echo "Dateneingabe fehlerhaft; Bitte überprüfen Sie Ihre Eingabe:"; echo "Ort
"; } if($Phone == "") { echo "Dateneingabe fehlerhaft; Bitte überprüfen Sie Ihre Eingabe:"; echo "Telephon
"; } /* if($Email == "") { echo "Dateneingabe fehlerhaft; Bitte überprüfen Sie Ihre Eingabe:"; echo "E-Mail Adresse
"; } */ return 0; } function _confirm_inputs($Name, $Name_of_ImageFile, $Price, $number,$Discription, $Person_Name, $Street, $Town, $Phone, $Email) { $this->_proof_Personal_Data($Person_Name, $Street, $Town, $Phone, $Email); echo ""; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo "
Name: {$Person_Name}
Straße: {$Street}
Wohnort: {$Town}
Telefon: {$Phone}
E-Mail: {$Email}
   
Bildname: {$Name}
Beschreibung: {$Discription}
Preis: {$Price} Euro
"; //************************************************ /* VIELLEICHT HIER DES BILD KLEIN ANZEIGEN * *************************************************/ echo "
"; echo "
"; echo "
"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n\n"; echo "
\n\n"; echo "
\n"; echo "
"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n\n"; echo "
\n\n"; echo "
\n"; echo "
"; echo "\n"; echo "
\n"; echo "
"; } } // Private Klasse! Sie soll in einem Klassenarray // einer anderen Klasse deklariert werden class _small_product{ // Klasse die automatisch ein Produkt in HTML-Umgebung für Shopsysteme erstellt function _small_product( $Name, $Name_of_ImageFile, $Price, $number,$Discription) { $Scaled_Name = $this->_scale_Picture_File($Name_of_ImageFile); echo "\n{$Name}
\n"; echo "\n"; echo "\n
\n"; // Hier werden die Variablen der Textfile übergeben! echo "\n"; // HIER MUSS NATÜRLICH DER ORGINALNME ÜBERGEBEN WERDEN!!!! echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "
\n"; } function _scale_Picture_File($Name_of_ImageFile) { //copy(PICTURE_FILE_DIRECTORY . "/" . $Name_of_ImageFile, $Name_of_ImageFile); $pictureMOD = new pictureModificator; $Scaled_Name = $pictureMOD->scale_jpg_with_max_Height(PICTURE_FILE_DIRECTORY . "/" . $Name_of_ImageFile, 155, 0, $Name_of_ImageFile); return $Scaled_Name; } } class _shop_personal_input{ function _shop_personal_input ($Name, $Name_of_ImageFile, $Price, $number, $Discription, $Person_Name, $Street, $Town, $Phone, $Email) { // GEHT NICHT FEHLER SIEHE UnTEN: BEI GELEGENHEIT!!! // $Scaled_Name = $this->_scale_Picture_File($Name_of_ImageFile); echo "
"; echo ""; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
Name: 
Straße: 
PLZ und Wohnort: 
Telefonnummer: 
E-Mail: 

"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
"; echo "\n"; echo ""; echo ""; echo ""; // ZURÜCK echo "
"; // BEI GELEBENHEIT HIER DEN RÜCKSPRUNG DAS RICHTIGE BILD ANZEIGEN!!! /*echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; */ echo "\n"; echo "
\n"; echo "
"; /* echo "\n"; echo "
"; echo $Name . "
\n"; */ } // DER FEHLER LIEGT DARIN, DASS IM ÜBERGEBENEM DATEINAMEN DER PFAD // SCHON DRINSTECKT function _scale_Picture_File($Name_of_ImageFile) { //copy(PICTURE_FILE_DIRECTORY . "/" . $Name_of_ImageFile, $Name_of_ImageFile); $pictureMOD = new pictureModificator; $Scaled_Name = $pictureMOD->scale_jpg_with_max_Height($Name_of_ImageFile, 150, 0, $Name_of_ImageFile); return $Scaled_Name; } } class _large_product{ // Klasse die automatisch ein Produkt in HTML umgebung für Shopsysteme erstellt // Variablen $Name $Bild $Beschreibung $Preis und Anzahl werden vom // aufrufendem Element übergeben! function _large_product($Name, $Name_of_ImageFile, $Price ,$number, $Discription) { $Scaled_Name = $this->_scale_Picture_File($Name_of_ImageFile); $Name_of_ImageFile = PICTURE_FILE_DIRECTORY . "/" . $Name_of_ImageFile; //HIER MUSS DANN FORMULAR ZUM BESTELLEN HÄR!! echo "\n{$Name}
\n"; if(LINK_TO_ORIGINAL_PIC == "YES") { echo ""; echo "\n"; } else { echo ""; } echo "
"; // BRACUHTS DIE ANZAHL?????? // echo "
Anzahl: {$number} \n"; echo "Preis: {$Price} Euro
\n"; echo "{$Discription}
\n"; /************************************************ WIE LEITE ICH DAS AUF EINE ANDERE DATEI UM???? ************************************************/ /* VIEW LARGE PICTURE FILE echo "
"; echo "\n"; echo "
\n"; */ // BESTELLEN echo "\n"; // ZURÜCK echo "
"; echo "
\n"; echo "\n"; // HIER MUSS NATÜRLICH DER ORGINALNME ÜBERGEBEN WERDEN!!!! echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo ""; echo "
\n"; } function _scale_Picture_File($Name_of_ImageFile) { //unlink(PICTURE_FILE_DIRECTORY . "/" . $Name_of_ImageFile . SCALED_FILE_EXTENSION . ".jpg"); $pictureMOD = new pictureModificator; $Scaled_Name = $pictureMOD->scale_jpg_with_max_Height(PICTURE_FILE_DIRECTORY . "/" . $Name_of_ImageFile, 290, "LARGE", $Name_of_ImageFile); return $Scaled_Name; } } class _Data_of_Products{ function _Data_of_Products() { // Vielleicht sollte ich allgemein Protokoll Routinen schreiben. } function return_DataOfProducts_Array() //WICHTIG: DIESE FUNKTION GIBT EIN 2DIMENSIONALES DATA_Field zurück!!!!! { if(file_exists(PRODUCT_DATA_FILE)) { return $this->_interpret_Data_of_Product_DataTXT($this->_read_Data()); } else { if(file_exists(CRITICAL_ERROR_PRODUCT_DATA_FILE)) { $ALERT = new _eMail_Alert; } else { $this->_generate_new_Product_DataTXT(); // Diese Funktion muss eine neue ProduktDataText Datei // erstellen; // Diese Funktion wird auch aufgerufen werden, // wenn aus einem Fehler die Datei gelöscht wird. // HIER E-MAIL informations ROUTIENE $ALERT = new _eMail_Alert("Es wird versucht eine neue " . PRODUCT_DATA_FILE . " zu generieren!") ; } } } function _read_Data() { // Die Funktion übernimmt die Aufgabe die Data-Datei einzulesen // und Kommentare zu entfernen $FileReader = new Allround; $Data_of_File = $FileReader->read_File(PRODUCT_DATA_FILE); $i = count($Data_of_File); $u = 0; // Entfernt die Kommentare! while($u < $i) { $Data_of_File[$u] = ereg_replace("#.*$", " ", $Data_of_File[$u]); $u++; } // Entfernt Leere Zeilen aus der Datei! $Data_of_File = $FileReader->remove_empty_Strings_of_StringArray($Data_of_File); return $Data_of_File; } function _generate_new_Product_DataTXT() { $TheNewFile = new generator_for_Product_DataTXT(); } function _interpret_Data_of_Product_DataTXT($Data = 0) // Funktion splittet den noch Text String in ein Array um! // Jetzt kann man mit den Eigenschaften der Produkte arbeiten! { /* if($Data == 0) { die("Fehler bei der Interpretation der Product_Data.txt - Datei! Keine Produkte vorhanden!"); } else {*/ // Hier der eigentliche Teil zur Datei Analye!! $i = count($Data); $u = 0; $Data_to_Return = array(); while($u < $i) { $Data_to_Return[$u] = split("[|]",$Data[$u]); $u++; } $i = count($Data); $u = 0; $z = 0; while($u < $i) { while($z < 4) { $Data_to_Return[$u][$z] = ltrim($Data_to_Return[$u][$z]); $Data_to_Return[$u][$z] = rtrim($Data_to_Return[$u][$z]); $z++; } $z = 0; $u++; } //} return $Data_to_Return; } } class user_Shop_Interface{ // Die Funktionen stammen z.T. aus des Input_For_Data - Klassen // Sie sind hier aber angepasst und hätten eine "veralgemeinerung" der // Anderen Klassen meiner Meinung nach nicht gerechtfertigt! // (Um einer Vererbung zu ermöglichen) // var $Usual_Advise = "There are no advise rules implemented, yet. Please contact your web-programmer"; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!WRITE FUNKTION UMBAUEN!!!!!!!!!!!!!!!!! function _write_data($Line_Number, $Array_of_Data, $Name, $Image_name, $Price, $Number, $Description) { $Interpreter = new _Data_of_Products; $Generator = new generator_for_Product_DataTXT; $Replacer = new Allround; // AN DER STELLE IST MAL EINE TYPUMWANDLUNG NOTWENDIG !!!!! // ;-) MÖCHTE NOCH EINEN PHP PROGRAMMIERER ÜBER C LÄSSTERN HÖREN settype ($Line_Number, "integer"); // HIER WIRD DAS ENTSPRECHENDE 1.DIMENSIONS ARRAY VON ARRAY_OF_DATA // DURCH DIE NEUE INFORMATION ERSETZT -> UM DIE NEUE DATEI ZU SCHREIBEN! $Array_of_Data[$Line_Number] = array($Name, $Image_name, $Price, $Number, $Description); $Array_of_Data = $Generator->TwoDimension_to_OneDimension($Array_of_Data); // $Replacer->echo_Array_HTML($Array_of_Data); // $Replacer->write_File("Test.txt", $Array_of_Data); $Generator->make_new_Product_DataTXT($Array_of_Data); $Array_of_Data = $Interpreter->return_DataOfProducts_Array(); } function user_Shop_Interface($Case, $Line_Number, $Name, $Image_name, $Price, $Number, $Description, $Directory) { $Interpreter = new _Data_of_Products; $Array_of_Data = $Interpreter->return_DataOfProducts_Array(); //"{$Name} | {$Name_of_ImageFile} | {$Price} | {$number} | {$Discription}"; if($Case == 0) { $Case = "1"; } switch ($Case) { case "1": // Standartausgabe $this->_Data_filled_inputForData_ChooseOfAktion($Array_of_Data); break; case "2": // Datensatz verändern bzw. erstmal eintippen $this->_Data_filled_Line_Modificator($Line_Number, $Array_of_Data, $Name, $Image_name, $Price, $Number, $Description); break; case "3": // Werte eines Produktes ändern $this->_Data_filled_inputForData_Change_Value($Array_of_Data); break; case "4": // Product an ausgewählter Stelle hinzufügen $this->_Data_filled_inputForData_Add_Certain_Line($Array_of_Data); break; case "5": // Bilddatei hochladen // $this->_input_for_picture_Upload($ echo "Der Dateiupload ist momentan noch nicht implementiert!"; break; case "6": // (bestimmnten [logisch!]) Datensatz entfernen $this->_give_output_Select_a_Line($Array_of_Data, 10, 0); break; case "7": // Daten schreibem $this->_write_data($Line_Number, $Array_of_Data, $Name, $Image_name, $Price, $Number, $Description); $Array_of_Data = $Interpreter->return_DataOfProducts_Array(); // $this->_Data_filled_inputForData_ChooseOfAktion($Array_of_Data) break; case "8": // Add_Certain_Line schreiben! Die Daten wie bei zwei bekommen // und dann an einen Array Umsteller weitergeben (9) $this->_inputForData_Add_Line($Line_Number, $Array_of_Data, $Name, $Image_name, $Price, $Number, $Description); break; case "9": // Array Umsteller für 8 -> write Line // Danach Standartausgabe! $Generator = new generator_for_Product_DataTXT; $MOD = new Allround; if($Line_Number == 0 && $Array_of_Data[0] == 0) { // ÄUSSERST UNELEGANT: In der generator Klasse ist ein Fehler // in der Schleife beim Schreiben der neuen Produkt Datei: // es wird mit count gemacht; wenn hier kein Array // min 2 Elemente übergeben wird, wird $Generator->make_new_Product_DataTXT(array($this->_set_Data_to_DATA_FILE_settings($Name, $Image_name, $Price, $Number, $Description))); } else { $Array_of_Data_FIRSTDIMENSION = $Generator->TwoDimension_to_OneDimension($Array_of_Data); // $MOD->echo_Array($MOD->add_specific_Line_to_Array($Array_of_Data_FIRSTDIMENSION, $Number_of_Line, $this->_set_Data_to_DATA_FILE_settings($Name, $Image_name, $Price, $Number, $Description))); $Array_of_Data_FIRSTDIMENSION = $MOD->add_specific_Line_to_Array($Array_of_Data_FIRSTDIMENSION, $Number_of_Line, $this->_set_Data_to_DATA_FILE_settings($Name, $Image_name, $Price, $Number, $Description)); $Generator->make_new_Product_DataTXT($Array_of_Data_FIRSTDIMENSION); } $Array_of_Data = $Interpreter->return_DataOfProducts_Array(); $this->_Data_filled_inputForData_ChooseOfAktion($Array_of_Data); break; case "10": // DATENSATZ UMWANDELN UND LÖSCHEN; DANACH STANDARTAUSGABE $Generator = new generator_for_Product_DataTXT; $Array_of_Data_FIRSTDIMENSION = $Generator->TwoDimension_to_OneDimension($Array_of_Data); $Generator = new generator_for_Product_DataTXT; $Deleter = new Allround; $Generator->make_new_Product_DataTXT($Deleter->dismiss_specific_Line_of_Array($Array_of_Data_FIRSTDIMENSION,$Line_Number)); $Array_of_Data = $Interpreter->return_DataOfProducts_Array(); $this->_Data_filled_inputForData_ChooseOfAktion($Array_of_Data); } //$this->_back_button(); } function _inputForData_Add_Line($Line_Number, $Array_of_Data, $Name, $Image_name, $Price, $Number, $Description) { $this->_Modificate_ONE_NEW_Data_Line($Line_Number, $Array_of_Data, $Name, $Image_name, $Price, $Number, $Description); /*$Generator = new generator_for_Product_DataTXT; $Array_of_Data = $Generator->TwoDimension_to_OneDimension($Array_of_Data); $MOD = new Allround; //$MOD->echo_Array_HTML($Array_of_Data, $Line_Number,$this->_set_Data_to_DATA_FILE_settings($Name, $Image_name, $Price, $Number, $Description)); $MOD->write_File(TEMP_DATA, $Array_of_Data);*/ } function _Data_filled_inputForData_ChooseOfAktion($Array_of_Data) { $this->_echo_possible_actions(); $this->_give_output_of_DataFile($Array_of_Data); } function _Data_filled_inputForData_Change_Value($Array_of_Data) { $this->_give_output_Select_a_Line($Array_of_Data, 2); } function _Data_filled_inputForData_Add_Certain_Line($Array_of_Data) { $this->_give_output_Select_a_Line($Array_of_Data, 8, 1); } function _Data_filled_Line_Modificator($Line_Number, $Array_of_Data, $Name, $Image_name, $Price, $Number, $Description) { $this->_Modificate_ONE_Data_Line($Line_Number, $Array_of_Data, $Name, $Image_name, $Price, $Number, $Description); } function _set_Data_to_DATA_FILE_settings($Name, $Image_name, $Price, $Number, $Description) { return "{$Name}|{$Image_name}|{$Price}|{$Number}|{$Description}"; } function _Modificate_ONE_NEW_Data_Line($Line_Number, $Array_of_Data, $Name, $Image_name, $Price, $Number, $Description) { $The_Files = new Allround; $Option_Files = $The_Files->content_of_directory (PICTURE_FILE_DIRECTORY); echo "

"; echo ""; echo "\n"; echo "
Ändern Sie die gewünschten Werte ab
"; echo ""; echo "\n"; echo ""; echo ""; $this->_new_Output(1, "Name"); $this->_new_Output(0, "Image_name"); $this->_new_Output(0, "Price"); $this->_new_Output(0, "Number"); $this->_new_Output(0, "Description"); echo ""; $u = 0; if($Array_of_Data[0]==0) { echo "Es wird eine neue Produktreihe angelegt!"; echo ""; $this->_new_Input($Line_Number, 7, "", "Name",1 ); $this->_make_select_form("Image_name", $Option_Files, 0 ); $this->_new_Input($Line_Number, 5, "", "Price",1 ); $this->_new_Input($Line_Number, 5, "", "Number",1 ); $this->_new_Input($Line_Number, 25, "", "Description",1 ); echo "
\n"; $this->_back_button(); } else { while($u < count($Array_of_Data[0]) + 1) { //"{$Name} | {$Name_of_ImageFile} | {$Price} | {$number} | {$Discription}"; if($u == 0) { $this->_new_Input($Line_Number, 7, "", "Name",1 ); } elseif($u == 1) { // HIER SOLLTE MAN AUS EINEM RUNTERFAHRENDEM MENÜ, DAS // ALLE BILDER AUS DEM BILDER ORDNER GESPEICHERT HAT, // AUSWÄHLEN KÖNNEN!!!!!!!!!!!!!!!!!!!!!! $this->_make_select_form("Image_name", $Option_Files, 0 ); } elseif($u == 2) { $this->_new_Input($Line_Number, 5, "", "Price",1 ); } elseif($u == 3) { $this->_new_Input($Line_Number, 5, "", "Number",1 ); } elseif($u == 4) { $this->_new_Input($Line_Number, 25, "", "Description",1 ); } elseif($u == 5) { echo "\n"; $this->_back_button(); } else { echo "Es ist ein unerwarteter Fehler Aufgetreten, die Fehlerroutine wurde eingeleitet"; $Alert = new _eMail_Alert("Bei der Ausgabe der Config - Datei zum User_Interface ist wurde ein unerlaubter Wert im Data-Array festgestellt!"); } $u++; } } echo "
"; } function _Modificate_ONE_Data_Line($Line_Number, $Array_of_Data, $Name, $Image_name, $Price, $Number, $Description) { $The_Files = new Allround; $Option_Files = $The_Files->content_of_directory(PICTURE_FILE_DIRECTORY); echo "

"; echo ""; echo "\n"; echo "
Ändern Sie die gewünschten Werte ab
"; echo ""; echo "\n"; echo ""; echo ""; $u = 0; while($u < count($Array_of_Data[0]) + 1) { //"{$Name} | {$Name_of_ImageFile} | {$Price} | {$number} | {$Discription}"; if($u == 0) { $this->_new_Input($Line_Number, 7,$Array_of_Data[$Line_Number][$u], "Name" ); } elseif($u == 1) { $this->_make_select_form("Image_name", $Option_Files, $Array_of_Data[$Line_Number][$u] ); //$this->_new_Input($Line_Number, 10,$Array_of_Data[$Line_Number][$u], "Image_name" ); } elseif($u == 2) { $this->_new_Input($Line_Number, 5,$Array_of_Data[$Line_Number][$u], "Price" ); } elseif($u == 3) { $this->_new_Input($Line_Number, 5,$Array_of_Data[$Line_Number][$u], "Number" ); } elseif($u == 4) { $this->_new_Input($Line_Number, 25,$Array_of_Data[$Line_Number][$u], "Description" ); } elseif($u == 5) { echo "
\n"; $this->_back_button(); } else { echo "Es ist ein unerwarteter Fehler Aufgetreten, die Fehlerroutine wurde eingeleitet"; $Alert = new _eMail_Alert("Bei der Ausgabe der Config - Datei zum User_Interface ist wurde ein unerlaubter Wert im Data-Array festgestellt!"); } $u++; } echo "
"; } function _give_output_Select_a_Line($Array_of_Data, $Case, $Additional_Select_Box = 0) { $i = 0; $u = 0; echo "




"; echo ""; echo "\n"; echo ""; echo "\n"; if($Additional_Select_Box == 1) { while($i < count($Array_of_Data) + 1) { //"{$Name} | {$Name_of_ImageFile} | {$Price} | {$number} | {$Discription}"; while($u < count($Array_of_Data[0]) + 1) { if($u == 0) { $this->_new_Output(1,$Array_of_Data[$i][$u] ); } elseif($u == 1) { $this->_new_Output(0,$Array_of_Data[$i][$u] ); } elseif($u == 2) { $this->_new_Output(0, $Array_of_Data[$i][$u] ); } elseif($u == 3) { $this->_new_Output(0,$Array_of_Data[$i][$u] ); } elseif($u == 4) { $this->_new_Output(0,$Array_of_Data[$i][$u] ); } elseif($u == 5) { $this->_add_Modify_Button($i); } else { echo "Es ist ein unerwarteter Fehler Aufgetreten, die Fehlerroutine wurde eingeleitet"; $Alert = new _eMail_Alert("Bei der Ausgabe der Config - Datei zum User_Interface ist wurde ein unerlaubter Wert im Data-Array festgestellt!"); } $u++; } echo ""; $u = 0; $i++; } } else { while($i < count($Array_of_Data)) { //"{$Name} | {$Name_of_ImageFile} | {$Price} | {$number} | {$Discription}"; while($u < count($Array_of_Data[0]) + 1) { if($u == 0) { $this->_new_Output(1,$Array_of_Data[$i][$u] ); } elseif($u == 1) { $this->_new_Output(0,$Array_of_Data[$i][$u] ); } elseif($u == 2) { $this->_new_Output(0,$Array_of_Data[$i][$u] ); } elseif($u == 3) { $this->_new_Output(0,$Array_of_Data[$i][$u] ); } elseif($u == 4) { $this->_new_Output(0,$Array_of_Data[$i][$u] ); } elseif($u == 5) { $this->_add_Modify_Button($i); } else { echo "Es ist ein unerwarteter Fehler Aufgetreten, die Fehlerroutine wurde eingeleitet"; $Alert = new _eMail_Alert("Bei der Ausgabe der Config - Datei zum User_Interface ist wurde ein unerlaubter Wert im Data-Array festgestellt!"); } $u++; } echo ""; $u = 0; $i++; } } echo "\n"; echo "
NameBilddateinamePreisAnzahlBeschreibung"; echo ""; echo "
"; } function _give_output_of_DataFile($Array_of_Data) { $i = 0; $u = 0; echo ""; echo " "; echo ""; echo "\n"; while($i < count($Array_of_Data)) { //"{$Name} | {$Name_of_ImageFile} | {$Price} | {$number} | {$Discription}"; while($u < count($Array_of_Data[0]) + 1) { if($u == 0) { $this->_new_Output(1, $Array_of_Data[$i][$u] ); } elseif($u == 1) { $this->_new_Output(0, $Array_of_Data[$i][$u] ); } elseif($u == 2) { $this->_new_Output(0, $Array_of_Data[$i][$u] ); } elseif($u == 3) { $this->_new_Output(0, $Array_of_Data[$i][$u] ); } elseif($u == 4) { $this->_new_Output(0, $Array_of_Data[$i][$u] ); } elseif($u == 5) { // $this->_add_Modify_Button($i, MODIFY_TEXT); } else { echo "Es ist ein unerwarteter Fehler Aufgetreten, die Fehlerroutine wurde eingeleitet"; $Alert = new _eMail_Alert("Bei der Ausgabe der Config - Datei zum User_Interface ist wurde ein unerlaubter Wert im Data-Array festgestellt!"); } $u++; } echo ""; $u = 0; $i++; } echo "
Übersicht
NameBilddateinamePreisAnzahlBeschreibung
"; } function _add_Modify_Button($Line_Number) { echo "\n"; } function _echo_possible_actions() { echo "
"; echo "
\n"; echo ""; // Bild hochladen echo ""; // Datensatz löschen echo ""; // HIER NOCH WEITERE OPTIONEN EINFÜGEN: // echo ""; echo "
"; // Bestehende Daten abändern echo ""; echo "Datensatz verändern"; // Neuen Datensatz hinzufügen echo ""; echo "Neues Produkt hinzufügen"; echo "Bild hochladen"; echo "Datensatz löschen"; // echo "Bild hochladen
"; echo "
\n"; echo "

"; } function _write_data_to_file($Array_of_Data, $Line_Number, $Name, $Image_name, $Price, $Number, $Description) { $Replacer = new Allround; // AN DER STELLE IST MAL EINE TYPUMWANDLUNG NOTWENDIG !!!!! // ;-) MÖCHTE NOCH EINEN PHP PROGRAMMIERER ÜBER C LÄSSTERN HÖREN settype ($Line_Number, "integer"); $Array_of_Data[$Line_Number] = array($Name, $Image_name, $Price, $Number, $Description); $Array_of_Data = $Generator->TwoDimension_to_OneDimension($Array_of_Data); $Generator->make_new_Product_DataTXT($Array_of_Data); $Array_of_Data = $Interpreter->return_DataOfProducts_Array(); } // Funktionsreihe von INPUT Form Feldern! function _echo_case($Case) { echo ""; } function _echo_line_Number($Line_Number) { echo ""; } function _new_Output($tableBegin = 0, $value) { // Damits auch symetrisch ist // echo "\n"; if($tableBegin == 1) { echo " {$value}\n"; } else { echo " {$value}\n"; } } function _new_Input($Line_Number, $sizeOfFields, $value, $name, $NOT_JUST_WRITE = 0) { // Damits auch symetrisch ist if($NOT_JUST_WRITE == 0) { echo "\n"; } else { echo "\n"; } } function _back_button() { // Zurück Button: Übergibt keine Variablen! echo "
"; } function _make_select_form($name, $array_of_content, $optional_first_entry) { // DIE STRINGS SO DURCHSUCHEN, DASS _SCALED DATEIEN AUSGESCHLOSSEN // WERDEN!!!!!!!!!!!!!!! $u=0; echo ""; } } class generator_for_Product_DataTXT{ // ICH DENK MIR DAS SO: EINE SEITE DIE DANN DIE VERSCHIEDENEN ELEMENTE // IN DER CONFIG DATEI ANZEIGT UND SICH AUCH SELBST WIEDER AUFRUFEN KANN // ( Z.B. UM AN EINER BESTIEMMTEN STELLE ETWAS EINZUFÜGEN) // DAS WIRD DIE KLASSE: USER_SHOP_INTERFACE function generator_for_Product_DataTXT() { //echo "new Generator für die Product_Data Datei!"; } function make_new_Product_DataTXT($Array_of_content = 0) { // HIER DEN CODE ZUR GENERIERUNG EINER NEUEN, LEEREN DATEI! $Text_of_File[0] = "# " . PRODUCT_DATA_FILE . " Konfigurationsfile"; $Text_of_File[count($Text_of_File)] = "# PLEASE DO NOT CHANGE THIS FILE"; if($Array_of_content != 0) { $i = count($Array_of_content); $u = 0; //********************************************************* //********************************************************* //****************EVTL. MUSS DAS = WEG ******************** //********************************************************* //********************************************************* while($u <= $i) { $Text_of_File[count($Text_of_File)] = $Array_of_content[$u]; $u++; } } $File_Writer = new Allround; $File_Writer->write_File(PRODUCT_DATA_FILE, $Text_of_File); } function TwoDimension_to_OneDimension($TwoDimension_Array) { // Wandelt ein Data Array (das Daten für das Produkt-File enthält) // in Daten um, die von der writeFile Funktion verwendet werden können $Return_Array = array(); $i = count($TwoDimension_Array); $u = 0; while($u < $i) { $Return_Array[$u] = $TwoDimension_Array[$u][0] . "|" . $TwoDimension_Array[$u][1] . "|" . $TwoDimension_Array[$u][2] . "|" . $TwoDimension_Array[$u][3] . "|" . $TwoDimension_Array[$u][4]; $u++; } return $Return_Array; } function add_item($Name = "PM-VX11", $Name_of_ImageFile, $Price ,$number, $Discription) { // Fügt einfach an die letzte Zeile einen Eintrag dran // es MUSS eine Name - Variable übergeben werden if($Name == "PM-VX11") { $Alert = new _eMail_Alert("Es sollte ein Item hinzugefügt werden, aber es wurde keine Daten übergeben: add_item"); echo "Es ist ein Fehler aufgetreten, die Fehlerroutine wurde eingeleitet!"; return 0; } else { $File_Writer = new Allround; if(!file_exists(PRODUCT_DATA_FILE)) { $ALERT = new _eMail_Alert("Es wird versucht eine neue " . PRODUCT_DATA_FILE . " zu generieren!") ; $this->make_new_Product_DataTXT(); } $content_of_DATA_FILE = $File_Writer->read_File(PRODUCT_DATA_FILE); $content_of_DATA_FILE[count($content_of_DATA_FILE)] = "{$Name} | {$Name_of_ImageFile} | {$Price} | {$number} | {$Discription}"; $File_Writer->write_File(PRODUCT_DATA_FILE, $content_of_DATA_FILE); } } function dismiss_specific_item($Number_of_Line = 0) { // Um dem Arrayproblem zu begegnen (im dunkelm) wird die Nummer der // Zeile auf die Null des Arrays angepasst. if($Number_of_Line == 0) { $Alert = new _eMail_Alert("Es sollte ein Item entfernt werden, aber es wurde keine Number_of_Line angegeben: dismiss_specific_item"); echo "Es ist ein Fehler aufgetreten, die Fehlerroutine wurde eingeleitet!"; return 0; } else { $Number_of_Line--; $Remover = new Allround; $Reader = new _Data_of_Products; $Data_File = $Reader->_read_Data(); $Data_File = $Remover->dismiss_specific_Line_of_Array($Data_File, $Number_of_Line); $this->make_new_Product_DataTXT($Data_File); } } function add_specific_item($Number_of_Line = 0, $Name = "PM-VX11", $Name_of_ImageFile, $Price ,$number, $Discription) { // !!!!!!!!!!!!!!!!!TODO: ZUM LAUFEN BRINGEN!!!!!!!!!!!!!!!!!!!!!! // HIER CODE UM EIN (1) BESTIMMTES(!) PRODUKT HINZUZUFÜGEN // Ich benutze die Funktion die gleich die Kommentare und Leerzeilen // ignoriert -> zwei Klassendeklarationen erforderlich // es MUSS eine Name - Variable übergeben werden if($Name == "PM-VX11") { $Alert = new _eMail_Alert("Es sollte ein Item hinzugefügt werden, aber es wurde keine Daten übergeben: add_specific_item/Name"); echo "Es ist ein Fehler aufgetreten, die Fehlerroutine wurde eingeleitet!"; return 0; } elseif($Number_of_Line == 0) { $Alert = new _eMail_Alert("Es sollte ein Item hinzugefügt werden, aber es wurde keine Daten übergeben: add_specific_item/Number_of_Line"); echo "Es ist ein Fehler aufgetreten, die Fehlerroutine wurde eingeleitet!"; return 0; } else { $Number_of_Line--; $File_Writer = new Allround; if(!file_exists(PRODUCT_DATA_FILE)) { $ALERT = new _eMail_Alert("Es wird von versucht eine neue " . PRODUCT_DATA_FILE . " zu generieren!") ; $this->make_new_Product_DataTXT(); } $Reader = new _Data_of_Products; $Data_File = $Reader->_read_Data(); $Data_File = $File_Writer->add_specific_Line_to_Array($Data_File, $Number_of_Line, "{$Name} | {$Name_of_ImageFile} | {$Price} | {$number} | {$Discription}"); $this->make_new_Product_DataTXT($Data_File); } } } class _eMail_Alert{ function _eMail_Alert($Message_to_Send) { $Date = new Allround; $Message[0] = "*************************************************"; $Message[count($Message)] = "* This is a automaticlly generated Error-Mail *"; $Message[count($Message)] = "*************************************************"; $Message[count($Message)] = "" ; $Message[count($Message)] = "\t" . $Date->give_out_Date(); $Message[count($Message)] = ""; $Message[count($Message)] = ""; $Message[count($Message)] = "Ort der Fehlermeldung:"; $Message[count($Message)] = ""; $Message[count($Message)] = LOCATION_OF_MAIL; $Message[count($Message)] = ""; $Message[count($Message)] = "Diese Nachricht wurde von der Prozedur übergeben,"; $Message[count($Message)] = "die den Fehler verursacht hat:"; $Message[count($Message)] = ""; $Message[count($Message)] = ""; $Message[count($Message)] = "{$Message_to_Send}"; $Message[count($Message)] = ""; $Message[count($Message)] = "************************************************"; $Message[count($Message)] = "* End of Message *"; $Message[count($Message)] = "************************************************"; $mailer = new Mailer(EMAIL_FOR_ERRORS,LOCATION_OF_MAIL,"Error in Shopsystem @ :" . LOCATION_OF_MAIL,$Message); } } ?>