コード例 #1
0
 /**
  * Make sure the essential namespaces are defined.
  *
  * @access	public
  *
  * @param	array		&$params: An array with parameters
  * @param	t3lib_tsStyleConfig		&$pObj: The parent object
  *
  * @return	string		Message informing the user of success or failure
  */
 public function checkMetadataFormats(&$params, &$pObj)
 {
     $nsDefined = array('MODS' => FALSE, 'TEIHDR' => FALSE);
     // Check if formats "MODS" and "TEIHDR" exist.
     $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('type', 'tx_dlf_formats', '(type=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('MODS', 'tx_dlf_formats') . ' OR type=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('TEIHDR', 'tx_dlf_formats') . ')' . tx_dlf_helper::whereClause('tx_dlf_formats'));
     while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
         $nsDefined[$resArray['type']] = TRUE;
     }
     // Build data array.
     $data = array();
     // Add MODS namespace.
     if (!$nsDefined['MODS']) {
         $data['tx_dlf_formats'][uniqid('NEW')] = array('pid' => 0, 'type' => 'MODS', 'root' => 'mods', 'namespace' => 'http://www.loc.gov/mods/v3', 'class' => 'tx_dlf_mods');
     }
     // Add TEIHDR namespace.
     if (!$nsDefined['TEIHDR']) {
         $data['tx_dlf_formats'][uniqid('NEW')] = array('pid' => 0, 'type' => 'TEIHDR', 'root' => 'teiHeader', 'namespace' => 'http://www.tei-c.org/ns/1.0', 'class' => 'tx_dlf_teihdr');
     }
     if (!empty($data)) {
         // Process changes.
         $substUid = tx_dlf_helper::processDBasAdmin($data);
         if (!empty($substUid)) {
             $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('metadataFormats.nsCreatedMsg'), $GLOBALS['LANG']->getLL('metadataFormats.nsCreated'), t3lib_FlashMessage::INFO, FALSE);
         } else {
             $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('metadataFormats.nsNotCreatedMsg'), $GLOBALS['LANG']->getLL('metadataFormats.nsNotCreated'), t3lib_FlashMessage::ERROR, FALSE);
         }
     } else {
         $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('metadataFormats.nsOkayMsg'), $GLOBALS['LANG']->getLL('metadataFormats.nsOkay'), t3lib_FlashMessage::OK, FALSE);
     }
     $this->content .= $message->render();
     return $this->content;
 }
コード例 #2
0
 /**
  * Update all outdated metadata configuration records
  *
  * @access	protected
  *
  * @return	void
  */
 protected function updateMetadataConfig()
 {
     $metadataUids = $this->getMetadataConfig();
     if (!empty($metadataUids)) {
         $data = array();
         // Get all old metadata configuration records.
         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_dlf_metadata.uid AS uid,tx_dlf_metadata.pid AS pid,tx_dlf_metadata.cruser_id AS cruser_id,tx_dlf_metadata.encoded AS encoded,tx_dlf_metadata.xpath AS xpath,tx_dlf_metadata.xpath_sorting AS xpath_sorting', 'tx_dlf_metadata', 'tx_dlf_metadata.uid IN (' . implode(',', $metadataUids) . ')' . tx_dlf_helper::whereClause('tx_dlf_metadata'), '', '', '');
         while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
             $newId = uniqid('NEW');
             // Copy record to new table.
             $data['tx_dlf_metadataformat'][$newId] = array('pid' => $resArray['pid'], 'cruser_id' => $resArray['cruser_id'], 'parent_id' => $resArray['uid'], 'encoded' => $resArray['encoded'], 'xpath' => $resArray['xpath'], 'xpath_sorting' => $resArray['xpath_sorting']);
             // Add reference to old table.
             $data['tx_dlf_metadata'][$resArray['uid']]['format'] = $newId;
         }
         if (!empty($data)) {
             // Process datamap.
             $substUids = tx_dlf_helper::processDBasAdmin($data);
             unset($data);
             if (!empty($substUids)) {
                 $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('update.metadataConfigOkay', TRUE), $GLOBALS['LANG']->getLL('update.metadataConfig', TRUE), t3lib_FlashMessage::OK, FALSE);
             } else {
                 $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('update.metadataConfigNotOkay', TRUE), $GLOBALS['LANG']->getLL('update.metadataConfig', TRUE), t3lib_FlashMessage::WARNING, FALSE);
             }
             $this->content .= $message->render();
         }
     }
 }
コード例 #3
0
ファイル: index.php プロジェクト: jacmendt/goobi-presentation
 /**
  * Add structure configuration
  *
  * @access	protected
  *
  * @return	void
  */
 protected function cmdAddStructure()
 {
     // Include structure definition file.
     include_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey) . 'modules/' . $this->modPath . 'structures.inc.php';
     // Build data array.
     foreach ($structures as $index_name => $values) {
         $data['tx_dlf_structures'][uniqid('NEW')] = array('pid' => intval($this->id), 'toplevel' => $values['toplevel'], 'label' => $GLOBALS['LANG']->getLL($index_name), 'index_name' => $index_name, 'oai_name' => $values['oai_name'], 'thumbnail' => 0);
     }
     $_ids = tx_dlf_helper::processDBasAdmin($data);
     // Check for failed inserts.
     if (count($_ids) == count($structures)) {
         // Fine.
         $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', tx_dlf_helper::getLL('flash.structureAddedMsg'), tx_dlf_helper::getLL('flash.structureAdded', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::OK, FALSE);
     } else {
         // Something went wrong.
         $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', tx_dlf_helper::getLL('flash.structureNotAddedMsg'), tx_dlf_helper::getLL('flash.structureNotAdded', TRUE), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, FALSE);
     }
     tx_dlf_helper::addMessage($_message);
 }