public static function reportBlueprintWithQuery($queryStr, $row_id_key = "", $name = "Untitled")
 {
     // Instantiate an empty ReportBlueprint
     $bp = new ReportBlueprint("reportBlueprintWithQuery");
     $bp->setName($name);
     $bp->setQuery($queryStr);
     $bp->setRowIdKey($row_id_key);
     return $bp;
 }
 private static function parseReportBlueprint($xml)
 {
     $blueprint = new ReportBlueprint((string) $xml['key']);
     $blueprint->setName((string) $xml['name']);
     $blueprint->setRowIdKey((string) $xml['rowIdKey']);
     $blueprint->setQuery((string) $xml->query);
     // list fields (double as report fields)
     foreach ($xml->field as $f) {
         $field = new ListField((string) $f['key']);
         $field->setDisplayName((string) $f->displayName);
         $field->setFormat((string) $f->format);
         $field->setHref((string) $f->href);
         $blueprint->add($field);
     }
     return $blueprint;
 }
echo "<h1>Testing ReportDrafter</h1>";
$reportBP = ReportBlueprint::reportBlueprintWithQuery("SELECT * FROM Member", "id", "MemberList");
$drafter = new ReportDrafter($reportBP);
echo $drafter->render();
/*
// #2
*/
echo "<h1>Testing ReportTableDrafter</h1>";
$reportBP = ReportBlueprint::reportBlueprintWithQuery("SELECT * FROM Member", "id", "MemberList");
$drafter = new ReportTableDrafter($reportBP);
echo $drafter->render();
/*
// #3
*/
echo "<h1>Testing ReportTableDrafter with Specific Fields</h1>";
$reportBP = ReportBlueprint::reportBlueprintWithQuery("SELECT * FROM Member", "id", "MemberList");
$login = new ListField("login");
$login->setDisplayName("Login");
$reportBP->add($login);
$passwd = new ListField("passwd");
$passwd->setDisplayName("Secret Key");
$passwd->setFormat("password");
$reportBP->add($passwd);
$email = new ListField("email");
$email->setDisplayName("Email Address");
$email->setHref("/admin/members/send-email.php?id={id}");
$reportBP->add($email);
$params = array();
$params["order"] = "modified DESC";
$params["where"] = "login IS NOT NULL";
$actions = array();