当前位置: 首页>>代码示例>>PHP>>正文


PHP sotf_Utils::writeXML方法代码示例

本文整理汇总了PHP中sotf_Utils::writeXML方法的典型用法代码示例。如果您正苦于以下问题:PHP sotf_Utils::writeXML方法的具体用法?PHP sotf_Utils::writeXML怎么用?PHP sotf_Utils::writeXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sotf_Utils的用法示例。


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

示例1: saveMetadataFile

 function saveMetadataFile()
 {
     global $permissions;
     $name = get_class($this);
     $name = str_replace("sotf_", "", $name);
     $xml = "<{$name}>";
     $xml .= sotf_Utils::writeXML('data', $this->data, 1);
     $roles = $this->getRoles();
     $xml .= sotf_Utils::writeXML('role', $roles, 1);
     $perms = $permissions->listUsersAndPermissions($this->id);
     $xml .= sotf_Utils::writeXML('permission', $perms, 1);
     $xml = $xml . "\n</{$name}>\n";
     $file = $this->getMetaDir() . '/metadump.xml';
     debug("dumping metadata xml in", $file);
     $fp = fopen("{$file}", "w");
     fwrite($fp, $xml);
     fclose($fp);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:sotf,代码行数:19,代码来源:sotf_ComplexNodeObject.class.php

示例2: saveMetadataFile

 function saveMetadataFile()
 {
     global $permissions;
     if (!is_dir($this->getMetaDir())) {
         addError("Programme dir not found", $this->getMetaDir());
         return false;
     }
     $name = get_class($this);
     $name = str_replace("sotf_", "", $name);
     $xml = "<{$name}>";
     $xml .= sotf_Utils::writeXML('data', $this->data, 1);
     $roles = $this->getRoles();
     $xml .= sotf_Utils::writeXML('role', $roles, 1);
     $perms = $permissions->listUsersAndPermissions($this->id);
     $xml .= sotf_Utils::writeXML('permission', $perms, 1);
     $links = $this->getAssociatedObjects('sotf_links', 'caption');
     $xml .= sotf_Utils::writeXML('link', $links, 1);
     $rights = $this->getAssociatedObjects('sotf_rights', 'start_time');
     $xml .= sotf_Utils::writeXML('right', $rights, 1);
     $topics = $this->getTopics();
     $xml .= sotf_Utils::writeXML('topic', $topics, 1);
     $xml = $xml . "\n</{$name}>\n";
     // TODO: save more data from other tables as well !!!!!
     $file = $this->getMetaDir() . '/metadump.xml';
     debug("dumping metadata xml in", $file);
     $fp = fopen("{$file}", "w");
     if (!$fp) {
         logError("Could not dump metadata into {$file}");
         // TODO: in this case the prg has been deleted in the meantime??
     } else {
         fwrite($fp, $xml);
         fclose($fp);
     }
     // save XBMF
     if (is_writable($this->getMetaDir())) {
         $meta = new sotf_Metadata($this);
         $xbmf = $meta->getXBMFMetadata();
         $file = $this->getMetaDir() . '/metadata.xml';
         sotf_Utils::save($file, $xbmf);
     }
     // to change modify_date
     $this->update();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:44,代码来源:sotf_Programme.class.php

示例3: writeXML

 function writeXML($name, $array, $level = 0)
 {
     if (empty($array)) {
         //return "\n" . str_repeat('  ',$level) . "<$name />";
         return "";
     }
     if (sotf_Utils::isAssocArray($array)) {
         $retval = "\n" . str_repeat('  ', $level) . "<{$name}>";
         reset($array);
         while (list($key, $value) = each($array)) {
             $type = gettype($value);
             switch ($type) {
                 case 'array':
                     $retval .= sotf_Utils::writeXML($key, $value, $level + 1);
                     break;
                 default:
                     $retval .= "\n" . str_repeat('  ', $level + 1) . "<{$key}>" . htmlspecialchars($value) . "</{$key}>";
             }
         }
         $retval .= "\n" . str_repeat('  ', $level) . "</{$name}>";
     } else {
         reset($array);
         while (list($key, $value) = each($array)) {
             $type = gettype($value);
             switch ($type) {
                 case 'array':
                     $retval .= sotf_Utils::writeXML($name, $value, $level);
                     break;
                 default:
                     $retval .= "\n" . str_repeat('  ', $level) . "<{$name}>" . htmlspecialchars($value) . "</{$name}>";
             }
         }
     }
     return $retval;
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:35,代码来源:sotf_Utils.class.php


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