Exemplo n.º 1
0
 /**
  * Store
  *
  * @return void
  */
 function doStore()
 {
     // keep track of former values for fieldModified below
     $obj = $this->_obj;
     $old = $obj->loadOldObject();
     if ($msg = $obj->store()) {
         CAppUI::setMsg($msg, UI_MSG_ERROR);
         if ($this->redirectError) {
             CAppUI::redirect($this->redirectError);
         }
     } else {
         // Keep trace for redirections
         CValue::setSession($this->objectKey, $obj->_id);
         // Insert new group and function permission
         if ($obj->fieldModified("function_id") || !$old->_id) {
             $obj->insFunctionPermission();
             $obj->insGroupPermission();
         }
         // Message
         CAppUI::setMsg($old->_id ? $this->modifyMsg : $this->createMsg, UI_MSG_OK);
         // Redirection
         if ($this->redirectStore) {
             CAppUI::redirect($this->redirectStore);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Redirection facility
  *  
  * @param string $action Action view     
  * @param string $params HTTP GET styled paramters
  * 
  * @return void
  */
 function redirect($action = "access_denied", $params = null)
 {
     global $actionType;
     // on passe a null soit "tab" soit "a" selon ou l'on se trouve
     CValue::setSession($actionType);
     if ($this->setValues) {
         if (is_scalar($this->setValues)) {
             CValue::setSession($this->setValues);
         } else {
             foreach ($this->setValues as $key => $value) {
                 CValue::setSession($key, $value);
             }
         }
     }
     $action_params = "";
     foreach (array("wsdl", "info", "ajax", "raw", "dialog") as $_action_type) {
         $_action_flag = CValue::get($_action_type);
         if ($_action_flag) {
             $action_params .= "&{$_action_type}={$_action_flag}";
         }
     }
     $context_param = $this->context ? "&context={$this->context}" : "";
     CAppUI::redirect("m=system&a={$action}" . $context_param . $action_params . $params);
 }
Exemplo n.º 3
0
$praticien_id = CValue::getOrSession("planning_chir_id");
$scroll_top = CValue::get("scroll_top", null);
$bloc_id = CValue::getOrSession("bloc_id");
$show_cancelled = CValue::getOrSession("show_cancelled", 0);
$show_operations = CValue::getOrSession("show_operations", 1);
$days_limit_future = abs(CAppUI::pref("planning_resa_days_limit"));
$max_date_planning = CMbDT::date("+ {$days_limit_future} DAYS", $today);
if ($date_planning > $today && $days_limit_future != 0 && $date_planning > $max_date_planning) {
    $date_planning = $max_date_planning;
}
$days_limit_past = abs(CAppUI::pref("planning_resa_past_days_limit"));
$min_date_planning = CMbDT::date("- {$days_limit_past} DAYS", $today);
if ($date_planning < $today && $days_limit_past != 0 && $date_planning < $min_date_planning) {
    $date_planning = $min_date_planning;
}
CValue::setSession("date_planning", $date_planning);
//alerts
$nbIntervHorsPlage = 0;
$nbIntervNonPlacees = 0;
$nbAlertesInterv = 0;
$debut = $fin = $date_planning;
$bloc = new CBlocOperatoire();
$where = array();
if ($bloc_id) {
    $where["bloc_operatoire_id"] = " = '{$bloc_id}'";
}
$where["group_id"] = " = '{$group->_id}' ";
/** @var CBlocOperatoire[] $blocs */
$blocs = $bloc->loadList($where);
CStoredObject::filterByPerm($blocs, PERM_READ);
if (count($blocs) == 1) {
Exemplo n.º 4
0
$theme_id = CValue::getOrSession("theme_id");
$chapitre_id = CValue::getOrSession("chapitre_id");
$sort_by = CValue::getOrSession("sort_by", "date");
$sort_way = CValue::getOrSession("sort_way", "DESC");
$docGed = new CDocGed();
if (!$docGed->load($doc_ged_id)) {
    // Ce document n'est pas valide
    $doc_ged_id = null;
    CValue::setSession("doc_ged_id");
    $docGed = new CDocGed();
} else {
    $docGed->loadLastActif();
    if (!$docGed->_lastactif->doc_ged_suivi_id || $docGed->annule) {
        // Ce document n'est pas Terminé ou est suspendu
        $doc_ged_id = null;
        CValue::setSession("doc_ged_id");
        $docGed = new CDocGed();
    } else {
        $docGed->_lastactif->loadFile();
        $docGed->loadRefs();
    }
}
$group = CGroups::loadCurrent();
// Liste des Thèmes
$theme = new CThemeDoc();
$where = array();
$where[] = "group_id = '{$group->_id}' OR group_id IS NULL";
/** @var CThemeDoc[] $listThemes */
$listThemes = $theme->loadlist($where, "nom");
// Liste des chapitres
$chapitre = new CChapitreDoc();
Exemplo n.º 5
0
CCanDo::checkRead();
//Initialisations des variables
$date = CValue::getOrSession("date", CMbDT::date());
$today = CMbDT::date();
$hour = CMbDT::time(null);
$board = CValue::get("board", 1);
$boardItem = CValue::get("boardItem", 1);
$consult = new CConsultation();
// Récupération des fonctions
$cabinets = CMediusers::loadFonctions();
// Récupération de la liste des anesthésistes
$mediuser = new CMediusers();
$anesthesistes = $mediuser->loadAnesthesistes(PERM_READ);
if ($consult->consultation_id) {
    $date = $consult->_ref_plageconsult->date;
    CValue::setSession("date", $date);
}
// Récupération des plages de consultation du jour et chargement des références
$listPlages = array();
foreach ($anesthesistes as $anesth) {
    $listPlages[$anesth->_id]["anesthesiste"] = $anesth;
    $plage = new CPlageconsult();
    $where = array();
    $where["chir_id"] = "= '{$anesth->_id}'";
    $where["date"] = "= '{$date}'";
    $order = "debut";
    $listPlage = $plage->loadList($where, $order);
    if (count($listPlage)) {
        $listPlages[$anesth->_id]["plages"] = $listPlage;
    } else {
        unset($listPlages[$anesth->_id]);
Exemplo n.º 6
0
 * @version    $Revision$
 */
CCanDo::checkRead();
$user = CUser::get();
$type = CValue::get("type");
$first = CValue::get("first");
$selected_user_id = CValue::get("selected_user_id");
$selected_service_valid_user_id = CValue::get("selected_service_valid_user_id");
$elem_concerne = CValue::get("elem_concerne");
$evenements = CValue::get("evenements");
$filter_item = CValue::get("filter_item");
CValue::setSession("selected_user_id", $selected_user_id);
CValue::setSession("selected_service_valid_user_id", $selected_service_valid_user_id);
CValue::setSession("elem_concerne", $elem_concerne);
CValue::setSession("evenements", $evenements);
CValue::setSession("filter_item", $filter_item);
$selected_fiche_id = CValue::getOrSession("selected_fiche_id");
$where = array();
if ($elem_concerne) {
    $where["fiches_ei.elem_concerne"] = "= '{$elem_concerne}'";
}
if ($selected_user_id) {
    $where["fiches_ei.user_id"] = "= '{$selected_user_id}'";
}
if ($selected_service_valid_user_id) {
    $where["fiches_ei.service_valid_user_id"] = "= '{$selected_service_valid_user_id}'";
}
$user_id = null;
if ($type == "AUTHOR" || CCanDo::edit() && !CCanDo::admin()) {
    $user_id = $user->_id;
}
Exemplo n.º 7
0
 /**
  * Calcul l'aspect confidentiel du patient
  *
  * @return bool on a accès ou pas
  */
 function checkVIP()
 {
     if ($this->_vip !== null) {
         return;
     }
     $this->_vip = false;
     $user = CMediusers::get();
     if ($this->vip && !CModule::getCanDo("dPpatient")->admin()) {
         // Test si le praticien est présent dans son dossier
         $praticiens = $this->loadRefsPraticiens();
         $user_in_list_prat = array_key_exists($user->_id, $praticiens);
         // Test si un l'utilisateur est présent dans les logs
         $user_in_logs = false;
         $this->loadLogs();
         foreach ($this->_ref_logs as $_log) {
             if ($user->_id == $_log->user_id) {
                 $user_in_logs = true;
                 break;
             }
         }
         $this->_vip = !$user_in_list_prat && !$user_in_logs;
     }
     if ($this->_vip) {
         CValue::setSession("patient_id", 0);
     }
 }
Exemplo n.º 8
0
    global $m, $tab;
    CAppUI::setMsg("Ce RPU n'est pas ou plus disponible", UI_MSG_WARNING);
    CAppUI::redirect("m={$m}&tab={$tab}&rpu_id=0");
}
// Création d'un RPU pour un séjour existant
if ($sejour_id) {
    $rpu = new CRPU();
    $rpu->sejour_id = $sejour_id;
    $rpu->loadMatchingObject();
    $rpu->updateFormFields();
}
if ($rpu->_id || $rpu->sejour_id) {
    // Mise en session de l'id de la consultation, si elle existe.
    $rpu->loadRefConsult();
    if ($rpu->_ref_consult->_id) {
        CValue::setSession("selConsult", $rpu->_ref_consult->_id);
    }
    $sejour = $rpu->_ref_sejour;
    $sejour->loadNDA();
    $sejour->loadRefPraticien(1);
    $sejour->loadRefsNotes();
} else {
    $rpu->_entree = CMbDT::dateTime();
    $sejour = new CSejour();
}
$rpu->loadRefMotif();
$rpu->orderCtes();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("rpu", $rpu);
$smarty->display("inc_form_complement.tpl");
Exemplo n.º 9
0
$ex_class_id = CValue::get("ex_class_id");
$target_element = CValue::get("target_element");
$other_container = CValue::get("other_container");
$print = CValue::get("print");
$start = CValue::get("start", 0);
$limit = CValue::get("limit");
$only_host = CValue::get("only_host");
$readonly = CValue::get("readonly");
// Search mode
$search_mode = CValue::get("search_mode", 0);
$date_min = CValue::get("date_min");
$date_max = CValue::get("date_max");
$group_id = CValue::get("group_id");
$concept_search = CValue::get("concept_search");
CValue::setSession('reference_class', $reference_class);
CValue::setSession('reference_id', $reference_id);
if ($reference_class) {
    /** @var CMbObject $reference */
    $reference = new $reference_class();
    if ($reference_id) {
        $reference->load($reference_id);
    }
} else {
    $reference = null;
}
CExClassField::$_load_lite = true;
CExObject::$_multiple_load = true;
CExObject::$_load_lite = $detail < 2;
$group_id = $group_id ? $group_id : CGroups::loadCurrent()->_id;
$where = array("group_id = '{$group_id}' OR group_id IS NULL");
if ($ex_class_id) {
Exemplo n.º 10
0
 * @package    Mediboard
 * @subpackage System
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$echange_ftp_id = CValue::get("echange_ftp_id");
$page = CValue::get('page', 0);
$now = CMbDT::date();
$_date_min = CValue::getOrSession('_date_min', CMbDT::dateTime("-7 day"));
$_date_max = CValue::getOrSession('_date_max', CMbDT::dateTime("+1 day"));
$function = CValue::getOrSession("function");
CValue::setSession("_date_min", $_date_min);
CValue::setSession("_date_max", $_date_max);
CValue::setSession("function", $function);
// Chargement de l'échange FTP demandé
$exchange_ftp = new CExchangeFTP();
$exchange_ftp->load($echange_ftp_id);
if ($exchange_ftp->_id) {
    $exchange_ftp->loadRefs();
    $exchange_ftp->input = unserialize($exchange_ftp->input);
    if ($exchange_ftp->ftp_fault != 1) {
        $exchange_ftp->output = unserialize($exchange_ftp->output);
    }
}
// Récupération de la liste des echanges SOAP
$itemExchangeFTP = new CExchangeFTP();
$where = array();
if ($_date_min && $_date_max) {
    $exchange_ftp->_date_min = $_date_min;
Exemplo n.º 11
0
 * @version  SVN: $Id: vw_find_code.php 27313 2015-02-25 13:23:18Z flaviencrochard $
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$lang = CValue::getOrSession("lang", CCodeCIM10::LANG_FR);
$code = CValue::getOrSession("code", "");
$keys = CValue::getOrSession("keys", "");
$level1 = CValue::getOrSession("level1", "");
$level2 = CValue::getOrSession("level2", "");
if (CValue::session("code") || CValue::session("keys")) {
    $level1 = "";
    CValue::setSession("level1");
}
if (!$level1) {
    $level2 = "";
    CValue::setSession("level2");
}
$cim10 = new CCodeCIM10();
$listLevel1 = $cim10->getSommaire($lang);
$listLevel2 = array();
$master = array();
$keys = trim($keys);
$code = trim($code);
if ($code || $keys) {
    $master = $cim10->findCodes($code, $keys, $lang);
} elseif ($level2) {
    $listLevel2 = $cim10->getSubCodes($level1, $lang);
    $master = $cim10->getSubCodes($level2, $lang);
} elseif ($level1) {
    $listLevel2 = $cim10->getSubCodes($level1, $lang);
    $master = $listLevel2;
}
$one_field = false || $one_field_presc;
$one_field_traitement = false;
$one_field_atcd = false;
$sejour_filled = false;
$consult_filled = false;
$interv_filled = false;
$from = null;
$to = null;
$data = array();
foreach ($fields as $_class => $_fields) {
    $data[$_class] = array_intersect_key($_GET, $_fields);
    $object = new $_class();
    $prefix = $object->_spec->table;
    foreach ($data[$_class] as $_field => $_value) {
        CValue::setSession($_field, $_value);
        if ($_value !== "") {
            $one_field = true;
        }
        if ($_value === "" || !$_fields[$_field]) {
            continue;
        }
        switch ($_fields[$_field]) {
            case "=":
                $where["{$prefix}.{$_field}"] = $ds->prepare(" = % ", $_value);
                break;
            default:
                $where["{$prefix}.{$_field}"] = $ds->prepareLike("%{$_value}%");
        }
    }
}
Exemplo n.º 13
0
$datetime_max = CValue::get("_datetime_max");
$order_by = CValue::get("order_by");
$group_similar = CValue::get("group_similar", "similar");
$user_id = CValue::get("user_id");
$human = CValue::get("human");
$robot = CValue::get("robot");
CValue::setSession("error_type", $error_type);
CValue::setSession("text", $text);
CValue::setSession("server_ip", $server_ip);
CValue::setSession("_datetime_min", $datetime_min);
CValue::setSession("_datetime_max", $datetime_max);
CValue::setSession("order_by", $order_by);
CValue::setSession("group_similar", $group_similar);
CValue::setSession("user_id", $user_id);
CValue::setSession("human", $human);
CValue::setSession("robot", $robot);
CView::enforceSlave();
$where = array();
$error_log = new CErrorLog();
$spec = $error_log->_spec;
$ds = $spec->ds;
if (($human || $robot) && !($human && $robot)) {
    $tag = CMediusers::getTagSoftware();
    $robots = array();
    if ($tag) {
        $query = "SELECT users.user_id\r\n            FROM users\r\n            LEFT JOIN id_sante400 ON users.user_id = id_sante400.object_id\r\n            WHERE (id_sante400.object_class = 'CMediusers'\r\n              AND id_sante400.tag = ?)\r\n              OR users.dont_log_connection = '1'\r\n            GROUP BY users.user_id";
        $query = $ds->prepare($query, $tag);
    } else {
        $query = "SELECT users.user_id\r\n            FROM users\r\n            WHERE users.dont_log_connection = '1'";
    }
    $robots = $ds->loadColumn($query);
Exemplo n.º 14
0
 * $Id$
 *
 * @category Hprimsante
 * @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::checkRead();
$message_string = CValue::post("message");
if (!$message_string) {
    return;
}
$message_string = stripslashes($message_string);
CValue::setSession("message", $message_string);
try {
    $message = new CHPrimSanteMessage();
    $message->parse($message_string);
    $message->_errors_msg = !$message->isOK(CHL7v2Error::E_ERROR);
    $message->_warnings_msg = !$message->isOK(CHL7v2Error::E_WARNING);
    $message->_xml = CMbString::highlightCode("xml", $message->toXML()->saveXML());
} catch (CHL7v2Exception $e) {
    CAppUI::stepMessage(UI_MSG_ERROR, $e->getMessage() . " (" . $e->extraData . ")");
    return;
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("message", $message);
$smarty->assign("key", "input");
$smarty->display("inc_display_hprim_message.tpl");
 * @package    Mediboard
 * @subpackage Stock
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$category_id = CValue::getOrSession('category_id');
$societe_id = CValue::getOrSession('societe_id');
$product_id = CValue::getOrSession('product_id');
$start = CValue::getOrSession('start');
$keywords = CValue::getOrSession('keywords');
$letter = CValue::getOrSession('letter', "%");
$show_all = CValue::get('show_all');
// Don't user getOrSession as we don't want to get it from session
CValue::setSession("show_all", $show_all);
$where = array();
$where["name"] = $letter === "#" ? "RLIKE '^[^A-Z]'" : "LIKE '{$letter}%'";
if ($category_id) {
    $where['category_id'] = " = '{$category_id}'";
}
if ($societe_id) {
    $where['societe_id'] = " = '{$societe_id}'";
}
if ($keywords) {
    $where[] = "`code` LIKE '%{$keywords}%' OR \r\n              `name` LIKE '%{$keywords}%' OR \r\n              `classe_comptable` LIKE '%{$keywords}%' OR \r\n              `description` LIKE '%{$keywords}%'";
}
if (!$show_all) {
    $where[] = "cancelled = '0' OR cancelled IS NULL";
}
$orderby = 'name, code';
Exemplo n.º 16
0
if ($use_poste) {
    $ljoin["poste_sspi"] = "poste_sspi.poste_sspi_id = operations.poste_sspi_id";
    $where[] = "(operations.poste_sspi_id IS NOT NULL AND poste_sspi.bloc_id = '{$bloc_id}')\r\n              OR (operations.poste_sspi_id IS NULL AND operations.salle_id " . CSQLDataSource::prepareIn(array_keys($listSalles)) . ")";
} else {
    $where["operations.salle_id"] = CSQLDataSource::prepareIn(array_keys($listSalles));
}
$where[] = "operations.plageop_id " . CSQLDataSource::prepareIn(array_keys($plages)) . " OR (operations.plageop_id IS NULL AND operations.date = '{$date}')";
// orders & filters
$order_col = CValue::get("order_col");
if ($order_col && $type) {
    CValue::setSession("order_col_" . $type, $order_col);
}
//order way
$order_way = CValue::get("order_way");
if ($order_way && $type) {
    CValue::setSession("order_way_" . $type, $order_way);
}
$order_way_final = CValue::getOrSession("order_way_" . $type, CValue::get("order_way"));
switch ($type) {
    case 'preop':
        $where["operations.entree_salle"] = "IS NULL";
        // $order = "operations.time_operation";
        $order_col = CValue::getOrSession("order_col_{$type}", "time_operation");
        break;
    case 'encours':
        $where["operations.entree_salle"] = "IS NOT NULL";
        $where["operations.sortie_salle"] = "IS NULL";
        // $order = "operations.entree_salle";
        $order_col = CValue::getOrSession("order_col_{$type}", "entree_salle");
        break;
    case 'ops':
Exemplo n.º 17
0
 */
CAppUI::requireModuleFile("dPhospi", "inc_vw_affectations");
$services_ids = CValue::getOrSession("services_ids");
$triAdm = CValue::getOrSession("triAdm");
$_type_admission = CValue::getOrSession("_type_admission", "ambucomp");
$filter_function = CValue::getOrSession("filter_function");
$date = CValue::getOrSession("date");
$granularite = CValue::getOrSession("granularite");
$readonly = CValue::getOrSession("readonly", 0);
$duree_uscpo = CValue::getOrSession("duree_uscpo", "0");
$isolement = CValue::getOrSession("isolement", "0");
$prestation_id = CValue::getOrSession("prestation_id", "");
$item_prestation_id = CValue::getOrSession("item_prestation_id");
$group_id = CGroups::loadCurrent()->_id;
if (CAppUI::conf("dPhospi prestations systeme_prestations", $group_id) == "standard") {
    CValue::setSession("prestation_id", "");
    $prestation_id = "";
}
if (is_array($services_ids)) {
    CMbArray::removeValue("", $services_ids);
}
$where = array();
$where["annule"] = "= '0'";
$where["sejour.group_id"] = "= '{$group_id}'";
$where[] = "(sejour.type != 'seances' && affectation.affectation_id IS NULL) || sejour.type = 'seances'";
$where["sejour.service_id"] = "IS NULL " . (is_array($services_ids) && count($services_ids) ? "OR `sejour`.`service_id` " . CSQLDataSource::prepareIn($services_ids) : "");
$order = null;
switch ($triAdm) {
    case "date_entree":
        $order = "entree ASC, sortie ASC";
        break;
        CValue::setSession("prenom", $patVitale->prenom);
        $cv->loadFromIdVitale($patVitale);
    }
}
// Recherhche par IPP
if ($patient_ipp && !$useVitale && CModule::getInstalled("dPsante400")) {
    // Initialisation dans le cas d'une recherche par IPP
    $patients = array();
    $patientsSoundex = array();
    $patientsCount = 0;
    $patientsSoundexCount = 0;
    $patient = new CPatient();
    $patient->_IPP = $patient_ipp;
    $patient->loadFromIPP();
    if ($patient->_id) {
        CValue::setSession("patient_id", $patient->_id);
        $patients[$patient->_id] = $patient;
    }
} else {
    $where = array();
    $whereSoundex = array();
    $ljoin = array();
    $soundexObj = new soundex2();
    // Limitation du nombre de caractères
    $patient_nom_search = trim($patient_nom);
    $patient_prenom_search = trim($patient_prenom);
    if ($limit_char_search = CAppUI::conf("dPpatients CPatient limit_char_search")) {
        $patient_nom_search = substr($patient_nom_search, 0, $limit_char_search);
        $patient_prenom_search = substr($patient_prenom_search, 0, $limit_char_search);
    }
    if ($patient_nom_search) {
Exemplo n.º 19
0
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$echange_soap_id = CValue::get("echange_soap_id");
$page = CValue::get('page', 0);
$now = CMbDT::date();
$_date_min = CValue::getOrSession('_date_min', CMbDT::dateTime("-7 day"));
$_date_max = CValue::getOrSession('_date_max', CMbDT::dateTime("+1 day"));
$service = CValue::getOrSession("service");
$web_service = CValue::getOrSession("web_service");
$fonction = CValue::getOrSession("fonction");
CValue::setSession("web_service", $web_service);
CValue::setSession("service", $service);
CValue::setSession("_date_min", $_date_min);
CValue::setSession("_date_max", $_date_max);
CValue::setSession("fonction", $fonction);
$doc_errors_msg = $doc_errors_ack = "";
// Chargement de l'échange SOAP demandé
$echange_soap = new CEchangeSOAP();
$echange_soap->load($echange_soap_id);
if ($echange_soap->_id) {
    $echange_soap->loadRefs();
    $echange_soap->input = unserialize($echange_soap->input);
    if ($echange_soap->soapfault != 1) {
        $echange_soap->output = unserialize($echange_soap->output);
    }
}
// Récupération de la liste des echanges SOAP
$itemEchangeSoap = new CEchangeSOAP();
$where = array();
if ($_date_min && $_date_max) {
Exemplo n.º 20
0
$m = $m_get = CValue::get("m");
$post_request = $_SERVER['REQUEST_METHOD'] == 'POST';
if ($post_request) {
    $m = CValue::post("m") ?: $m;
}
$m = CAppUI::checkFileName($m);
if (null == $m) {
    $m = CPermModule::getFirstVisibleModule();
    $parts = explode("-", CAppUI::pref("DEFMODULE"), 2);
    $pref_module = $parts[0];
    if ($pref_module && CPermModule::getViewModule(CModule::getInstalled($pref_module)->mod_id, PERM_READ)) {
        $m = $pref_module;
    }
    if (count($parts) == 2) {
        $tab = $parts[1];
        CValue::setSession("tab", $tab);
    }
}
// Still no target module
if (null == $m) {
    CAppUI::redirect("m=system&a=access_denied");
}
if (null == ($module = CModule::getInstalled($m))) {
    // dP remover super hack
    if (null == ($module = CModule::getInstalled("dP{$m}"))) {
        CAppUI::redirect("m=system&a=module_missing&mod={$m}");
    }
    $m = "dP{$m}";
}
// Get current module permissions
// these can be further modified by the included action files
Exemplo n.º 21
0
$prat_id = CValue::getOrSession("chirSel", 0);
$userSel = CMediusers::get($prat_id);
$userSel->loadRefs();
$canUserSel = $userSel->canDo();
// Vérification des droits sur les praticiens
$listChir = CConsultation::loadPraticiens(PERM_EDIT);
if (!$userSel->isMedical()) {
    CAppUI::setMsg("Vous devez selectionner un professionnel de santé", UI_MSG_ALERT);
    CAppUI::redirect("m=dPcabinet&tab=0");
}
$canUserSel->needsEdit();
$selConsult = CValue::getOrSession("selConsult", 0);
$dossier_anesth_id = CValue::getOrSession("dossier_anesth_id", 0);
if (isset($_GET["date"])) {
    $selConsult = null;
    CValue::setSession("selConsult", 0);
}
$anesth = new CTypeAnesth();
$anesth = $anesth->loadGroupList();
// Consultation courante
$consult = new CConsultation();
$consult->_ref_chir = $userSel;
if ($selConsult) {
    $consult->load($selConsult);
    CCanDo::checkObject($consult);
    $canConsult = $consult->canDo();
    $canConsult->needsEdit();
    $consult->loadRefConsultAnesth();
    $consult->loadRefPlageConsult();
    if (isset($consult->_refs_dossiers_anesth[$dossier_anesth_id])) {
        $consult->_ref_consult_anesth = $consult->_refs_dossiers_anesth[$dossier_anesth_id];
Exemplo n.º 22
0
 static function getServicesIdsPref($services_ids = array())
 {
     // Détection du changement d'établissement
     $group_id = CValue::get("g");
     if (!$services_ids || $group_id) {
         $group_id = $group_id ? $group_id : CGroups::loadCurrent()->_id;
         $pref_services_ids = json_decode(CAppUI::pref("services_ids_hospi"));
         // Si la préférence existe, alors on la charge
         if (isset($pref_services_ids->{"g{$group_id}"})) {
             $services_ids = $pref_services_ids->{"g{$group_id}"};
             $services_ids = explode("|", $services_ids);
             CMbArray::removeValue("", $services_ids);
         } else {
             $service = new CService();
             $where = array();
             $where["group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
             $where["cancelled"] = "= '0'";
             $services_ids = array_keys($service->loadListWithPerms(PERM_READ, $where, "externe, nom"));
         }
     }
     if (is_array($services_ids)) {
         CMbArray::removeValue("", $services_ids);
     }
     global $m;
     $save_m = $m;
     foreach (array("dPhospi", "dPadmissions") as $_module) {
         $m = $_module;
         CValue::setSession("services_ids", $services_ids);
     }
     $m = $save_m;
     return $services_ids;
 }
Exemplo n.º 23
0
 * @package    Mediboard
 * @subpackage Patients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 26857 $
 */
CCanDo::checkRead();
$mediuser = CMediusers::get();
// Chargement du patient sélectionné
$patient_id = CValue::getOrSession("patient_id");
$patient = new CPatient();
if ($new = CValue::get("new")) {
    $patient->load(null);
    CValue::setSession("patient_id", null);
    CValue::setSession("selClass", null);
    CValue::setSession("selKey", null);
} else {
    $patient->load($patient_id);
}
$patient_nom = trim(CValue::getOrSession("nom"));
$patient_prenom = trim(CValue::getOrSession("prenom"));
$patient_ville = CValue::get("ville");
$patient_cp = CValue::get("cp");
$patient_day = CValue::getOrSession("Date_Day");
$patient_month = CValue::getOrSession("Date_Month");
$patient_year = CValue::getOrSession("Date_Year");
$patient_naissance = "{$patient_year}-{$patient_month}-{$patient_day}";
$patient_ipp = CValue::get("patient_ipp");
$patient_nda = CValue::get("patient_nda");
$useVitale = CValue::get("useVitale", CModule::getActive("fse") && CAppUI::pref('LogicielLectureVitale') != 'none' ? 1 : 0);
$prat_id = CValue::get("prat_id");
Exemplo n.º 24
0
// Catégorie demandée
$categorie = new CEiCategorie();
if (!$categorie->load($ei_categorie_id)) {
    // Cette catégorie n'est pas valide
    $ei_categorie_id = null;
    CValue::setSession("ei_categorie_id");
    $categorie = new CEiCategorie();
} else {
    $categorie->loadRefsBack();
}
// Item demandé
$item = new CEiItem();
if (!$item->load($ei_item_id)) {
    // Cet item n'est pas valide
    $ei_item_id = null;
    CValue::setSession("ei_item_id");
    $item = new CEiItem();
} else {
    $item->loadRefsFwd();
}
// Liste des Catégories
$listCategories = $categorie->loadList(null, "nom");
// Liste des Items
$where = null;
if ($vue_item) {
    $where = "ei_categorie_id = '{$vue_item}'";
}
/** @var CEiItem[] $listItems */
$listItems = $item->loadList($where, "ei_categorie_id, nom");
foreach ($listItems as $_item) {
    $_item->loadRefsFwd();
Exemplo n.º 25
0
    $patient = $sejour->_ref_patient;
}
$grossesse = new CGrossesse();
if ($grossesse_id && !$sejour_id && !$operation_id) {
    $grossesse->load($grossesse_id);
    $sejour->grossesse_id = $grossesse->_id;
    $sejour->_ref_grossesse = $grossesse;
    $patient = $grossesse->loadRefParturiente();
}
// On récupère l'opération
$op = new COperation();
$op->load($operation_id);
if ($op->_id) {
    $op->loadRefSejour();
    if (CAppUI::conf("dPplanningOp COperation use_session_praticien")) {
        CValue::setSession("chir_id", $op->chir_id);
    }
    if (CBrisDeGlace::isBrisDeGlaceRequired()) {
        $canAccess = CAccessMedicalData::checkForSejour($op->_ref_sejour);
        if (!$canAccess) {
            if (!$op->canDo()->read) {
                global $m, $tab;
                CAppUI::setMsg("Vous n'avez pas accés à cette intervention hors plage", UI_MSG_WARNING);
                CAppUI::redirect("m={$m}&tab={$tab}&operation_id=0");
            }
        }
    } else {
        if (!$op->canDo()->read) {
            global $m, $tab;
            CAppUI::setMsg("Vous n'avez pas accés à cette intervention hors plage", UI_MSG_WARNING);
            CAppUI::redirect("m={$m}&tab={$tab}&operation_id=0");
 /**
  * Store object
  *
  * @return void
  */
 function doStore()
 {
     if ($msg = $this->_obj->store()) {
         CAppUI::setMsg($msg, UI_MSG_ERROR);
         if ($this->redirectError) {
             $this->redirect =& $this->redirectError;
         }
     } else {
         $id = $this->objectKey;
         CValue::setSession($id, $this->_obj->_id);
         CAppUI::setMsg($this->_old->_id ? $this->modifyMsg : $this->createMsg, UI_MSG_OK);
         // Store additional object reference to the CExObject
         $ex_object_guid = CMbArray::get($this->request, "_ex_object_guid");
         if ($ex_object_guid) {
             $obj = $this->_obj;
             /** @var CExObject $ex_object */
             $ex_object = CStoredObject::loadFromGuid($ex_object_guid);
             if ($ex_object->_id) {
                 $ex_object->additional_class = $obj->_class;
                 $ex_object->additional_id = $obj->_id;
                 $ex_object->store();
             }
         }
         if ($this->redirectStore) {
             $this->redirect =& $this->redirectStore;
         }
     }
 }
Exemplo n.º 27
0
<?php

/**
 * $Id: do_consult_anesth_aed.php 19253 2013-05-24 07:18:23Z aurelie17 $
 *
 * @package    Mediboard
 * @subpackage dPcabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 19253 $
 */
if ($chir_id = CValue::post("chir_id")) {
    CValue::setSession("chir_id", $chir_id);
}
$do = new CDoObjectAddEdit("CConsultAnesth");
$do->doIt();
Exemplo n.º 28
0
 /**
  * @see parent::doStore()
  */
 function doStore()
 {
     $upload = null;
     if (CValue::POST("_from_yoplet") == 1) {
         /** @var CFile $obj */
         $obj = $this->_obj;
         $array_file_name = array();
         $path = CAppUI::conf("dPfiles yoplet_upload_path");
         if (!$path) {
             $path = "tmp";
         }
         // On retire les backslashes d'escape
         $file_name = stripslashes($this->request['_file_path']);
         // Récupération du nom de l'image en partant de la fin de la chaîne
         // et en rencontrant le premier \ ou /
         preg_match('@[\\\\/]([^\\\\/]*)$@i', $file_name, $array_file_name);
         $file_name = $array_file_name[1];
         $extension = strrchr($file_name, '.');
         $_rename = $this->request['_rename'] ? $this->request['_rename'] : 'upload';
         $file_path = "{$path}/" . $this->request['_checksum'];
         $obj->file_name = $_rename == 'upload' ? $file_name : $_rename . $extension;
         $obj->_old_file_path = $this->request['_file_path'];
         $obj->doc_size = filesize($file_path);
         $obj->author_id = CAppUI::$user->_id;
         if (CModule::getActive("cda")) {
             $obj->type_doc = $this->request["type_doc"];
         }
         $obj->fillFields();
         $obj->updateFormFields();
         $obj->file_type = CMbPath::guessMimeType($file_name);
         if ($msg = $obj->store()) {
             CAppUI::setMsg($msg, UI_MSG_ERROR);
         } else {
             $obj->forceDir();
             $obj->moveFile($file_path);
         }
         return parent::doStore();
     }
     $_file_category_id = CValue::post("_file_category_id");
     $language = CValue::post("language");
     $type_doc = CValue::post("type_doc");
     $named = CValue::post("named");
     $rename = CValue::post("_rename");
     CValue::setSession("_rename", $rename);
     if (isset($_FILES["formfile"])) {
         $aFiles = array();
         $upload =& $_FILES["formfile"];
         foreach ($upload["error"] as $fileNumber => $etatFile) {
             if (!$named) {
                 $rename = $rename ? $rename . strrchr($upload["name"][$fileNumber], '.') : "";
             }
             if ($upload["name"][$fileNumber]) {
                 $aFiles[] = array("_mode" => "file", "name" => $upload["name"][$fileNumber], "type" => CMbPath::guessMimeType($upload["name"][$fileNumber]), "tmp_name" => $upload["tmp_name"][$fileNumber], "error" => $upload["error"][$fileNumber], "size" => $upload["size"][$fileNumber], "language" => $language, "type_doc" => $type_doc, "file_category_id" => $_file_category_id, "object_id" => CValue::post("object_id"), "object_class" => CValue::post("object_class"), "_rename" => $rename);
             }
         }
         // Pasted images, via Data uri
         if (!empty($_POST["formdatauri"])) {
             $data_uris = $_POST["formdatauri"];
             $data_names = $_POST["formdatauri_name"];
             foreach ($data_uris as $fileNumber => $fileContent) {
                 $parsed = $this->parseDataUri($fileContent);
                 $_name = $data_names[$fileNumber];
                 if (!$named) {
                     $ext = strrchr($_name, '.');
                     if ($ext === false) {
                         $ext = "." . substr(strrchr($parsed["mime"], '/'), 1);
                         $_name .= $ext;
                     }
                     $rename = $rename ? $rename . $ext : "";
                 }
                 $temp = tempnam(sys_get_temp_dir(), "up_");
                 file_put_contents($temp, $parsed["data"]);
                 if ($data_names[$fileNumber]) {
                     $aFiles[] = array("_mode" => "datauri", "name" => $_name, "type" => $parsed["mime"], "tmp_name" => $temp, "error" => 0, "size" => strlen($parsed["data"]), "language" => $language, "type_doc" => $type_doc, "file_category_id" => $_file_category_id, "object_id" => CValue::post("object_id"), "object_class" => CValue::post("object_class"), "_rename" => $rename);
                 }
             }
         }
         $merge_files = CValue::post("_merge_files");
         if ($merge_files) {
             $pdf = new CMbPDFMerger();
             $this->_obj = new $this->_obj->_class();
             /** @var CFile $obj */
             $obj = $this->_obj;
             $file_name = "";
             $nb_converted = 0;
             foreach ($aFiles as $key => $file) {
                 $converted = 0;
                 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;
                 }
                 // Si c'est un pdf, on le rajoute sans aucun traitement
                 if (substr(strrchr($file["name"], '.'), 1) == "pdf") {
                     $file_name .= substr($file["name"], 0, strpos($file["name"], '.'));
                     $pdf->addPDF($file["tmp_name"], 'all');
                     $nb_converted++;
                     $converted = 1;
                 } else {
                     if ($obj->isPDFconvertible($file["name"]) && $obj->convertToPDF($file["tmp_name"], $file["tmp_name"] . "_converted")) {
                         $pdf->addPDF($file["tmp_name"] . "_converted", 'all');
                         $file_name .= substr($file["name"], 0, strpos($file["name"], '.'));
                         $nb_converted++;
                         $converted = 1;
                     } else {
                         $other_file = new CFile();
                         $other_file->bind($file);
                         $other_file->file_name = $file["name"];
                         $other_file->file_type = $file["type"];
                         $other_file->doc_size = $file["size"];
                         $other_file->fillFields();
                         $other_file->private = CValue::post("private");
                         if (false == ($res = $other_file->moveTemp($file))) {
                             CAppUI::setMsg("Fichier non envoyé", UI_MSG_ERROR);
                             continue;
                         }
                         $other_file->author_id = CAppUI::$user->_id;
                         if ($msg = $other_file->store()) {
                             CAppUI::setMsg("Fichier non enregistré: {$msg}", UI_MSG_ERROR);
                             continue;
                         }
                         CAppUI::setMsg("Fichier enregistré", UI_MSG_OK);
                     }
                 }
                 // Pour le nom du pdf de fusion, on concatène les noms des fichiers
                 if ($key != count($aFiles) - 1 && $converted) {
                     $file_name .= "-";
                 }
             }
             // Si des fichiers ont été convertis et ajoutés à PDFMerger,
             // création du cfile.
             if ($nb_converted) {
                 $obj->file_name = $file_name . ".pdf";
                 $obj->file_type = "application/pdf";
                 $obj->author_id = CAppUI::$user->_id;
                 $obj->private = CValue::post("private");
                 $obj->object_id = CValue::post("object_id");
                 $obj->object_class = CValue::post("object_class");
                 $obj->updateFormFields();
                 $obj->fillFields();
                 $obj->forceDir();
                 $tmpname = tempnam("/tmp", "pdf_");
                 $pdf->merge('file', $tmpname);
                 $obj->doc_size = strlen(file_get_contents($tmpname));
                 $obj->moveFile($tmpname);
                 //rename($tmpname, $obj->_file_path . "/" .$obj->file_real_filename);
                 if ($msg = $obj->store()) {
                     CAppUI::setMsg("Fichier non enregistré: {$msg}", UI_MSG_ERROR);
                 } else {
                     CAppUI::setMsg("Fichier enregistré", UI_MSG_OK);
                 }
             }
         } else {
             foreach ($aFiles as $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;
                 }
                 // Reinstanciate
                 $this->_obj = new $this->_obj->_class();
                 /** @var CFile $obj */
                 $obj = $this->_obj;
                 $obj->bind($file);
                 $obj->file_name = empty($file["_rename"]) ? $file["name"] : $file["_rename"];
                 $obj->file_type = $file["type"];
                 if ($obj->file_type == "application/x-download") {
                     $obj->file_type = CMbPath::guessMimeType($obj->file_name);
                 }
                 $obj->doc_size = $file["size"];
                 $obj->fillFields();
                 $obj->private = CValue::post("private");
                 if ($file["_mode"] == "file") {
                     $res = $obj->moveTemp($file);
                 } else {
                     $res = $obj->moveFile($file["tmp_name"]);
                 }
                 if (false == $res) {
                     CAppUI::setMsg("Fichier non envoyé", UI_MSG_ERROR);
                     continue;
                 }
                 // File owner on creation
                 if (!$obj->file_id) {
                     $obj->author_id = CAppUI::$user->_id;
                 }
                 if ($msg = $obj->store()) {
                     CAppUI::setMsg("Fichier non enregistré: {$msg}", UI_MSG_ERROR);
                     continue;
                 }
                 CAppUI::setMsg("Fichier enregistré", UI_MSG_OK);
             }
         }
         // Redaction du message et renvoi
         if (CAppUI::isMsgOK() && $this->redirectStore) {
             $this->redirect =& $this->redirectStore;
         }
         if (!CAppUI::isMsgOK() && $this->redirectError) {
             $this->redirect =& $this->redirectError;
         }
     } else {
         parent::doStore();
     }
 }
    $where["functions_mediboard.group_id"] = "= '{$group_id}'";
    $users_all = $user->loadList($where, null, null, null, $ljoin);
    /** @var $users CUser[] */
    $users = array_diff_key($users_all, $users_ldap);
    $users = array_slice($users, $start, $count);
    $count = $count_no_associate = $count_associate = 0;
    foreach ($users as $_user) {
        try {
            $source_ldap = CLDAP::bind($_user, $ldaprdn, $ldappass);
            $_user = CLDAP::searchAndMap($_user, $source_ldap, $source_ldap->_ldapconn, $_user->user_username, null);
        } catch (CMbException $e) {
            $e->stepAjax();
        }
        if ($_user->_count_ldap != 0) {
            $count_associate++;
        }
        if ($_user->_count_ldap == 0) {
            CAppUI::stepAjax("'{$_user->_view}' / '{$_user->user_username}' non associé", UI_MSG_WARNING);
            $count_no_associate++;
        }
        $count++;
    }
    if ($count == 0) {
        echo "<script type='text/javascript'>stop=true;</script>";
    }
    $next = $start + $count_no_associate;
    CAppUI::stepAjax("{$count_associate} comptes associés");
    CAppUI::stepAjax("{$count_no_associate} comptes non associés", UI_MSG_WARNING);
    CValue::setSession("start", $next);
    CAppUI::stepAjax("On continuera au n° {$next} / " . count($users) . " restants");
}
Exemplo n.º 30
0
$directory = CValue::post("directory");
$files_directory = CValue::post("files_directory");
if (!is_dir($directory)) {
    CAppUI::stepAjax("'%s' is not a directory", UI_MSG_WARNING, $directory);
    return;
}
if ($files_directory && !is_dir($files_directory)) {
    CAppUI::stepAjax("'%s' is not a directory", UI_MSG_WARNING, $files_directory);
    return;
}
$directory = str_replace("\\\\", "\\", $directory);
$files_directory = str_replace("\\\\", "\\", $files_directory);
CValue::setSession("step", $step);
CValue::setSession("start", $start);
CValue::setSession("directory", $directory);
CValue::setSession("files_directory", $files_directory);
$step = min($step, 1000);
CStoredObject::$useObjectCache = false;
// Import ...
$iterator = new DirectoryIterator($directory);
$count_dirs = 0;
$i = 0;
foreach ($iterator as $_fileinfo) {
    if ($_fileinfo->isDot()) {
        continue;
    }
    if ($_fileinfo->isDir() && strpos($_fileinfo->getFilename(), "CPatient-") === 0) {
        $i++;
        if ($i <= $start) {
            continue;
        }