function load($file, $options = null)
 {
     parent::load($file);
     $root = $this->documentElement;
     list($this->object_class, $this->object_id) = explode("-", $root->nodeName);
     $objectNodes = $root->childNodes;
     $objects = array();
     foreach ($objectNodes as $node) {
         $values = $this->getFields($node);
         $refs = $this->getRefs($node);
         $objects[$node->getAttribute("id")] = new CMbObjectImport($node->nodeName, $values, $refs);
     }
     $this->objects_values = $objects;
 }
}
if (null == ($remote_url = $clCconfig["remote_url"])) {
    CAppUI::stepAjax("Remote URL not configured", UI_MSG_ERROR);
}
if (false === ($content = file_get_contents($remote_url))) {
    CAppUI::stepAjax("Couldn't connect to remote url", UI_MSG_ERROR);
}
// Check imported catalogue document
$doc = new CMbXMLDocument();
if (!$doc->loadXML($content)) {
    CAppUI::stepAjax("Document is not well formed", UI_MSG_ERROR);
}
$tmpPath = "tmp/dPlabo/import_catalogue.xml";
CMbPath::forceDir(dirname($tmpPath));
$doc->save($tmpPath);
$doc->load($tmpPath);
if (!$doc->schemaValidate("modules/{$m}/remote/catalogue.xsd")) {
    CAppUI::stepAjax("Document is not valid", UI_MSG_ERROR);
}
CAppUI::stepAjax("Document is valid", UI_MSG_OK);
// Check access to idSante400
$canSante400 = CModule::getCanDo("dPsante400");
if (!$canSante400->edit) {
    CAppUI::stepAjax("No permission for module 'dPsante400' or module not installed", UI_MSG_ERROR);
}
// Import catalogue
$cat = new SimpleXMLElement($content);
try {
    importCatalogue($cat);
} catch (CMbException $e) {
    $e->stepAjax();
示例#3
0
 /**
  * Retourne une entrée dans un jeux de valeur
  *
  * @param String $name Nom du jeux de valeur
  * @param String $code Identifiant de la valeur voulut
  *
  * @return array
  */
 static function loadEntryJV($name, $code)
 {
     $path = "modules/xds/resources/jeux_de_valeurs/{$name}";
     $dom = new CMbXMLDocument();
     $dom->load($path);
     $xpath = new CMbXPath($dom);
     $node = $xpath->queryUniqueNode("//line[@id='{$code}']");
     $valeur = array("id" => $xpath->queryAttributNode(".", $node, "id"), "oid" => $xpath->queryAttributNode(".", $node, "oid"), "name" => $xpath->queryAttributNode(".", $node, "name"));
     return $valeur;
 }
示例#4
0
 /**
  * fonction permettant de créér la structure principal des classes d'un XSD
  *
  * @return bool
  */
 static function createClassFromXSD()
 {
     $pathXSD = "modules/cda/resources/POCD_MT000040.xsd";
     $pathDir = "modules/cda/classes/classesCDA/classesGenerate/";
     $dom = new CMbXMLDocument("UTF-8");
     $dom->load($pathXSD);
     $xpath = new CMbXPath($dom);
     $xpath->registerNamespace("xs", "http://www.w3.org/2001/XMLSchema");
     $nodeList = $xpath->query("//xs:complexType[@name] | //xs:simpleType[@name]");
     foreach ($nodeList as $_node) {
         $tabVariable = array();
         $tabProps = array();
         /** @var DOMElement $_node */
         $elements = $_node->getElementsByTagName("element");
         $nodeAttributes = $_node->getElementsByTagName("attribute");
         $nameNode = $xpath->queryAttributNode(".", $_node, "name");
         $nameNode = str_replace(".", "_", $nameNode);
         list($tabVariable, $tabProps) = self::createPropsForElement($elements, $tabVariable, $tabProps);
         list($tabVariable, $tabProps) = self::createPropsForElement($nodeAttributes, $tabVariable, $tabProps);
         $smarty = new CSmartyDP();
         $smarty->assign("name", $nameNode);
         $smarty->assign("variables", $tabVariable);
         $smarty->assign("props", $tabProps);
         $data = $smarty->fetch("defaultClassCDA.tpl");
         file_put_contents($pathDir . "CCDA" . $nameNode . ".class.php", $data);
     }
     return true;
 }
 *
 * @package    Mediboard
 * @subpackage Labo
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
if (!class_exists("DOMDocument")) {
    trigger_error("sorry, DOMDocument is needed");
    return;
}
CCanDo::checkRead();
$mbPrescription = new CPrescriptionLabo();
$doc = new CMbXMLDocument();
$docReference = new CMbXMLDocument();
$docReference->load("modules/dPlabo/remote/prescription.xml");
$docReference->setSchema("modules/dPlabo/remote/prescription.xsd");
$doc->setSchema("modules/dPlabo/remote/prescription.xsd");
if (!$doc->checkSchema()) {
    return;
}
// Chargement de la prescription
$mb_prescription_id = CValue::post("mb_prescription_id", 2);
if ($mbPrescription->load($mb_prescription_id)) {
    $mbPrescription->loadRefs();
}
$doc->setDocument("tmp/Prescription-" . $mbPrescription->_id . ".xml");
$prescription = $doc->addElement($doc, "prescription");
$doc->addAttribute($prescription, "id", $mbPrescription->_id);
$doc->addAttribute($prescription, "date", CMbDT::date());
$nomPraticien = $doc->addElement($prescription, "nomPraticien", $mbPrescription->_ref_praticien->_user_last_name);
示例#6
0
 * @category Password Keeper
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 * @link     http://www.mediboard.org */
CApp::setTimeLimit(360);
// Récupération du fichier
$file = CValue::files('datafile');
$passphrase = CValue::post('passphrase');
if (!$passphrase || !$file) {
    $msg = "Le fichier et la phrase de passe doivent être saisis.";
    CAppUI::stepAjax($msg, UI_MSG_ERROR);
}
$user = CMediusers::get();
$dom = new CMbXMLDocument();
if (!$dom->load($file['tmp_name'])) {
    CAppUI::redirect('m=passwordKeeper&a=vw_import_keeper&dialog=1');
}
$xpath = new CMbXPath($dom);
$keeperNode = $xpath->queryUniqueNode("/keeper");
$keeperName = $keeperNode->getAttribute("name");
if ($keeperNode->nodeName != "keeper") {
    CAppUI::redirect('m=passwordKeeper&a=vw_import_keeper&dialog=1');
}
$keeper = new CPasswordKeeper();
$keeper->keeper_name = $keeperName;
$keeper->_passphrase = $passphrase;
$keeper->user_id = $user->_id;
$keeper->store();
$categoryNodes = $xpath->query("//category");
foreach ($categoryNodes as $_categoryNode) {