public function search() { $dh = Loader::helper('concrete/dashboard/sitemap'); if (!$dh->canRead()) { return false; } if ($_REQUEST['submitSearch']) { $this->searchRequest->resetSearchRequest(); } $req = $this->searchRequest->getSearchRequest(); $columns = PageSearchColumnSet::getCurrent(); if (!$this->pageList->getActiveSortColumn()) { $col = $columns->getDefaultSortColumn(); $this->pageList->sanitizedSortBy($col->getColumnKey(), $col->getColumnDefaultSortDirection()); } $cvName = htmlentities($req['cvName'], ENT_QUOTES, APP_CHARSET); $this->pageList->setPageVersionToRetrieve(\Concrete\Core\Page\PageList::PAGE_VERSION_RECENT); if ($cvName != '') { $this->pageList->filterByName($cvName); } if ($req['numResults'] && Loader::helper('validation/numbers')->integer($req['numResults'])) { $this->pageList->setItemsPerPage($req['numResults']); } if ($req['ptID']) { $this->pageList->filterByPageTypeID($req['ptID']); } if (is_array($req['field'])) { foreach ($req['field'] as $i => $item) { $this->fields[] = $this->getField($item); // due to the way the form is setup, index will always be one more than the arrays if ($item != '') { switch ($item) { case 'keywords': $keywords = htmlentities($req['keywords'], ENT_QUOTES, APP_CHARSET); $this->pageList->filterByFulltextKeywords($keywords); break; case 'num_children': $symbol = '='; if ($req['cChildrenSelect'] == 'gt') { $symbol = '>'; } elseif ($req['cChildrenSelect'] == 'lt') { $symbol = '<'; } $this->pageList->filterByNumberOfChildren($req['cChildren'], $symbol); break; case 'owner': $ui = \UserInfo::getByUserName($req['owner']); if (is_object($ui)) { $this->pageList->filterByUserID($ui->getUserID()); } else { $this->pageList->filterByUserID(-1); } break; case 'theme': $this->pageList->filter('pThemeID', $req['pThemeID']); break; case 'parent': if (isset($req['_cParentAll'])) { $req['cParentAll'] = $req['_cParentAll']; } if ($req['cParentIDSearchField'] > 0) { if ($req['cParentAll'] == 1) { $pc = \Page::getByID($req['cParentIDSearchField']); $cPath = $pc->getCollectionPath(); $this->pageList->filterByPath($cPath); } else { $this->pageList->filterByParentID($req['cParentIDSearchField']); } } break; case 'version_status': if (in_array($req['versionToRetrieve'], array(\Concrete\Core\Page\PageList::PAGE_VERSION_RECENT, \Concrete\Core\Page\PageList::PAGE_VERSION_ACTIVE))) { $this->pageList->setPageVersionToRetrieve($req['versionToRetrieve']); } break; case 'permissions_inheritance': $this->pageList->filter('cInheritPermissionsFrom', $req['cInheritPermissionsFrom']); break; case "date_public": $wdt = Loader::helper('form/date_time'); /* @var $wdt \Concrete\Core\Form\Service\Widget\DateTime */ $dateFrom = $wdt->translate('date_public_from', $req); if ($dateFrom) { $this->pageList->filterByPublicDate($dateFrom, '>='); } $dateTo = $wdt->translate('date_public_to', $req); if ($dateTo != '') { if (preg_match('/^(.+\\d+:\\d+):00$/', $dateTo, $m)) { $dateTo = $m[1] . ':59'; } $this->pageList->filterByPublicDate($dateTo, '<='); } break; case "last_modified": $wdt = Loader::helper('form/date_time'); /* @var $wdt \Concrete\Core\Form\Service\Widget\DateTime */ $dateFrom = $wdt->translate('last_modified_from', $req); if ($dateFrom) { $this->pageList->filterByDateLastModified($dateFrom, '>='); } $dateTo = $wdt->translate('last_modified_to', $req); if ($dateTo) { if (preg_match('/^(.+\\d+:\\d+):00$/', $dateTo, $m)) { $dateTo = $m[1] . ':59'; } $this->pageList->filterByDateLastModified($dateTo, '<='); } break; case "date_added": $wdt = Loader::helper('form/date_time'); /* @var $wdt \Concrete\Core\Form\Service\Widget\DateTime */ $dateFrom = $wdt->translate('date_added_from', $req); if ($dateFrom) { $this->pageList->filterByDateAdded($dateFrom, '>='); } $dateTo = $wdt->translate('date_added_to', $req); if ($dateTo) { if (preg_match('/^(.+\\d+:\\d+):00$/', $dateTo, $m)) { $dateTo = $m[1] . ':59'; } $this->pageList->filterByDateAdded($dateTo, '<='); } break; default: $akID = $item; $fak = CollectionAttributeKey::getByID($akID); if (!is_object($fak) || !$fak instanceof CollectionAttributeKey) { break; } $type = $fak->getAttributeType(); $cnt = $type->getController(); $cnt->setRequestArray($req); $cnt->setAttributeKey($fak); $cnt->searchForm($this->pageList); break; } } } } $handleName = "filter" . Loader::helper('text')->camelcase($this->attributeHandle); if (method_exists("Application\\Src\\AdvancedAttributeFilters", $handleName)) { \Application\Src\AdvancedAttributeFilters::$handleName($this, $this->pageList); } else { $options = MultipagePickerAttributeTypeValue::getOptions($this->attributeKeyID); if ($options['path']) { $this->pageList->filterByPath($options['path']); } if ($options['parentId']) { $this->pageList->filterByParentID(intval($options['parentID'])); } if ($options['typeHandle']) { $this->pageList->filterByCollectionTypeHandle($options['typeHandle']); } } $ilr = new PageSearchResult($columns, $this->pageList, URL::to($this->getSearchURL()), $this->fields); $this->result = $ilr; }
<?php defined('C5_EXECUTE') or die("Access Denied."); use Concrete\Package\AdvancedAssetPickers\Attribute\MultipagePicker\Value as MultipagePickerAttributeTypeValue; $akID = $this->attributeKey->getAttributeKeyID(); $obj = MultipagePickerAttributeTypeValue::getById($avID); $single = intval($single); if ($single == 1) { $mode = "single"; } else { $mode = "multi"; } ?> <script type="text/javascript"> ccm_launchPageManager<?php echo $akID; ?> = function() { CustomAjaxPageSelector.launchDialog(setPickerCallback<?php echo $akID; ?> (),{ handle:"<?php echo $akHandle; ?> ", multipleSelection: <?php echo $single; ?>