\n";
$list .= $c;
}
}
$t = new Template(CMS_TEMPLATE_DIR."customerlist2.html");
$t->setVar("CUSTOMERS", $list);
$t->setVar("COUNT", mysql_num_rows($result));
return $t->toString();
}
/** @see CmsObject::handleAction()
*/
//---------------------------------------------
function handleAction($action, $position=0, $type=NULL){
//---------------------------------------------
switch($action){
case "download_complete_all":
$this->doUpdateExportDate("complete only (all)");
$this->doDownload("complete only", false);
break;
case "download_complete_new":
$this->doUpdateExportDate("complete only (new)");
$this->doDownload("complete only", true);
break;
case "download_all":
$this->doUpdateExportDate("all (all)");
$this->doDownload("all", false);
break;
case "deleteCustomer":
$this->doDeleteCustomer($position);
break;
}
}
/** @see CmsObject::getCssClass()
*/
//-----------------------------------------------
function getCssClass(){
//-----------------------------------------------
return "itemCustomers";
}
// === ADDITIONAL METHODS ================================================================= //
/** offers an exported csv file for download
* @param data type of download data
* @param new true, if only newly added data (since last download)
* @warning: EXITS THE PHP SCRIPT!
*/
//-----------------------------------------------
function doDownload($data, $new){
//-----------------------------------------------
//download only customers with complete address data
if($data == "complete only"){
$customers = "
";
$customers .= "
";
$customers .= "
Vorname
";
$customers .= "
Nachname
";
$customers .= "
Adresse
";
$customers .= "
PLZ
";
$customers .= "
Ort
";
$customers .= "
";
if($new){
$query = sprintf("SELECT * FROM bruckm_ticketcustomer
WHERE creationDate > %s
AND surname != '' AND firstname != '' AND address != '' AND zip != NULL AND city != ''
ORDER BY surname ASC, firstname ASC",
sqlstring($this->lastExportDate));
}
else{
$query = sprintf("SELECT * FROM bruckm_ticketcustomer
WHERE surname != '' AND firstname != '' AND address != '' AND zip IS NOT NULL AND city != ''
ORDER BY surname ASC, firstname ASC");
}
$result = dbQuery($query);
while($line = mysqli_fetch_array($result, MYSQLI_ASSOC)){
$customers .= "
";
//load genres
$query = sprintf("SELECT id,name FROM bruckm_index WHERE class = 'TicketGenre' ORDER BY name ASC");
$result = dbQuery($query);
while($line = mysqli_fetch_array($result, MYSQLI_ASSOC)){
$genres[] = $line['id'];
$customers .= "
$line[name]
";
}
$customers .= "
";
//load customers
$query = sprintf("SELECT * FROM bruckm_ticketcustomer ORDER BY surname ASC, firstname ASC");
$result = dbQuery($query);
while($line = mysqli_fetch_array($result, MYSQLI_ASSOC)){
$customers .= "