/** * @param $input **/ static function updateForReport($input) { /* call from front/config.form.php * $report = "bar" (from reports) or "foo_bar" (other plugins) */ $prof = new ProfileRight(); $report = $input['report']; $rightname = "plugin_reports_{$report}"; $current = self::getAllProfilesRights(array("name = '{$rightname}'"), true); foreach ($input as $profiles_id => $right) { if (is_numeric($profiles_id)) { if (isset($current[$profiles_id])) { $prof->update(array('id' => $current[$profiles_id]['id'], 'rights' => $right)); } else { if ($right) { $prof->add(array('profiles_id' => $profiles_id, 'name' => $rightname, 'rights' => $right)); } } // TODO Check here with another plugin } } }