/** * Create and setup QListBox lstGroupRegistrationsesAsGroupstructure * @param string $strControlId optional ControlId to use * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query * @return QListBox */ public function lstGroupRegistrationsesAsGroupstructure_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null) { $this->lstGroupRegistrationsesAsGroupstructure = new QListBox($this->objParentObject, $strControlId); $this->lstGroupRegistrationsesAsGroupstructure->Name = QApplication::Translate('Group Registrationses As Groupstructure'); $this->lstGroupRegistrationsesAsGroupstructure->SelectionMode = QSelectionMode::Multiple; // We need to know which items to "Pre-Select" $objAssociatedArray = $this->objGrowthGroupStructure->GetGroupRegistrationsAsGroupstructureArray(); // Setup and perform the Query if (is_null($objCondition)) { $objCondition = QQ::All(); } $objGroupRegistrationsCursor = GroupRegistrations::QueryCursor($objCondition, $objOptionalClauses); // Iterate through the Cursor while ($objGroupRegistrations = GroupRegistrations::InstantiateCursor($objGroupRegistrationsCursor)) { $objListItem = new QListItem($objGroupRegistrations->__toString(), $objGroupRegistrations->Id); foreach ($objAssociatedArray as $objAssociated) { if ($objAssociated->Id == $objGroupRegistrations->Id) { $objListItem->Selected = true; } } $this->lstGroupRegistrationsesAsGroupstructure->AddItem($objListItem); } // Return the QListControl return $this->lstGroupRegistrationsesAsGroupstructure; }
<?php require dirname(__FILE__) . '/../../includes/prepend.inc.php'; QApplication::Authenticate(); // Disable strict no-cache for IE due to IE issues with downloading no-cache items if (QApplication::IsBrowser(QBrowserType::InternetExplorer)) { header("Pragma:"); header("Expires:"); } header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename=gg_registrations.csv'); print "First Name,Last Name,E-mail,Address,City,Zip Code,Date Received,Preferred Location 1, Preferred Location 2, Requested Group Role, Requested Group Types, Requested Group Days, Source, Processed,Groups Placed, Placement Date\r\n"; $objGroupRegistrantCursor = GroupRegistrations::QueryCursor(QQ::All()); function EscapeCsv($strString) { return '"' . str_replace('"', '""', $strString) . '"'; } while ($objGroupRegistrant = GroupRegistrations::InstantiateCursor($objGroupRegistrantCursor)) { print EscapeCsv($objGroupRegistrant->FirstName); print ","; print EscapeCsv($objGroupRegistrant->LastName); print ","; print EscapeCsv($objGroupRegistrant->Email); print ","; print EscapeCsv($objGroupRegistrant->Address); print ","; print EscapeCsv($objGroupRegistrant->City); print ","; print EscapeCsv($objGroupRegistrant->Zipcode); print ","; print EscapeCsv($objGroupRegistrant->DateReceived->ToString('M/D/YYYY'));