コード例 #1
0
 /**
  * Charge les listes de choix d'une classe pour un utilisateur, sa fonction et son établissement
  *
  * @param int    $user_id           identifiant de l'utilisateur
  * @param string $modeleType        classe ciblée
  * @param string $other_function_id autre fonction
  *
  * @return void
  */
 function loadHelpers($user_id, $modeleType, $other_function_id = "")
 {
     $compte_rendu = new CCompteRendu();
     $ds = $compte_rendu->getDS();
     // Chargement de l'utilisateur courant
     $currUser = CMediusers::get($user_id);
     $order = "name";
     // Where user_id
     $whereUser = array();
     $whereUser["user_id"] = $ds->prepare("= %", $user_id);
     $whereUser["class"] = $ds->prepare("= %", $compte_rendu->_class);
     // Where function_id
     $whereFunc = array();
     $whereFunc["function_id"] = $other_function_id ? "IN ({$currUser->function_id}, {$other_function_id})" : $ds->prepare("= %", $currUser->function_id);
     $whereFunc["class"] = $ds->prepare("= %", $compte_rendu->_class);
     // Where group_id
     $whereGroup = array();
     $group = CGroups::loadCurrent();
     $whereGroup["group_id"] = $ds->prepare("= %", $group->_id);
     $whereGroup["class"] = $ds->prepare("= %", $compte_rendu->_class);
     // Chargement des aides
     $aide = new CAideSaisie();
     /** @var CAideSaisie $aidesUser */
     $aidesUser = $aide->loadList($whereUser, $order, null, "aide_id");
     /** @var CAideSaisie $aidesFunc */
     $aidesFunc = $aide->loadList($whereFunc, $order, null, "aide_id");
     /** @var CAideSaisie $aidesGroup */
     $aidesGroup = $aide->loadList($whereGroup, $order, null, "aide_id");
     $this->helpers["Aide de l'utilisateur"] = array();
     foreach ($aidesUser as $aideUser) {
         if ($aideUser->depend_value_1 == $modeleType || $aideUser->depend_value_1 == "") {
             $this->helpers["Aide de l'utilisateur"][CMbString::htmlEntities($aideUser->name)] = CMbString::htmlEntities($aideUser->text);
         }
     }
     $this->helpers["Aide de la fonction"] = array();
     foreach ($aidesFunc as $aideFunc) {
         if ($aideFunc->depend_value_1 == $modeleType || $aideFunc->depend_value_1 == "") {
             $this->helpers["Aide de la fonction"][CMbString::htmlEntities($aideFunc->name)] = CMbString::htmlEntities($aideFunc->text);
         }
     }
     $this->helpers["Aide de l'établissement"] = array();
     foreach ($aidesGroup as $aideGroup) {
         if ($aideGroup->depend_value_1 == $modeleType || $aideGroup->depend_value_1 == "") {
             $this->helpers["Aide de l'établissement"][CMbString::htmlEntities($aideGroup->name)] = CMbString::htmlEntities($aideGroup->text);
         }
     }
 }
コード例 #2
0
ファイル: aides_export_csv.php プロジェクト: fbone/mediboard4
/**
 * Export CSV des aides à la saisie
 *
 * @category CompteRendu
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:\$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$list = CValue::post('id', array());
$owner = CValue::post('owner');
$object_class = CValue::post('object_class');
CMbObject::$useObjectCache = false;
if (!is_array($list)) {
    $list = explode("-", $list);
}
$filename = 'Aides saisie' . ($owner ? " - {$owner}" : '') . ($object_class ? " - " . CAppUI::tr($object_class) : '') . '.csv';
$out = fopen("php://output", "w");
header("Content-Type: application/csv");
header("Content-Disposition: attachment; filename=\"{$filename}\"");
$aide = new CAideSaisie();
fputcsv($out, array_keys($aide->getCSVFields()));
foreach ($list as $id) {
    if (!$aide->load($id)) {
        continue;
    }
    fputcsv($out, $aide->getCSVFields());
}
コード例 #3
0
ファイル: CMbObject.class.php プロジェクト: fbone/mediboard4
 /**
  * Charge toutes les aides à la saisie de l'objet pour un utilisateur donné
  *
  * @param int    $user_id        Utilisateur
  * @param string $keywords       Permet de filtrer les aides commançant par le filtre, si non null
  * @param string $depend_value_1 Valeur de la dépendance 1 lié à l'aide
  * @param string $depend_value_2 Valeur de la dépendance 2 lié à l'aide
  * @param string $object_field   Type d'objet concerné
  * @param string $strict         True or False
  *
  * @return void
  */
 function loadAides($user_id, $keywords = null, $depend_value_1 = null, $depend_value_2 = null, $object_field = null, $strict = "true")
 {
     foreach ($this->_specs as $field => $spec) {
         if (isset($spec->helped)) {
             $this->_aides[$field] = array("no_enum" => null);
         }
     }
     // Chargement de l'utilisateur courant
     $user = new CMediusers();
     $user->load($user_id);
     $user->loadRefFunction();
     // Préparation du chargement des aides
     $ds =& $this->_spec->ds;
     // Construction du Where
     $where = array();
     $where[] = "(user_id = '{$user_id}' OR \n      function_id = '{$user->function_id}' OR \n      group_id = '{$user->_ref_function->group_id}')";
     $where["class"] = $ds->prepare("= %", $this->_class);
     if ($strict == "true") {
         if ($depend_value_1) {
             $where["depend_value_1"] = " = '{$depend_value_1}'";
         }
         if ($depend_value_2) {
             $where["depend_value_2"] = " = '{$depend_value_2}'";
         }
     } else {
         if ($depend_value_1) {
             $where[] = "(depend_value_1 = '{$depend_value_1}' OR depend_value_1 IS NULL)";
         }
         if ($depend_value_2) {
             $where[] = "(depend_value_2 = '{$depend_value_2}' OR depend_value_2 IS NULL)";
         }
     }
     if ($object_field) {
         $where["field"] = " = '{$object_field}'";
     }
     // tri par user puis function puis group (ordre inversé pour avoir ce résultat)
     $order = "group_id, function_id, user_id, depend_value_1, depend_value_2, name, text";
     // Chargement des Aides de l'utilisateur
     $aide = new CAideSaisie();
     // TODO: si on veut ajouter un $limit, il faudrait l'ajouter en argument de la fonction loadAides
     $aides = $aide->seek($keywords, $where, null, null, null, $order);
     $this->orderAides($aides, $depend_value_1, $depend_value_2);
 }
コード例 #4
0
ファイル: vw_idx_aides.php プロジェクト: fbone/mediboard4
<?php

/**
 * Interface des aides à la saisie
 *
 * @category CompteRendu
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:\$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$filtre = new CAideSaisie();
// Utilisateur sélectionné ou utilisateur courant
$filtre->user_id = CView::get("user_id", "num pos", true);
$filtre->function_id = CView::get("function_id", "num pos", true);
$filtre->class = CView::get("class", "str", true);
$keywords = CView::get("keywords", "str", true);
$start = CValue::getOrSession("start", array("user" => 0, "func" => 0, "etab" => 0));
$order_col_aide = CView::get("order_col_aide", "enum list|class|field|depend_value_1|depend_value_2|name default|class", true);
$order_way = CView::get("order_way", "enum list|ASC|DESC default|ASC", true);
CView::checkin();
$classes = array_flip(CApp::getInstalledClasses());
// Chargement des classes possibles pour les aides à la saisie
foreach ($classes as $class => &$infos) {
    $object = new $class();
    $infos = array();
    foreach ($object->_specs as $field => $spec) {
        if (!isset($spec->helped)) {
            continue;
コード例 #5
0
 $user_id = $function_id = $group_id = null;
 switch ($owner->_class) {
     case "CMediusers":
         $user_id = $owner->_id;
         break;
     case "CFunctions":
         $function_id = $owner->_id;
         break;
     case "CGroups":
         $group_id = $owner->_id;
 }
 // Object columns on the first line
 $cols = fgetcsv($fp);
 // Each line
 while ($line = fgetcsv($fp)) {
     $aide = new CAideSaisie();
     foreach ($cols as $index => $field) {
         $aide->{$field} = $line[$index] === "" ? null : $line[$index];
     }
     $aide->user_id = $user_id;
     $aide->function_id = $function_id;
     $aide->group_id = $group_id;
     $aide->escapeValues();
     $alreadyExists = $aide->loadMatchingObject();
     if ($msg = $aide->store()) {
         CAppUI::setMsg($msg);
         continue;
     }
     if ($alreadyExists) {
         CAppUI::setMsg("Aide à la saisie déjà présente");
     } else {
コード例 #6
0
ファイル: edit_aide.php プロジェクト: fbone/mediboard4
}
// Liste des aides
$user_id = CValue::get("user_id", CAppUI::$user->_id);
if (!$user_id) {
    $user_id = CAppUI::$user->_id;
}
$user = new CMediusers();
$user->load($user_id);
$user->loadRefFunction();
$group = $user->_ref_function->loadRefGroup();
// Accès aux aides à la saisie de la fonction et de l'établissement
$module = CModule::getActive("dPcompteRendu");
$is_admin = $module && $module->canAdmin();
$access_function = $is_admin || CAppUI::conf("compteRendu CAideSaisie access_function");
$access_group = $is_admin || CAppUI::conf("compteRendu CAideSaisie access_group");
$aidebis = new CAideSaisie();
$whereClause = "`class` = '" . $class . "' AND\r\n`field` = '" . $field . "' AND (\r\n  user_id     = " . $user_id;
if ($access_function) {
    $whereClause .= " OR function_id = " . $user->function_id;
}
if ($access_group) {
    $whereClause .= " OR group_id    = " . $group->_id;
}
$whereClause .= ")";
$where[] = $whereClause;
$orderby = "name";
$aides = $aidebis->loadList($where, $orderby);
$aide = new CAideSaisie();
$aide->load($aide_id);
if ($aide->_id) {
    if ($aide->function_id && !$access_function) {
コード例 #7
0
ファイル: check_params.php プロジェクト: fbone/mediboard4
     $criteres["level1"]["cprt"][$_praticien->_id] = $idex->_id ? true : false;
     // Paramétrage eCap (appel d'un web service)
     $criteres["level1"]["ecap"][$_praticien->_id] = null;
 }
 // Vue offline paramétrée et accessible
 $criteres["level1"]["offline"][$_praticien->_id] = false;
 //----- Level 2
 // Aides à la saisie
 $aides = array();
 $aide = new CAideSaisie();
 $aide->user_id = $_praticien->_id;
 $aides["user"] = $aide->countMatchingList();
 $aide = new CAideSaisie();
 $aide->function_id = $_praticien->_ref_function->_id;
 $aides["func"] = $aide->countMatchingList();
 $aide = new CAideSaisie();
 $aide->group_id = $_praticien->_ref_function->_ref_group->_id;
 $aides["group"] = $aide->countMatchingList();
 $criteres["level2"]["aides"][$_praticien->_id] = array_sum($aides) ? true : false;
 $details["level2"]["aides"][$_praticien->_id] = $aides;
 // Tarifs
 $tarifs = array();
 $tarif = new CTarif();
 $tarif->chir_id = $_praticien->_id;
 $tarifs["user"] = $tarif->countMatchingList();
 $tarif = new CTarif();
 $tarif->function_id = $_praticien->_ref_function->_id;
 $tarifs["func"] = $tarif->countMatchingList();
 $criteres["level2"]["tarifs"][$_praticien->_id] = array_sum($tarifs) ? true : false;
 $details["level2"]["tarifs"][$_praticien->_id] = $tarifs;
 // Modèles bodies
コード例 #8
0
$access_group = $is_admin || CAppUI::conf("compteRendu CAideSaisie access_group");
$aides = array();
$aidesCount = array();
if (!$function_id) {
    $aides["user"] = array();
    $aidesCount["user"] = 0;
}
if ($access_function) {
    $aides["func"] = array();
    $aidesCount["func"] = 0;
}
if ($access_group) {
    $aides["etab"] = array();
    $aidesCount["etab"] = 0;
}
$_aide = new CAideSaisie();
foreach ($aides as $owner => $_aides_by_owner) {
    switch ($owner) {
        case "user":
            $key_where = "user_id";
            $where[$key_where] = "= '{$userSel->user_id}'";
            break;
        case "func":
            $key_where = "function_id";
            $where[$key_where] = "= '" . ($function_id ? $function_id : $userSel->function_id) . "'";
            break;
        case "etab":
            $key_where = "group_id";
            $where[$key_where] = "= '" . ($function_id ? $function->_ref_group->_id : $userSel->_ref_function->group_id) . "'";
            break;
    }
コード例 #9
0
ファイル: ajax_edit_aide.php プロジェクト: fbone/mediboard4
<?php

/**
 * $Id$
 *  
 * @category Modèles
 * @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();
$aide_id = CValue::getOrSession("aide_id");
$user_id = CValue::getOrSession("user_id");
$function_id = $aide = new CAideSaisie();
$aide->load($aide_id);
// Accès aux aides à la saisie de la fonction et de l'établissement
$module = CModule::getActive("dPcompteRendu");
$is_admin = $module && $module->canAdmin();
$access_function = $is_admin || CAppUI::conf("compteRendu CAideSaisie access_function");
$access_group = $is_admin || CAppUI::conf("compteRendu CAideSaisie access_group");
if ($aide->_id) {
    if ($aide->function_id && !$access_function) {
        CAppUI::redirect("m=system&a=access_denied");
    }
    if ($aide->group_id && !$access_group) {
        CAppUI::redirect("m=system&a=access_denied");
    }
} else {
    $aide->user_id = $user_id;
コード例 #10
0
ファイル: aides_import_csv.php プロジェクト: fbone/mediboard4
 $user_id = $function_id = $group_id = null;
 switch ($owner->_class) {
     case "CMediusers":
         $user_id = $owner->_id;
         break;
     case "CFunctions":
         $function_id = $owner->_id;
         break;
     case "CGroups":
         $group_id = $owner->_id;
 }
 // Object columns on the first line
 $cols = fgetcsv($fp);
 // Each line
 while ($line = fgetcsv($fp)) {
     $aide = new CAideSaisie();
     foreach ($cols as $index => $field) {
         $aide->{$field} = $line[$index] === "" ? null : $line[$index];
     }
     $aide->user_id = $user_id;
     $aide->function_id = $function_id;
     $aide->group_id = $group_id;
     $alreadyExists = $aide->loadMatchingObjectEsc();
     if ($msg = $aide->store()) {
         CAppUI::setMsg($msg);
         continue;
     }
     if ($alreadyExists) {
         CAppUI::setMsg("Aide à la saisie déjà présente");
     } else {
         CAppUI::setMsg("CAideSaisie-msg-create");