Example #1
0
function plugin_projet_MassiveActionsProcess($data)
{
    $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
    $projet_item = new PluginProjetProjet_Item();
    switch ($data['action']) {
        case "plugin_projet_add_item":
            foreach ($data["item"] as $key => $val) {
                if ($val == 1) {
                    $input = array('plugin_projet_projets_id' => $data['plugin_projet_projets_id'], 'items_id' => $key, 'itemtype' => $data['itemtype']);
                    if ($projet_item->can(-1, 'w', $input)) {
                        if ($projet_item->add($input)) {
                            $res['ok']++;
                        } else {
                            $res['ko']++;
                        }
                    } else {
                        $res['noright']++;
                    }
                }
            }
            break;
    }
}