From 49f078c8fc55f4005c1b4182aabe36d6dd16e34e Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Mon, 13 Mar 2023 20:01:34 -0600 Subject: [PATCH] Update member report --- lib/mkmemberdirectory.php | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/mkmemberdirectory.php b/lib/mkmemberdirectory.php index 91d3766..2b05c6e 100644 --- a/lib/mkmemberdirectory.php +++ b/lib/mkmemberdirectory.php @@ -153,12 +153,10 @@ END; $header = $phpWord->addSection(["paperSize" => "Letter", 'marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600]); $header->addTitle("HACHE Member Directory\n", 1); - $updated = $header->addTextRun(); - $updated->addText("Updated: ", ['bold' => true]); - $updated->addText("$date"); - $iconkey = $header->addTextRun(); - $iconkey->addText("Icon key: ", ['bold' => true]); - $iconkey->addText("●: Graduated student | ►: Photo permission denied"); + $header->addText("Updated: ", ['bold' => true]); + $header->addText("$date"); + $header->addText("Icon key: ", ['bold' => true]); + $header->addText("●: Graduated student | ►: Photo permission denied"); $header->addText($Strings->get("You agree to use the information in this directory for homeschool use ONLY. All other purposes, such as soliciting, is strictly prohibited.", false)); $header->addTextBreak(2); @@ -178,21 +176,28 @@ END; $famtext->addText("►"); } $famtext->addText($f->getName(), ['bold' => true]); - $famtext->addText(", " . $f->getFather() . " and " . $f->getMother()); - $body->addText($f->getAddress() . ", " . $f->getCity() . ", " . $f->getState() . " " . $f->getZip()); - $links = $body->addTextRun(); - $links->addLink("tel:" . $f->getPhone(), $f->getPhone()); - $links->addText(" "); - $links->addLink("mailto:" . $f->getEmail(), $f->getEmail()); + if (!empty($f->getFather()) && !empty($f->getMother())) { + $famtext->addText(", " . $f->getFather() . " and " . $f->getMother()); + } else if (!empty($f->getFather())) { + $famtext->addText(", " . $f->getFather()); + } else if (!empty($f->getMother())) { + $famtext->addText(", " . $f->getMother()); + } + $famtext = $body->addTextRun(); + $famtext->addText($f->getAddress() . ", " . $f->getCity() . ", " . $f->getState() . " " . $f->getZip()); + $famtext = $body->addTextRun(); + $famtext->addLink("tel:" . $f->getPhone(), $f->getPhone()); + $famtext->addText(" "); + $famtext->addLink("mailto:" . $f->getEmail(), $f->getEmail()); foreach ($f->getChildren() as $child) { - $chtext = $body->addTextRun(["indent" => 1440]); + $famtext = $body->addTextRun(); if ($child->isGraduated()) { - $chtext->addText(" ● "); + $famtext->addText(" ● "); } else { - $chtext->addText(" "); + $famtext->addText(" "); } - $chtext->addText($child->getName() . ", " . date("M y", $child->getBirthday())); + $famtext->addText($child->getName() . ", " . date("M y", $child->getBirthday())); } $body->addTextBreak(1); }