• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP XMLDAO类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中XMLDAO的典型用法代码示例。如果您正苦于以下问题:PHP XMLDAO类的具体用法?PHP XMLDAO怎么用?PHP XMLDAO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了XMLDAO类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _cacheMiss

 function _cacheMiss($cache, $id)
 {
     $allLanguages =& Registry::get('allLanguages-' . $cache->cacheId, true, null);
     if ($allLanguages === null) {
         // Add a locale load to the debug notes.
         $notes =& Registry::get('system.debug.notes');
         $locale = $cache->cacheId;
         if ($locale == null) {
             $locale = AppLocale::getLocale();
         }
         $filename = $this->getLanguageFilename($locale);
         $notes[] = array('debug.notes.languageListLoad', array('filename' => $filename));
         // Reload locale registry file
         $xmlDao = new XMLDAO();
         $data = $xmlDao->parseStruct($filename, array('language'));
         // Build array with ($charKey => array(stuff))
         if (isset($data['language'])) {
             foreach ($data['language'] as $languageData) {
                 $allLanguages[$languageData['attributes']['code']] = array($languageData['attributes']['name']);
             }
         }
         if (is_array($allLanguages)) {
             asort($allLanguages);
         }
         $cache->setEntireCache($allLanguages);
     }
     if (isset($allLanguages[$id])) {
         return $allLanguages[$id];
     } else {
         return null;
     }
 }
开发者ID:jprk,项目名称:pkp-lib,代码行数:32,代码来源:LanguageDAO.inc.php


示例2: XMLDAO

 function &parseSchemaMap()
 {
     $xmlDao = new XMLDAO();
     $schemaMapHandler = new SchemaMapHandler();
     $schemaMap =& $xmlDao->parseWithHandler(SCHEMA_MAP_REGISTRY_FILE, $schemaMapHandler);
     return $schemaMap;
 }
开发者ID:ramonsodoma,项目名称:harvester,代码行数:7,代码来源:SchemaAliasDAO.inc.php


示例3: _cacheMiss

 /**
  * Handle a cache miss
  * @param $cache GenericCache
  * @param $id mixed ID that wasn't found in the cache
  * @return null
  */
 function _cacheMiss($cache, $id)
 {
     $allCodelistItems =& Registry::get('all' . $this->getName() . 'CodelistItems', true, null);
     if ($allCodelistItems === null) {
         // Add a locale load to the debug notes.
         $notes =& Registry::get('system.debug.notes');
         $locale = $cache->cacheId;
         if ($locale == null) {
             $locale = AppLocale::getLocale();
         }
         $filename = $this->getFilename($locale);
         $notes[] = array('debug.notes.codelistItemListLoad', array('filename' => $filename));
         // Reload locale registry file
         $xmlDao = new XMLDAO();
         $nodeName = $this->getName();
         // i.e., subject
         $data = $xmlDao->parseStruct($filename, array($nodeName));
         // Build array with ($charKey => array(stuff))
         if (isset($data[$nodeName])) {
             foreach ($data[$nodeName] as $codelistData) {
                 $allCodelistItems[$codelistData['attributes']['code']] = array($codelistData['attributes']['text']);
             }
         }
         if (is_array($allCodelistItems)) {
             asort($allCodelistItems);
         }
         $cache->setEntireCache($allCodelistItems);
     }
     return null;
 }
开发者ID:PublishingWithoutWalls,项目名称:omp,代码行数:36,代码来源:CodelistItemDAO.inc.php


示例4: _cacheMiss

 function _cacheMiss(&$cache, $id)
 {
     $allCodelistItems =& Registry::get('all' . $this->getListName() . 'CodelistItems', true, null);
     if ($allCodelistItems === null) {
         // Add a locale load to the debug notes.
         $notes =& Registry::get('system.debug.notes');
         $locale = $cache->cacheId;
         if ($locale == null) {
             $locale = AppLocale::getLocale();
         }
         $filename = $this->getFilename($locale);
         $notes[] = array('debug.notes.codelistItemListLoad', array('filename' => $filename));
         // Reload locale registry file
         $xmlDao = new XMLDAO();
         $listName =& $this->getListName();
         // i.e., 'List30'
         import('lib.pkp.classes.codelist.ONIXParserDOMHandler');
         $handler = new ONIXParserDOMHandler($listName);
         import('lib.pkp.classes.xslt.XSLTransformer');
         import('lib.pkp.classes.file.FileManager');
         import('classes.file.TemporaryFileManager');
         $temporaryFileManager = new TemporaryFileManager();
         $fileManager = new FileManager();
         $tmpName = tempnam($temporaryFileManager->getBasePath(), 'ONX');
         $xslTransformer = new XSLTransformer();
         $xslTransformer->setParameters(array('listName' => $listName));
         $xslTransformer->setRegisterPHPFunctions(true);
         $xslFile = 'lib/pkp/xml/onixFilter.xsl';
         $filteredXml = $xslTransformer->transform($filename, XSL_TRANSFORMER_DOCTYPE_FILE, $xslFile, XSL_TRANSFORMER_DOCTYPE_FILE, XSL_TRANSFORMER_DOCTYPE_STRING);
         if (!$filteredXml) {
             assert(false);
         }
         $data = null;
         if (is_writeable($tmpName)) {
             $fp = fopen($tmpName, 'wb');
             fwrite($fp, $filteredXml);
             fclose($fp);
             $data = $xmlDao->parseWithHandler($tmpName, $handler);
             $fileManager->deleteFile($tmpName);
         } else {
             fatalError('misconfigured directory permissions on: ' . $temporaryFileManager->getBasePath());
         }
         // Build array with ($charKey => array(stuff))
         if (isset($data[$listName])) {
             foreach ($data[$listName] as $code => $codelistData) {
                 $allCodelistItems[$code] = $codelistData;
             }
         }
         if (is_array($allCodelistItems)) {
             asort($allCodelistItems);
         }
         $cache->setEntireCache($allCodelistItems);
     }
     return null;
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:55,代码来源:ONIXCodelistItemDAO.inc.php


示例5: XMLDAO

 /**
  * Parse information from a version XML file.
  * @return array
  */
 function &parseVersionXML($url)
 {
     $xmlDao = new XMLDAO();
     $data = $xmlDao->parseStruct($url, array());
     if (!$data) {
         $result = false;
         return $result;
     }
     // FIXME validate parsed data?
     $versionInfo = array();
     if (isset($data['application'][0]['value'])) {
         $versionInfo['application'] = $data['application'][0]['value'];
     }
     if (isset($data['type'][0]['value'])) {
         $versionInfo['type'] = $data['type'][0]['value'];
     }
     if (isset($data['release'][0]['value'])) {
         $versionInfo['release'] = $data['release'][0]['value'];
     }
     if (isset($data['tag'][0]['value'])) {
         $versionInfo['tag'] = $data['tag'][0]['value'];
     }
     if (isset($data['date'][0]['value'])) {
         $versionInfo['date'] = $data['date'][0]['value'];
     }
     if (isset($data['info'][0]['value'])) {
         $versionInfo['info'] = $data['info'][0]['value'];
     }
     if (isset($data['package'][0]['value'])) {
         $versionInfo['package'] = $data['package'][0]['value'];
     }
     if (isset($data['patch'][0]['value'])) {
         $versionInfo['patch'] = array();
         foreach ($data['patch'] as $patch) {
             $versionInfo['patch'][$patch['attributes']['from']] = $patch['value'];
         }
     }
     if (isset($data['class'][0]['value'])) {
         $versionInfo['class'] = (string) $data['class'][0]['value'];
     }
     $versionInfo['lazy-load'] = isset($data['lazy-load'][0]['value']) ? (int) $data['lazy-load'][0]['value'] : 0;
     $versionInfo['sitewide'] = isset($data['sitewide'][0]['value']) ? (int) $data['sitewide'][0]['value'] : 0;
     if (isset($data['release'][0]['value']) && isset($data['application'][0]['value'])) {
         $version =& Version::fromString($data['release'][0]['value'], isset($data['type'][0]['value']) ? $data['type'][0]['value'] : null, $data['application'][0]['value'], isset($data['class'][0]['value']) ? $data['class'][0]['value'] : '', $versionInfo['lazy-load'], $versionInfo['sitewide']);
         $versionInfo['version'] =& $version;
     }
     return $versionInfo;
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:52,代码来源:VersionCheck.inc.php


示例6: _mapCacheMiss

 /**
  * This function is called when the cache cannot be loaded;
  * in this case, re-generate the cache from XML.
  * @param $cache object
  * @param $id string (fixed to "mapping")
  */
 function _mapCacheMiss(&$cache, $id)
 {
     static $mappings;
     if (!isset($mappings)) {
         // Load the mapping list.
         $xmlDao = new XMLDAO();
         $data = $xmlDao->parseStruct($this->getPluginPath() . '/' . LANGUAGE_MAP_FILE, array('mapping'));
         if (isset($data['mapping'])) {
             foreach ($data['mapping'] as $mapping) {
                 $mappings[$mapping['attributes']['from']] = $mapping['attributes']['to'];
             }
         }
         $cache->setEntireCache($mappings);
     }
     return null;
 }
开发者ID:ramonsodoma,项目名称:harvester,代码行数:22,代码来源:LanguageMapPreprocessorPlugin.inc.php


示例7: _countryCacheMiss

 function _countryCacheMiss($cache, $id)
 {
     $countries =& Registry::get('allCountriesData', true, array());
     if (!isset($countries[$id])) {
         // Reload country registry file
         $xmlDao = new XMLDAO();
         $data = $xmlDao->parseStruct($this->getFilename(), array('countries', 'country'));
         if (isset($data['countries'])) {
             foreach ($data['country'] as $countryData) {
                 $countries[$id][$countryData['attributes']['code']] = $countryData['attributes']['name'];
             }
         }
         asort($countries[$id]);
         $cache->setEntireCache($countries[$id]);
     }
     return null;
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:17,代码来源:CountryDAO.inc.php


示例8: _cacheMiss

 function _cacheMiss(&$cache, $id)
 {
     $mappings = array();
     // Add a debug note indicating an XML load.
     $notes =& Registry::get('system.debug.notes');
     $notes[] = array('debug.notes.helpMappingLoad', array('id' => $id, 'filename' => $this->filename));
     // Reload help XML file
     $xmlDao = new XMLDAO();
     $data = $xmlDao->parseStruct($this->filename, array('topic'));
     // Build associative array of page keys and ids
     if (isset($data['topic'])) {
         foreach ($data['topic'] as $helpData) {
             $mappings[$helpData['attributes']['key']] = $helpData['attributes']['id'];
         }
     }
     $cache->setEntireCache($mappings);
     return isset($mappings[$id]) ? $mappings[$id] : null;
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:18,代码来源:HelpMappingFile.inc.php


示例9: _timeZoneCacheMiss

 function _timeZoneCacheMiss($cache, $id)
 {
     $timeZones =& Registry::get('allTimeZonesData', true, null);
     if ($timeZones === null) {
         // Reload time zone registry file
         $xmlDao = new XMLDAO();
         $data = $xmlDao->parseStruct($this->getFilename(), array('timezones', 'entry'));
         $timeZones = array();
         if (isset($data['timezones'])) {
             foreach ($data['entry'] as $timeZoneData) {
                 $timeZones[$timeZoneData['attributes']['key']] = $timeZoneData['attributes']['name'];
             }
         }
         asort($timeZones);
         $cache->setEntireCache($timeZones);
     }
     return null;
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:18,代码来源:TimeZoneDAO.inc.php


示例10: _mapCacheMiss

 /**
  * This function is called when the cache cannot be loaded;
  * in this case, re-generate the cache from XML.
  * @param $cache object
  * @param $id string (fixed to "mapping")
  */
 function _mapCacheMiss(&$cache, $id)
 {
     static $mappings;
     if (!isset($mappings)) {
         // Load the mapping list.
         $xmlDao = new XMLDAO();
         // $cache->cacheId has the same value as the archive ID (but ask Alec to verify this is always
         // true in this context)
         $typemap_file = "typemap-" . $cache->cacheId . ".xml";
         $data = $xmlDao->parseStruct($this->getPluginPath() . '/' . $typemap_file, array('mapping'));
         if (isset($data['mapping'])) {
             foreach ($data['mapping'] as $mapping) {
                 $mappings[$mapping['attributes']['from']] = $mapping['attributes']['to'];
             }
         }
         $cache->setEntireCache($mappings);
     }
     return null;
 }
开发者ID:jalperin,项目名称:harvester,代码行数:25,代码来源:TypeMapPreprocessorPlugin.inc.php


示例11: XMLDAO

 /**
  * Parse information from a version XML file.
  * @return array
  */
 function &parseVersionXML($url)
 {
     $xmlDao = new XMLDAO();
     $data = $xmlDao->parseStruct($url, array());
     if (!$data) {
         $result = false;
         return $result;
     }
     // FIXME validate parsed data?
     $versionInfo = array();
     if (isset($data['application'][0]['value'])) {
         $versionInfo['application'] = $data['application'][0]['value'];
     }
     if (isset($data['type'][0]['value'])) {
         $versionInfo['type'] = $data['type'][0]['value'];
     }
     if (isset($data['release'][0]['value'])) {
         $versionInfo['release'] = $data['release'][0]['value'];
     }
     if (isset($data['tag'][0]['value'])) {
         $versionInfo['tag'] = $data['tag'][0]['value'];
     }
     if (isset($data['date'][0]['value'])) {
         $versionInfo['date'] = $data['date'][0]['value'];
     }
     if (isset($data['info'][0]['value'])) {
         $versionInfo['info'] = $data['info'][0]['value'];
     }
     if (isset($data['package'][0]['value'])) {
         $versionInfo['package'] = $data['package'][0]['value'];
     }
     if (isset($data['patch'][0]['value'])) {
         $versionInfo['patch'] = array();
         foreach ($data['patch'] as $patch) {
             $versionInfo['patch'][$patch['attributes']['from']] = $patch['value'];
         }
     }
     if (isset($data['version'][0]['value'])) {
         $versionInfo['version'] = Version::fromString($data['release'][0]['value'], $data['application'][0]['value'], isset($data['type'][0]['value']) ? $data['type'][0]['value'] : null);
     }
     return $versionInfo;
 }
开发者ID:anorton,项目名称:pkp-lib,代码行数:46,代码来源:VersionCheck.inc.php


示例12: _mapCacheMiss

 /**
  * This function is called when the cache cannot be loaded;
  * in this case, re-generate the cache from XML.
  * @param $cache object
  * @param $id string (fixed to "mapping")
  */
 function _mapCacheMiss(&$cache, $id)
 {
     static $mappings;
     if (!isset($mappings)) {
         // Load the mapping list.
         $xmlDao = new XMLDAO();
         $typemapFile = $this->getPluginPath() . '/typemap-' . (int) $cache->cacheId . '.xml';
         if (file_exists($typemapFile)) {
             $data = $xmlDao->parseStruct($typemapFile, array('mapping'));
         } else {
             $data = array();
         }
         if (isset($data['mapping'])) {
             foreach ($data['mapping'] as $mapping) {
                 $mappings[$mapping['attributes']['from']] = $mapping['attributes']['to'];
             }
         }
         $cache->setEntireCache($mappings);
     }
     return null;
 }
开发者ID:Rygbee,项目名称:harvester,代码行数:27,代码来源:TypeMapPreprocessorPlugin.inc.php


示例13: _cacheMiss

 function _cacheMiss($cache, $id)
 {
     $allCurrencies =& Registry::get('allCurrencies', true, null);
     if ($allCurrencies === null) {
         // Add a locale load to the debug notes.
         $notes =& Registry::get('system.debug.notes');
         $filename = $this->getCurrencyFilename(AppLocale::getLocale());
         $notes[] = array('debug.notes.currencyListLoad', array('filename' => $filename));
         // Reload locale registry file
         $xmlDao = new XMLDAO();
         $data = $xmlDao->parseStruct($filename, array('currency'));
         // Build array with ($charKey => array(stuff))
         if (isset($data['currency'])) {
             foreach ($data['currency'] as $currencyData) {
                 $allCurrencies[$currencyData['attributes']['code_alpha']] = array($currencyData['attributes']['name'], $currencyData['attributes']['code_numeric']);
             }
         }
         asort($allCurrencies);
         $cache->setEntireCache($allCurrencies);
     }
     return null;
 }
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:22,代码来源:CurrencyDAO.inc.php


示例14: array

 /**
  * Static method: Load a locale array from a file. Not cached!
  * @param $filename string Filename to locale XML to load
  * @param array
  */
 function &load($filename)
 {
     $localeData = array();
     // Reload localization XML file
     $xmlDao = new XMLDAO();
     $data = $xmlDao->parseStruct($filename, array('message'));
     // Build array with ($key => $string)
     if (isset($data['message'])) {
         foreach ($data['message'] as $messageData) {
             $localeData[$messageData['attributes']['key']] = $messageData['value'];
         }
     }
     return $localeData;
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:19,代码来源:LocaleFile.inc.php


示例15: XMLDAO

 /**
  * Load a locale list from a file.
  * @param $filename string
  * @return array
  */
 function &loadLocaleList($filename)
 {
     $xmlDao = new XMLDAO();
     $data = $xmlDao->parseStruct($filename, array('locale'));
     $allLocales = array();
     // Build array with ($localKey => $localeName)
     if (isset($data['locale'])) {
         foreach ($data['locale'] as $localeData) {
             $allLocales[$localeData['attributes']['key']] = $localeData['attributes'];
         }
     }
     return $allLocales;
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:18,代码来源:PKPLocale.inc.php


示例16: installEmailTemplateData

    /**
     * Install email template localized data from an XML file.
     * NOTE: Uses qstr instead of ? bindings so that SQL can be fetched
     * rather than executed.
     * @param $templateDataFile string Filename to install
     * @param $returnSql boolean Whether or not to return SQL rather than
     * executing it
     * @param $emailKey string If specified, the key of the single template
     * to install (otherwise all are installed)
     * @return array
     */
    function installEmailTemplateData($templateDataFile, $returnSql = false, $emailKey = null)
    {
        $xmlDao = new XMLDAO();
        $sql = array();
        $data = $xmlDao->parse($templateDataFile, array('email_texts', 'email_text', 'subject', 'body', 'description'));
        if (!$data) {
            return false;
        }
        $locale = $data->getAttribute('locale');
        foreach ($data->getChildren() as $emailNode) {
            if ($emailKey && $emailKey != $emailNode->getAttribute('key')) {
                continue;
            }
            $sql[] = 'DELETE FROM email_templates_default_data WHERE email_key = ' . $this->_dataSource->qstr($emailNode->getAttribute('key')) . ' AND locale = ' . $this->_dataSource->qstr($locale);
            if (!$returnSql) {
                $this->update(array_shift($sql));
            }
            $sql[] = 'INSERT INTO email_templates_default_data
				(email_key, locale, subject, body, description)
				VALUES
				(' . $this->_dataSource->qstr($emailNode->getAttribute('key')) . ', ' . $this->_dataSource->qstr($locale) . ', ' . $this->_dataSource->qstr($emailNode->getChildValue('subject')) . ', ' . $this->_dataSource->qstr($emailNode->getChildValue('body')) . ', ' . $this->_dataSource->qstr($emailNode->getChildValue('description')) . ")";
            if (!$returnSql) {
                $this->update(array_shift($sql));
            }
        }
        if ($returnSql) {
            return $sql;
        }
        return true;
    }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:41,代码来源:PKPEmailTemplateDAO.inc.php


示例17: installDefaultBaseData

    /**
     * Install setting type localized data from an XML file.
     * @param $locale string
     * @param $pressId int
     * @param $skipLoad bool
     * @param $localInstall bool
     * @return boolean
     */
    function installDefaultBaseData($locale, $pressId, $skipLoad = true, $localeInstall = false)
    {
        $xmlDao = new XMLDAO();
        $data = $xmlDao->parse($this->getDefaultBaseFilename());
        if (!$data) {
            return false;
        }
        $defaultIds = $this->getDefaultSettingIds($pressId);
        Locale::requireComponents(array(LOCALE_COMPONENT_OMP_DEFAULT_SETTINGS), $locale);
        foreach ($data->getChildren() as $formatNode) {
            $settings =& $this->getSettingAttributes($formatNode, $locale);
            if (empty($defaultIds[$formatNode->getAttribute('key')])) {
                // ignore keys not associated with this press
                continue;
            } else {
                // prepare a list of attributes not defined in the current settings xml file
                unset($defaultIds[$formatNode->getAttribute('key')]);
            }
            foreach ($settings as $settingName => $settingValue) {
                $this->update('INSERT INTO press_defaults
					(press_id, assoc_type, entry_key, locale, setting_name, setting_value, setting_type)
					VALUES
					(?, ?, ?, ?, ?, ?, ?)', array($pressId, $this->getDefaultType(), $formatNode->getAttribute('key'), $locale, $settingName, $settingValue, 'string'));
            }
        }
        $attributeNames =& $this->getSettingAttributes();
        // install defaults for keys not defined in the xml
        foreach ($defaultIds as $key => $id) {
            foreach ($attributeNames as $setting) {
                $this->update('INSERT INTO press_defaults
					(press_id, assoc_type, entry_key, locale, setting_name, setting_value, setting_type)
					VALUES
					(?, ?, ?, ?, ?, ?, ?)', array($pressId, $this->getDefaultType(), $key, $locale, $setting, '##', 'string'));
            }
        }
        if ($skipLoad) {
            return true;
        }
        if ($localeInstall) {
            $this->restoreByPressId($pressId, $locale);
        } else {
            $this->restoreByPressId($pressId);
        }
        return true;
    }
开发者ID:jerico-dev,项目名称:omp,代码行数:53,代码来源:DefaultSettingDAO.inc.php


示例18: installDefaults

 /**
  * Install default data for settings.
  * @param $contextId int Context ID
  * @param $locales array List of locale codes
  */
 function installDefaults($contextId, $locales)
 {
     // Load all the necessary locales.
     foreach ($locales as $locale) {
         AppLocale::requireComponents(LOCALE_COMPONENT_APP_DEFAULT, LOCALE_COMPONENT_PKP_DEFAULT, $locale);
     }
     $xmlDao = new XMLDAO();
     $data = $xmlDao->parseStruct('registry/genres.xml', array('genre'));
     if (!isset($data['genre'])) {
         return false;
     }
     $seq = 0;
     foreach ($data['genre'] as $entry) {
         $attrs = $entry['attributes'];
         // attempt to retrieve an installed Genre with this key.
         // Do this to preserve the genreId.
         $genre = $this->getByKey($attrs['key'], $contextId);
         if (!$genre) {
             $genre = $this->newDataObject();
         }
         $genre->setContextId($contextId);
         $genre->setKey($attrs['key']);
         $genre->setSortable($attrs['sortable']);
         $genre->setCategory($attrs['category']);
         $genre->setDependent($attrs['dependent']);
         $genre->setSupplementary($attrs['supplementary']);
         $genre->setSequence($seq++);
         foreach ($locales as $locale) {
             $genre->setName(__($attrs['localeKey'], array(), $locale), $locale);
         }
         $genre->setDesignation($attrs['designation']);
         if ($genre->getId() > 0) {
             // existing genre.
             $this->updateObject($genre);
         } else {
             $this->insertObject($genre);
         }
     }
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:44,代码来源:GenreDAO.inc.php


示例19: _updateOrInstallReviewObjectTypes

 /**
  * Update or install review objects
  * @param $journal Journal
  * @param $reviewObjects array of review object types keys or ids
  * @param $locales array of locales
  * @param $action string (install or update)
  */
 function _updateOrInstallReviewObjectTypes($journal, $reviewObjects, $locales, $action)
 {
     $plugin =& $this->_getObjectsForReviewPlugin();
     if (!isset($journal) || !isset($reviewObjects) || !isset($locales) || !isset($action)) {
         return false;
     }
     $journalId = $journal->getId();
     $plugin->import('classes.ReviewObjectType');
     $plugin->import('classes.ReviewObjectMetadata');
     $reviewObjectTypeDao =& DAORegistry::getDAO('ReviewObjectTypeDAO');
     $reviewObjectMetadataDao =& DAORegistry::getDAO('ReviewObjectMetadataDAO');
     $onlyCommonMetadata = false;
     foreach ($reviewObjects as $keyOrId) {
         if ($action == 'install') {
             // Create a new review object type
             $reviewObjectType = $reviewObjectTypeDao->newDataObject();
             $reviewObjectType->setContextId($journalId);
             $reviewObjectType->setActive(0);
             $reviewObjectType->setKey($keyOrId);
         } elseif ($action == 'update') {
             // Get the review object type
             $reviewObjectType =& $reviewObjectTypeDao->getById($keyOrId, $journalId);
             if (!isset($reviewObjectType)) {
                 return false;
             }
             // If the type was created by the user, update only the common metadata
             if ($reviewObjectType->getKey() == NULL) {
                 $onlyCommonMetadata = true;
             }
         }
         // Callect the metadata in the array
         $reviewObjectMetadataArray = array();
         // For all languages
         foreach ($locales as $locale) {
             // Register the locale/translation file
             $localePath = $plugin->getPluginPath() . '/locale/' . $locale . '/locale.xml';
             AppLocale::registerLocaleFile($locale, $localePath, true);
             $xmlDao = new XMLDAO();
             // Get common metadata
             $commonDataPath = $plugin->getPluginPath() . '/xml/commonMetadata.xml';
             $commonData = $xmlDao->parse($commonDataPath);
             $commonMetadata = $commonData->getChildByName('objectMetadata');
             $allMetadataChildren = $commonMetadata->getChildren();
             // Get the object metadata
             if (!$onlyCommonMetadata) {
                 // Parse the review object XML file
                 $itemPath = $plugin->getPluginPath() . '/xml/reviewObjects/' . $reviewObjectType->getKey() . '.xml';
                 $data = $xmlDao->parse($itemPath);
                 if (!$data) {
                     return false;
                 }
                 // Set the review object name
                 $itemTypeName = __($data->getChildValue('objectType'), array(), $locale);
                 $reviewObjectType->setName($itemTypeName, $locale);
                 // $reviewObjectType->setDescription($itemTypeNameDescription, $locale);
                 // Get the review object role selection options
                 $roleSelectionOptions = $data->getChildByName('roleSelectionOptions');
                 // Handle Metadata
                 // Get multiple options metadata types
                 $multipleOptionsTypes = ReviewObjectMetadata::getMultipleOptionsTypes();
                 // Get metadata types defined in DTD
                 $dtdTypes = ReviewObjectMetadata::getMetadataDTDTypes();
                 // Get the review object metadata
                 $itemMetadata = $data->getChildByName('objectMetadata');
                 // Merge all (common + review objec) metadata
                 $allMetadataChildren = array_merge($commonMetadata->getChildren(), $itemMetadata->getChildren());
             }
             // Go through the metadata
             foreach ($allMetadataChildren as $metadataNode) {
                 $key = $metadataNode->getAttribute('key');
                 // If we have already went througt, collected/considered the metadata
                 if (array_key_exists($key, $reviewObjectMetadataArray)) {
                     $reviewObjectMetadata = $reviewObjectMetadataArray[$key];
                 } else {
                     if ($action == 'update') {
                         // Get the metadata
                         $reviewObjectMetadata = $reviewObjectMetadataDao->getByKey($key, $reviewObjectType->getId());
                     }
                     if ($action == 'install' || !isset($reviewObjectMetadata)) {
                         // Create a new metadata
                         $reviewObjectMetadata = $reviewObjectMetadataDao->newDataObject();
                         $reviewObjectMetadata->setSequence(REALLY_BIG_NUMBER);
                         $metadataType = $dtdTypes[$metadataNode->getAttribute('type')];
                         $reviewObjectMetadata->setMetadataType($metadataType);
                         $required = $metadataNode->getAttribute('required');
                         $reviewObjectMetadata->setRequired($required == 'true' ? 1 : 0);
                         $display = $metadataNode->getAttribute('display');
                         $reviewObjectMetadata->setDisplay($display == 'true' ? 1 : 0);
                     }
                 }
                 // Set metadata name
                 $name = __($metadataNode->getChildValue('name'), array(), $locale);
                 $reviewObjectMetadata->setName($name, $locale);
//.........这里部分代码省略.........
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:101,代码来源:ReviewObjectTypesEditorHandler.inc.php


示例20: _ICD10CacheMiss

 function _ICD10CacheMiss(&$cache, $id)
 {
     $ICD10s =& Registry::get('allICD10sData', true, array());
     if (!isset($ICD10s[$id])) {
         // Reload ICD10 registry file
         $xmlDao = new XMLDAO();
         $data = $xmlDao->parseStruct($this->getFilename(), array('ICD10s', 'ICD10'));
         if (isset($data['ICD10s'])) {
             foreach ($data['ICD10'] as $ICD10Data) {
                 if (strlen($ICD10Data['attributes']['name']) > 60) {
                     $name = substr($ICD10Data['attributes']['name'], 0, 60) . '...';
                 } else {
                     $name = $ICD10Data['attributes']['name'];
                 }
                 $ICD10s[$id][$ICD10Data['attributes']['code']] = $ICD10Data['attributes']['code'] . ' ' . $name;
             }
         }
         asort($ICD10s[$id]);
         $cache->setEntireCache($ICD10s[$id]);
     }
     return null;
 }
开发者ID:elavaud,项目名称:hrp_ct,代码行数:22,代码来源:ArticleDetailsDAO.inc.php



注:本文中的XMLDAO类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP XMLDBAction类代码示例发布时间:2022-05-23
下一篇:
PHP XMLCustomWriter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap