function get_AG($template, $errorMessages) { $accessGroupM = new RowManager_AccessGroupManager(); $multilingualLabelL = new RowManager_MultilingualLabelManager(); $join = new JoinPair($multilingualLabelL->getJoinOnFieldX('label_key'), $accessGroupM->getJoinOnFieldX('accessgroup_key')); $MTM = new MultiTableManager(); $MTM->addRowManager($multilingualLabelL); $MTM->addRowManager($accessGroupM, $join); $MTM->constructSearchCondition('language_id', '=', '1', true); $result = $MTM->find(); if (!isset($result)) { $errorMessages = 'Failed to join database to get label'; } else { $result->setFirst(); $count = 0; while ($resultMLM = $result->getNext($multilingualLabelL)) { $resultAGM = $result->getCurrent($accessGroupM); $agLabel[] = $resultMLM->getLabel(); $agID[] = $resultAGM->getID(); } $template->set('agLabel', $agLabel); $template->set('agID', $agID); } return $errorMessages; }