/**
  * Constructor
  *
  * @param string $className Class name
  * @param int    $objectKey Object key name
  */
 function CDoObjectAddEdit($className, $objectKey = null)
 {
     if (CAppUI::conf("readonly")) {
         CAppUI::stepAjax("Mode-readonly-title", UI_MSG_ERROR);
         return;
     }
     global $m;
     $this->className = $className;
     $this->postRedirect = null;
     $this->redirect = "m={$m}";
     $this->redirectStore = null;
     $this->redirectError = null;
     $this->redirectDelete = null;
     $this->createMsg = CAppUI::tr("{$className}-msg-create");
     $this->modifyMsg = CAppUI::tr("{$className}-msg-modify");
     $this->deleteMsg = CAppUI::tr("{$className}-msg-delete");
     $this->request =& $_POST;
     $this->_logIt = true;
     // @todo : à supprimer cf déplacement dans le doBind()
     $this->_obj = new $this->className();
     $this->_old = new $this->className();
     $this->onAfterInstanciation();
     // Lancer ceci apres chaque instanciation de _obj et _old !!
     $this->objectKey = $objectKey ? $objectKey : $this->_obj->_spec->key;
     $this->objectKeys = $this->objectKey . "s";
 }
Ejemplo n.º 2
0
 /**
  * @see parent::getValue()
  */
 function getValue($object, $smarty = null, $params = array())
 {
     if ($object->color) {
         return "<div style=\"background-color: #{$object->color}; min-width:30px; height:1em; border: solid 1px #afafaf;\"></div>";
     }
     return CAppUI::tr("Undefined");
 }
Ejemplo n.º 3
0
 /**
  * @see parent::getValue()
  */
 function getValue($object, $smarty = null, $params = array())
 {
     if ($this->class) {
         return CMbString::htmlSpecialChars(CAppUI::tr($object->{$this->fieldName}));
     }
     return parent::getValue($object, $smarty, $params);
 }
 public function stepAjax($type = UI_MSG_WARNING)
 {
     $args = func_get_args();
     $msg = CAppUI::tr($this->getMessage(), array_slice($args, 1));
     CAppUI::$localize = false;
     CAppUI::stepAjax($msg, $type);
     CAppUI::$localize = true;
 }
 /**
  * @see parent::doStore()
  */
 function doStore()
 {
     if (isset($_FILES['attachment'])) {
         $mail_id = CValue::post('mail_id');
         $mail = new CUserMail();
         $mail->load($mail_id);
         $files = array();
         foreach ($_FILES['attachment']['error'] as $key => $file_error) {
             if (isset($_FILES['attachment']['name'][$key])) {
                 $files[] = array('name' => $_FILES['attachment']['name'][$key], 'tmp_name' => $_FILES['attachment']['tmp_name'][$key], 'error' => $_FILES['attachment']['error'][$key], 'size' => $_FILES['attachment']['size'][$key]);
             }
         }
         foreach ($files as $_key => $_file) {
             if ($_file['error'] == UPLOAD_ERR_NO_FILE) {
                 continue;
             }
             if ($_file['error'] != 0) {
                 CAppUI::setMsg(CAppUI::tr("CFile-msg-upload-error-" . $_file["error"]), UI_MSG_ERROR);
                 continue;
             }
             $attachment = new CMailAttachments();
             $attachment->name = $_file['name'];
             $content_type = mime_content_type($_file['tmp_name']);
             $attachment->type = $attachment->getTypeInt($content_type);
             $attachment->bytes = $_file['size'];
             $attachment->mail_id = $mail_id;
             $content_type = explode('/', $content_type);
             $attachment->subtype = strtoupper($content_type[1]);
             $attachment->disposition = 'ATTACHMENT';
             $attachment->extension = substr(strrchr($attachment->name, '.'), 1);
             $attachment->part = $mail->countBackRefs('mail_attachments') + 1;
             $attachment->store();
             $file = new CFile();
             $file->setObject($attachment);
             $file->author_id = CAppUI::$user->_id;
             $file->file_name = $attachment->name;
             $file->file_date = CMbDT::dateTime();
             $file->fillFields();
             $file->updateFormFields();
             $file->doc_size = $attachment->bytes;
             $file->file_type = mime_content_type($_file['tmp_name']);
             $file->moveFile($_file, true);
             if ($msg = $file->store()) {
                 CAppUI::setMsg(CAppUI::tr('CMailAttachments-error-upload-file') . ':' . CAppUI::tr($msg), UI_MSG_ERROR);
                 CApp::rip();
             }
             $attachment->file_id = $file->_id;
             if ($msg = $attachment->store()) {
                 CAppUI::setMsg($msg, UI_MSG_ERROR);
                 CApp::rip();
             }
         }
         CAppUI::setMsg('CMailAttachments-msg-added', UI_MSG_OK);
     } else {
         parent::doStore();
     }
 }
Ejemplo n.º 6
0
 /**
  * get the comment error
  *
  * @return string
  */
 function getCommentError()
 {
     $comment_error = CAppUI::tr("CHPrimSanteEvent-{$this->sous_type}-{$this->type}-{$this->code_error}");
     if ($this->comment) {
         $comment_error .= " : {$this->comment}";
     }
     $comment_error = str_replace("\r", "", $comment_error);
     return $comment_error;
 }
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->_value = $this->value;
     if (array_key_exists($this->type, self::$_style_values)) {
         $this->_value = CAppUI::tr("{$this->_class}.value.{$this->type}.{$this->value}");
     }
     $this->_view = $this->getFormattedValue("type") . ": {$this->value}";
 }
Ejemplo n.º 8
0
 /**
  * @see parent::getValue()
  */
 function getValue($object, $smarty = null, $params = array())
 {
     $fieldName = $this->fieldName;
     $propValue = $this->getListValues($object->{$fieldName});
     $ret = array();
     foreach ($propValue as $_value) {
         $ret[] = CMbString::htmlSpecialChars(CAppUI::tr("{$object->_class}.{$fieldName}.{$_value}"));
     }
     return implode(", ", $ret);
 }
Ejemplo n.º 9
0
/**
 * Fonction utilitaire pour la sauvegarde rapide d'un object avec génération du message
 *
 * @param CMbObject $object Objet à enregister
 *
 * @return void
 */
function storeObject($object)
{
    $title = $object->_id ? "-msg-modify" : "-msg-create";
    if ($msg = $object->store()) {
        CAppUI::setMsg($msg, UI_MSG_ERROR);
        echo CAppUI::getMsg();
        CApp::rip();
    }
    CAppUI::setMsg(CAppUI::tr(get_class($object) . $title), UI_MSG_OK);
}
Ejemplo n.º 10
0
 /**
  * Dispatch message
  * 
  * @param string         $data         Data
  * @param CInteropSender $actor        Actor data
  * @param int            $exchange_id  Identifier exchange 
  * @param bool           $to_treatment Treat the exchange
  * 
  * @return string Dispatch response
  */
 static function dispatch($data, CInteropSender $actor = null, $exchange_id = null, $to_treatment = true)
 {
     $contexts = null;
     // Dicom a besoin des contextes de présentation afin de pouvoir déchiffrer le message
     if (is_array($data)) {
         $contexts = $data["pres_contexts"];
         $data = $data["msg"];
     }
     if (substr($data, 0, 3) === "") {
         $data = substr($data, 3);
     }
     if ($actor && isset($actor->_configs["encoding"]) && $actor->_configs["encoding"] == "UTF-8") {
         $data = utf8_decode($data);
     }
     self::$errors = array();
     // Accepte t-on des utilisateurs acteurs non enregistrés ?
     if (!$actor) {
         CEAIDispatcher::$errors[] = CAppUI::tr("CEAIDispatcher-no_actor");
         return self::dispatchError($data, $actor);
     }
     // est-ce que je comprend la famille de messages ?
     /** @var CExchangeDataFormat $data_format */
     if (($data_format = self::understand($data, $actor, $contexts)) === null) {
         self::$errors[] = CAppUI::tr("CEAIDispatcher-no_understand");
         return self::dispatchError($data, $actor);
     }
     // est-ce que je supporte cette famille de messages ?
     $supported = false;
     $family_message_class = !$data_format->_family_message_class ? get_class($data_format->_family_message) : $data_format->_family_message_class;
     $msg_supported_classes = $data_format->getMessagesSupported($actor->_guid, false, null, true);
     foreach ($msg_supported_classes as $_msg_supported_class => $_msg_supported) {
         if ($family_message_class == $_msg_supported_class) {
             $supported = true;
         }
     }
     if (!$supported) {
         self::$errors[] = CAppUI::tr("CEAIDispatcher-_family_message_no_supported_for_this_actor", $family_message_class);
         return self::dispatchError($data, $actor);
     }
     $actor->_data_format = $data_format;
     $data_format->sender_id = $actor->_id;
     $data_format->sender_class = $actor->_class;
     $data_format->group_id = $actor->group_id;
     $data_format->_ref_sender = $actor;
     $data_format->_message = $data;
     $data_format->_exchange_id = $exchange_id;
     $data_format->_to_treatment = $to_treatment;
     // Traitement par le handler du format
     try {
         return $data_format->handle();
     } catch (CMbException $e) {
         self::$errors[] = $e->getMessage();
         return self::dispatchError($data, $actor);
     }
 }
Ejemplo n.º 11
0
/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Urgences
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
function viewMsg($msg, $action, $txt = "")
{
    global $m, $tab;
    $action = CAppUI::tr($action);
    if ($msg) {
        CAppUI::setMsg("{$action}: {$msg}", UI_MSG_ERROR);
        CAppUI::redirect("m={$m}&tab={$tab}");
        return;
    }
    CAppUI::setMsg("{$action} {$txt}", UI_MSG_OK);
}
Ejemplo n.º 12
0
/**
 * Fonction utilitaire pour la sauvegarde rapide d'un object avec génération du message
 *
 * @param CMbObject $object Objet à enregister
 *
 * @return void
 */
function storeObject($object)
{
    $title = $object->_id ? "-msg-modify" : "-msg-create";
    if ($msg = $object->store()) {
        CAppUI::setMsg($msg, UI_MSG_ERROR);
        echo CAppUI::getMsg();
        // Il peut y avoir un msg de retour postérieur à la création de l'objet
        // On continue donc le processus de création de la naissance
        //CApp::rip();
    }
    CAppUI::setMsg(CAppUI::tr(get_class($object) . $title), UI_MSG_OK);
}
Ejemplo n.º 13
0
 function canDeleteEx()
 {
     $query = "SELECT COUNT(DISTINCT repas.repas_id) AS number\r\n                    FROM repas WHERE (`{$this->type}` IS NOT NULL AND `{$this->type}` = '{$this->plat_id}')";
     $obj = null;
     if (!$this->_spec->ds->loadObject($query, $obj)) {
         return $this->_spec->ds->error();
     }
     if ($obj->number) {
         return CAppUI::tr("CMbObject-msg-nodelete-backrefs") . ": " . $obj->number . " repas";
     }
     return null;
 }
Ejemplo n.º 14
0
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->_view = $this->loadRefUser()->_view . " - ";
     $params = $this->getParams();
     if (isset($params["m"])) {
         $module = $params["m"];
         $this->_view .= CAppUI::tr("module-{$module}-court");
         if (isset($params["a"])) {
             $action = $params["a"];
             $this->_view .= " - " . CAppUI::tr("mod-{$module}-tab-{$action}");
         }
     }
 }
 /**
  * @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) : "";
 }
Ejemplo n.º 16
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     // Check unique affectation_id except absence (leave / return from leave)
     if ($this->movement_type != "AABS" && $this->movement_type != "RABS") {
         $movement = new self();
         $this->completeField("affectation_id");
         $movement->movement_type = $this->movement_type;
         $movement->affectation_id = $this->affectation_id;
         $movement->cancel = 0;
         $movement->loadMatchingObject();
         if ($this->affectation_id && $movement->_id && $this->_id != $movement->_id) {
             return CAppUI::tr("{$this->_class}-failed-affectation_id") . " : {$this->affectation_id}";
         }
     }
     return null;
 }
 * @category DPpatients
 * @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
 */
if (!CAppUI::pref("allowed_modify_identity_status")) {
    CAppUI::redirect("m=system&a=access_denied");
}
$number_day = CValue::getOrSession("_number_day", 8);
$number_day = $number_day ?: 8;
$now = CValue::getOrSession("_date_end", CMbDT::date());
$before = CMbDT::date("-{$number_day} DAY", $now);
$csv = new CCSVFile();
$line = array("Date", CAppUI::tr("CPatient.status.PROV"), CAppUI::tr("CPatient.status.DPOT"), CAppUI::tr("CPatient.status.ANOM"), CAppUI::tr("CPatient.status.CACH"), CAppUI::tr("CPatient.status.VALI"));
$csv->writeLine($line);
$results = CPatientStateTools::getPatientStateByDate($before, $now);
$values = array();
for ($i = $number_day; $i >= 0; $i--) {
    $values[CMbDT::date("-{$i} DAY", $now)] = array("PROV" => 0, "DPOT" => 0, "ANOM" => 0, "CACH" => 0, "VALI" => 0);
}
foreach ($results as $_result) {
    $values[$_result["date"]][$_result["state"]] = $_result["total"];
}
foreach ($values as $_date => $_value) {
    $line = array($_date);
    $line = array_merge($line, array_values($_value));
    $csv->writeLine($line);
}
$csv->stream("statut_patient_par_date");
Ejemplo n.º 18
0
 * @subpackage messagerie
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 * @link       http://www.mediboard.org
 */
$account_id = CValue::get('account_id');
$mail_id = Cvalue::get('mail_id');
$reply_to_id = CValue::get('reply_to_id');
$answer_to_all = CValue::get('answer_to_all');
$account = new CSourcePOP();
$account->load($account_id);
$smtp = CExchangeSource::get("mediuser-{$account->object_id}", 'smtp');
if (!$smtp->_id) {
    $smarty = new CSmartyDP();
    $smarty->assign('msg', CAppUI::tr('CUserMail-msg-no_smtp_source_linked_to_pop_account'));
    $smarty->assign('type', 'error');
    $smarty->assign('modal', 1);
    $smarty->assign('close_modal', 1);
    $smarty->display('inc_display_msg.tpl');
    CApp::rip();
}
$mail = new CUserMail();
if ($mail_id) {
    $mail->load($mail_id);
    if ($mail->text_html_id) {
        $mail->loadContentHTML();
        $mail->_content = $mail->_text_html->content;
    } elseif ($mail->text_plain_id) {
        $mail->loadContentPlain();
        $mail->_content = $mail->_text_plain->content;
Ejemplo n.º 19
0
 /**
  * Check if linked object is already coded
  *
  * @return string|null Error message, null when succesfull
  */
 function checkCoded()
 {
     if (!$this->_check_coded || $this->_forwardRefMerging) {
         return null;
     }
     $this->completeField("object_class");
     $this->completeField("object_id");
     /** @var CCodable $object */
     $object = new $this->object_class();
     $object->load($this->object_id);
     if ($object->_coded == "1") {
         return CAppUI::tr($object->_class) . " déjà validée : Impossible de coter l'acte";
     }
     return null;
 }
Ejemplo n.º 20
0
    foreach ($_modele->childNodes as $_node) {
        if (in_array($_node->nodeName, CCompteRendu::$fields_import_export)) {
            $modele->{$_node->nodeName} = $_node->nodeValue;
        }
    }
    $modele->nom = utf8_decode($modele->nom);
    // Mapping de l'entête, pieds de page, introduction, conclusion
    foreach ($components as $_component) {
        if ($modele->{$_component}) {
            $modele->{$_component} = $modeles_ids[$modele->{$_component}];
        }
    }
    // Recherche de la catégorie
    $cat = utf8_decode($_modele->getAttribute("cat"));
    if ($cat) {
        $categorie = new CFilesCategory();
        $categorie->nom = $cat;
        if (!$categorie->loadMatchingObject()) {
            $categorie->store();
        }
        $modele->file_category_id = $categorie->_id;
    }
    if ($msg = $modele->store()) {
        CAppUI::stepAjax($modele->nom . " - " . $msg, UI_MSG_ERROR);
        continue;
    }
    CAppUI::stepAjax($modele->nom . " - " . CAppUI::tr("CCompteRendu-msg-create"), UI_MSG_OK);
    // On garde la référence entre l'id provenant du xml et l'id en base
    $modeles_ids[$_modele->getAttribute("modele_id")] = $modele->_id;
}
CAppUI::js("window.opener.getForm('filterModeles').onsubmit()");
Ejemplo n.º 21
0
/**
 * $Id$
 *
 * @category Files
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$category_id = CValue::getOrSession("category_id", 0);
$page = intval(CValue::get('page', 0));
$filter = CValue::getOrSession("filter", "");
$eligible_file_view = CValue::getOrSession("eligible_file_view");
$class = CValue::getOrSession("class");
$listClass = CApp::getChildClasses();
$classes = array();
foreach ($listClass as $key => $_class) {
    $classes[$_class] = CAppUI::tr($_class);
}
asort($classes);
$smarty = new CSmartyDP();
$smarty->assign("category_id", $category_id);
$smarty->assign("page", $page);
$smarty->assign("listClass", $classes);
$smarty->assign("filter", $filter);
$smarty->assign("class", $class);
$smarty->assign("eligible_file_view", $eligible_file_view);
$smarty->display("vw_categories.tpl");
Ejemplo n.º 22
0
<?php

/**
 * $Id$
 * 
 * @package    Mediboard
 * @subpackage dPcabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$consultation_id = CValue::post("consultation_id");
$plageconsult_id = CValue::post("plageconsult_id");
$heure = CValue::post("heure");
$consult = new CConsultation();
$consult->load($consultation_id);
$new_consult = new CConsultation();
$new_consult->plageconsult_id = $plageconsult_id;
$new_consult->heure = $heure;
$new_consult->chrono = CConsultation::PLANIFIE;
$new_consult->patient_id = $consult->patient_id;
$new_consult->categorie_id = $consult->categorie_id;
$msg = $new_consult->store();
if ($msg) {
    CAppUI::setMsg($msg, UI_MSG_ERROR);
} else {
    CAppUI::setMsg(CAppUI::tr("CConsultation-msg-create"), UI_MSG_OK);
}
echo CAppUI::getMsg();
CApp::rip();
Ejemplo n.º 23
0
// context
$object_guid = CValue::post("context_guid");
$context = CMbObject::loadFromGuid($object_guid);
// get data uri
foreach ($data as $_key => &$_data) {
    $file = new CFile();
    $file->load($_data["file_id"]);
    $file->getDataURI();
    $_data["file_uri"] = $file->_data_uri;
}
//user
$user = CMediusers::get($user_id);
// file
$file = new CFile();
$file->setObject($context);
$file->file_name = CAppUI::tr("CFile-create-mozaic") . " de " . CAppUI::tr($context->_class) . " du " . CMbDT::dateToLocale(CMbDT::date()) . ".pdf";
$file->file_type = "application/pdf";
$file->file_category_id = $cat_id;
$file->author_id = CMediusers::get()->_id;
$file->fillFields();
$file->updateFormFields();
$file->forceDir();
$file->store();
$cr = new CCompteRendu();
$cr->_page_format = "A4";
$cr->_orientation = "portrait";
// use template for header and footer
$template_header = new CTemplateManager();
$context->fillTemplate($template_header);
$header = CCompteRendu::getSpecialModel($user, "CPatient", "[ENTETE MOZAIC]");
if ($header->_id) {
Ejemplo n.º 24
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);
 }
 /**
  * Source is reachable ?
  * @return boolean reachable
  */
 function isReachable()
 {
     $this->_reachable = 0;
     if (!$this->active) {
         $this->_reachable = 1;
         $this->_message = CAppUI::tr("CExchangeSource_no-active", $this->host);
         return;
     }
     if (!$this->isReachableSource()) {
         return;
     }
     if (!$this->isAuthentificate()) {
         return;
     }
     $this->_reachable = 2;
     $this->_message = CAppUI::tr("{$this->_class}-reachable-source", $this->host);
 }
/**
 * Génération des données des graphiques du palmarès ressources
 *
 * @param string $module   Module concerné
 * @param string $date     Date de référence
 * @param string $element  Type de données à afficher
 * @param string $interval Interval de temps à analyser
 * @param int    $numelem  Nombre d'éléments maximum
 *
 * @return array Les données de palmarès
 */
function graphRessourceLog($module, $date, $element = 'duration', $interval = 'day', $numelem = 4)
{
    if (!$date) {
        $date = CMbDT::date();
    }
    switch ($interval) {
        default:
        case "day":
            $startx = "{$date} 00:00:00";
            $endx = "{$date} 23:59:59";
            break;
        case "month":
            $startx = CMbDT::dateTime("-1 MONTH", "{$date} 00:00:00");
            $endx = "{$date} 23:59:59";
            break;
        case "year":
            $startx = CMbDT::dateTime("-27 WEEKS", "{$date} 00:00:00");
            $endx = "{$date} 23:59:59";
            break;
    }
    if ($module == "total") {
        $groupmod = 0;
        $module_name = null;
    } elseif ($module == "modules") {
        $groupmod = 1;
        $module_name = null;
    } else {
        $groupmod = 0;
        $module_name = $module;
    }
    $logs = CAccessLog::loadAggregation($startx, $endx, $groupmod, $module_name);
    $series = array();
    $i = 0;
    foreach ($logs as $data) {
        $series[$i]["data"] = array(array(0, $data->{$element}));
        $series[$i]["label"] = $module != 'modules' ? $data->_action : $data->_module;
        $i++;
    }
    if (!function_exists('compareDataPie')) {
        /**
         * Comparaison entre deux données du graphique en pie
         *
         * @param array $a Première donnée
         * @param array $b Deuxième donnée
         *
         * @return bool La première valeur est-elle inférieure à la deuxième
         */
        function compareDataPie($a, $b)
        {
            return $a["data"][0][1] < $b["data"][0][1];
        }
    }
    usort($series, "compareDataPie");
    $seriesNew = array_slice($series, 0, $numelem);
    if (count($series) > $numelem) {
        $other = array_slice($series, $numelem);
        $seriesNew[$numelem]["data"] = array(array(0, 0));
        $seriesNew[$numelem]["label"] = "Autres";
        $n = 0;
        foreach ($other as $_other) {
            $seriesNew[$numelem]["data"][0][1] += $_other["data"][0][1];
            $n++;
        }
        $seriesNew[$numelem]["label"] .= " ({$n})";
    }
    $series = $seriesNew;
    // Set up the title for the graph
    $title = CMbDT::format($date, "%A %d %b %Y");
    if ($module) {
        $title .= " : " . CAppUI::tr($module);
    }
    $options = array('title' => utf8_encode($title), 'HtmlText' => false, 'grid' => array('verticalLines' => false, 'horizontalLines' => false, 'outlineWidth' => 0), 'xaxis' => array('showLabels' => false), 'yaxis' => array('showLabels' => false), 'pie' => array('show' => true, 'sizeRatio' => 0.5), 'legend' => array('backgroundOpacity' => 0.3));
    return array('series' => $series, 'options' => $options);
}
 /**
  * Update locales array
  *
  * @return void
  */
 function updateTranslation()
 {
     $items = $this->getRealListOwner()->getItemNames();
     $ex_class = $this->loadRefExClass();
     $key = ".{$this->name}";
     $_class_name = $ex_class->getExClassName();
     CAppUI::addLocale($_class_name, "{$key}.", CAppUI::tr("Undefined"));
     foreach ($items as $_id => $_item) {
         CAppUI::addLocale($_class_name, "{$key}.{$_id}", $_item);
     }
     $trans = null;
     $local_key = "{$key}-{$this->name}";
     if (isset(CAppUI::$locales[$_class_name][$local_key])) {
         $this->_locale = CAppUI::$locales[$_class_name][$local_key];
     } else {
         $trans = $trans ? $trans : $this->loadRefTranslation();
         $this->_locale = $trans->std;
     }
     $local_key = "{$key}-{$this->name}-desc";
     if (isset(CAppUI::$locales[$_class_name][$local_key])) {
         $this->_locale_desc = CAppUI::$locales[$_class_name][$local_key];
     } else {
         $trans = $trans ? $trans : $this->loadRefTranslation();
         $this->_locale_desc = $trans->desc;
     }
     $local_key = "{$key}-{$this->name}-court";
     if (isset(CAppUI::$locales[$_class_name][$local_key])) {
         $this->_locale_court = CAppUI::$locales[$_class_name][$local_key];
     } else {
         $trans = $trans ? $trans : $this->loadRefTranslation();
         $this->_locale_court = $trans->court;
     }
     $this->_view = $this->_locale;
 }
 /**
  * Duplicate an transformation to another (or the same) category
  *
  * @param int $transformation_ruleset_dest_id RuleSet destination
  *
  * @return string
  */
 function duplicate($transformation_ruleset_dest_id)
 {
     $this->_id = '';
     if ($transformation_ruleset_dest_id == $this->eai_transformation_ruleset_id) {
         $this->name .= CAppUI::tr("copy_suffix");
     }
     $this->eai_transformation_ruleset_id = $transformation_ruleset_dest_id;
     return $this->store();
 }
Ejemplo n.º 29
0
    $objects_id = explode("-", $objects_id);
}
$user = CMediusers::get();
CMbArray::removeValue("", $objects_id);
$objects = array();
$result = null;
$checkMerge = null;
$statuses = array();
$merge_type = null;
if (class_exists($objects_class) && count($objects_id)) {
    foreach ($objects_id as $object_id) {
        /** @var CMbObject $object */
        $object = new $objects_class();
        $merge_type = $object->_spec->merge_type;
        if ($merge_type == 'none') {
            CAppUI::stepAjax("Merging_%sclass_is_forbidden_by_spec", UI_MSG_ERROR, CAppUI::tr($object->_class));
        }
        // the CMbObject is loaded
        if (!$object->load($object_id)) {
            CAppUI::setMsg("Chargement impossible de l'objet [{$object_id}]", UI_MSG_ERROR);
            continue;
        }
        $object->loadView();
        $object->loadAllFwdRefs(true);
        $object->_selected = false;
        $object->_disabled = false;
        $objects[] = $object;
    }
    // Default préselection of first object
    $_selected = reset($objects);
    // selection of the first CSejour or CPatient with an ext ID
 /**
  * @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;
 }