コード例 #1
0
ファイル: index.php プロジェクト: jacmendt/goobi-presentation
 /**
  * Iterates through list of documents and indexes them
  *
  * @access	protected
  *
  * @return	void
  */
 protected function indexLoop()
 {
     // Get document from list.
     list($uid, $title) = $this->list->remove(0);
     $this->list->save();
     // Save document to database and index.
     $doc =& tx_dlf_document::getInstance($uid, 0, TRUE);
     if ($doc->ready) {
         $doc->save($doc->pid, $this->data['core']);
     }
     // Give feedback about progress.
     $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentsToGo'), count($this->list))), tx_dlf_helper::getLL('flash.running', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, TRUE);
     $this->markerArray['CONTENT'] .= $_message->render();
     // Start next loop.
     $this->markerArray['CONTENT'] .= '<script type="text/javascript">window.location.href=unescape("' . \TYPO3\CMS\Core\Utility\GeneralUtility::rawUrlEncodeJS(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('id' => $this->id, 'CMD' => 'indexLoop', $this->prefixId => array('core' => $this->data['core']), 'random' => uniqid())))) . '");</script>';
     $this->printContent();
 }
コード例 #2
0
 /**
  * The main method of the PlugIn
  *
  * @access	public
  *
  * @param	string		$content: The PlugIn content
  * @param	array		$conf: The PlugIn configuration
  *
  * @return	string		The content that is displayed on the website
  */
 public function main($content, $conf)
 {
     $this->init($conf);
     // Don't cache the output.
     $this->setCache(FALSE);
     // Load the list.
     $this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
     // Sort the list if applicable.
     if (!empty($this->piVars['order']) && $this->piVars['order'] != $this->list->metadata['options']['order'] || isset($this->piVars['asc']) && $this->piVars['asc'] != $this->list->metadata['options']['order.asc']) {
         // Order list by given field.
         $this->list->sort($this->piVars['order'], (bool) $this->piVars['asc']);
         // Update list's metadata.
         $listMetadata = $this->list->metadata;
         $listMetadata['options']['order'] = $this->piVars['order'];
         $listMetadata['options']['order.asc'] = (bool) $this->piVars['asc'];
         $this->list->metadata = $listMetadata;
         // Save updated list.
         $this->list->save();
         // Reset pointer.
         $this->piVars['pointer'] = 0;
     }
     // Load template file.
     if (!empty($this->conf['templateFile'])) {
         $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
     } else {
         $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/listview/template.tmpl'), '###TEMPLATE###');
     }
     $subpartArray['entry'] = $this->cObj->getSubpart($this->template, '###ENTRY###');
     $subpartArray['subentry'] = $this->cObj->getSubpart($this->template, '###SUBENTRY###');
     // Set some variable defaults.
     if (!empty($this->piVars['pointer']) && $this->piVars['pointer'] * $this->conf['limit'] + 1 <= count($this->list)) {
         $this->piVars['pointer'] = max(intval($this->piVars['pointer']), 0);
     } else {
         $this->piVars['pointer'] = 0;
     }
     // Load metadata configuration.
     $this->loadConfig();
     for ($i = $this->piVars['pointer'] * $this->conf['limit'], $j = ($this->piVars['pointer'] + 1) * $this->conf['limit']; $i < $j; $i++) {
         if (empty($this->list[$i])) {
             break;
         } else {
             $content .= $this->getEntry($i, $subpartArray);
         }
     }
     $markerArray['###LISTTITLE###'] = $this->list->metadata['label'];
     $markerArray['###LISTDESCRIPTION###'] = $this->list->metadata['description'];
     if (!empty($this->list->metadata['thumbnail'])) {
         $markerArray['###LISTTHUMBNAIL###'] = '<img alt="" src="' . $this->list->metadata['thumbnail'] . '" />';
     } else {
         $markerArray['###LISTTHUMBNAIL###'] = '';
     }
     if ($i) {
         $markerArray['###COUNT###'] = htmlspecialchars(sprintf($this->pi_getLL('count'), $this->piVars['pointer'] * $this->conf['limit'] + 1, $i, count($this->list)));
     } else {
         $markerArray['###COUNT###'] = $this->pi_getLL('nohits', '', TRUE);
     }
     $markerArray['###PAGEBROWSER###'] = $this->getPageBrowser();
     $markerArray['###SORTING###'] = $this->getSortingForm();
     $content = $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE), $markerArray);
     return $this->pi_wrapInBaseClass($content);
 }