#!/usr/bin/php -q
Test keyTest value"));
//print_r(processLine("Test p
"));
	
	$entries = array("Surname" => array("Test keyTest value"),"Given name" => array("Test p
"),"User quotas" => array("User quotasMountpoint | Soft block | Soft inode | Hard block | Hard inode"," | /usr | 10 | 100 | 15 | 150"));
	$structure = getStructure(array("User"));
	$structure = $structure['User'];
	$pdf = new LamPDF("User");
	
	// Loop over each account and add a new page in the PDF file for it 
		// Start a new page for each account
		$pdf->AddPage();
		
		// Get PDF entries for the current account
		//$entries = $account->get_pdfEntries($account_type);
		
		// Now create the PDF file acording to the structure with the submitted values 
		foreach($structure as $entry) {
			// We have a new section to start
			$name = $entry['attributes']['NAME'];
			if($entry['tag'] == "SECTION" && $entry['type'] == "open") {
				if(preg_match("/^\_[a-z]+/",$name)) {
					$section_headline = $entries[ucwords(substr($name,1))][0];
				}
				else {
					$section_headline = $name;
				}
				$pdf->setFont("arial","B",12);
				$pdf->Write(5,"- " . _($section_headline) . ":");
				$pdf->Ln(6);
			}
			// We have a section to end
			elseif($entry['tag'] == "SECTION" && $entry['type'] == "close") {
				$pdf->Ln(9);
			}
			// We have to include a static text.
			elseif($entry['tag'] == "TEXT") {
				
			}
			// We have to include an entry from the account
			elseif($entry['tag'] == "ENTRY") {
				// Get current entry
				$entry = $entries[$name];
				
				// Loop over all rows of this entry (most of the time this will be just one)
				if($entry != null) {
				foreach($entry as $line) {
					// Substitue XML syntax with valid FPDF methods
					$methods = processLine($line);
					// Call every method
					foreach($methods as $method) {
						call_user_method_array	($method[0],$pdf,$method[1]);
					}
				}
				$key = false;
				}
			}
		}
		$pdf->Close();
		$pdf->Output('/home/md/workspace/lam/tests/test.pdf','F');
?> |