/**
  * Returns a list of WCFSetup resources.
  * 
  * @return	array<array>
  */
 protected function getResources()
 {
     $cache = $this->getCache('wcfSetupResource', 'WcfSetupResource');
     $resources = array(array('label' => '', 'path' => ''));
     $sourceList = new SourceList();
     $sourceList->sqlConditions = "source.sourceID IN (" . implode(',', WCF::getUser()->getAccessibleSourceIDs()) . ")";
     $sourceList->sqlLimit = 0;
     $sourceList->readObjects();
     foreach ($sourceList->getObjects() as $source) {
         if (!isset($cache[$source->sourceID])) {
             continue;
         }
         foreach ($cache[$source->sourceID] as $resource) {
             $resources[] = array('label' => $source->name . ' :: ' . FileUtil::getRelativePath($source->sourceDirectory, $resource), 'path' => $resource);
         }
     }
     return $resources;
 }
 /**
  * @see	Page::readData()
  */
 public function readData()
 {
     parent::readData();
     // get accessible sources
     $sourceList = new SourceList();
     $sourceList->sqlLimit = 0;
     $sourceList->hasAccessCheck = true;
     $sourceList->readObjects();
     foreach ($sourceList->getObjects() as $source) {
         $this->accessibleSources[] = $source->sourceID;
         $cache = $this->getCache('packages-' . $source->sourceID, 'Packages');
         foreach ($cache['packages'] as $package) {
             if (!in_array($package['packageName'], $this->packages[$package['packageType']])) {
                 $this->packages[$package['packageType']][] = $package['packageName'];
             }
         }
     }
     sort($this->packages['plugin'], SORT_STRING);
     sort($this->packages['standalone'], SORT_STRING);
 }
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @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 void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = SourceList::QueryCount($objCondition, $objClauses);
     }
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from SourceList, given the clauses above
     $this->DataSource = SourceList::QueryArray($objCondition, $objClauses);
 }
 /**
  * Refresh this MetaControl with Data from the local GroupRegistrations object.
  * @param boolean $blnReload reload GroupRegistrations from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objGroupRegistrations->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objGroupRegistrations->Id;
         }
     }
     if ($this->lstSourceList) {
         $this->lstSourceList->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstSourceList->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objSourceListArray = SourceList::LoadAll();
         if ($objSourceListArray) {
             foreach ($objSourceListArray as $objSourceList) {
                 $objListItem = new QListItem($objSourceList->__toString(), $objSourceList->Id);
                 if ($this->objGroupRegistrations->SourceList && $this->objGroupRegistrations->SourceList->Id == $objSourceList->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSourceList->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSourceListId) {
         $this->lblSourceListId->Text = $this->objGroupRegistrations->SourceList ? $this->objGroupRegistrations->SourceList->__toString() : null;
     }
     if ($this->calDateReceived) {
         $this->calDateReceived->DateTime = $this->objGroupRegistrations->DateReceived;
     }
     if ($this->lblDateReceived) {
         $this->lblDateReceived->Text = sprintf($this->objGroupRegistrations->DateReceived) ? $this->objGroupRegistrations->__toString($this->strDateReceivedDateTimeFormat) : null;
     }
     if ($this->txtFirstName) {
         $this->txtFirstName->Text = $this->objGroupRegistrations->FirstName;
     }
     if ($this->lblFirstName) {
         $this->lblFirstName->Text = $this->objGroupRegistrations->FirstName;
     }
     if ($this->txtLastName) {
         $this->txtLastName->Text = $this->objGroupRegistrations->LastName;
     }
     if ($this->lblLastName) {
         $this->lblLastName->Text = $this->objGroupRegistrations->LastName;
     }
     if ($this->txtGender) {
         $this->txtGender->Text = $this->objGroupRegistrations->Gender;
     }
     if ($this->lblGender) {
         $this->lblGender->Text = $this->objGroupRegistrations->Gender;
     }
     if ($this->txtAddress) {
         $this->txtAddress->Text = $this->objGroupRegistrations->Address;
     }
     if ($this->lblAddress) {
         $this->lblAddress->Text = $this->objGroupRegistrations->Address;
     }
     if ($this->txtPhone) {
         $this->txtPhone->Text = $this->objGroupRegistrations->Phone;
     }
     if ($this->lblPhone) {
         $this->lblPhone->Text = $this->objGroupRegistrations->Phone;
     }
     if ($this->txtEmail) {
         $this->txtEmail->Text = $this->objGroupRegistrations->Email;
     }
     if ($this->lblEmail) {
         $this->lblEmail->Text = $this->objGroupRegistrations->Email;
     }
     if ($this->txtComments) {
         $this->txtComments->Text = $this->objGroupRegistrations->Comments;
     }
     if ($this->lblComments) {
         $this->lblComments->Text = $this->objGroupRegistrations->Comments;
     }
     if ($this->lstGroupRole) {
         $this->lstGroupRole->RemoveAllItems();
         $this->lstGroupRole->AddItem(QApplication::Translate('- Select One -'), null);
         $objGroupRoleArray = GroupRole::LoadAll();
         if ($objGroupRoleArray) {
             foreach ($objGroupRoleArray as $objGroupRole) {
                 $objListItem = new QListItem($objGroupRole->__toString(), $objGroupRole->Id);
                 if ($this->objGroupRegistrations->GroupRole && $this->objGroupRegistrations->GroupRole->Id == $objGroupRole->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstGroupRole->AddItem($objListItem);
             }
         }
     }
     if ($this->lblGroupRoleId) {
         $this->lblGroupRoleId->Text = $this->objGroupRegistrations->GroupRole ? $this->objGroupRegistrations->GroupRole->__toString() : null;
     }
     if ($this->txtPreferredLocation1) {
         $this->txtPreferredLocation1->Text = $this->objGroupRegistrations->PreferredLocation1;
     }
     if ($this->lblPreferredLocation1) {
         $this->lblPreferredLocation1->Text = $this->objGroupRegistrations->PreferredLocation1;
     }
     if ($this->txtPreferredLocation2) {
         $this->txtPreferredLocation2->Text = $this->objGroupRegistrations->PreferredLocation2;
     }
     if ($this->lblPreferredLocation2) {
         $this->lblPreferredLocation2->Text = $this->objGroupRegistrations->PreferredLocation2;
     }
     if ($this->txtCity) {
         $this->txtCity->Text = $this->objGroupRegistrations->City;
     }
     if ($this->lblCity) {
         $this->lblCity->Text = $this->objGroupRegistrations->City;
     }
     if ($this->txtZipcode) {
         $this->txtZipcode->Text = $this->objGroupRegistrations->Zipcode;
     }
     if ($this->lblZipcode) {
         $this->lblZipcode->Text = $this->objGroupRegistrations->Zipcode;
     }
     if ($this->txtGroupDay) {
         $this->txtGroupDay->Text = $this->objGroupRegistrations->GroupDay;
     }
     if ($this->lblGroupDay) {
         $this->lblGroupDay->Text = $this->objGroupRegistrations->GroupDay;
     }
     if ($this->txtGroupsPlaced) {
         $this->txtGroupsPlaced->Text = $this->objGroupRegistrations->GroupsPlaced;
     }
     if ($this->lblGroupsPlaced) {
         $this->lblGroupsPlaced->Text = $this->objGroupRegistrations->GroupsPlaced;
     }
     if ($this->calDateProcessed) {
         $this->calDateProcessed->DateTime = $this->objGroupRegistrations->DateProcessed;
     }
     if ($this->lblDateProcessed) {
         $this->lblDateProcessed->Text = sprintf($this->objGroupRegistrations->DateProcessed) ? $this->objGroupRegistrations->__toString($this->strDateProcessedDateTimeFormat) : null;
     }
     if ($this->chkProcessedFlag) {
         $this->chkProcessedFlag->Checked = $this->objGroupRegistrations->ProcessedFlag;
     }
     if ($this->lblProcessedFlag) {
         $this->lblProcessedFlag->Text = $this->objGroupRegistrations->ProcessedFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->lstGrowthGroupStructuresAsGroupstructure) {
         $this->lstGrowthGroupStructuresAsGroupstructure->RemoveAllItems();
         $objAssociatedArray = $this->objGroupRegistrations->GetGrowthGroupStructureAsGroupstructureArray();
         $objGrowthGroupStructureArray = GrowthGroupStructure::LoadAll();
         if ($objGrowthGroupStructureArray) {
             foreach ($objGrowthGroupStructureArray as $objGrowthGroupStructure) {
                 $objListItem = new QListItem($objGrowthGroupStructure->__toString(), $objGrowthGroupStructure->Id);
                 foreach ($objAssociatedArray as $objAssociated) {
                     if ($objAssociated->Id == $objGrowthGroupStructure->Id) {
                         $objListItem->Selected = true;
                     }
                 }
                 $this->lstGrowthGroupStructuresAsGroupstructure->AddItem($objListItem);
             }
         }
     }
     if ($this->lblGrowthGroupStructuresAsGroupstructure) {
         $objAssociatedArray = $this->objGroupRegistrations->GetGrowthGroupStructureAsGroupstructureArray();
         $strItems = array();
         foreach ($objAssociatedArray as $objAssociated) {
             $strItems[] = $objAssociated->__toString();
         }
         $this->lblGrowthGroupStructuresAsGroupstructure->Text = implode($strGlue, $strItems);
     }
 }
Example #5
0
 public function btnSubmit_Click($strFormId, $strControlId, $strParameter)
 {
     $this->objGroupRegistration->DateReceived = new QDateTime(QDateTime::Now);
     $this->objGroupRegistration->FirstName = $this->txtFirstName->Text;
     $this->objGroupRegistration->LastName = $this->txtLastName->Text;
     $this->objGroupRegistration->Address = $this->txtAddress->Text;
     $this->objGroupRegistration->City = $this->txtCity->Text;
     $this->objGroupRegistration->Zipcode = $this->txtZipCode->Text;
     $this->objGroupRegistration->Email = $this->txtEmail->Text;
     $this->objGroupRegistration->Phone = $this->txtPhoneNumber->Text;
     $this->objGroupRegistration->Comments = $this->txtComments->Text;
     foreach (SourceList::LoadAll() as $objSourceList) {
         if ($objSourceList->Name == $this->lstSource->SelectedName) {
             $this->objGroupRegistration->SourceListId = $objSourceList->Id;
             break;
         }
     }
     $this->objGroupRegistration->Gender = $this->lstGender->SelectedName;
     $this->objGroupRegistration->GroupRoleId = $this->lstParticipationType->SelectedValue;
     $strDays = '';
     foreach ($this->chkDaysAvailable as $chkDays) {
         if ($chkDays->Checked) {
             $strDays .= $chkDays->Text . ', ';
         }
     }
     $strDays = substr($strDays, 0, strlen($strDays) - 1);
     $this->objGroupRegistration->GroupDay = $strDays;
     $this->objGroupRegistration->PreferredLocation1 = $this->lstLocationFirst->SelectedName;
     $this->objGroupRegistration->PreferredLocation2 = $this->lstLocationSecond->SelectedName;
     $this->objGroupRegistration->Save();
     foreach ($this->chkGroupType as $chkGroup) {
         if ($chkGroup->Checked) {
             $this->objGroupRegistration->AssociateGrowthGroupStructureAsGroupstructure(GrowthGroupStructure::Load($chkGroup->Name));
         }
     }
     // Send Facilitator Application if user selected to be a Facilitator
     if ($this->lstParticipationType->SelectedName == 'Facilitator') {
         $this->SendMessage();
     }
     //Send notification
     $this->SendNotification();
     QApplication::Redirect('/success.php');
 }
 /**
  * Reads-in a source
  *
  * @return	boolean	source is valid
  */
 public function readSource()
 {
     $this->source = new Source($this->sourceID);
     if (!$this->source->sourceID || !$this->source->hasAccess()) {
         throw new IllegalLinkException();
     }
     // other sources
     if ($this->otherSources) {
         $sourceList = new SourceList();
         $sourceList->checkHasAccess = true;
         $sourceList->sqlConditions = 'source.sourceID <> ' . $this->source->sourceID;
         $sourceList->readObjects();
         $this->sources = $sourceList->getObjects();
     }
 }
 protected static function readPackageCache()
 {
     self::$packageCache = array('hashes' => array(), 'packages' => array());
     // read accessible sources
     require_once PB_DIR . 'lib/data/source/SourceList.class.php';
     $sourceList = new SourceList();
     $sourceList->sqlLimit = 0;
     $sourceList->hasAccessCheck = true;
     $sourceList->readObjects();
     $sources = $sourceList->getObjects();
     foreach ($sources as $source) {
         self::$sources[$source->sourceID] = $source;
     }
     foreach (WCF::getUser()->getAccessibleSourceIDs() as $sourceID) {
         $cacheName = 'packages-' . $sourceID;
         WCF::getCache()->addResource($cacheName, PB_DIR . 'cache/cache.' . $cacheName . '.php', PB_DIR . 'lib/system/cache/CacheBuilderPackages.class.php');
         $cache = WCF::getCache()->get($cacheName);
         self::$packageCache['hashes'] = array_merge(self::$packageCache['hashes'], $cache['hashes']);
         self::$packageCache['packages'] = array_merge(self::$packageCache['packages'], $cache['packages']);
     }
 }
Example #8
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, SourceList::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this SourceListMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing SourceList object creation - defaults to CreateOrEdit
  * @return SourceListMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objSourceList = SourceList::Load($intId);
         // SourceList was found -- return it!
         if ($objSourceList) {
             return new SourceListMetaControl($objParentObject, $objSourceList);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a SourceList object with PK arguments: ' . $intId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new SourceListMetaControl($objParentObject, new SourceList());
 }
Example #10
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objSourceList) {
         $objObject->objSourceList = SourceList::GetSoapObjectFromObject($objObject->objSourceList, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intSourceListId = null;
         }
     }
     if ($objObject->dttDateReceived) {
         $objObject->dttDateReceived = $objObject->dttDateReceived->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->objGroupRole) {
         $objObject->objGroupRole = GroupRole::GetSoapObjectFromObject($objObject->objGroupRole, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intGroupRoleId = null;
         }
     }
     if ($objObject->dttDateProcessed) {
         $objObject->dttDateProcessed = $objObject->dttDateProcessed->__toString(QDateTime::FormatSoap);
     }
     return $objObject;
 }
Example #11
0
 public function RenderSource(GroupRegistrations $objGroupRegistration)
 {
     return SourceList::Load($objGroupRegistration->SourceListId)->Name;
 }
    print EscapeCsv($objGroupRegistrant->PreferredLocation1);
    print ",";
    print EscapeCsv($objGroupRegistrant->PreferredLocation2);
    print ",";
    print EscapeCsv($objGroupRegistrant->GroupRole->Name);
    print ",";
    $strReturn = '';
    foreach (GrowthGroupStructure::LoadAll() as $objGrowthGroupStructure) {
        if ($objGroupRegistrant->IsGrowthGroupStructureAsGroupstructureAssociated($objGrowthGroupStructure)) {
            $strReturn .= $objGrowthGroupStructure->Name . ', ';
        }
    }
    $strReturn = substr($strReturn, 0, strlen($strReturn) - 2);
    print EscapeCsv($strReturn);
    print ",";
    print EscapeCsv($objGroupRegistrant->GroupDay);
    print ",";
    print EscapeCsv(SourceList::Load($objGroupRegistrant->SourceListId)->Name);
    print ",";
    if ($objGroupRegistrant->ProcessedFlag) {
        print 'Yes';
    } else {
        print 'No';
    }
    print ",";
    print EscapeCsv($objGroupRegistrant->GroupsPlaced);
    print ",";
    print EscapeCsv($objGroupRegistrant->DateProcessed);
    print ",";
    print "\r\n";
}