/**
  * Get target object
  *
  * @return CMbObject
  */
 function getObject()
 {
     if (!$this->object) {
         $this->object = CStoredObject::loadFromGuid($this->object_guid);
     }
     if ($this->object) {
         $this->object->loadComplete();
     }
     return $this->object;
 }
Esempio n. 2
0
$file_class = CValue::get("object_class");
$destination_guid = CValue::get("destination_guid");
$name = CValue::get("file_name");
$category_id = CValue::get("category_id");
$allowed = array("CFile", "CCompteRendu");
if (!in_array($file_class, $allowed)) {
    CAppUI::stepAjax("CFile-msg-not_allowed_object_to_move", UI_MSG_ERROR);
}
/** @var CFile|CCompteRendu $file */
$file = new $file_class();
$file->load($file_id);
$file->file_category_id = $category_id && $category_id != $file->file_category_id ? $category_id : $file->file_category_id;
if ($file instanceof CFile) {
    $file->file_name = $name ? $name : $file->file_name;
}
$destination = CStoredObject::loadFromGuid($destination_guid);
if ($file->object_id == $destination->_id && $file->object_class == $destination->_class) {
    CAppUI::stepAjax("CFile-msg-from_equal_to", UI_MSG_ERROR);
}
$file->setObject($destination);
// check category
$cat = new CFilesCategory();
$cat->load($file->file_category_id);
if ($cat->class && $cat->class != $destination->_class) {
    $file->file_category_id = "";
}
if ($msg = $file->store()) {
    CAppUI::setMsg($msg, UI_MSG_ERROR);
} else {
    CAppUI::setMsg("CFile-msg-moved");
}
Esempio n. 3
0
 * @package    Mediboard
 * @subpackage Patients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$salutation_id = CValue::get('salutation_id');
$object_class = CValue::get('object_class');
$object_id = CValue::get('object_id');
$salutation = new CSalutation();
$salutation->load($salutation_id);
if (!$salutation_id) {
    if (!$object_class || !in_array('CStoredObject', class_parents($object_class))) {
        CAppUI::stepAjax('common-error-Invalid class name', UI_MSG_ERROR);
    }
    $object = CStoredObject::loadFromGuid("{$object_class}-{$object_id}");
    if (!$object || !$object->_id) {
        CAppUI::stepAjax('common-error-Invalid object', UI_MSG_ERROR);
    }
    $salutation->owner_id = CMediusers::get()->_id;
    $salutation->object_class = $object_class;
    $salutation->object_id = $object_id;
}
$salutation->loadRefOwner();
$salutation->loadTargetObject();
$users = new CMediusers();
$users = $users->loadListWithPerms(PERM_EDIT, array('actif' => "= '1'"));
$smarty = new CSmartyDP();
$smarty->assign("salutation", $salutation);
$smarty->assign("object_class", $object_class);
$smarty->display("vw_edit_salutation.tpl");
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 27681 $
 */
CCanDo::checkRead();
$object_guid = CValue::get("object_guid");
$pack_id = CValue::get("pack_id");
$result_set_id = CValue::get("result_set_id");
$result_id = CValue::get("result_id");
$result_set = new CObservationResultSet();
if ($result_set_id) {
    $result_set->load($result_set_id);
    $object = $result_set->loadRefContext();
} else {
    /** @var COperation|CSejour $object */
    $object = CStoredObject::loadFromGuid($object_guid);
    $result_set->context_class = $object->_class;
    $result_set->context_id = $object->_id;
    $result_set->datetime = CMbDT::dateTime();
    $result_set->patient_id = $object->loadRelPatient()->_id;
}
list($results) = CObservationResultSet::getResultsFor($object);
$pack = new CSupervisionGraphPack();
$pack->load($pack_id);
$links = $pack->loadRefsGraphLinks();
foreach ($links as $_link) {
    $_graph = $_link->loadRefGraph();
    if ($_graph instanceof CSupervisionGraph) {
        $axes = $_graph->loadRefsAxes();
        foreach ($axes as $_axis) {
            $series = $_axis->loadRefsSeries();
 /**
  * Store object
  *
  * @return void
  */
 function doStore()
 {
     if ($msg = $this->_obj->store()) {
         CAppUI::setMsg($msg, UI_MSG_ERROR);
         if ($this->redirectError) {
             $this->redirect =& $this->redirectError;
         }
     } else {
         $id = $this->objectKey;
         CValue::setSession($id, $this->_obj->_id);
         CAppUI::setMsg($this->_old->_id ? $this->modifyMsg : $this->createMsg, UI_MSG_OK);
         // Store additional object reference to the CExObject
         $ex_object_guid = CMbArray::get($this->request, "_ex_object_guid");
         if ($ex_object_guid) {
             $obj = $this->_obj;
             /** @var CExObject $ex_object */
             $ex_object = CStoredObject::loadFromGuid($ex_object_guid);
             if ($ex_object->_id) {
                 $ex_object->additional_class = $obj->_class;
                 $ex_object->additional_id = $obj->_id;
                 $ex_object->store();
             }
         }
         if ($this->redirectStore) {
             $this->redirect =& $this->redirectStore;
         }
     }
 }
 * $Id$
 *
 * @package    Mediboard
 * @subpackage dPpatients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CSessionHandler::writeClose();
$const = new CConstantesMedicales();
$perms = $const->canDo();
if (!$perms->read) {
    $perms->redirect();
}
$context_guid = CValue::get('context_guid');
$context = CStoredObject::loadFromGuid($context_guid);
$ranks = CConstantesMedicales::getConstantsByRank('graph', false, CConstantesMedicales::guessHost($context));
$list_cste = array();
$list_cumul = array();
$cste_nb = 0;
$cumul_nb = 0;
if (array_key_exists(1, $ranks['all'])) {
    /* We only display constants with rank 1 */
    foreach ($ranks['all'][1] as $_cste) {
        if (substr($_cste, 0, 1) === "_") {
            continue;
        }
        /* We display at most 4 graph with cumuled constants */
        if (isset(CConstantesMedicales::$list_constantes[$_cste]['cumul_reset_config'])) {
            if ($cumul_nb < 4) {
                $list_cumul[] = $_cste;
 function importObject(DOMElement $element)
 {
     $id = $element->getAttribute("id");
     if (isset($this->imported[$id])) {
         return;
     }
     $this->name_suffix = " (import du " . CMbDT::dateTime() . ")";
     $map_to = isset($this->map[$id]) ? $this->map[$id] : null;
     switch ($element->getAttribute("class")) {
         // --------------------
         case "CExClass":
             $values = self::getValuesFromElement($element);
             $ex_class = new CExClass();
             $ex_class->name = $this->options["ex_class_name"];
             $ex_class->group_id = CGroups::loadCurrent()->_id;
             $ex_class->pixel_positionning = $values["pixel_positionning"];
             $ex_class->native_views = $values["native_views"];
             $ex_class->_dont_create_default_group = true;
             if ($msg = $ex_class->store()) {
                 throw new Exception($msg);
             }
             CAppUI::stepAjax("Formulaire '%s' créé", UI_MSG_OK, $ex_class->name);
             $map_to = $ex_class->_guid;
             break;
             // --------------------
         // --------------------
         case "CExList":
             if ($map_to == "__create__") {
                 /** @var CExList $_ex_list */
                 $_ex_list = $this->getObjectFromElement($element);
                 if ($msg = $_ex_list->store()) {
                     $_ex_list->name .= $this->name_suffix;
                 }
                 if ($msg = $_ex_list->store()) {
                     CAppUI::stepAjax($msg, UI_MSG_WARNING);
                     break;
                 }
                 CAppUI::stepAjax("Liste '%s' créée", UI_MSG_OK, $_ex_list);
                 $_elements = $this->getElementsByFwdRef("CExListItem", "list_id", $id);
                 foreach ($_elements as $_element) {
                     $_list_item = new CExListItem();
                     bindHashToObject(self::getValuesFromElement($_element), $_list_item);
                     $_list_item->list_id = $_ex_list->_id;
                     if ($msg = $_list_item->store()) {
                         CAppUI::stepAjax($msg, UI_MSG_WARNING);
                         break;
                     }
                     CAppUI::stepAjax("Elément de liste '%s' créé", UI_MSG_OK, $_list_item);
                     $_item_id = $_element->getAttribute("id");
                     $this->map[$_item_id] = $_list_item->_guid;
                     $this->imported[$_item_id] = true;
                 }
                 $map_to = $_ex_list->_guid;
             } else {
                 /** @var CExList $ex_list */
                 $ex_list = CStoredObject::loadFromGuid($map_to);
                 $list_items = $ex_list->loadRefItems();
                 foreach ($list_items as $_item) {
                     $this->map[$_item->_guid] = $_item->_guid;
                 }
             }
             break;
             // --------------------
         // --------------------
         case "CExConcept":
             if ($map_to == "__create__") {
                 /** @var CExConcept $_ex_concept */
                 $_ex_concept = $this->getObjectFromElement($element);
                 if ($_ex_concept->ex_list_id) {
                     $_ex_concept->updatePropFromList();
                 }
                 $_ex_concept->prop = $_ex_concept->updateFieldProp($_ex_concept->prop);
                 if ($msg = $_ex_concept->store()) {
                     $_ex_concept->name .= $this->name_suffix;
                 }
                 if ($msg = $_ex_concept->store()) {
                     CAppUI::stepAjax($msg, UI_MSG_WARNING);
                     break;
                 }
                 CAppUI::stepAjax("Concept '%s' créé", UI_MSG_OK, $_ex_concept);
                 $map_to = $_ex_concept->_guid;
             }
             break;
         case "CExClassField":
             /** @var CExClassField $_ex_field */
             $_ex_field = $this->getObjectFromElement($element);
             if ($this->options["ignore_disabled_fields"] && $_ex_field->disabled) {
                 break;
             }
             $_ex_field->_make_unique_name = false;
             // Met à jour default|XXX des champs enum pour garder la bonne référence
             // @FIXME Ne fonctionne pas à cause du fait qu'il y a un concept_id ....
             $_spec_obj = $_ex_field->getSpecObject();
             if ($_spec_obj instanceof CEnumSpec && $_spec_obj->default) {
                 $_new_default = $this->getIdFromGuid($this->map["CExListItem-{$_spec_obj->default}"]);
                 $_ex_field->prop = preg_replace('/ default\\|\\d+/', " default|{$_new_default}", $_ex_field->prop);
             }
             if ($msg = $_ex_field->store()) {
                 CAppUI::stepAjax($msg, UI_MSG_WARNING);
                 break;
             }
             CAppUI::stepAjax("Champ '%s' créé", UI_MSG_OK, $_ex_field);
             $map_to = $_ex_field->_guid;
             break;
             // --------------------
         // --------------------
         case "CExClassFieldGroup":
         case "CExClassFieldSubgroup":
         case "CExClassFieldTranslation":
         case "CExClassMessage":
         case "CExClassHostField":
             $_object = $this->getObjectFromElement($element);
             if ($msg = $_object->store()) {
                 CAppUI::stepAjax($msg, UI_MSG_WARNING);
                 break;
             }
             CAppUI::stepAjax(CAppUI::tr($_object->_class) . " '%s' créé", UI_MSG_OK, $_object);
             $map_to = $_object->_guid;
             break;
         case "CExClassFieldPredicate":
             /** @var CExClassFieldPredicate $_object */
             $_object = $this->getObjectFromElement($element);
             if ($_object->value) {
                 $_field = $_object->loadRefExClassField();
                 if ($_field->getSpecObject() instanceof CEnumSpec) {
                     $this->predicates_to_fix[] = $_object;
                 }
             }
             if ($msg = $_object->store()) {
                 CAppUI::stepAjax($msg, UI_MSG_WARNING);
                 break;
             }
             CAppUI::stepAjax(CAppUI::tr($_object->_class) . " '%s' créé", UI_MSG_OK, $_object);
             $map_to = $_object->_guid;
             break;
         default:
             // Ignore object
             break;
     }
     $this->map[$id] = $map_to;
     $this->imported[$id] = true;
 }
Esempio n. 8
0
 /**
  * @see parent::importObject()
  */
 function importObject(DOMElement $element)
 {
     $id = $element->getAttribute("id");
     if (isset($this->imported[$id])) {
         return;
     }
     $_class = $element->getAttribute("class");
     $group = CGroups::loadCurrent();
     if ($_class == "CGroups") {
         $this->storeIdExt($group, $id);
         $this->map[$id] = $group->_guid;
         $this->imported[$id] = true;
     }
     $this->name_suffix = " (import du " . CMbDT::dateTime() . ")";
     $map_to = isset($this->map[$id]) ? $this->map[$id] : null;
     if (!$map_to) {
         //CAppUI::stepAjax("ID ignoré : '%s'", UI_MSG_OK, $id);
         return;
     }
     switch ($_class) {
         // --------------------
         case "CGroups":
             CAppUI::stepAjax("Etablissement de rattachement : '%s'", UI_MSG_OK, $group->text);
             $map_to = $group->_guid;
             break;
         case "CUser":
             switch ($map_to) {
                 case "__ignore__":
                     // Ignore
                     break;
                 default:
                     /** @var CMbObject $_object */
                     $_object = CStoredObject::loadFromGuid($map_to);
                     $this->storeIdExt($_object, $id);
                     $map_to = $_object->_guid;
             }
             break;
         case "CSalle":
         case "CFunctions":
         case "CService":
         case "CBlocOperatoire":
             switch ($map_to) {
                 case "__ignore__":
                     // Ignore
                     break;
                 case "__create__":
                     /** @var CSalle|CFunctions|CService|CBlocOperatoire $_object */
                     $_object = $this->getObjectFromElement($element);
                     if ($msg = $_object->store()) {
                         if ($_object instanceof CGroups || $_object instanceof CFunctions) {
                             $_object->text .= $this->name_suffix;
                         } elseif ($_object instanceof CSalle || $_object instanceof CService || $_object instanceof CBlocOperatoire) {
                             $_object->nom .= $this->name_suffix;
                         }
                     }
                     if ($msg = $_object->store()) {
                         CAppUI::stepAjax($msg, UI_MSG_WARNING);
                         break;
                     }
                     $this->storeIdExt($_object, $id);
                     CAppUI::stepAjax("%s '%s' créé", UI_MSG_OK, CAppUI::tr($_object->_class), $_object);
                     $map_to = $_object->_guid;
                     break;
                 default:
                     /** @var CMbObject $_object */
                     $_object = CStoredObject::loadFromGuid($map_to);
                     $this->storeIdExt($_object, $id);
                     $map_to = $_object->_guid;
             }
             break;
         default:
             // Ignore object
             break;
     }
     $this->map[$id] = $map_to;
     $this->imported[$id] = true;
 }
 * @version  SVN: $Id: ajax_refresh_exchange.php 15880 2012-06-15 08:14:36Z phenxdesign $
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$person_id_number = CValue::request("person_id_number");
$person_namespace_id = CValue::request("person_namespace_id");
$person_universal_id = CValue::request("person_universal_id");
$person_universal_id_type = CValue::request("person_universal_id_type");
$person_identifier_type_code = CValue::request("person_identifier_type_code");
$domains_returned_namespace_id = CValue::request("domains_returned_namespace_id");
$domains_returned_universal_id = CValue::request("domains_returned_universal_id");
$domains_returned_universal_id_type = CValue::request("domains_returned_universal_id_type");
$cn_receiver_guid = CValue::sessionAbs("cn_receiver_guid");
/** @var CReceiverHL7v2 $receiver_hl7v2 */
if ($cn_receiver_guid) {
    $receiver_hl7v2 = CStoredObject::loadFromGuid($cn_receiver_guid);
} else {
    $receiver_hl7v2 = new CReceiverHL7v2();
    $receiver_hl7v2->actif = 1;
    $receiver_hl7v2->group_id = CGroups::loadCurrent()->_id;
    $receiver_hl7v2->loadObject();
}
if (!$receiver_hl7v2 || !$receiver_hl7v2->_id) {
    CAppUI::stepAjax("No receiver", UI_MSG_WARNING);
    return;
}
CAppUI::stepAjax("From: " . $receiver_hl7v2->nom);
$profil = "PIX";
$transaction = "ITI9";
$message = "QBP";
$code = "Q23";