Example #1
0
 /**
  * Check collision with another plage regarding defined in class spec
  *
  * @return string Collision message
  */
 function hasCollisions()
 {
     if ($this->_skip_collisions) {
         return null;
     }
     // Check whether mandatory collision keys are defined
     $keys = $this->_spec->collision_keys;
     if (!is_array($keys)) {
         CModelObject::error("CPlageHoraire-collision_keys", $this->_class);
     }
     $this->completeField("date", "debut", "fin");
     $this->completeField($keys);
     // Get all other plages the same day
     $where[$this->_spec->key] = "!= '{$this->_id}'";
     $where["date"] = "= '{$this->date}'";
     $where["debut"] = "< '{$this->fin}'";
     $where["fin"] = "> '{$this->debut}'";
     // Append collision keys clauses
     foreach ($keys as $_key) {
         $where[$_key] = "= '{$this->{$_key}}'";
     }
     // Load collision
     /** @var CPlageHoraire $plage */
     $plage = new $this->_class();
     $this->_colliding_plages = $plage->loadList($where);
     // Build collision message
     $msgs = array();
     foreach ($this->_colliding_plages as $_plage) {
         /** @var CPlageHoraire $_plage */
         $msgs[] = "Collision avec la plage de '{$_plage->debut}' à '{$_plage->fin}'";
     }
     return count($msgs) ? implode(", ", $msgs) : null;
 }
 /**
  * Get properties specifications as strings
  *
  * @see parent::getProps()
  * @return array
  */
 function getProps()
 {
     $props = parent::getProps();
     // Add primary key as ref on self class when existing
     if ($key = $this->_spec->key) {
         $props[$key] = "ref class|{$this->_class} show|0";
     }
     return $props;
 }
Example #3
0
 /**
  * constructor
  *
  * @param CSourcePOP $source Source POP
  */
 function __construct($source)
 {
     //stock the source
     $this->source = $source;
     if (!function_exists("imap_open")) {
         CModelObject::error("FE-IMAP-support-not-available");
     }
     //initialise open TIMEOUT
     imap_timeout(1, $this->source->timeout);
     //lets create the string for stream
     $type = $this->source->type == "pop3" ? "/" . $this->source->type : "";
     $ssl = $this->source->auth_ssl == "SSL/TLS" ? "/ssl/novalidate-cert" : "/notls";
     $port = $this->source->port ? ":" . $this->source->port : "";
     $extension = $this->source->extension ? $this->source->extension : "";
     return $this->_server = "{" . $this->source->host . $port . $type . $ssl . "}" . $extension;
 }
Example #4
0
 /**
  * Staticly build object handlers array
  *
  * @return void
  */
 protected static final function makeHandlers()
 {
     if (is_array(self::$handlers)) {
         return;
     }
     // Static initialisations
     self::$handlers = array();
     foreach (CAppUI::conf("eai_handlers") as $_class => $_active) {
         if ($_active) {
             if (!class_exists($_class)) {
                 CModelObject::error("application-eai-handler-missing-class%s", $_class);
                 continue;
             }
             self::$handlers[$_class] = new $_class();
         }
     }
 }
Example #5
0
 /**
  * @see parent::checkProperty()
  */
 function checkProperty($object)
 {
     $propValue = $object->{$this->fieldName};
     // Root node surrounding
     $source = utf8_encode("<div>{$propValue}</div>");
     //for external html content => no validation
     if (stripos($source, "<html") !== false) {
         return null;
     }
     // Entity purge
     $source = preg_replace("/&\\w+;/i", "", $source);
     // Escape warnings, returns false if really invalid
     if (!@DOMDocument::loadXML($source)) {
         CModelObject::warning("Error-Html-document-bad-formatted");
         return "Le document HTML est mal formé, ou la requête n'a pas pu se terminer.";
     }
     return null;
 }
 /**
  * Load target of meta object
  *
  * @param bool $cache Utilisation du cache
  *
  * @return CMbObject
  */
 function loadTargetObject($cache = true)
 {
     if ($this->_ref_object || !$this->object_class) {
         return $this->_ref_object;
     }
     if (!class_exists($this->object_class)) {
         $ex_object = CExObject::getValidObject($this->object_class);
         if (!$ex_object) {
             CModelObject::error("Unable-to-create-instance-of-object_class%s-class", $this->object_class);
             return null;
         } else {
             $ex_object->load($this->object_id);
             $this->_ref_object = $ex_object;
         }
     } else {
         $this->_ref_object = $this->loadFwdRef("object_id", $cache);
     }
     if (!$this->_ref_object->_id) {
         $this->_ref_object->load(null);
         $this->_ref_object->_view = "Element supprimé";
     }
     return $this->_ref_object;
 }
 /**
  * Check collision with another plage regarding defined in class spec
  *
  * @return array Collision list
  */
 function getCollisions()
 {
     // Check whether mandatory collision keys are defined
     $keys = $this->_spec->collision_keys;
     if (!is_array($keys)) {
         CModelObject::error("class%s-collision_keys-not-available", $this->_class);
         return array();
     }
     $keys = $this->_spec->collision_keys;
     $this->completeField("start", "end");
     $this->completeField($keys);
     // Get all other plages the same day
     //chevauchement & inside
     $where[$this->_spec->key] = "!= '{$this->_id}'";
     // OLD METHOD
     /*$where[] = "(`start` < '$this->start' AND `end` > '$this->start') OR
       (`start` < '$this->end' AND `end` > '$this->end') OR
       (`start` > '$this->end' AND `end` < '$this->end')";*/
     $where["start"] = "< '{$this->end}'";
     $where["end"] = "> '{$this->start}'";
     // Append collision keys clauses
     foreach ($keys as $_key) {
         $where[$_key] = "= '{$this->{$_key}}'";
     }
     // Load collision
     /** @var CPlageCalendaire $plages */
     $plages = new $this->_class();
     $this->_colliding_plages = $plages->loadList($where);
     // Build collision message
     $msgs = array();
     /** @var $_plage CPlageCalendaire */
     foreach ($this->_colliding_plages as $_plage) {
         $msgs[] = CAppUI::tr("CPlageCalendaire-collision-with-plageNb%d-start%s-end%s", $_plage->_id, $_plage->start, $_plage->end);
     }
     return $this->_collisionList = $msgs;
 }
 /**
  * Collection natural sort utility with diacritic sensitiveness options
  *
  * @param CModelObject[] $objects    Object collection to be sorted
  * @param string[]       $fields     Fields to sort on
  * @param bool           $diacritics Take diacritics (accents and more) into account
  *
  * @return array
  */
 public static function naturalSort($objects, $fields, $diacritics = false)
 {
     if (empty($objects)) {
         return $objects;
     }
     $callback = $diacritics ? "_cmpFieldNaturalAccentsDiacritics" : "_cmpFieldNatural";
     foreach ($fields as $field) {
         self::$sortField = $field;
         usort($objects, array(__CLASS__, $callback));
     }
     // Restore original keys
     return array_combine(CMbArray::pluck($objects, "_id"), $objects);
 }
 /**
  * Check whether target field exists in object
  * 
  * @param object $object Object to scan
  * @param string $field  Field name
  * 
  * @return string Error-like message
  */
 function checkTargetPropValue($object, $field)
 {
     $fields = get_object_vars($object);
     if (!$field || $field === true || !is_scalar($field) || !array_key_exists($field, $fields)) {
         $class = get_class($this);
         CModelObject::warning("Element-cible-field%s-invalide-ou-inexistant-dans-la-classe%s", $field, $class);
         return "Erreur système";
     }
     return null;
 }
    }
    // Si tout est coté, on n'affiche pas l'opération
    if ($nb_actes_ccam >= $nbCodes) {
        unset($consultations[$key]);
        continue;
    }
    $_consult->_actes_non_cotes = $nbCodes - $nb_actes_ccam;
    $_consult->loadRefsFwd();
    $_consult->loadRefSejour();
    $_consult->loadRefPraticien()->loadRefFunction();
    // Liste des actes CCAM cotées
    foreach ($_consult->loadRefsActesCCAM() as $_acte) {
        $_acte->loadRefExecutant();
    }
}
$consultations = CModelObject::naturalSort($consultations, array("_date"));
if (!$export) {
    $smarty = new CSmartyDP();
    $smarty->assign("totals", $totals);
    $smarty->assign("interventions", $interventions);
    $smarty->assign("consultations", $consultations);
    $smarty->assign("debut", $debut);
    $smarty->assign("fin", $fin);
    $smarty->assign("all_prats", $all_prats);
    $smarty->assign("board", CValue::get("board", 0));
    $smarty->assign('interv_with_no_codes', $interv_with_no_codes);
    $smarty->assign('display_not_exported', CValue::get('display_not_exported', 0));
    $smarty->display("../../dPboard/templates/inc_list_interv_non_cotees.tpl");
} else {
    $csv = new CCSVFile();
    $line = array("Praticiens", "Patient", "Evènement", "Actes Non cotés", "Codes prévus", "Actes cotés");
Example #11
0
    list($object_class, $type, $fields) = $_insert;
    $triplets[] = "{$object_class}-{$type}-{$fields}";
}
$where = "CONCAT_WS('-', `object_class`, `type`, `fields`) " . CSQLDataSource::prepareIn($triplets);
$request->addWhere($where);
// Actual query
if ($execute) {
    $query = $request->makeSelect($log);
    $list = $ds->loadList($query);
    $class_to_table = array();
    foreach ($list as $_row) {
        $_object_class = $_row["object_class"];
        $_type = $_row["type"];
        $_fields = $_row["fields"];
        if (!isset($class_to_table[$_object_class])) {
            $_obj = CModelObject::getInstance($_object_class);
            $_spec = $_obj->_spec;
            $class_to_table[$_object_class] = array("table" => $_spec->table, "key" => $_spec->key);
        }
        $_table_info = $class_to_table[$_object_class];
        $_table = $_table_info["table"];
        $_key = $_table_info["key"];
        foreach ($inserts as $_insert) {
            /** @var callable $callback */
            list($object_class, $type, $fields, $callback) = $_insert;
            if ($fields === $_fields && $object_class === $_object_class && $type === $_type) {
                $_query = $callback($ds, $_row);
                $ds->exec($_query);
                $counts["insert"] += $ds->affectedRows();
            }
        }
$where["type"] = "= 'body'";
// Niveau utilisateur
$where["user_id"] = " = '{$curr_user->_id}'";
if ($user->canEdit()) {
    $where["user_id"] = "IN ('{$user->_id}', '{$curr_user->_id}')";
}
$modeles = $compte_rendu->seek($keywords, $where, 100, false, null, "nom");
// Niveau fonction
// Inclusion des fonctions secondaires de l'utilisateur connecté
// et de l'utilisateur concerné
unset($where["user_id"]);
$sec_function = new CSecondaryFunction();
$whereSecFunc = array();
$whereSecFunc["user_id"] = " = '{$curr_user->_id}'";
if ($user->canEdit()) {
    $whereSecFunc["user_id"] = "IN ('{$user->_id}', '{$curr_user->_id}')";
}
$function_sec = $sec_function->loadList($whereSecFunc);
$function_ids = array_merge(CMbArray::pluck($function_sec, "function_id"), array($user->function_id, $curr_user->function_id));
$where["function_id"] = CSQLDataSource::prepareIn($function_ids);
$modeles = array_merge($modeles, $compte_rendu->seek($keywords, $where, 100, false, null, "nom"));
// Niveau établissement
unset($where["function_id"]);
$where["group_id"] = " = '{$user->_group_id}'";
$modeles = array_merge($modeles, $compte_rendu->seek($keywords, $where, 100, false, null, "nom"));
$modeles = CModelObject::naturalSort($modeles, array("nom"), true);
$smarty = new CSmartyDP();
$smarty->assign("modeles", $modeles);
$smarty->assign("nodebug", true);
$smarty->assign("keywords", $keywords);
$smarty->display("inc_modele_autocomplete.tpl");
Example #13
0
        // Creates array(DateTimeZone => 'Friendly name')
    }
}
$php_config = ini_get_all();
$php_config_important = array("memory_limit", "default_socket_timeout", "max_execution_time", "mysql.connect_timeout", "session.gc_maxlifetime");
$php_config_tree = array("general" => array());
foreach ($php_config as $key => $value) {
    $parts = explode(".", $key, 2);
    $value["user"] = $value["access"] & 1;
    if (count($parts) == 1) {
        $php_config_tree["general"][$key] = $value;
    } else {
        if (!isset($php_config_tree[$parts[0]])) {
            $php_config_tree[$parts[0]] = array();
        }
        $php_config_tree[$parts[0]][$key] = $value;
    }
}
$browser_compat = array('firefox' => array('3.0', '3.5', '3.6', '4', '5', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'), 'msie' => array('7.0', '8.0', '9.0', '10.0'), 'opera' => array('9.0', '9.6', '10.0', '10.1', '10.7', '11.0', '12.0'), 'chrome' => array('10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30'), 'safari' => array('525.26' => '3.2', '525.27' => '3.2.1', '525.28' => '3.2.3', '530.17' => '4.0', '533.16' => '4.1 / 5.0', '533.17.8' => '4.1.1 / 5.0.1', '533.19.4' => '5.0.3', '534.48.3' => '5.1', '534.55.3' => '5.1.5'));
// Source SMTP
$message_smtp = CExchangeSource::get("system-message", "smtp", true, null, false);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("timezones", $timezones);
$smarty->assign("php_config", $php_config_tree);
$smarty->assign("php_config_important", $php_config_important);
$smarty->assign("browser_compat", $browser_compat);
$smarty->assign("message_smtp", $message_smtp);
CModelObject::makeHandlers();
$smarty->assign("handlers", CModelObject::getHandlers());
$smarty->display("configure.tpl");
Example #14
0
 /**
  * Charge toutes les réponses du RPU
  *
  * @return CMotifReponse[]
  */
 function loadRefsReponses()
 {
     $this->_ref_reponses = $this->loadBackRefs("reponses_rpu");
     return $this->_ref_reponses = CModelObject::naturalSort($this->_ref_reponses, array("_degre"));
 }
Example #15
0
 /**
  * Registers a table in the module
  *
  * @param string $table Table name
  *
  * @return void
  */
 function addTable($table)
 {
     if (in_array($table, $this->tables)) {
         CModelObject::error("Table-table%s-already-exists", $table);
     }
     $this->tables[] = $table;
 }
 static function buildEventsGrid(COperation $interv, $time_debut_op_iso, $time_fin_op_iso, $time_min, $time_max)
 {
     // ---------------------------------------------------
     // Gestes, Medicaments, Perfusions peranesth
     $evenements = array("CAnesthPerop" => array(), "CAffectationPersonnel" => array());
     // Personnel de l'interv
     $interv->loadAffectationsPersonnel();
     foreach ($interv->_ref_affectations_personnel as $affectations) {
         foreach ($affectations as $_affectation) {
             if (!$_affectation->debut || !$_affectation->fin) {
                 continue;
             }
             $evenements["CAffectationPersonnel"][$_affectation->_id] = array("icon" => null, "label" => $_affectation->_ref_personnel, "unit" => null, "alert" => false, "datetime" => $_affectation->debut, "position" => CSupervisionTimedEntity::getPosition($_affectation->debut, $time_min, $time_max), "width" => CSupervisionTimedEntity::getWidth($_affectation->debut, $_affectation->fin, $time_min, $time_max), "object" => $_affectation, "editable" => false);
         }
     }
     // Personnel de la plage
     $plageop = $interv->_ref_plageop;
     $plageop->loadAffectationsPersonnel();
     foreach ($plageop->_ref_affectations_personnel as $affectations) {
         foreach ($affectations as $_affectation) {
             if (!$_affectation->debut || !$_affectation->fin) {
                 continue;
             }
             $evenements["CAffectationPersonnel"][$_affectation->_id] = array("icon" => null, "label" => $_affectation->_ref_personnel, "unit" => null, "alert" => false, "datetime" => $_affectation->debut, "position" => CSupervisionTimedEntity::getPosition($_affectation->debut, $time_min, $time_max), "width" => CSupervisionTimedEntity::getWidth($_affectation->debut, $_affectation->fin, $time_min, $time_max), "object" => $_affectation, "editable" => false);
         }
     }
     // Gestes perop
     $interv->loadRefsAnesthPerops();
     foreach ($interv->_ref_anesth_perops as $_perop) {
         $evenements["CAnesthPerop"][$_perop->_id] = array("icon" => null, "label" => $_perop->libelle, "unit" => null, "alert" => $_perop->incident, "datetime" => $_perop->datetime, "position" => CSupervisionTimedEntity::getPosition($_perop->datetime, $time_min, $time_max), "object" => $_perop, "editable" => true);
     }
     // Lignes de medicaments et d'elements
     $sejour = $interv->loadRefSejour();
     $prescription = $sejour->loadRefPrescriptionSejour();
     if ($prescription->_id) {
         $lines = $prescription->loadPeropLines(false);
         foreach ($lines as $_line_array) {
             $_line = $_line_array["object"];
             $key = "CPrescription._chapitres.{$_line->_chapitre}";
             if (!isset($evenements[$key])) {
                 $evenements[$key] = array("subitems" => array(), "icon" => $_line->_chapitre);
             }
             // Build view
             $_subkey = array("line" => $_line, "label" => "");
             $_view = "";
             if ($_line instanceof CPrescriptionLineElement) {
                 $_view = $_line->_view;
             } elseif ($_line instanceof CPrescriptionLineMix) {
                 foreach ($_line->_ref_lines as $_mix_item) {
                     $_view .= "{$_mix_item->_ucd_view} / ";
                 }
             } else {
                 $_view = $_line->_ucd_view;
             }
             $_subkey["label"] = $_view;
             $_subkey_guid = $_subkey["line"]->_guid;
             if (!isset($evenements[$key]["subitems"][$_subkey_guid])) {
                 $evenements[$key]["subitems"][$_subkey_guid] = array("label" => $_subkey["label"], "line" => $_line, "items" => array());
             }
             foreach ($_line_array["administrations"] as $_adms) {
                 $_adms = CModelObject::naturalSort($_adms, array("dateTime"));
                 foreach ($_adms as $_adm) {
                     $unite = "";
                     if ($_line instanceof CPrescriptionLineMedicament || $_line instanceof CPrescriptionLineMix) {
                         $unite = $_adm->_ref_object->_ref_produit->libelle_unite_presentation;
                     }
                     $evenements[$key]["subitems"][$_subkey_guid]["items"][] = array("label" => "", "unit" => "{$_adm->quantite} {$unite}", "alert" => false, "datetime" => $_adm->dateTime, "position" => CSupervisionTimedEntity::getPosition($_adm->dateTime, $time_min, $time_max), "object" => $_adm, "editable" => false);
                 }
             }
         }
     }
     return $evenements;
 }
 /**
  * @see parent::checkOptions()
  */
 function checkOptions()
 {
     parent::checkOptions();
     if (!$this->list) {
         CModelObject::warning("CEnumSpec-list-missing-for-field-fieldName%s-of-class-className%s", $this->fieldName, $this->className);
     }
 }
Example #18
0
 /**
  * @see parent::checkProperty()
  */
 function checkProperty($object)
 {
     $propValue = CMbFieldSpec::checkNumeric($object->{$this->fieldName}, false);
     if ($propValue === null) {
         return "N'est pas une valeur décimale";
     }
     // pos
     if ($this->pos && $propValue <= 0) {
         return "Doit avoir une valeur positive";
     }
     // min
     if ($this->min) {
         if (!($min = CMbFieldSpec::checkNumeric($this->min, false))) {
             CModelObject::warning("Specification-de-minimum-numerique-invalide-min=min%d", $this->min);
             return "Erreur système";
         }
         if ($propValue < $min) {
             return "Doit avoir une valeur minimale de {$min}";
         }
     }
     // max
     if ($this->max) {
         $max = CMbFieldSpec::checkNumeric($this->max, false);
         if ($max === null) {
             CModelObject::warning("Specification-de-maximum-numerique-invalide-max=max%d", $this->max);
             return "Erreur système";
         }
         if ($propValue > $max) {
             return "Doit avoir une valeur maximale de {$max}";
         }
     }
     return null;
 }
Example #19
0
 /**
  * Construit les données afin que celles-ci soient indexées (avec les fields corrects)
  *
  * @param CMbObject $datum The datum you want to construct
  *
  * @return array
  */
 function constructDatum($datum)
 {
     if ($datum['type'] != 'delete') {
         /** @var IIndexableObject|CStoredObject $object */
         $object = CModelObject::getInstance($datum["object_class"]);
         // cas où l'objet a été supprimé avant son indexation en create ou update
         if (!$object->load($datum['object_id'])) {
             $datum_to_index["id"] = $datum['object_id'];
             $datum_to_index["date"] = CMbDT::format(CMbDT::dateTime(), "%Y/%m/%d");
             return $datum_to_index;
         }
         //On récupère les champs à indexer.
         $datum_to_index = $object->getIndexableData();
         if (!$datum_to_index["date"]) {
             $datum_to_index["id"] = $datum['object_id'];
             $datum_to_index["date"] = CMbDT::format(CMbDT::dateTime(), "%Y/%m/%d");
         }
         $datum_to_index['body'] = $this->normalizeEncoding($datum_to_index['body']);
         $datum_to_index['title'] = $this->normalizeEncoding($datum_to_index['title']);
     } else {
         $datum_to_index["id"] = $datum['object_id'];
         $datum_to_index["date"] = CMbDT::format(CMbDT::dateTime(), "%Y/%m/%d");
     }
     return $datum_to_index;
 }