Ejemplo n.º 1
0
/**
 * import the csv firstname file
 *
 * @param string $targetPath filepath
 * @param int    $start      start from
 * @param int    $count      step of import
 *
 * @return void
 */
function importFile($targetPath, $start, $count)
{
    $fp = fopen($targetPath, 'r');
    //0 = first line
    if ($start == 0) {
        $start++;
    }
    $line_nb = 0;
    while ($line = fgetcsv($fp, null, ";")) {
        if ($line_nb >= $start && $line_nb < $start + $count) {
            $found = false;
            $fn = CMbString::removeDiacritics(trim($line[0]));
            $sex = trim($line[1]);
            $language = CMbString::removeDiacritics(trim($line[2]));
            if ($sex == "m,f" || $sex == "f,m") {
                $sex = "u";
            }
            $firstname = new CFirstNameAssociativeSex();
            $firstname->firstname = $fn;
            $firstname->language = $language;
            $firstname->loadMatchingObjectEsc();
            if ($firstname->_id) {
                // found
                $found = true;
                if ($sex != $firstname->sex) {
                    $firstname->sex = "u";
                }
            } else {
                // not found
                $firstname->sex = $sex;
            }
            // store & message
            if ($msg = $firstname->store()) {
                CAppUI::stepAjax($msg, UI_MSG_WARNING);
            } else {
                if ($found == true) {
                    CAppUI::stepAjax("prénom <strong>{$fn}</strong>, mis à jour <strong>[{$firstname->sex}]</strong>");
                } else {
                    CAppUI::stepAjax("prénom <strong>{$fn}</strong>, ajouté <strong>[{$firstname->sex}]</strong>");
                }
            }
        }
        $line_nb++;
    }
    return;
}
Ejemplo n.º 2
0
 /**
  * Collection natural sort utility with diacritic
  *
  * @param array $array The array to sort
  *
  * @return array
  */
 static function naturalSort(&$array)
 {
     uasort($array, function ($a, $b) {
         return strnatcasecmp(CMbString::removeDiacritics($a), CMbString::removeDiacritics($b));
     });
 }
Ejemplo n.º 3
0
 $group_id = $group->_id;
 $where['sejour.group_id'] = " = '{$group_id}'";
 $where['sejour.entree'] = "BETWEEN '" . reset($dates) . "' AND '" . end($dates) . "'";
 $nb_rpus = $rpu->countList($where, null, $ljoin);
 $percent = CValue::get("_percent") * $nb_rpus;
 $percent = $percent / 100;
 $sql = "SELECT TRIM(TRAILING '\r\n' from substring_index( `diag_infirmier` , '\\n', 1 )) AS categorie, COUNT(*) as nb_diag\n    FROM `rpu`\n    LEFT JOIN `sejour` ON `rpu`.sejour_id = `sejour`.sejour_id\n    WHERE `diag_infirmier` IS NOT NULL\n    AND `group_id` = '{$group_id}'\n    AND `entree` BETWEEN '" . reset($dates) . "' AND '" . end($dates) . "'\n    GROUP BY categorie\n    HAVING nb_diag > {$percent}";
 $result = $ds->exec($sql);
 $areas = array();
 while ($row = $ds->fetchArray($result)) {
     $areas[] = $row["categorie"];
 }
 $areas[] = "AUTRES DIAGNOSTICS";
 foreach ($areas as &$_area) {
     $_area = rtrim($_area);
     $_area = CMbString::removeDiacritics($_area);
     $_area = strtoupper($_area);
 }
 $areas = array_unique($areas);
 $data[$axe]["options"]["title"] .= utf8_encode(" (" . count($areas) . " catégories)");
 $series =& $data[$axe]['series'];
 $totaux = array();
 // On compte le nombre total de rpu par date
 foreach ($dates as $i => $_date) {
     $_date_next = CMbDT::date("+1 {$period}", $_date);
     $where['sejour.entree'] = "BETWEEN '{$_date}' AND '{$_date_next}'";
     $totaux[$i] = $rpu->countList($where, null, $ljoin);
 }
 $j = 0;
 foreach ($areas as $value) {
     unset($where[10]);
 /**
  * Diacritic insensitive comparison callback for natural sorting
  *
  * @param CModelObject $a Object having a self::$sortField property
  * @param CModelObject $b Object having a self::$sortField property
  *
  * @return int Comparison result
  */
 protected static function _cmpFieldNaturalAccentsDiacritics($a, $b)
 {
     $sort_field = self::$sortField;
     return strnatcasecmp(CMbString::removeDiacritics($a->{$sort_field}), CMbString::removeDiacritics($b->{$sort_field}));
 }
Ejemplo n.º 5
0
 function makeUsernamePassword($first_name, $last_name, $id = null, $number = false, $prepass = "******")
 {
     $length = 20 - strlen($id);
     $this->_user_username = substr(preg_replace($number ? "/[^a-z0-9]/i" : "/[^a-z]/i", "", strtolower(CMbString::removeDiacritics(($first_name ? $first_name[0] : '') . $last_name))), 0, $length) . $id;
     $this->_user_password = $prepass . substr(preg_replace($number ? "/[^a-z0-9]/i" : "/[^a-z]/i", "", strtolower(CMbString::removeDiacritics($last_name))), 0, $length) . $id;
 }
Ejemplo n.º 6
0
            $query = "SELECT * FROM master WHERE abbrev LIKE('%" . substr($abbrev, 0, $i) . "%') ORDER BY code ASC LIMIT 1";
        } else {
            $query = "SELECT * FROM master WHERE abbrev = '" . substr($abbrev, 0, $i) . "' LIMIT 1";
        }
        $result = $ds->exec($query);
        $row = $ds->fetchArray($result);
        $level_SID = $row['SID'];
        if ($level_SID && $prev_SID != $level_SID) {
            $query = "UPDATE `master` SET `id" . ($i - $offset) . "` = {$level_SID} WHERE SID = {$SID}";
            $ds->exec($query);
            $prev_SID = $level_SID;
        } else {
            $offset++;
        }
    }
    $label = str_replace("'", "\\'", CMbString::removeDiacritics($diff[3], CMbString::UPPERCASE));
    // Insertion des libellés dans toutes les langues
    $query = "INSERT into libelle (\r\n             `SID`, `source`, `valid`, `author`,\r\n             `libelle`, `FR_OMS`, `EN_OMS`, `GE_DIMDI`, `GE_AUTO`, `FR_CHRONOS`) VALUES (\r\n    {$SID},'S','1','atih',\r\n    '" . $label . "','" . $label . "','" . $label . "','" . $label . "','" . $label . "','" . $label . "')";
    $ds->exec($query);
    // Inutile vu qu'on n'a pas les descriptions dans le CSV
    // On récupère la clé primaire du dernier libellé ajouté
    /*$query = "SELECT * FROM libelle WHERE 1 ORDER BY LID DESC LIMIT 1";
      $result = $ds->exec($query);
      $row = $ds->fetchArray($result);
      $LID = $row['LID'];
      
      // Insertion des liens vers les libellés dans toutes les langues
      $query = "INSERT into `descr` (`SID`, `LID`) VALUES ($SID, $LID)";
      $ds->exec($query);*/
}
CAppUI::stepAjax(count($list_diff) . " codes supplémentaires ont été ajoutés dans la CIM10", UI_MSG_OK);
 * $Id$
 *  
 * @package    Mediboard
 * @subpackage patients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 * @link       http://www.mediboard.org
 */
CCanDo::check();
$needle = CValue::request('_search_constants', 0);
$list_constantes = CConstantesMedicales::$list_constantes;
$results = array();
if ($needle) {
    foreach ($list_constantes as $_constant => $params) {
        if (strpos($_constant, 'cumul') !== false) {
            continue;
        }
        $search_elements = array();
        $search_elements[] = CMbString::removeDiacritics(strtolower($_constant));
        $search_elements[] = CMbString::removeDiacritics(strtolower(CAppUI::tr("CConstantesMedicales-{$_constant}")));
        $search_elements[] = CMbString::removeDiacritics(strtolower(CAppUI::tr("CConstantesMedicales-{$_constant}-court")));
        $search_elements[] = CMbString::removeDiacritics(strtolower(CAppUI::tr("CConstantesMedicales-{$_constant}-desc")));
        if (strpos(implode('|', $search_elements), $needle) !== false) {
            $results[] = $_constant;
        }
    }
}
$smarty = new CSmartyDP();
$smarty->assign('results', $results);
$smarty->display('inc_autocomplete_constants.tpl');
Ejemplo n.º 8
0
 function addUniteFonctionnelle(DOMNode $elParent, COperation $operation)
 {
     $salle = $operation->updateSalle();
     $nom = CMbString::removeDiacritics($salle->nom);
     $nom = str_replace("'", "", $nom);
     $nom = CMbString::convertHTMLToXMLEntities($nom);
     $this->addCodeLibelle($elParent, "uniteFonctionnelle", substr($nom, 0, 10), "");
 }