本文整理汇总了PHP中ApacheSolrForTypo3\Solr\Site::getAvailableSites方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::getAvailableSites方法的具体用法?PHP Site::getAvailableSites怎么用?PHP Site::getAvailableSites使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApacheSolrForTypo3\Solr\Site
的用法示例。
在下文中一共展示了Site::getAvailableSites方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateAdditionalFields
/**
* Checks any additional data that is relevant to this task. If the task
* class is not relevant, the method is expected to return TRUE
*
* @param array $submittedData reference to the array containing the data submitted by the user
* @param SchedulerModuleController $schedulerModule reference to the calling object (Scheduler's BE module)
* @return boolean True if validation was ok (or selected class is not relevant), FALSE otherwise
*/
public function validateAdditionalFields(array &$submittedData, SchedulerModuleController $schedulerModule)
{
$result = false;
// validate site
$sites = Site::getAvailableSites();
if (array_key_exists($submittedData['site'], $sites)) {
$result = true;
}
// escape limit
$submittedData['documentsToIndexLimit'] = intval($submittedData['documentsToIndexLimit']);
return $result;
}
示例2: render
/**
* @return mixed
*/
public function render()
{
$availableSites = Site::getAvailableSites();
$currentSite = $this->moduleDataStorageService->loadModuleData()->getSite();
$hasSites = is_array($availableSites) && count($availableSites) > 0;
$this->templateVariableContainer->add('availableSites', $availableSites);
$this->templateVariableContainer->add('currentSite', $currentSite);
$this->templateVariableContainer->add('hasSites', $hasSites);
$output = $this->renderChildren();
$this->templateVariableContainer->remove('hasSites');
$this->templateVariableContainer->remove('currentSite');
$this->templateVariableContainer->remove('availableSites');
return $output;
}
示例3: render
public function render()
{
$this->tag->addAttribute('onchange', 'jumpToUrl(document.URL + \'&tx_solr_tools_solradministration[action]=setSite&tx_solr_tools_solradministration[site]=\'+this.options[this.selectedIndex].value,this);');
$sites = Site::getAvailableSites();
$currentSite = $this->moduleDataStorageService->loadModuleData()->getSite();
$options = '';
foreach ($sites as $site) {
$selectedAttribute = '';
if ($site == $currentSite) {
$selectedAttribute = ' selected="selected"';
}
$options .= '<option value="' . $site->getRootPageId() . '"' . $selectedAttribute . '>' . $site->getLabel() . '</option>';
}
$this->tag->setContent($options);
return '<div class="docheader-funcmenu siteSelector"><label>Site: </label>' . $this->tag->render() . '</div>';
}
示例4: resolveSiteHashAllowedSites
/**
* Resolves magic keywords in allowed sites configuration.
* Supported keywords:
* __solr_current_site - The domain of the site the query has been started from
* __current_site - Same as __solr_current_site
* __all - Adds all domains as allowed sites
* * - Same as __all
*
* @param integer $pageId A page ID that is then resolved to the site it belongs to
* @param string $allowedSitesConfiguration TypoScript setting for allowed sites
* @return string List of allowed sites/domains, magic keywords resolved
*/
public static function resolveSiteHashAllowedSites($pageId, $allowedSitesConfiguration)
{
if ($allowedSitesConfiguration == '*' || $allowedSitesConfiguration == '__all') {
$sites = Site::getAvailableSites();
$domains = array();
foreach ($sites as $site) {
$domains[] = $site->getDomain();
}
$allowedSites = implode(',', $domains);
} else {
$allowedSites = str_replace(array('__solr_current_site', '__current_site'), Site::getSiteByPageId($pageId)->getDomain(), $allowedSitesConfiguration);
}
return $allowedSites;
}
示例5: validateAdditionalFields
/**
* Checks any additional data that is relevant to this task. If the task
* class is not relevant, the method is expected to return TRUE
*
* @param array $submittedData reference to the array containing the data submitted by the user
* @param SchedulerModuleController $schedulerModule reference to the calling object (Scheduler's BE module)
* @return bool True if validation was ok (or selected class is not relevant), FALSE otherwise
*/
public function validateAdditionalFields(array &$submittedData, SchedulerModuleController $schedulerModule)
{
$result = false;
// validate site
$sites = Site::getAvailableSites();
if (array_key_exists($submittedData['site'], $sites)) {
$result = true;
}
return $result;
}
示例6: initializeAction
/**
* Initializes resources commonly needed for several actions
*
* @return void
*/
protected function initializeAction()
{
try {
$site = $this->request->getArgument('site');
if (is_numeric($site)) {
$siteRootPageId = $this->request->getArgument('site');
$this->site = Site::getSiteByPageId($siteRootPageId);
} else {
if ($site instanceof Site) {
$this->site = $site;
}
}
} catch (NoSuchArgumentException $nsae) {
$sites = Site::getAvailableSites();
$site = array_shift($sites);
$this->site = $site;
}
$this->request->setArgument('site', $this->site);
$moduleData = $this->moduleDataStorageService->loadModuleData();
$moduleData->setSite($this->site);
$this->moduleDataStorageService->persistModuleData($moduleData);
}
示例7: canGetAllSites
/**
* @test
*/
public function canGetAllSites()
{
$this->importDataSetFromFixture('can_get_all_sites.xml');
$sites = Site::getAvailableSites();
$this->assertSame(1, count($sites), 'Expected to retrieve one site from fixture');
}