/**
  * @see parent::getProps()
  */
 function getProps()
 {
     $props = parent::getProps();
     $props["ex_group_id"] = "ref class|CExClassFieldGroup cascade";
     $props["subgroup_id"] = "ref class|CExClassFieldSubgroup nullify";
     $props["concept_id"] = "ref class|CExConcept autocomplete|name";
     $props["name"] = "str notNull protected canonical";
     $props["disabled"] = "bool notNull default|0";
     //$props["report_level"]= "enum list|1|2|host";
     $props["report_class"] = "enum list|" . implode("|", CExClassEvent::getReportableClasses());
     $props["prop"] = "text notNull";
     $props["predicate_id"] = "ref class|CExClassFieldPredicate autocomplete|_view|true nullify";
     $props["prefix"] = "str";
     $props["suffix"] = "str";
     $props["show_label"] = "bool notNull default|1";
     $props["tab_index"] = "num";
     $props["readonly"] = "bool notNull default|0";
     $props["hidden"] = "bool notNull default|0";
     $props["in_doc_template"] = "bool notNull default|0";
     $props["formula"] = "text";
     // canonical tokens
     $props["_formula"] = "text";
     // localized tokens
     $props["result_in_title"] = "bool notNull default|0";
     $props["coord_field_x"] = "num min|0 max|100";
     $props["coord_field_y"] = "num min|0 max|100";
     //$props["coord_field_colspan"] = "num min|1 max|100";
     //$props["coord_field_rowspan"] = "num min|1 max|100";
     $props["coord_label_x"] = "num min|0 max|100";
     $props["coord_label_y"] = "num min|0 max|100";
     // Pixel positionned
     $props["coord_left"] = "num";
     $props["coord_top"] = "num";
     $props["coord_width"] = "num min|1";
     $props["coord_height"] = "num min|1";
     $props["_ex_class_id"] = "ref class|CExClass";
     $props["_locale"] = "str notNull";
     $props["_locale_desc"] = "str";
     $props["_locale_court"] = "str";
     return $props;
 }
 * $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
 */
$event_name = CValue::post("event_name");
$object_class = CValue::post("object_class");
$form_name = CValue::post("form_name");
$ids = CValue::post("ids");
CSessionHandler::writeClose();
//CExObject::$_load_lite = true;
$ex_class_event = new CExClassEvent();
$ds = $ex_class_event->getDS();
$group_id = CGroups::loadCurrent()->_id;
$where = array("ex_class_event.host_class" => $ds->prepare("=%", $object_class), "ex_class_event.event_name" => $ds->prepare("=%", $event_name), "ex_class.conditional" => $ds->prepare("=%", 0), $ds->prepare("ex_class.group_id = % OR ex_class.group_id IS NULL", $group_id));
$ljoin = array("ex_class" => "ex_class.ex_class_id = ex_class_event.ex_class_id");
/** @var CExClassEvent[] $ex_class_events */
$ex_class_events = $ex_class_event->loadList($where, null, null, null, $ljoin);
$ex_classes = array();
$ex_objects = array();
$count_available = count($ex_class_events);
foreach ($ex_class_events as $_ex_class_event) {
    $_ex_class = $_ex_class_event->loadRefExClass();
    $_ex_class->getFormulaField();
    $ex_classes[$_ex_class->_id] = $_ex_class;
}
$object_data = array();
Пример #3
0
            case 0:
        }
    }
}
$step = $limit;
$total = 0;
if ($limit) {
    $limit = "{$start}, {$limit}";
}
$ref_objects_cache = array();
$search = null;
if ($concept_search) {
    $concept_search = stripslashes($concept_search);
    $search = CExConcept::parseSearch($concept_search);
}
$ex_class_event = new CExClassEvent();
$ex_class_events = null;
$ex_link = new CExLink();
$group_id = $group_id ? $group_id : CGroups::loadCurrent()->_id;
$where = array("ex_link.group_id" => "= '{$group_id}'");
if ($ex_class_id) {
    $where['ex_link.ex_class_id'] = "= '{$ex_class_id}'";
}
$ljoin = array();
$creation_context = null;
if (!$creation_context_class || !$creation_context_id) {
    $creation_context_class = $reference_class;
    $creation_context_id = $reference_id;
}
if ($creation_context_class) {
    /** @var CSejour|CPatient|CConsultation $creation_context */
<?php

/**
 * $Id: ajax_autocomplete_hostfields.php 17759 2013-01-14 11:27:24Z phenxdesign $
 *
 * @package    Mediboard
 * @subpackage forms
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 17759 $
 */
CCanDo::checkEdit();
$ex_class_event_id = CValue::get("ex_class_event_id");
$keywords = CValue::get("_host_field_view");
$ex_class_event = new CExClassEvent();
$ex_class_event->load($ex_class_event_id);
$list = $ex_class_event->buildHostFieldsList();
$show_views = false;
// filtrage
if ($keywords) {
    $show_views = true;
    $re = preg_quote($keywords);
    $re = CMbString::allowDiacriticsInRegexp($re);
    $re = str_replace("/", "\\/", $re);
    $re = "/({$re})/i";
    foreach ($list as $_key => $element) {
        if (!preg_match($re, $element["title"])) {
            unset($list[$_key]);
        }
    }
}
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage forms
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkEdit();
$ex_class_event_id = CValue::get("ex_class_event_id");
$ex_class_id = CValue::get("ex_class_id");
$ex_class_event = new CExClassEvent();
$ex_class_event->load($ex_class_event_id);
$host_object = null;
$reference1 = null;
$reference2 = null;
/** @var CEnumSpec $unicity_spec */
$unicity_spec = $ex_class_event->_specs["unicity"];
// mise a jour des specs de l'unicité pour etre plus user friendly
if ($ex_class_event->_id) {
    $ex_class_event->loadRefsConstraints();
    $ex_class_event->loadRefsNotes();
    $ex_class_event->getHostClassOptions();
    foreach ($ex_class_event->_ref_constraints as $_ex_constraint) {
        $_ex_constraint->loadTargetObject();
        if ($_ex_constraint->_ref_target_object instanceof CMediusers) {
            $_ex_constraint->_ref_target_object->loadRefFunction();
        }
 /**
  * Resolve spec from $this->field
  *
  * @param CModelObject $ref_object Ref object
  *
  * @return CMbFieldSpec|null
  */
 function resolveSpec(CModelObject $ref_object)
 {
     /** @var CMbObject $ref_object */
     /** @var string $field */
     list($ref_object, $field) = $this->getFieldAndObject($ref_object);
     $parts = explode("-", $field);
     $connected_user = CExClassEvent::getConnectedUserSpec();
     if (count($parts) == 1) {
         if ($field == "CONNECTED_USER") {
             $spec = $connected_user;
         } else {
             $spec = $ref_object->_specs[$field];
         }
     } else {
         $subparts = explode(".", $parts[0]);
         /** @var CRefSpec $_spec */
         if ($subparts[0] == "CONNECTED_USER") {
             $_spec = $connected_user;
         } else {
             $_spec = $ref_object->_specs[$subparts[0]];
         }
         if (count($subparts) > 1) {
             $class = $subparts[1];
         } else {
             if (!$_spec->class) {
                 return null;
             }
             $class = $_spec->class;
         }
         $obj = new $class();
         if ($parts[1] == "CONNECTED_USER") {
             $spec = $connected_user;
         } else {
             $spec = $obj->_specs[$parts[1]];
         }
     }
     return $spec;
 }
    CAppUI::stepAjax($msg, UI_MSG_WARNING);
    trigger_error($msg, E_USER_ERROR);
    return;
}
// searching for a CExClassEvent
//$ex_class_event = new CExClassEvent;
//$ex_class_event->host_class =
$object = CMbObject::loadFromGuid($object_guid);
if ($object_guid && !$object) {
    CAppUI::stepAjax("Objet supprimé", UI_MSG_ERROR);
}
if ($object->_id) {
    $object->loadComplete();
}
// searching for a CExClassEvent
$ex_class_event = new CExClassEvent();
$ex_class_event->host_class = $object->_class;
if ($event_name) {
    $ex_class_event->event_name = $event_name;
}
$ex_class_event->ex_class_id = $ex_class_id;
$ex_class_event->loadMatchingObject();
/** @var CExObject $ex_object */
if (!$ex_object_id) {
    $ex_class = new CExClass();
    $ex_class->load($ex_class_id);
    $ex_objects = $ex_class_event->getExObjectForHostObject($object);
    $ex_object = reset($ex_objects);
    if (!$ex_object) {
        $ex_object = $ex_class->getExObjectInstance();
    }
Пример #8
0
$type = CValue::post("type");
$entree_preparee_trigger = CValue::post("_entree_preparee_trigger");
$sejour_id = CValue::post("sejour_id");
$create_affectation = CAppUI::conf("urgences create_affectation");
$sejour = new CSejour();
$sejour->load($sejour_id);
$rpu = $sejour->loadRefRPU();
if ($rpu && $rpu->mutation_sejour_id) {
    $sejour_id = $sejour->_ref_rpu->mutation_sejour_id;
}
$sejour_hospit = new CSejour();
$sejour_hospit->load($sejour_id);
$curr_affectation_hospit = $sejour_hospit->loadRefCurrAffectation();
// Pour un séjour ayant comme mode de sortie urgence:
if ($create_affectation && $mode_sortie == "mutation" && $rpu && $rpu->_id && ($lit_id && $curr_affectation_hospit->lit_id != $lit_id || $service_sortie_id && $curr_affectation_hospit->service_id != $service_sortie_id)) {
    // Création de l'affectation d'hospitalisation
    $affectation_hospit = new CAffectation();
    $affectation_hospit->entree = CMbDT::dateTime();
    $affectation_hospit->lit_id = $lit_id;
    $affectation_hospit->service_id = $service_sortie_id;
    // Mutation en provenance des urgences
    $affectation_hospit->_mutation_urg = true;
    $sejour_hospit->forceAffectation($affectation_hospit);
}
// Lancement des formulaires automatiques sur le champ entrée préparée
if ($sejour->_id && $entree_preparee_trigger && CModule::getActive("forms")) {
    $ex_class_events = CExClassEvent::getForObject($sejour, "preparation_entree_auto", "required");
    echo CExClassEvent::getJStrigger($ex_class_events);
}
$do = new CDoObjectAddEdit("CSejour");
$do->doIt();
/**
 * $Id: ajax_trigger_ex_classes_multiple.php 23812 2014-07-02 11:49:14Z phenxdesign $
 *
 * @package    Mediboard
 * @subpackage forms
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 23812 $
 */
//CCanDo::checkAdmin();
$object_guids = CValue::get("object_guids", array());
$event_name = CValue::get("event_name");
CExClassConstraint::$_load_lite = true;
$ex_class_events = array();
$group_id = CGroups::loadCurrent()->_id;
$ex_class_event = new CExClassEvent();
$ds = $ex_class_event->_spec->ds;
$where = array("ex_class_event.event_name" => $ds->prepare("=%", $event_name), "ex_class_event.disabled" => $ds->prepare("=%", 0), "ex_class.conditional" => $ds->prepare("=%", 0), $ds->prepare("ex_class.group_id = % OR ex_class.group_id IS NULL", $group_id));
$ljoin = array("ex_class" => "ex_class.ex_class_id = ex_class_event.ex_class_id");
foreach ($object_guids as $object_guid) {
    $object = CMbObject::loadFromGuid($object_guid);
    $where["ex_class_event.host_class"] = $ds->prepare("=%", $object->_class);
    /** @var CExClassEvent[] $_ex_class_events */
    $_ex_class_events = $ex_class_event->loadList($where, null, null, null, $ljoin);
    CStoredObject::massLoadBackRefs($_ex_class_events, "constraints");
    foreach ($_ex_class_events as $_id => $_ex_class_event) {
        if ($_ex_class_event->checkConstraints($object)) {
            $_ex_class_event->_host_object = $object;
            $ex_class_events[] = $_ex_class_event;
        }
    }
Пример #10
0
 function loadNativeViews(CExClassEvent $event)
 {
     $this->_native_views = array();
     $views = $event->getAvailableNativeViews();
     $selected_views = explode('|', $this->_ref_ex_class->native_views);
     foreach ($views as $_name => $_class) {
         if (in_array($_name, $selected_views)) {
             $this->_native_views[$_name] = $this->getReferenceObject($_class);
         }
     }
     return $this->_native_views;
 }
Пример #11
0
 /**
  * @see parent::loadEditView()
  */
 function loadEditView()
 {
     parent::loadEditView();
     CExObject::initLocales();
     CExObject::$_locales_cache_enabled = false;
     if ($this->pixel_positionning) {
         $grid = null;
         $out_of_grid = null;
         $this->getPixelGrid();
         foreach ($this->_ref_groups as $_ex_group) {
             $_ex_group->loadRefsSubgroups(true);
             $_ex_group->loadRefsPictures(true);
             $_subgroups = $_ex_group->loadRefsSubgroups(true);
             foreach ($_subgroups as $_subgroup) {
                 $_subgroup->countBackRefs("children_groups");
                 $_subgroup->countBackRefs("children_fields");
                 $_subgroup->countBackRefs("children_messages");
             }
         }
     } else {
         list($grid, $out_of_grid) = $this->getGrid(4, 40, false);
     }
     $events = $this->loadRefsEvents();
     foreach ($events as $_event) {
         $_event->countBackRefs("constraints");
     }
     $this->_groups = CGroups::loadGroups();
     $this->_ex_object = $this->getExObjectInstance();
     $this->_grid = $grid;
     $this->_out_of_grid = $out_of_grid;
     if (!$this->_id) {
         $this->group_id = CGroups::loadCurrent()->_id;
     }
     $classes = CExClassEvent::getReportableClasses();
     $instances = array();
     foreach ($classes as $_class) {
         $instances[$_class] = new $_class();
     }
     $this->_host_objects = $instances;
     $category = new CExClassCategory();
     $this->_categories = $category->loadList(null, "title");
 }
Пример #12
0
 static function getReportableFields($class = null)
 {
     $list = array();
     if ($class) {
         $classes = array($class);
     } else {
         $classes = CExClassEvent::getReportableClasses();
     }
     $full = false;
     foreach ($classes as $_class) {
         $ex_class_event = new CExClassEvent();
         $ex_class_event->host_class = $_class;
         $list = array_merge($list, $ex_class_event->buildHostFieldsList($_class));
     }
     if (!$full) {
         $select = array_flip(array("CPatient _annees", "CPatient _poids", "CPatient _taille"));
         $list = array_intersect_key($list, $select);
     }
     return $list;
 }
Пример #13
0
$group_id = CGroups::loadCurrent()->_id;
$where = array("group_id = '{$group_id}' OR group_id IS NULL");
$ex_class = new CExClass();
CExClass::$_list_cache = $ex_class->loadList($where, "name");
// Loading the events
$ex_classes_creation = array();
$ex_class_events = array();
$_ex_class_creation = array();
foreach (CExClass::$_list_cache as $_ex_class_id => $_ex_class) {
    if (!$_ex_class->conditional) {
        $_ex_class_creation[] = $_ex_class_id;
    }
}
$where = array("ex_class_event.ex_class_id" => CSQLDataSource::get("std")->prepareIn($_ex_class_creation), "ex_class_event.disabled" => "= '0'");
/** @var CExClassEvent[] $ex_class_events_by_ref */
$ex_class_event = new CExClassEvent();
$ex_class_events_by_ref = $ex_class_event->loadList($where);
CStoredObject::massLoadBackRefs($ex_class_events_by_ref, "constraints");
foreach ($ex_class_events_by_ref as $_ex_class_event) {
    $_key = "{$_ex_class_event->host_class}/{$_ex_class_event->ex_class_id}";
    /** @var CExClassEvent[] $_ex_class_events */
    if (!array_key_exists($_key, $ex_class_events)) {
        $ex_class_events[$_key] = array();
    }
    $ex_class_events[$_key][] = $_ex_class_event;
}
foreach ($_ex_class_creation as $_ex_class_id) {
    if (!isset($ex_class_events["{$context->_class}/{$_ex_class_id}"])) {
        continue;
    }
    $_ex_class_events = $ex_class_events["{$context->_class}/{$_ex_class_id}"];