function doSpecificMassiveActions($input = array()) { $res = array('ok' => 0, 'ko' => 0, 'noright' => 0); switch ($input['action']) { case "Transfert": if ($input['itemtype'] == 'PluginBadgesBadge') { foreach ($input["item"] as $key => $val) { if ($val == 1) { $badge = new PluginBadgesBadge(); $badge->getFromDB($key); $type = PluginBadgesBadgeType::transfer($badge->fields["plugin_badges_badgetypes_id"], $input['entities_id']); if ($type > 0) { $values["id"] = $key; $values["plugin_badges_badgetypes_id"] = $type; if ($badge->update($values)) { $res['ok']++; } else { $res['ko']++; } } unset($values); $values["id"] = $key; $values["entities_id"] = $input['entities_id']; if ($badge->update($values)) { $res['ok']++; } else { $res['ko']++; } } } } break; default: return parent::doSpecificMassiveActions($input); } return $res; }
$badge->delete($_POST); $badge->redirectToList(); } else { if (isset($_POST["restore"])) { $badge->check($_POST['id'], 'w'); $badge->restore($_POST); $badge->redirectToList(); } else { if (isset($_POST["purge"])) { $badge->check($_POST['id'], 'w'); $badge->delete($_POST, 1); $badge->redirectToList(); } else { if (isset($_POST["update"])) { $badge->check($_POST['id'], 'w'); $badge->update($_POST); Html::back(); } else { $badge->checkGlobal("r"); $plugin = new Plugin(); if ($plugin->isActivated("environment")) { Html::header(PluginBadgesBadge::getTypeName(2), '', "plugins", "environment", "badges"); } else { Html::header(PluginBadgesBadge::getTypeName(2), '', "plugins", "badges"); } $badge->showForm($_GET["id"]); Html::footer(); } } } }