/**
  * @see parent::getFormHtmlElement()
  */
 function getFormHtmlElement($object, $params, $value, $className)
 {
     $maxLength = 10;
     CMbArray::defaultValue($params, "size", $maxLength);
     CMbArray::defaultValue($params, "maxlength", $maxLength);
     return $this->getFormElementText($object, $params, $value, $className);
 }
 /**
  * Fill other identifiers
  *
  * @param array       &$data Datas
  * @param array       $ufs   UF
  * @param CHL7v2Event $event Event
  *
  * @return null
  */
 function fillOtherSegments(&$data, $ufs = array(), CHL7v2Event $event)
 {
     // ZBE-8: Ward of care responsibility in the period starting with this movement (XON) (optional)
     $uf_type = $event->_receiver->_configs["build_ZBE_8"];
     /** @var CUniteFonctionnelle $uf_soins */
     $uf_soins = isset($ufs[$uf_type]) ? $ufs[$uf_type] : null;
     if (isset($uf_soins->_id)) {
         $data[] = array(array($uf_soins->libelle, null, null, null, null, $this->getAssigningAuthority("mediboard"), "UF", null, null, $uf_soins->code));
     } else {
         $data[] = null;
     }
     // ZBE-9: Nature of this movement (CWE)
     // S - Changement de responsabilité de soins uniquement
     // H - Changement de  responsabilité  d'hébergement  soins uniquement
     // M - Changement de responsabilité médicale uniquement
     // L - Changement de lit uniquement
     // D - Changement de prise en charge médico-administrative laissant les responsabilités et la localisation du patient inchangées
     //     (ex : changement de tarif du séjour en unité de soins)
     // SM - Changement de responsabilité soins + médicale
     // SH - Changement de responsabilité soins + hébergement
     // MH - Changement de responsabilité hébergement + médicale
     // LD - Changement de prise en charge médico-administrative et de lit, laissant les responsabilités inchangées
     // HMS - Changement conjoint des trois responsabilités.
     /* @todo Voir comment gérer ceci... */
     // Changement d'UF médicale
     if (CMbArray::in($event->code, "Z80 Z81 Z82 Z83")) {
         $data[] = "M";
     } elseif (CMbArray::in($event->code, "Z84 Z85 Z86 Z87")) {
         $data[] = "S";
     } else {
         $data[] = "HMS";
     }
 }
 /**
  * Get an HTML representation of the symbol char
  *
  * @return string The HTML symbol char
  */
 function getSymbolChar()
 {
     $this->completeField("symbol", "show_points", "display");
     if (!$this->show_points && $this->display != "points") {
         return null;
     }
     return CMbArray::get(self::$_symbol_chars, $this->symbol);
 }
 /**
  * Retourne le nom de la classe
  *
  * @return mixed|string
  */
 function getNameClass()
 {
     $name = get_class($this);
     $name = substr($name, 4);
     if (get_class($this) === "CCDA_base_cs") {
         $name = CMbArray::get(explode("_", $name), 1);
     }
     return $name;
 }
 /**
  * @see parent::getFormHtmlElement()
  */
 function getFormHtmlElement($object, $params, $value, $className)
 {
     $field = CMbString::htmlSpecialChars($this->fieldName);
     $value = CMbString::htmlSpecialChars($value);
     $class = CMbString::htmlSpecialChars("{$className} {$this->prop}");
     $form = CMbArray::extract($params, "form");
     $extra = CMbArray::makeXmlAttributes($params);
     return "<input type=\"tel\" name=\"{$field}\" value=\"{$value}\" class=\"{$class} styled-element\" {$extra} />";
 }
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     $this->_query_params_get = $get = json_decode($this->query_params_get, true);
     $this->_query_params_post = $post = json_decode($this->query_params_post, true);
     $this->_session_data = $session = json_decode($this->session_data, true);
     $get = is_array($get) ? $get : array();
     $post = is_array($post) ? $post : array();
     $this->_module = CValue::first(CMbArray::extract($get, "m"), CMbArray::extract($post, "m"));
     $this->_action = CValue::first(CMbArray::extract($get, "tab"), CMbArray::extract($get, "a"), CMbArray::extract($post, "dosql"));
 }
 /**
  * Returns a spec object for an object's field from a class name
  *
  * @param string $class The class name
  * @param string $field The field name
  * @param string $prop  The prop string serializing the spec object options
  *
  * @throws Exception
  * @return CMbFieldSpec
  */
 static function getSpecWithClassName($class, $field, $prop)
 {
     $spec_class = "CMbFieldSpec";
     // Get Spec type
     $first_space = strpos($prop, " ");
     $spec_type = $first_space === false ? $prop : substr($prop, 0, $first_space);
     // Get spec class
     if ($spec_type && null == ($spec_class = CMbArray::get(self::$classes, $spec_type))) {
         throw new Exception("Invalid spec '{$prop}' for field '{$class}::{$field}'");
     }
     return new $spec_class($class, $field, $prop);
 }
Example #8
0
/**
 * Delete content and update exchange
 *
 * @param CContentTabular $content_tabular Content tabular
 * @param int             $type_content_id Content ID
 * @param date            $date_max        Date max
 * @param int             $max             Max exchange
 *
 * @return int
 */
function deleteContentAndUpdateExchange(CContentTabular $content_tabular, $type_content_id, $date_max, $max)
{
    $ds = $content_tabular->_spec->ds;
    // Récupère les content Tabulé
    $query = "SELECT cx.content_id\r\n            FROM content_tabular AS cx, exchange_hl7v2 AS ec\r\n            WHERE ec.`date_production` < '{$date_max}'\r\n            AND ec.{$type_content_id} = cx.content_id\r\n            LIMIT {$max};";
    $ids = CMbArray::pluck($ds->loadList($query), "content_id");
    // Suppression du contenu Tabulé
    $query = "DELETE FROM content_tabular\r\n            WHERE content_id " . CSQLDataSource::prepareIn($ids);
    $ds->exec($query);
    // Mise à jour des échanges
    $query = "UPDATE exchange_hl7v2\r\n              SET `{$type_content_id}` = NULL \r\n              WHERE `{$type_content_id}` " . CSQLDataSource::prepareIn($ids);
    $ds->exec($query);
    $count = $ds->affectedRows();
    return $count;
}
 /**
  * @see parent::getValue()
  */
 function getValue($object, $smarty = null, $params = array())
 {
     if ($smarty) {
         include_once $smarty->_get_plugin_filepath('modifier', 'date_format');
     }
     $propValue = $object->{$this->fieldName};
     $format = CMbArray::extract($params, "format", CAppUI::conf("datetime"));
     if ($format === "relative") {
         $relative = CMbDate::relative($propValue, CMbDT::dateTime());
         return $relative["count"] . " " . CAppUI::tr($relative["unit"] . ($relative["count"] > 1 ? "s" : ""));
     }
     $date = CMbArray::extract($params, "date");
     if ($date && CMbDT::date($propValue) == $date) {
         $format = CAppUI::conf("time");
     }
     return $propValue && $propValue != "0000-00-00 00:00:00" ? smarty_modifier_date_format($propValue, $format) : "";
 }
 function addAudiogramme($values, $value_name, $title, $mark_color, $mark_type, $mark_file = null, $line = true)
 {
     $frequences = CExamAudio::$frequences;
     $root = CAppUI::conf("root_dir");
     $image_file = "{$root}/images/icons/{$mark_file}";
     // Empty plot case
     $datay = $values;
     CMbArray::removeValue("", $datay);
     if (!count($datay)) {
         return;
     }
     $words = explode(" ", $this->title->t);
     $cote = $words[1];
     $labels = array();
     $jscalls = array();
     // Remove empty values to connect distant points
     $datax = array();
     $datay = array();
     foreach ($values as $key => $value) {
         if ($value !== "" && $value !== null) {
             $frequence = $frequences[$key];
             $jstitle = strtr($title, "\n", " ");
             $labels[] = "Modifier la valeur {$value}dB pour {$jstitle} à {$frequence}";
             $jscalls[] = "javascript:changeTonalValue('{$cote}','{$value_name}',{$key})";
             $datay[] = -intval($value);
             $datax[] = "{$key}";
             // Needs to be a string when null
         }
     }
     $p1 = new LinePlot($datay, $datax);
     $p1->mark->SetType($mark_type, $image_file, 1.0);
     $this->Add($p1);
     // Create the first line
     $p1->SetColor($mark_color);
     $p1->SetCenter();
     $p1->SetLegend($title);
     $p1->SetWeight($line ? 1 : -10);
     $p1->SetCSIMTargets($jscalls, $labels);
     // Marks
     $p1->mark->SetColor($mark_color);
     $p1->mark->SetFillColor("{$mark_color}@0.6");
     $p1->mark->SetWidth(4);
 }
 function update($newValues = array(), $keepOld = true)
 {
     $newValues = array_map_recursive('stripslashes', $newValues);
     if ($keepOld) {
         $this->load();
         $newValues = CMbArray::mergeRecursive($this->values, $newValues);
     }
     if (!count($newValues)) {
         if (is_file($this->targetPath)) {
             unlink($this->targetPath);
         }
         return;
     }
     $this->values = $newValues;
     // Throws many E_STRICT errors
     $config = @new Config();
     @$config->parseConfig($this->values, $this->configType, $this->options);
     return @$config->writeConfig($this->targetPath, $this->configType, $this->options);
 }
Example #12
0
 /**
  * Load all salutation from a given class
  *
  * @param string       $object_class Target object class
  * @param integer|null $object_id    Target object ID
  * @param int          $perm         Permission needed on owners
  * @param integer|null $owner_id     Specific owner ID
  *
  * @return CSalutation[]
  */
 static function loadAllSalutations($object_class, $object_id = null, $perm = PERM_EDIT, $owner_id = null)
 {
     if (!$owner_id) {
         $users = new CMediusers();
         $users = $users->loadListWithPerms($perm, array('actif' => "= '1'"));
         $user_ids = $users ? CMbArray::pluck($users, '_id') : array(CMediusers::get()->_id);
         unset($users);
     } else {
         $user_ids = array($owner_id);
     }
     /** @var CSalutation $salutation */
     $salutation = new self();
     $ds = $salutation->_spec->ds;
     $where = array('owner_id' => $ds->prepareIn($user_ids), 'object_class' => $ds->prepare('= ?', $object_class));
     if ($object_id) {
         $where['object_id'] = $ds->prepare('= ?', $object_id);
     }
     return $salutation->loadList($where);
 }
Example #13
0
 /**
  * Build event
  *
  * @param CMbObject $object Object
  *
  * @see parent::build()
  *
  * @return void
  */
 function build($object)
 {
     // Traitement sur le mbObject
     $this->object = $object;
     $this->last_log = $object->loadLastLog();
     // Récupération de la version HL7 en fonction du receiver et de la transaction
     $this->version = CAppUI::conf("hl7 default_version");
     if ($version = CMbArray::get($this->_receiver->_configs, $this->transaction . "_HL7_version")) {
         $this->version = $version;
     }
     // Génération de l'échange
     $this->generateExchange();
     $terminator = $this->getSegmentTerminator($this->_receiver->_configs["ER7_segment_terminator"]);
     // Création du message HL7
     $message = new CHL7v2Message($this->version);
     $message->segmentTerminator = $terminator;
     $message->name = $this->msg_codes;
     $this->message = $message;
 }
Example #14
0
 /**
  * @see parent::getFormHtmlElement()
  */
 function getFormHtmlElement($object, $params, $value, $className)
 {
     $field = CMbString::htmlSpecialChars($this->fieldName);
     $form = CMbArray::extract($params, "form");
     $extra = CMbArray::makeXmlAttributes($params);
     $readonly = CMbArray::extract($params, "readonly");
     $default_color = $this->default ? $this->default : "ffffff";
     $reset_value = $this->notNull ? $default_color : "";
     $bg_reset = $reset_value ? "#{$reset_value}" : "transparent";
     $value = !$value && ($this->notNull || $this->default) ? $default_color : $value;
     $sHtml = "\n    <input type=\"text\" class=\"color_picker\" name=\"{$field}\" value=\"{$value}\" {$extra} />\n    <button type=\"button\" onclick=\"var elem = \$(this).previous('input'); \$V(elem, '{$reset_value}', true); elem.setStyle({backgroundColor: '{$bg_reset}'});\" class='cancel notext'></button>\n    ";
     if ($form && !$readonly) {
         $js_params = "{}";
         if (!$this->notNull) {
             $js_params = "{required:false}";
         }
         $sHtml .= "<script type=\"text/javascript\">\n        Main.add(function(){\n          var _e = getForm('" . $form . "').elements['" . $field . "'];\n          new jscolor.color(_e, {$js_params});\n        })\n      </script>";
     }
     return $sHtml;
 }
 function addAudiogramme($values, $mark_color)
 {
     $pressions = CExamAudio::$pressions;
     // Empty plot case
     $datay = $values;
     CMbArray::removeValue("", $datay);
     if (!count($datay)) {
         return;
     }
     $title = $this->title->t;
     $words = explode(" ", $title);
     $cote = $words[1];
     $labels = array();
     $jscalls = array();
     // Remove empty values to connect distant points
     $datax = array();
     $datay = array();
     foreach ($values as $key => $value) {
         if ($value !== "" && $value !== null) {
             $pression = $pressions[$key];
             $jstitle = strtr($title, "\n", " ");
             $labels[] = "Modifier l'admittance {$value} ml pour {$jstitle} à la pression {$pression} mm H²0";
             $jscalls[] = "javascript:changeTympanValue('{$cote}',{$key})";
             $datay[] = $value;
             $datax[] = "{$key}";
             // Needs to be a string when null
         }
     }
     $p1 = new LinePlot($datay, $datax);
     // Create the first line
     $p1->SetColor($mark_color);
     $p1->SetCenter();
     $p1->SetWeight(1);
     $p1->SetCSIMTargets($jscalls, $labels);
     // Marks
     $p1->mark->SetType(MARK_FILLEDCIRCLE);
     $p1->mark->SetColor($mark_color);
     $p1->mark->SetFillColor("{$mark_color}@0.6");
     $p1->mark->SetWidth(4);
     $this->Add($p1);
 }
Example #16
0
 function doStore()
 {
     parent::doStore();
     if (CModule::getActive("dPprescription") && !$this->_old->_id) {
         $p_to_c = new CPrescriptionProtocoleToConcept();
         $count_p_to_c = $p_to_c->countList();
         if ($count_p_to_c > 0) {
             /** @var CExObject $ex_object */
             $ex_object = $this->_obj;
             $all_fields = $ex_object->loadRefExClass()->loadRefsAllFields();
             $bool_concept_ids = array();
             foreach ($all_fields as $_field) {
                 if (strpos($_field->prop, "bool") === 0 && $_field->concept_id && $ex_object->{$_field->name} == "1") {
                     $bool_concept_ids[] = $_field->concept_id;
                 }
             }
             $bool_concept_ids = array_unique($bool_concept_ids);
             $where = array("concept_id" => $p_to_c->getDS()->prepareIn($bool_concept_ids));
             $protocole_ids = array_values(CMbArray::pluck($p_to_c->loadList($where), "protocole_id"));
             if (count($protocole_ids)) {
                 /** @var CSejour $sejour */
                 $sejour = $ex_object->getReferenceObject("CSejour");
                 if ($sejour && $sejour->_id) {
                     $prescription = $sejour->loadRefPrescriptionSejour();
                     if (!$prescription->_id) {
                         $prescription = new CPrescription();
                         $prescription->object_id = $sejour->_id;
                         $prescription->object_class = $sejour->_class;
                         $prescription->type = "sejour";
                         if ($msg = $prescription->store()) {
                             CAppUI::setMsg($msg, UI_MSG_WARNING);
                         }
                     }
                     $ops_ids = implode("-", CMbArray::pluck($sejour->loadRefsOperations(array("annulee" => "= '0'")), "operation_id"));
                     CAppUI::callbackAjax("window.opener.ExObject.checkOpsBeforeProtocole", $protocole_ids, $prescription->_id, $sejour->_id, $ops_ids);
                 }
             }
         }
     }
 }
 /**
  * Load trigger data
  *
  * @return void
  */
 function loadTriggeredData()
 {
     $triggers = $this->loadBackRefs("ex_triggers");
     $this->_triggered_data = array();
     if (!count($triggers)) {
         return;
     }
     $keys = CMbArray::pluck($triggers, "trigger_value");
     $values = CMbArray::pluck($triggers, "ex_class_triggered_id");
     $this->_triggered_data = array_combine($keys, $values);
 }
 /**
  * Handle event
  *
  * @param CHL7Acknowledgment $ack        Acknowledgement
  * @param CPatient           $newPatient Person
  * @param array              $data       Nodes data
  *
  * @return null|string
  */
 function handle(CHL7Acknowledgment $ack, CPatient $newPatient, $data)
 {
     // Traitement du message des erreurs
     $comment = $warning = "";
     $exchange_hl7v2 = $this->_ref_exchange_hl7v2;
     $exchange_hl7v2->_ref_sender->loadConfigValues();
     $sender = $exchange_hl7v2->_ref_sender;
     foreach ($data["merge"] as $_data_merge) {
         $data = $_data_merge;
         $mbPatient = new CPatient();
         $mbPatientElimine = new CPatient();
         $patientPI = CValue::read($data['personIdentifiers'], "PI");
         $patientRI = CValue::read($data['personIdentifiers'], "RI");
         $patientEliminePI = CValue::read($data['personElimineIdentifiers'], "PI");
         $patientElimineRI = CValue::read($data['personElimineIdentifiers'], "RI");
         // Acquittement d'erreur : identifiants RI et PI non fournis
         if (!$patientRI && !$patientPI || !$patientElimineRI && !$patientEliminePI) {
             return $exchange_hl7v2->setAckAR($ack, "E100", null, $newPatient);
         }
         $idexPatient = CIdSante400::getMatch("CPatient", $sender->_tag_patient, $patientPI);
         if ($mbPatient->load($patientRI)) {
             if ($idexPatient->object_id && $mbPatient->_id != $idexPatient->object_id) {
                 $comment = "L'identifiant source fait référence au patient : {$idexPatient->object_id}";
                 $comment .= " et l'identifiant cible au patient : {$mbPatient->_id}.";
                 return $exchange_hl7v2->setAckAR($ack, "E130", $comment, $newPatient);
             }
         }
         if (!$mbPatient->_id) {
             $mbPatient->load($idexPatient->object_id);
         }
         $idexPatientElimine = CIdSante400::getMatch("CPatient", $sender->_tag_patient, $patientEliminePI);
         if ($mbPatientElimine->load($patientElimineRI)) {
             if ($idexPatientElimine->object_id && $mbPatientElimine->_id != $idexPatientElimine->object_id) {
                 $comment = "L'identifiant source fait référence au patient : {$idexPatientElimine->object_id}";
                 $comment .= "et l'identifiant cible au patient : {$mbPatientElimine->_id}.";
                 return $exchange_hl7v2->setAckAR($ack, "E131", $comment, $newPatient);
             }
         }
         if (!$mbPatientElimine->_id) {
             $mbPatientElimine->load($idexPatientElimine->object_id);
         }
         if (!$mbPatient->_id || !$mbPatientElimine->_id) {
             $comment = !$mbPatient->_id ? "Le patient {$mbPatient->_id} est inconnu dans Mediboard." : "Le patient {$mbPatientElimine->_id} est inconnu dans Mediboard.";
             return $exchange_hl7v2->setAckAR($ack, "E120", $comment, $newPatient);
         }
         // Passage en trash de l'IPP du patient a éliminer
         $newPatient->trashIPP($idexPatientElimine);
         if ($mbPatient->_id == $mbPatientElimine->_id) {
             return $exchange_hl7v2->setAckAA($ack, "I104", null, $newPatient);
         }
         $patientsElimine_array = array($mbPatientElimine);
         $first_patient_id = $mbPatient->_id;
         $checkMerge = $mbPatient->checkMerge($patientsElimine_array);
         // Erreur sur le check du merge
         if ($checkMerge) {
             $comment = "La fusion de ces deux patients n'est pas possible à cause des problèmes suivants : {$checkMerge}";
             return $exchange_hl7v2->setAckAR($ack, "E121", $comment, $newPatient);
         }
         $mbPatientElimine_id = $mbPatientElimine->_id;
         /** @todo mergePlainFields resets the _id */
         $mbPatient->_id = $first_patient_id;
         // Notifier les autres destinataires
         $mbPatient->_eai_sender_guid = $sender->_guid;
         $mbPatient->_merging = CMbArray::pluck($patientsElimine_array, "_id");
         if ($msg = $mbPatient->merge($patientsElimine_array)) {
             return $exchange_hl7v2->setAckAR($ack, "E103", $msg, $mbPatient);
         }
         $mbPatient->_mbPatientElimine_id = $mbPatientElimine_id;
         $comment = CEAIPatient::getComment($mbPatient, $mbPatientElimine);
     }
     return $exchange_hl7v2->setAckAA($ack, "I103", $comment, $mbPatient);
 }
 /**
  * @see parent::build
  */
 function build(CHPrimSanteEvent $event)
 {
     parent::build($event);
     $patient = $this->patient;
     $sejour = $this->sejour;
     $actor = isset($event->_sender->_id) ? $event->_sender : $event->_receiver;
     $group = $actor->loadRefGroup();
     $patient->loadIPP($group->_id);
     // P-1: type segment - P(par défaut) (ST)
     // P-2: rang segment - (NM)
     $data[] = "1";
     // P-3: Patient ID (SPEC) (optional)
     $data[] = array(array($patient->_IPP, $patient->_patient_elimine ? $patient->_patient_elimine->_IPP : null, $patient->_patient_elimine ? "FU" : null));
     // P-4: Patient ID (ST) (optional)
     $data[] = null;
     // P-5: sejour ID (ST) (optional)
     $data[] = null;
     // P-6: Nom patient (PN) (optional)
     $data[] = array(array($patient->_p_last_name, $patient->_p_first_name, $patient->prenom_2, $patient->civilite));
     // P-7: Nom de naissance (ST) (optional)
     $data[] = $patient->_p_maiden_name;
     // P-8: Date de naissance (TS) (optional)
     $data[] = $patient->_p_birth_date;
     // P-9: Sexe (ID) (optional)
     $data[] = CMbString::upper($patient->sexe);
     // P-10: race (forbidden)
     $data[] = null;
     $address = explode("\n", $patient->_p_street_address, 1);
     // P-11: adresse (AD) (optional)
     $data[] = array(array(CMbArray::get($address, 0), str_replace("\n", " ", CMbArray::get($address, 1)), $patient->_p_city, null, $patient->_p_postal_code, $patient->pays_insee));
     // P-12: INS (version 2.3) (optional)
     $data[] = null;
     // P-13: téléphone (TN) (optional) (repeatable)
     $data[] = array($patient->_p_phone_number, $patient->_p_mobile_phone_number);
     // P-14: Médecins (CNA) (optional) (repeatable)
     $data[] = null;
     // P-15: Traitement local 1 (ST) (optional)
     $data[] = null;
     // P-16: Traitement local 2 (ST) (optional)
     $data[] = null;
     // P-17: Taille (CQ) (optional)
     $data[] = null;
     // P-18: Poids (CQ) (optional)
     $data[] = null;
     // P-19: Diagnostic (CE) (optional) (repeatable)
     $data[] = null;
     // P-20: Traitement (ST) (optional) (repeatable)
     $data[] = null;
     // P-21: Régime (ST) (optional)
     $data[] = null;
     // P-22: Commentaire 1 (ST) (optional)
     $data[] = null;
     // P-23: Commentaire 2 (ST) (optional)
     $data[] = null;
     // P-24: Date de mouvement (TS) (optional) (repeatable)
     $data[] = null;
     // P-25: Statut de l'admission (ID) (optional)
     $data[] = null;
     // P-26: Localisation (SPEC) (optional)
     $data[] = null;
     // P-27: classification diagnostic (CE) (optional)
     $data[] = null;
     // P-28: Religion (forbidden)
     $data[] = null;
     // P-29: Situation maritale (ID) (optional)
     $data[] = $this->getMaritalStatus($patient->situation_famille);
     // P-30: Précauton à prendre (ID) (optional)
     $data[] = null;
     // P-31: Langue (ST) (optional)
     $data[] = null;
     // P-32: Statut de confidentialité (ID) (optional)
     $data[] = null;
     // P-33: Date de dernière modification (TS) (optional)
     $data[] = null;
     // P-34: Date de décès (TS) (optional)
     $data[] = null;
     $this->fill($data);
 }
 /**
  * Get categories tree
  *
  * @param bool $operation see operations
  *
  * @return array
  */
 static function getCategoriesTree($operation = false)
 {
     $object = new self();
     $target_classes = CDailyCheckList::getNonHASClasses($operation);
     $targets = array();
     $by_class = array();
     foreach ($target_classes as $_class) {
         if ($_class != "COperation") {
             /** @var CSalle|CBlocOperatoire $_object */
             $_object = new $_class();
             //$_targets = $_object->loadGroupList();
             $_targets = $_object->loadList();
             array_unshift($_targets, $_object);
             $targets[$_class] = array_combine(CMbArray::pluck($_targets, "_id"), $_targets);
         }
         $where = array("target_class" => "= '{$_class}'");
         if ($_class == "COperation") {
             $where["list_type_id"] = ' IS NOT NULL';
         }
         /** @var CDailyCheckItemCategory[] $_list */
         $_list = $object->loadList($where, "target_id+0, title");
         // target_id+0 to have NULL at the beginning
         $by_object = array();
         foreach ($_list as $_category) {
             $_key = $_category->target_id ? $_category->target_id : "all";
             $by_object[$_key][$_category->_id] = $_category;
         }
         $by_class[$_class] = $by_object;
     }
     return array($targets, $by_class);
 }
Example #21
0
 function fillLimitedTemplate(&$template)
 {
     CDestinataire::makeAllFor($this);
     $destinataires = CDestinataire::$destByClass;
     foreach ($destinataires as $_destinataires_by_class) {
         foreach ($_destinataires_by_class as $_destinataire) {
             if (!isset($_destinataire->nom) || strlen($_destinataire->nom) == 0 || $_destinataire->nom === " ") {
                 continue;
             }
             $template->destinataires[] = array("nom" => $_destinataire->nom, "email" => $_destinataire->email, "tag" => $_destinataire->tag);
         }
     }
     $this->loadRefsFwd();
     $this->loadRefLatestConstantes(null, array(), null, false);
     $this->loadIPP();
     $this->loadLastINS();
     $this->notify("BeforeFillLimitedTemplate", $template);
     $template->addProperty("Patient - article", $this->_civilite);
     $template->addProperty("Patient - article long", ucfirst($this->_civilite_long));
     $template->addProperty("Patient - article long (minuscule)", strtolower($this->_civilite_long));
     $template->addProperty("Patient - nom", $this->nom);
     $template->addProperty("Patient - nom jeune fille", $this->nom_jeune_fille);
     $template->addProperty("Patient - prénom", $this->prenom);
     $template->addProperty("Patient - adresse", $this->adresse);
     $template->addProperty("Patient - ville", $this->ville);
     $template->addProperty("Patient - cp", $this->cp);
     $template->addProperty("Patient - années", $this->_annees);
     $template->addProperty("Patient - âge", $this->_age);
     $template->addProperty("Patient - date de naissance", $this->getFormattedValue("naissance"));
     $template->addProperty("Patient - lieu de naissance", $this->lieu_naissance);
     $template->addProperty("Patient - sexe", strtolower($this->getFormattedValue("sexe")));
     $template->addProperty("Patient - sexe court", substr(strtolower($this->getFormattedValue("sexe")), 0, 1));
     $template->addProperty("Patient - numéro d'assuré", $this->getFormattedValue("matricule"));
     $template->addProperty("Patient - téléphone", $this->getFormattedValue("tel"));
     $template->addProperty("Patient - mobile", $this->getFormattedValue("tel2"));
     $template->addProperty("Patient - téléphone autre", $this->tel_autre);
     $template->addProperty("Patient - profession", $this->profession);
     $template->addProperty("Patient - IPP", $this->_IPP);
     $template->addProperty("Patient - Qualité bénéficiaire", $this->qual_beneficiaire);
     $this->guessExoneration();
     $template->addProperty("Patient - Qualité bénéficiaire - Libellé", $this->libelle_exo);
     $template->addProperty("Patient - Numéro de sécurité sociale", $this->getFormattedValue("matricule"));
     $template->addBarcode("Patient - Code barre ID", $this->_id);
     $template->addBarcode("Patient - Code barre IPP", $this->_IPP);
     $template->addBarcode("Patient - Code barre INS", $this->_ref_last_ins ? $this->_ref_last_ins->ins : "");
     if ($this->sexe === "m") {
         $template->addProperty("Patient - il/elle", "il");
         $template->addProperty("Patient - Il/Elle (majuscule)", "Il");
         $template->addProperty("Patient - le/la", "le");
         $template->addProperty("Patient - Le/La (majuscule)", "Le");
         $template->addProperty("Patient - du/de la", "du");
         $template->addProperty("Patient - au/à la", "au");
         $template->addProperty("Patient - accord genre", "");
     } else {
         $template->addProperty("Patient - il/elle", "elle");
         $template->addProperty("Patient - Il/Elle (majuscule)", "Elle");
         $template->addProperty("Patient - le/la", "la");
         $template->addProperty("Patient - Le/La (majuscule)", "La");
         $template->addProperty("Patient - du/de la", "de la");
         $template->addProperty("Patient - au/à la", "à la");
         $template->addProperty("Patient - accord genre", "e");
     }
     $medecin = $this->_ref_medecin_traitant->_id ? $this->_ref_medecin_traitant : new CMedecin();
     $template->addProperty("Patient - médecin traitant", "{$medecin->nom} {$medecin->prenom}");
     $template->addProperty("Patient - médecin traitant - Nom Prénom", "{$medecin->nom} {$medecin->prenom}");
     $template->addProperty("Patient - médecin traitant - nom", $medecin->nom);
     $template->addProperty("Patient - médecin traitant - prenom", $medecin->prenom);
     $template->addProperty("Patient - médecin traitant - adresse", "{$medecin->adresse} \n {$medecin->cp} {$medecin->ville}");
     $template->addProperty("Patient - médecin traitant - voie", $medecin->adresse);
     $template->addProperty("Patient - médecin traitant - cp", $medecin->cp);
     $template->addProperty("Patient - médecin traitant - ville", $medecin->ville);
     $template->addProperty("Patient - médecin traitant - confraternité", $medecin->_confraternite);
     $template->addProperty("Patient - médecin traitant - tel", $medecin->getFormattedValue("tel"));
     $template->addProperty("Patient - médecin traitant - fax", $medecin->getFormattedValue("fax"));
     if ($medecin->sexe == "f") {
         $template->addProperty("Patient - médecin traitant - accord genre", "e");
         $template->addProperty("Patient - médecin traitant - article long", "Mme le docteur");
     } elseif ($medecin->sexe == "m") {
         $template->addProperty("Patient - médecin traitant - accord genre", "");
         $template->addProperty("Patient - médecin traitant - article long", "Mr le docteur");
     } else {
         $template->addProperty("Patient - médecin traitant - accord genre", "");
         $template->addProperty("Patient - médecin traitant - article long", "le docteur");
     }
     // Employeur
     $this->loadRefsCorrespondantsPatient();
     $correspondants = $this->_ref_cp_by_relation;
     foreach ($correspondants as $relation => $_correspondants) {
         $_correspondant = @reset($_correspondants);
         // Dans le cas d'un modèle, création d'un correspondant pour chaque type de relation
         if (!count($_correspondants)) {
             $_correspondant = new CCorrespondantPatient();
             $_correspondant->relation = $relation;
         }
         switch ($_correspondant->relation) {
             case "employeur":
                 $template->addProperty("Patient - employeur - nom", $_correspondant->nom);
                 $template->addProperty("Patient - employeur - adresse", $_correspondant->adresse);
                 $template->addProperty("Patient - employeur - cp", $_correspondant->cp);
                 $template->addProperty("Patient - employeur - ville", $_correspondant->ville);
                 $template->addProperty("Patient - employeur - tel", $_correspondant->getFormattedValue("tel"));
                 $template->addProperty("Patient - employeur - mobile", $_correspondant->getFormattedValue("mob"));
                 $template->addProperty("Patient - employeur - urssaf", $_correspondant->urssaf);
                 break;
             case "prevenir":
                 $template->addProperty("Patient - prévenir - nom", $_correspondant->nom);
                 $template->addProperty("Patient - prévenir - prénom", $_correspondant->prenom);
                 $template->addProperty("Patient - prévenir - adresse", $_correspondant->adresse);
                 $template->addProperty("Patient - prévenir - cp", $_correspondant->cp);
                 $template->addProperty("Patient - prévenir - ville", $_correspondant->ville);
                 $template->addProperty("Patient - prévenir - tel", $_correspondant->getFormattedValue("tel"));
                 $template->addProperty("Patient - prévenir - mobile", $_correspondant->getFormattedValue("mob"));
                 $template->addProperty("Patient - prévenir - parente", $_correspondant->parente);
                 break;
             case "confiance":
                 $template->addProperty("Patient - confiance - nom", $_correspondant->nom);
                 $template->addProperty("Patient - confiance - nom de jeune fille", $_correspondant->nom_jeune_fille);
                 $template->addProperty("Patient - confiance - prénom", $_correspondant->prenom);
                 $template->addProperty("Patient - confiance - date de naissance", $_correspondant->getFormattedValue("naissance"));
                 $template->addProperty("Patient - confiance - adresse", $_correspondant->adresse);
                 $template->addProperty("Patient - confiance - cp", $_correspondant->cp);
                 $template->addProperty("Patient - confiance - ville", $_correspondant->ville);
                 $template->addProperty("Patient - confiance - tel", $_correspondant->getFormattedValue("tel"));
                 $template->addProperty("Patient - confiance - mobile", $_correspondant->getFormattedValue("mob"));
                 $template->addProperty("Patient - confiance - parente", $_correspondant->parente);
         }
     }
     // Vider les anciens holders
     for ($i = 1; $i < 4; $i++) {
         $template->addProperty("Patient - médecin correspondant {$i}");
         $template->addProperty("Patient - médecin correspondant {$i} - adresse");
         $template->addProperty("Patient - médecin correspondant {$i} - spécialité");
     }
     $this->loadRefsCorrespondants();
     $i = 0;
     $noms = array();
     foreach ($this->_ref_medecins_correspondants as $corresp) {
         $i++;
         $corresp->loadRefsFwd();
         $medecin = $corresp->_ref_medecin;
         $nom = "{$medecin->nom} {$medecin->prenom}";
         $noms[] = $nom;
         $template->addProperty("Patient - médecin correspondant {$i}", $nom);
         $template->addProperty("Patient - médecin correspondant {$i} - adresse", "{$medecin->adresse}\n{$medecin->cp} {$medecin->ville}");
         $template->addProperty("Patient - médecin correspondant {$i} - spécialité", CMbString::htmlEntities($medecin->disciplines));
     }
     $template->addProperty("Patient - médecins correspondants", implode(" - ", $noms));
     //Liste des séjours du patient
     $this->loadRefsSejours();
     if (is_array($this->_ref_sejours)) {
         foreach ($this->_ref_sejours as $_sejour) {
             $_sejour->loadRefPraticien();
         }
         $smarty = new CSmartyDP("modules/dPpatients");
         $smarty->assign("sejours", $this->_ref_sejours);
         $sejours = $smarty->fetch("print_closed_sejours.tpl", '', '', 0);
         $sejours = preg_replace('`([\\n\\r])`', '', $sejours);
     } else {
         $sejours = CAppUI::tr("CSejour.none");
     }
     $template->addProperty("Patient - liste des séjours", $sejours, '', false);
     $const_med = $this->_ref_constantes_medicales;
     $const_dates = $this->_latest_constantes_dates;
     $grid_complet = CConstantesMedicales::buildGridLatest($const_med, $const_dates, true);
     $grid_minimal = CConstantesMedicales::buildGridLatest($const_med, $const_dates, false);
     $grid_valued = CConstantesMedicales::buildGridLatest($const_med, $const_dates, false, true);
     $smarty = new CSmartyDP("modules/dPpatients");
     // Horizontal
     $smarty->assign("constantes_medicales_grid", $grid_complet);
     $constantes_complet_horiz = $smarty->fetch("print_constantes.tpl", '', '', 0);
     $constantes_complet_horiz = preg_replace('`([\\n\\r])`', '', $constantes_complet_horiz);
     $smarty->assign("constantes_medicales_grid", $grid_minimal);
     $constantes_minimal_horiz = $smarty->fetch("print_constantes.tpl", '', '', 0);
     $constantes_minimal_horiz = preg_replace('`([\\n\\r])`', '', $constantes_minimal_horiz);
     $smarty->assign("constantes_medicales_grid", $grid_valued);
     $constantes_valued_horiz = $smarty->fetch("print_constantes.tpl", '', '', 0);
     $constantes_valued_horiz = preg_replace('`([\\n\\r])`', '', $constantes_valued_horiz);
     // Vertical
     $smarty->assign("constantes_medicales_grid", $grid_complet);
     $constantes_complet_vert = $smarty->fetch("print_constantes_vert.tpl", '', '', 0);
     $constantes_complet_vert = preg_replace('`([\\n\\r])`', '', $constantes_complet_vert);
     $smarty->assign("constantes_medicales_grid", $grid_minimal);
     $constantes_minimal_vert = $smarty->fetch("print_constantes_vert.tpl", '', '', 0);
     $constantes_minimal_vert = preg_replace('`([\\n\\r])`', '', $constantes_minimal_vert);
     $smarty->assign("constantes_medicales_grid", $grid_valued);
     $constantes_valued_vert = $smarty->fetch("print_constantes_vert.tpl", '', '', 0);
     $constantes_valued_vert = preg_replace('`([\\n\\r])`', '', $constantes_valued_vert);
     // Liste des fichiers
     $this->loadRefsFiles();
     $list = CMbArray::pluck($this->_ref_files, "file_name");
     $template->addListProperty("Patient - Liste des fichiers", $list);
     // Identité
     $identite = $this->loadNamedFile("identite.jpg");
     $template->addImageProperty("Patient - Photo d'identite", $identite->_id);
     $template->addProperty("Patient - Constantes - mode complet horizontal", $constantes_complet_horiz, '', false);
     $template->addProperty("Patient - Constantes - mode minimal horizontal", $constantes_minimal_horiz, '', false);
     $template->addProperty("Patient - Constantes - mode avec valeurs horizontal", $constantes_valued_horiz, '', false);
     $template->addProperty("Patient - Constantes - mode complet vertical", $constantes_complet_vert, '', false);
     $template->addProperty("Patient - Constantes - mode minimal vertical", $constantes_minimal_vert, '', false);
     $template->addProperty("Patient - Constantes - mode avec valeurs vertical", $constantes_valued_vert, '', false);
     $template->addProperty("Patient - poids", "{$const_med->poids} kg");
     $template->addProperty("Patient - taille", "{$const_med->taille} cm");
     $template->addProperty("Patient - Pouls", $const_med->pouls);
     $template->addProperty("Patient - IMC", $const_med->_imc);
     $template->addProperty("Patient - VST", $const_med->_vst);
     $template->addProperty("Patient - température", $const_med->temperature . "°");
     $template->addProperty("Patient - TA", $const_med->ta ? "{$const_med->_ta_systole} / {$const_med->_ta_diastole}" : "");
     $template->addProperty("Patient - Saturation (spo2)", $const_med->spo2);
     // Assuré social
     $template->addProperty("Patient - Assuré social - nom", $this->assure_nom);
     $template->addProperty("Patient - Assuré social - nom jeune fille", $this->assure_nom_jeune_fille);
     $template->addProperty("Patient - Assuré social - prénom", $this->assure_prenom);
     $template->addProperty("Patient - Assuré social - date de naissance", $this->getFormattedValue("assure_naissance"));
     $template->addProperty("Patient - Assuré social - article", $this->_assure_civilite);
     $template->addProperty("Patient - Assuré social - article long", $this->_assure_civilite_long);
     $template->addProperty("Patient - Assuré social - adresse", $this->assure_adresse);
     $template->addProperty("Patient - Assuré social - ville", $this->assure_ville);
     $template->addProperty("Patient - Assuré social - cp", $this->assure_cp);
     $template->addProperty("Patient - Assuré social - pays", $this->assure_pays);
     $template->addProperty("Patient - Assuré social - téléphone", $this->assure_tel);
     $template->addProperty("Patient - Assuré social - mobile", $this->assure_tel2);
     $template->addProperty("Patient - Assuré social - cp naissance", $this->assure_cp_naissance);
     $template->addProperty("Patient - Assuré social - lieu de naissance", $this->assure_lieu_naissance);
     $template->addProperty("Patient - Assuré social - profession", $this->assure_profession);
     // Bénéficiaire de soins
     $template->addProperty("Patient - Bénéficiaire de soin - code régime", $this->code_regime);
     $template->addProperty("Patient - Bénéficiaire de soin - caisse gest", $this->caisse_gest);
     $template->addProperty("Patient - Bénéficiaire de soin - centre gest", $this->centre_gest);
     $template->addProperty("Patient - Bénéficiaire de soin - code gest", $this->code_gestion);
     $template->addProperty("Patient - Bénéficiaire de soin - régime santé", $this->regime_sante);
     $template->addDateProperty("Patient - Bénéficiaire de soin - début période", $this->deb_amo);
     $template->addDateProperty("Patient - Bénéficiaire de soin - fin période", $this->fin_amo);
     $template->addProperty("Patient - Bénéficiaire de soin - régime am", $this->getFormattedValue("regime_am"));
     $template->addProperty("Patient - Bénéficiaire de soin - ald", $this->getFormattedValue("ald"));
     $template->addProperty("Patient - Bénéficiaire de soin - incapable majeur", $this->getFormattedValue("incapable_majeur"));
     $template->addProperty("Patient - Bénéficiaire de soin - cmu", $this->getFormattedValue("cmu"));
     $template->addProperty("Patient - Bénéficiaire de soin - ATNC", $this->getFormattedValue("ATNC"));
     $template->addDateProperty("Patient - Bénéficiaire de soin - validité vitale", $this->fin_validite_vitale);
     $template->addProperty("Patient - Bénéficiaire de soin - médecin traitant déclaré", $this->getFormattedValue("medecin_traitant_declare"));
     $template->addProperty("Patient - Bénéficiaire de soin - types contrat mutuelle", addslashes($this->mutuelle_types_contrat));
     $template->addProperty("Patient - Bénéficiaire de soin - notes amo", addslashes($this->notes_amo));
     $template->addProperty("Patient - Bénéficiaire de soin - libellé exo", addslashes($this->libelle_exo));
     $template->addProperty("Patient - Bénéficiaire de soin - notes amc", addslashes($this->notes_amc));
     if (CModule::getActive("maternite")) {
         $allaitement = $this->loadLastAllaitement();
         $template->addDateProperty("Patient - Allaitement - Début", $allaitement->date_debut);
         $template->addDateProperty("Patient - Allaitement - Fin", $allaitement->date_fin);
         $grossesse = $this->loadLastGrossesse();
         $template->addDateProperty("Patient - Grossesse - Terme prévu", $grossesse->terme_prevu);
         $template->addDateProperty("Patient - Grossesse - Date des dernières règles", $grossesse->date_dernieres_regles);
         $template->addProperty("Patient - Grossesse - En cours", $grossesse->getFormattedValue("active"));
         $template->addProperty("Patient - Grossesse - Multiple", $grossesse->getFormattedValue("multiple"));
         $template->addProperty("Patient - Grossesse - Allaitement maternel", $grossesse->getFormattedValue("allaitement_maternel"));
         $template->addProperty("Patient - Grossesse - Fausse couche", $grossesse->getFormattedValue('fausse_couche'), null, false);
         $template->addProperty("Patient - Grossesse - Lieu d'accouchement", $grossesse->getFormattedValue("lieu_accouchement"));
         $template->addProperty("Patient - Grossesse - Remarques", $grossesse->rques);
     }
     if (CModule::getActive("forms")) {
         CExObject::addFormsToTemplate($template, $this, "Patient");
     }
     $this->notify("AfterFillLimitedTemplate", $template);
 }
Example #22
0
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage developpement
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$files = array("style/mediboard/forms.css");
$files = array_merge($files, glob("modules/*/css/main.css"));
$button_classes = array();
foreach ($files as $_file) {
    $forms_css = file_get_contents($_file);
    $matches = array();
    preg_match_all('/a\\.button\\.([^\\:]+)\\:before/', $forms_css, $matches);
    $button_classes = array_merge($button_classes, $matches[1]);
}
CMbArray::removeValue("rtl", $button_classes);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign('button_classes', array_values($button_classes));
$smarty->display('css_test.tpl');
Example #23
0
 /**
  * @see parent::getFormHtmlElement()
  */
 function getFormHtmlElement($object, $params, $value, $className)
 {
     $form = CMbArray::extract($params, "form");
     $increment = CMbArray::extract($params, "increment");
     $showPlus = CMbArray::extract($params, "showPlus");
     $fraction = CMbArray::extract($params, "fraction");
     $showFraction = CMbArray::extract($params, "showFraction");
     $deferEvent = CMbArray::extract($params, "deferEvent");
     $bigButtons = CMbArray::extract($params, "bigButtons");
     $readonly = CMbArray::get($params, "readonly");
     $field = CMbString::htmlSpecialChars($this->fieldName);
     $min = CMbArray::extract($params, "min");
     if ($min === null) {
         $min = CMbFieldSpec::checkNumeric($this->min, false);
     }
     $max = CMbArray::extract($params, "max");
     if ($max === null) {
         $max = CMbFieldSpec::checkNumeric($this->max, false);
     }
     $new_value = CMbArray::extract($params, "value");
     if ($new_value !== null) {
         $value = $new_value;
     }
     $decimals = CMbArray::extract($params, "decimals", $this->decimals);
     if ($decimals == null) {
         $decimals = isset($this->precise) ? 4 : 2;
     }
     $step = CMbArray::extract($params, "step");
     $step = CMbFieldSpec::checkNumeric($step, false);
     CMbArray::defaultValue($params, "size", 4);
     if ($form && $increment && !$readonly) {
         $sHtml = $this->getFormElementText($object, $params, ($value >= 0 && $showPlus ? '+' : '') . ($value == 0 && $showPlus ? '0' : $value), $className, "number");
         $sHtml .= '
 <script type="text/javascript">
   Main.add(function(){
     var element = $(document.forms["' . $form . '"]["' . $field . '"]);
     
     if ($(element.form).isReadonly()) return;
     
     element.addSpinner({';
         if ($step) {
             $sHtml .= "step: {$step},";
         }
         if ($decimals) {
             $sHtml .= "decimals: {$decimals},";
         }
         if ($this->pos) {
             $sHtml .= "min: 0,";
         } elseif (isset($min)) {
             $sHtml .= "min: {$min},";
         }
         if (isset($max)) {
             $sHtml .= "max: {$max},";
         }
         if ($deferEvent) {
             $sHtml .= "deferEvent: true,";
         }
         if ($bigButtons) {
             $sHtml .= "bigButtons: true,";
         }
         if ($showPlus) {
             $sHtml .= "showPlus: true,";
         }
         if ($fraction) {
             $sHtml .= "fraction: true,";
         }
         if ($showFraction) {
             $sHtml .= "showFraction: true,";
         }
         $sHtml .= '_:0 // IE rules
     });
   });
 </script>';
     } else {
         $sHtml = $this->getFormElementText($object, $params, $value, $className, "number");
     }
     return $sHtml;
 }
    $chir->loadBackRefs("secondary_functions");
    foreach ($chir->_back["secondary_functions"] as $curr_sec_func) {
        $functions[] = $curr_sec_func->function_id;
    }
    $list_functions = implode(",", $functions);
    $where[] = "protocole.chir_id = '{$chir->_id}' OR protocole.function_id IN ({$list_functions})";
} else {
    $where["function_id"] = " = '{$function_id}'";
}
$where["for_sejour"] = $type == 'interv' ? "= '0'" : "= '1'";
if ($sejour_type) {
    $where["type"] = "= '{$sejour_type}'";
}
$order = "libelle_sejour, libelle, codes_ccam";
$list_protocoles = $protocole->loadListWithPerms(PERM_READ, $where, $order, "{$page[$type]},{$step}");
$systeme_materiel_expert = CAppUI::conf("dPbloc CPlageOp systeme_materiel") == "expert";
foreach ($list_protocoles as $_prot) {
    $_prot->loadRefsFwd();
    if ($systeme_materiel_expert == "expert") {
        $_prot->_types_ressources_ids = implode(",", CMbArray::pluck($_prot->loadRefsBesoins(), "type_ressource_id"));
    }
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("list_protocoles", $list_protocoles);
$smarty->assign("total_protocoles", $protocole->_totalWithPerms);
$smarty->assign("page", $page);
$smarty->assign("step", $step);
$smarty->assign("chir", $mediuser);
$smarty->assign("type", $type);
$smarty->display("inc_list_protocoles.tpl");
Example #25
0
 /**
  * Remove a table in the module
  *
  * @param string $table Table name
  *
  * @return void
  */
 function dropTable($table)
 {
     CMbArray::removeValue($table, $this->tables);
 }
 /**
  * @see parent::getFormHtmlElement()
  */
 function getFormHtmlElement($object, $params, $value, $className)
 {
     $form = CMbArray::extract($params, "form");
     // needs to be extracted
     $field = CMbString::htmlSpecialChars($this->fieldName);
     $extra = CMbArray::makeXmlAttributes($params);
     $sHtml = '<input type="password" name="' . $field . '" class="' . CMbString::htmlSpecialChars(trim($className . ' ' . $this->prop)) . ' styled-element" ';
     if ($this->revealable) {
         $sHtml .= ' value="' . CMbString::htmlSpecialChars($value) . '" ';
     }
     $sHtml .= $extra . ' />';
     if ($this->revealable) {
         $sHtml .= '<button class="lookup notext" type="button" onclick="var i=$(this).previous(\'input\');i.type=(i.type==\'password\')?\'text\':\'password\'"></button>';
     }
     if ($this->randomizable) {
         $random_call = "getRandomPassword('{$object->_class}', '{$field}');";
         $title = CAppUI::tr("common-action-Get random password");
         $sHtml .= '<button class="change notext" type="button" onclick="' . $random_call . '" title="' . $title . '"></button>';
     }
     $sHtml .= '<span id="' . $field . '_message"></span>';
     return $sHtml;
 }
Example #27
0
                 $_object->_disabled = true;
             }
             $_selected = reset($extid);
         }
     }
 }
 // Selected object IS selected (!)
 $_selected->_selected = true;
 // Check merge
 /** @var CMbObject $result */
 $result = new $objects_class();
 $checkMerge = $result->checkMerge($objects);
 // Merge trivial fields
 foreach (array_keys($result->getPlainFields()) as $field) {
     $values = CMbArray::pluck($objects, $field);
     CMbArray::removeValue("", $values);
     // No values
     if (!count($values)) {
         $statuses[$field] = "none";
         continue;
     }
     $result->{$field} = reset($values);
     // One unique value
     if (count($values) == 1) {
         $statuses[$field] = "unique";
         continue;
     }
     // Multiple values
     $statuses[$field] = count(array_unique($values)) == 1 ? "duplicate" : "multiple";
 }
 $result->updateFormFields();
 /**
  * Check service availability
  *
  * @throws CMbException
  *
  * @return void
  */
 public function checkServiceAvailability()
 {
     $url = $this->wsdl_url;
     if ($this->wsdl_original) {
         $url = $this->wsdl_original;
     }
     $xml = file_get_contents($url);
     $dom = new CMbXMLDocument();
     $dom->loadXML($xml);
     $xpath = new CMbXPath($dom);
     $xpath->registerNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");
     $xpath->registerNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
     $xpath->registerNamespace("soap12", "http://schemas.xmlsoap.org/wsdl/soap12");
     $login = CMbArray::get($this->options, "login");
     $password = CMbArray::get($this->options, "password");
     $service_nodes = $xpath->query("//wsdl:service");
     foreach ($service_nodes as $_service_node) {
         $service_name = $_service_node->getAttribute("name");
         $port_nodes = $xpath->query("wsdl:port", $_service_node);
         foreach ($port_nodes as $_port_node) {
             $address = $xpath->queryAttributNode("soap:address|soap12:address", $_port_node, "location");
             if (!$address) {
                 continue;
             }
             if ($login && $password) {
                 $address = str_replace("://", "://{$login}:{$password}@", $address);
             }
             // Url exist
             $url_exist = CHTTPClient::checkUrl($address, $this->check_option);
             if (!$url_exist) {
                 throw new CMbException("Service '{$service_name}' injoignable à l'adresse : <em>{$address}</em>");
             }
         }
     }
 }
/**
 * Calcul le taux d'utilisation de prise de rendez-vous par créneaux de 5 minutes
 *
 * @param CPlageconsult[] $plages Plages
 * @param array           $list   Liste
 * @param CPlageconsult   $plage  Plage
 *
 * @return array
 */
function utilisation_rdv($plages, $list, $plage)
{
    $utilisation = array();
    // Granularité de 5 minutes.
    // 288 créneaux de 5 minutes dans 24 heures
    for ($i = 0; $i < 288; $i++) {
        $time = CMbDT::time($i * 5 . " minutes", $plage->debut);
        $utilisation[$time] = 0;
        if ($time == $plage->fin) {
            break;
        }
    }
    foreach ($plages as $_plage) {
        $rdvs = $_plage->loadRefsConsultations(false);
        $freq = CMbDT::transform($_plage->freq, null, "%M");
        foreach ($rdvs as $_rdv) {
            $nb_cases = $_rdv->duree * $freq / 5;
            for ($i = 0; $i < $nb_cases; $i++) {
                $time = CMbDT::time($i * 5 . " minutes", $_rdv->heure);
                if (!isset($utilisation[$time])) {
                    continue;
                }
                $utilisation[$time]++;
            }
        }
    }
    ksort($utilisation);
    // Granularité à la fréquence des consultations de la plage
    $creneaux = array_flip(CMbArray::pluck($list, "time"));
    $save_key = 0;
    foreach ($utilisation as $key => $_util) {
        if (!isset($creneaux[$key]) && isset($utilisation[$save_key])) {
            $utilisation[$save_key] = max($_util, $utilisation[$save_key]);
            unset($utilisation[$key]);
        } else {
            $utilisation[$key] = $_util;
            $save_key = $key;
        }
    }
    return $utilisation;
}
Example #30
0
if (null == ($object_class = CValue::get("object_class"))) {
    CAppUI::stepMessage(UI_MSG_WARNING, "{$tab}-msg-mode-missing");
    return;
}
$unlock_dossier = CValue::get("unlock_dossier", 0);
$NDA = "";
$IPP = "";
switch ($object_class) {
    case "COperation":
        $object = new COperation();
        // Chargement de l'opération et génération du document
        $operation_id = CValue::post("mb_operation_id", CValue::getOrSession("object_id"));
        if ($object->load($operation_id)) {
            $object->loadRefs();
            $codes = explode("|", $object->codes_ccam);
            $actes = CMbArray::pluck($object->_ref_actes_ccam, "code_acte");
            foreach ($object->_ref_actes_ccam as $acte_ccam) {
                $acte_ccam->loadRefsFwd();
            }
            // Suppression des actes non codés
            if (CAppUI::conf("dPsalleOp CActeCCAM del_actes_non_cotes")) {
                foreach ($codes as $_key => $_code) {
                    $key = array_search($_code, $actes);
                    if ($key === false) {
                        unset($codes[$_key]);
                    }
                }
            }
            $object->_codes_ccam = $codes;
            $mbSejour =& $object->_ref_sejour;
            $mbSejour->loadRefsFwd();