public static function load_in_list($assoc_list) { Logger::log("Enter: EventAssociation::load_in_list"); $assocs = array(); for ($i = 0; $i < count($assoc_list); $i++) { $a = new EventAssociation(); $a->load($assoc_list[$i]); $assocs[$i] = $a; } Logger::log("Exit: EventAssociation::load_in_list"); return $assocs; }
if (count($add_assoc_group_errors)) { $msg .= __("Add group:"); foreach ($add_assoc_group_errors as $n => $err) { $msg .= "<br />{$err}"; } $is_display = false; $is_edit = true; } } // see if we have a remove request for an association foreach ($_POST as $k => $v) { if (preg_match('/^remove_assoc_(\\d+)/', $k, $m)) { $rem_assoc = (int) $m[1]; $assoc = new EventAssociation(); try { $assoc->load($rem_assoc); } catch (CNException $e) { $msg = __("You may not remove the association to this event.") . "<br/>" . $e->getMessage(); } if ($assoc->user_id) { // is this user OWNER and TARGET? if ($assoc->user_id == PA::$login_user->user_id && ($assoc->assoc_target_type == 'user' && $assoc->assoc_target_id == PA::$login_user->user_id)) { $msg = __("You cannot remove yourself from this event, as you created it. Please use 'Delete Event' instead."); } else { if ($assoc->user_id == PA::$login_user->user_id || $assoc->assoc_target_type == 'user' && $assoc->assoc_target_id == PA::$login_user->user_id) { EventAssociation::delete($rem_assoc); } else { $msg = __("You may not remove the association to this event."); } } }