Exemplo n.º 1
0
/**
 * $Id$
 *  
 * @category Personnel
 * @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
 */
$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);
Exemplo n.º 2
0
$where = array();
if ($object_id) {
    $where["object_id"] = " = '{$object_id}'";
}
if ($object_class) {
    $where["object_class"] = " = '{$object_class}'";
}
if ($list) {
    $where["personnel_id"] = CSQLDataSource::prepareIn($list);
}
// Chargement des 50 dernieres affectations de personnel
$order = "affect_id DESC";
$limit = "0, 50";
$affectations = array();
if ($object_id || $object_class || $list) {
    $affectations = $filter->loadList($where, $order, $limit);
}
foreach ($affectations as $key => $_affectation) {
    $_affectation->loadRefPersonnel();
    $_affectation->_ref_personnel->loadRefUser();
    $_affectation->loadRefObject();
    $_affectation->_ref_object->loadRefsFwd();
}
foreach ($affectations as $key => $_affect) {
    $listAffectations[$_affect->_ref_personnel->emplacement][] = $_affect;
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("affect_id", $affect_id);
$smarty->assign("listUsers", $listUsers);
$smarty->assign("listPers", $listPers);