Example #1
0
/**
 * $Id: ajax_import_group.php 28187 2015-05-05 15:06:40Z phenxdesign $
 *  
 * @category Forms
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision: 28187 $
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$uid = preg_replace('/[^\\d]/', '', CValue::get("uid"));
$temp = CAppUI::getTmpPath("group_import");
$file = "{$temp}/{$uid}";
$import = new CExClassImport($file);
/** @var DOMElement $group */
// Etablissements -------
$group = $import->getElementsbyClass("CGroups")->item(0);
$group_name = $import->getNamedValueFromElement($group, "text");
$data = array();
// Services -------
$data["CService"] = $import->getObjectsList("CService", "nom");
// Functions -------
$data["CFunctions"] = $import->getObjectsList("CFunctions", "text");
// Users -------
$data["CUser"] = $import->getObjectsList("CUser", "user_username", false, false);
// Blocs -------
$data["CBlocOperatoire"] = $import->getObjectsList("CBlocOperatoire", "nom");
// Salles -------
$data["CSalle"] = $import->getObjectsList("CSalle", "nom");
/**
 * $Id: ajax_import_ex_class.php 27644 2015-03-23 13:43:59Z phenxdesign $
 *  
 * @category Forms
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision: 27644 $
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$uid = preg_replace('/[^\\d]/', '', CValue::get("uid"));
$temp = CAppUI::getTmpPath("ex_class_import");
$file = "{$temp}/{$uid}";
$import = new CExClassImport($file);
$map = array("CExConcept" => array("behaviour" => "shared", "children" => "CExCListItem-list_id", "fields" => array("name" => "ask")), "CExList" => array("behaviour" => "shared", "children" => "CExCListItem-list_id", "fields" => array("name" => "ask")), "CExClassListItem" => array(), "CExClass" => array("children" => array("CExClassFieldGroup-ex_class_id"), "fields" => array("group_id" => "ask")), "CExClassFieldGroup" => array("children" => array("CExClassField-ex_group_id"), "fields" => array("group_id" => "ask")), "CExClassField" => array("children" => array("CExListItem-field_id", "CExClassFieldTranslation-ex_class_field_id"), "fields" => array("group_id" => "ask")), "CExClassFieldTranslation" => array());
/** @var DOMElement $ex_class */
$ex_class = $import->getElementsbyClass("CExClass")->item(0);
$ex_class_name = $import->getNamedValueFromElement($ex_class, "name");
$list_elements = $import->getElementsbyClass("CExList");
$lists = array();
foreach ($list_elements as $_list_element) {
    $_id = $_list_element->getAttribute("id");
    $_elements = $import->getElementsByFwdRef("CExListItem", "list_id", $_id);
    $_elements_values = array();
    foreach ($_elements as $_element) {
        $_elements_values[] = CMbXMLObjectImport::getValuesFromElement($_element);
    }
    /** @var CExList[] $_similar */
    $_similar = $import->getSimilarFromElement($_list_element);
<?php

/**
 * $Id$
 *  
 * @category Forms
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkEdit();
$uid = CValue::post("file_uid");
$from_db = CValue::post("fromdb");
$options = CValue::post("options");
$options = stripslashes_deep($options);
$options["ignore_disabled_fields"] = isset($options["ignore_disabled_fields"]);
$uid = preg_replace('/[^\\d]/', '', $uid);
$temp = CAppUI::getTmpPath("ex_class_import");
$file = "{$temp}/{$uid}";
$import = new CExClassImport($file);
try {
    $import->import($from_db, $options);
} catch (Exception $e) {
    CAppUI::stepAjax($e->getMessage(), UI_MSG_WARNING);
}