/** * @param ActiveRecordList $arl * * @return mixed|string */ protected function buildQuery(ActiveRecordList $arl) { // SELECTS $q = $arl->getArSelectCollection()->asSQLStatement(); // Concats $q .= $arl->getArConcatCollection()->asSQLStatement(); $q .= ' FROM ' . $arl->getAR()->getConnectorContainerName(); // JOINS $q .= $arl->getArJoinCollection()->asSQLStatement(); // WHERE $q .= $arl->getArWhereCollection()->asSQLStatement(); // ORDER $q .= $arl->getArOrderCollection()->asSQLStatement(); // LIMIT $q .= $arl->getArLimitCollection()->asSQLStatement(); //TODO: using template in the model. if ($arl->getDebug()) { global $tpl; if ($tpl instanceof ilTemplate) { ilUtil::sendInfo($q); } else { var_dump($q); // FSX } } $arl->setLastQuery($q); return $q; }