コード例 #1
0
function managePersonnel($obj)
{
    global $_iade_id, $_aideop_id, $_op_panseuse_id, $_sagefemme_id, $_manipulateur_id, $del_personnel;
    if ($_iade_id) {
        $affectation_personnel = new CAffectationPersonnel();
        $affectation_personnel->object_class = $obj->_class;
        $affectation_personnel->object_id = $obj->_id;
        $affectation_personnel->personnel_id = $_iade_id;
        if ($msg = $affectation_personnel->store()) {
            CAppUI::setMsg($msg, UI_MSG_ERROR);
        } else {
            CAppUI::setMsg("IADE ajoutée", UI_MSG_OK);
        }
    }
    if ($_aideop_id) {
        $affectation_personnel = new CAffectationPersonnel();
        $affectation_personnel->object_class = $obj->_class;
        $affectation_personnel->object_id = $obj->_id;
        $affectation_personnel->personnel_id = $_aideop_id;
        if ($msg = $affectation_personnel->store()) {
            CAppUI::setMsg($msg, UI_MSG_ERROR);
        } else {
            CAppUI::setMsg("Aide opératoire ajoutée", UI_MSG_OK);
        }
    }
    if ($_op_panseuse_id) {
        $affectation_personnel = new CAffectationPersonnel();
        $affectation_personnel->object_class = $obj->_class;
        $affectation_personnel->object_id = $obj->_id;
        $affectation_personnel->personnel_id = $_op_panseuse_id;
        if ($msg = $affectation_personnel->store()) {
            CAppUI::setMsg($msg, UI_MSG_ERROR);
        } else {
            CAppUI::setMsg("Panseuse ajoutée", UI_MSG_OK);
        }
    }
    if ($_sagefemme_id) {
        $affectation_personnel = new CAffectationPersonnel();
        $affectation_personnel->object_class = $obj->_class;
        $affectation_personnel->object_id = $obj->_id;
        $affectation_personnel->personnel_id = $_sagefemme_id;
        if ($msg = $affectation_personnel->store()) {
            CAppUI::setMsg($msg, UI_MSG_ERROR);
        } else {
            CAppUI::setMsg("Sage femme ajoutée", UI_MSG_OK);
        }
    }
    if ($_manipulateur_id) {
        $affectation_personnel = new CAffectationPersonnel();
        $affectation_personnel->object_class = $obj->_class;
        $affectation_personnel->object_id = $obj->_id;
        $affectation_personnel->personnel_id = $_manipulateur_id;
        if ($msg = $affectation_personnel->store()) {
            CAppUI::setMsg($msg, UI_MSG_ERROR);
        } else {
            CAppUI::setMsg("Manipulateur ajouté", UI_MSG_OK);
        }
    }
    foreach ($del_personnel as $_personnel_id) {
        if ($_personnel_id) {
            $affectation_personnel = new CAffectationPersonnel();
            $affectation_personnel->object_class = $obj->_class;
            $affectation_personnel->object_id = $obj->_id;
            $affectation_personnel->personnel_id = $_personnel_id;
            $affectation_personnel->loadMatchingObject();
            if ($affectation_personnel->_id) {
                if ($msg = $affectation_personnel->delete()) {
                    CAppui::setMsg($msg, UI_MSG_ERROR);
                } else {
                    CAppUI::setMsg("Personnel supprimé");
                }
            }
        }
    }
}
コード例 #2
0
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
$step = CValue::get("step", 0);
$aff_pers = new CAffectationPersonnel();
$where = array();
$where["object_class"] = "= 'CPlageOp'";
$affs = $aff_pers->loadList($where, null, "{$step},1000");
/**@var $_aff CAffectationPersonnel */
foreach ($affs as $_aff) {
    $plage = $_aff->loadRefObject();
    $ops = $plage->loadBackIds("operations");
    foreach ($ops as $_op) {
        $affectation = new CAffectationPersonnel();
        $whereAff = array();
        $whereAff["personnel_id"] = "= '{$_aff->personnel_id}'";
        $whereAff["object_class"] = "= 'COperation'";
        $whereAff["object_id"] = "= '{$_op}'";
        $whereAff["parent_affectation_id"] = "IS NULL";
        if ($affectation->loadObject($whereAff)) {
            $affectation->parent_affectation_id = $_aff->_id;
            $msg = $affectation->store();
            CAppUI::stepAjax($msg ? $msg : "Affectation modifiée", $msg ? UI_MSG_ERROR : UI_MSG_OK);
        }
    }
}
CAppui::js('if (' . count($affs) . ' > 0) { 
  $V(getForm("Configure").step, parseInt($V(getForm("Configure").step))+1000);
  affUpdate();
 }');