function do_main() { $sCode = KTUtil::arrayGet($_REQUEST, 'code'); $sName = KTUtil::arrayGet($_REQUEST, 'varname', 'fFolderId'); $oWidget = unserialize($_SESSION['collection_widgets'][$sCode]); $oCollection = $oWidget->getCollection(); $oFolder = Folder::get(KTUtil::arrayGet($_REQUEST, 'fFolderId', 1)); if (PEAR::isError($oFolder)) { $this->errorRedirectToMain(_kt('Invalid folder selected.')); exit(0); } $aOptions = array('ignorepermissions' => KTBrowseUtil::inAdminMode($this->oUser, $oFolder)); $oCollection->_queryObj->folder_id = $oFolder->getId(); $aOptions = $oCollection->getEnvironOptions(); $aOptions['return_url'] = KTUtil::addQueryString($_SERVER['PHP_SELF'], array('code' => $sCode, 'varname' => $sName, 'fFolderId' => $oFolder->getId())); $oCollection->setOptions($aOptions); // add the collection code to the title column QS params foreach ($oWidget->aCols as $ns) { $aColOpts = $oCollection->getColumnOptions($ns); $aColOpts['qs_params'] = kt_array_merge(KTUtil::arrayGet($aColOpts, 'qs_params', array()), array('code' => $sCode, 'varname' => $sName)); $oCollection->setColumnOptions($ns, $aColOpts); } // make the breadcrumbs $aBreadcrumbs = $this->_generate_breadcrumbs($oFolder, $sCode, $oWidget->aBCUrlParams, $sName); print KTTemplating::renderTemplate('ktcore/forms/widgets/collection', array('collection' => $oCollection, 'folder' => $oFolder, 'breadcrumbs' => $aBreadcrumbs, 'targetname' => $sName)); exit(0); }