function recommend_contact($receiver, $contact, $message) { $user = lms_steam::get_current_user(); $subject = str_replace("%NAME", $contact->get_attribute("USER_FIRSTNAME") . " " . $contact->get_attribute("USER_FULLNAME"), gettext("Recommendation of %NAME as contact")); $message .= "\n\n--\n\n" . gettext("This message was created via the introduce contact function.") . " " . str_replace(array("%NAME1", "%NAME2"), array($user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), $contact->get_attribute("USER_FIRSTNAME") . " " . $contact->get_attribute("USER_FULLNAME")), gettext("%NAME1 wants to recommend %NAME2 to you.")) . "\n\n" . gettext("Name") . ": " . $contact->get_attribute("USER_FIRSTNAME") . " " . $contact->get_attribute("USER_FULLNAME") . "\n" . gettext("Contact page") . ": " . PATH_URL . "user/" . $contact->get_name() . "/\n"; lms_steam::mail($receiver, $user, $subject, $message); }
public function subscribe($password = "", $message = "") { $user = lms_steam::get_current_user(); $group_name = $this->get_display_name(); if ($this->is_password_protected()) { if ($this->check_group_pw($password)) { $this->add_member($user, $password); $result = array("succeeds" => TRUE, "confirmation" => str_replace("%GROUP", $group_name, str_replace("%GROUP", $this->get_name(), gettext("You have been added to '%GROUP'.")))); } else { $result = array("succeeds" => FALSE, "problem" => gettext("Wrong password."), "hint" => gettext("If you want to join and do not know the password, please contact a group moderator."), "confirmation" => ""); } } else { if ($this->is_moderated()) { $user = lms_steam::get_current_user(); $username = $user->get_full_name(); $this->add_membership_request($user); $admins = $this->get_admins(); if (!is_array($admins)) { $admins = array($admins); } $link = $this instanceof koala_group_course ? PATH_URL . SEMESTER_URL . "/" . $this->get_semester()->get_name() . "/" . $this->get_name() . "/requests/" : PATH_URL . "groups/" . $this->get_id() . "/requests/"; foreach ($admins as $admin) { $adminname = $admin->get_full_name(); $mailbody = str_replace("%NAME", $adminname, gettext("Dear %NAME,")) . "\n\n" . str_replace(array("%NAME", "%GROUP"), array($username, $group_name), gettext("The user %NAME has requested membership for '%GROUP':")) . "\n\n<b>{$message}</b>\n\n" . gettext("Since you are a moderator for this group, you can affirm the membership or decline.") . "\n\n" . str_replace("%PAGE", "<a href=\"{$link}\">" . gettext("open membership requests") . "</a>", gettext("Please see %PAGE for further instructions.")); //$admin->mail( "LLMS: Membership Request" , $message, $user->get_attribute( "USER_EMAIL" ) ); lms_steam::mail($admin, $user, gettext("koaLA: Membership Request"), $mailbody); } $result = array("succeeds" => TRUE, "confirmation" => str_replace("%GROUP", $group_name, str_replace("%GROUP", $group_name, gettext("Membership request for '%GROUP' has been sent.")))); } else { $this->add_member($user); $result = array("succeeds" => TRUE, "confirmation" => str_replace("%GROUP", $group_name, gettext("You have been added to '%GROUP'."))); } } return $result; }
} } } if ($steam_group->delete()) { $user->get_attributes(array(OBJ_NAME, USER_FIRSTNAME, USER_FULLNAME)); foreach ($members as $member) { $cache = get_cache_function($member->get_name()); $cache->drop("lms_steam::user_get_groups", $member->get_name(), TRUE); $cache->drop("lms_steam::user_get_groups", $member->get_name(), FALSE); $cache->drop("lms_steam::user_get_profile", $member->get_name()); $cache->drop("lms_portal::get_menu_html", $member->get_name(), TRUE); } $cache = get_cache_function($steam_group->get_id()); $cache->drop("lms_steam::group_get_members", $steam_group->get_id()); foreach ($members as $member) { lms_steam::mail($member, $user, PLATFORM_NAME . ": " . str_replace("%NAME", h($group_name), gettext("Group %NAME has been deleted.")), str_replace("%USER", $user->get_name() . " (" . $user->get_attribute(USER_FIRSTNAME) . " " . $user->get_attribute(USER_FULLNAME) . ")", str_replace("%NAME", h($group_name), gettext("The group '%NAME' has been deleted from he koaLA System by %USER."))) . "\n\n-- \n" . str_replace("%NAME", h($group_name), gettext("This system generated notification message was sent to you as a former member of the deleted group \"%NAME\""))); } $_SESSION["confirmation"] = str_replace("%NAME", h($group_name), gettext("The group '%NAME' has been deleted. A notification has been sent to former members.")); header("Location: " . $upper_link); exit; } else { throw new Exception("Deletion of group failed"); } } $content = new HTML_TEMPLATE_IT(); $content->loadTemplateFile(PATH_TEMPLATES . "group_delete.template.html"); $content->setVariable("FORM_ACTION", ""); $content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure?")); $content->setVariable("INFO_DELETE_GROUP", str_replace("%GROUP_NAME", h($group->get_name()), gettext("You are going to delete '%GROUP_NAME'.")) . "<br />" . gettext("All data of this group will be removed from the system including weblogs, wikis, forums and documents. All members of this group will be notified about the deletion automatically.") . "<br /><br /><strong>" . gettext("The deletion process may take several minutes.")) . "</strong>"; $content->setVariable("LABEL_DELETE_IT", gettext("Yes, delete this group")); $content->setVariable("DELETE_BACK_LINK", $_SERVER["HTTP_REFERER"]);
foreach ($bookings_for_deletion as $booking) { $result = $GLOBALS["STEAM"]->predefined_command($user_module, "lookup_login", array($booking->student_login, FALSE), 0); if (is_object($result[0])) { $student = $result[0]; } else { // Benutzer hat sich noch nie in sTeam eingeloggt. continue; } $steam_group = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $booking->course_id_koala, 0); $course = new koala_group_course($steam_group); // KURSAUSTRITT AUCH IN KOALA MIT UEBERNEHMEN if ($course->remove_member($student)) { $message = str_replace("%NAME", $student->get_attribute("USER_FIRSTNAME") . " " . $student->get_attribute("USER_FULLNAME"), gettext("Hallo %NAME,")) . "\n\n"; $message .= str_replace("%GROUP", $course->get_name(), gettext("You have been removed from the course '%GROUP' because of your membership data in the HIS LSF system.")) . "\n\n"; $message .= gettext("This is an automatically generated email."); lms_steam::mail($student, lms_steam::get_current_user(), PLATFORM_NAME . ": " . str_replace("%GROUP", $course->get_name(), gettext("You have been removed from the course '%GROUP'.")), $message); $query = "DELETE FROM " . SYNC_TABLE_NAME . " WHERE id='" . $booking->id . "';"; if (mysql_query($query)) { $counter_deleted_bookings++; } } else { print "konnte nicht geloescht werden."; } } // LOGGING try { logging::write_log(LOG_HISLSFSYNC, "HISLSF_SYNC\tDeleted bookings: " . $counter_deleted_bookings); logging::write_log(LOG_HISLSFSYNC, "HISLSF_SYNC\t=== END ==="); } catch (Exception $e) { error_log($e->getTraceAsString()); print "Cannot write Log-File! ";
$cache = get_cache_function($group->get_id(), CACHE_LIFETIME_STATIC); $cache->drop("lms_steam::group_get_members", $group->get_id()); // uncache menu so that course/group appears: $cache = get_cache_function($candidate->get_name()); $cache->drop("lms_steam::user_get_profile", $candidate->get_name()); $cache->drop("lms_portal::get_menu_html", $candidate->get_name(), TRUE); } } elseif (isset($_POST['cancel']) && is_array($_POST['cancel'])) { $candidate = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), key($_POST["cancel"])); $group->remove_membership_request($candidate); $subject = str_replace("%GROUP", $group->get_name(), gettext("Your membership for '%GROUP' was rejected")); $message = gettext("Your membership was rejected."); $portal->set_confirmation(str_replace("%NAME", $candidate->get_attribute("USER_FIRSTNAME") . " " . $candidate->get_attribute("USER_FULLNAME"), gettext("Membership of %NAME rejected."))); } //$candidate->mail( $subject, $message, $user->get_attribute( "USER_EMAIL" )); lms_steam::mail($candidate, $user, $subject, $message); } $result = $group->get_membership_requests(); $html_people = new HTML_TEMPLATE_IT(); $html_people->loadTemplateFile(PATH_TEMPLATES . "list_users.template.html"); $no_people = count($result); if ($no_people > 0) { $start = $portal->set_paginator(10, $no_people, "(" . gettext("%TOTAL membership requests") . ")"); $end = $start + 10 > $no_people ? $no_people : $start + 10; $html_people->setVariable("LABEL_CONTACTS", gettext("Membership requests") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_people), gettext("%a-%z out of %s")) . ")"); $html_people->setCurrentBlock("BLOCK_CONTACT_LIST"); $html_people->setVariable("LABEL_NAME_POSITION", gettext("Name, position")); $html_people->setVariable("LABEL_SUBJECT_AREA", gettext("Subject area")); $html_people->setVariable("LABEL_COMMUNICATION", gettext("Communication")); $html_people->setVariable("TH_MANAGE_CONTACT", gettext("Action")); foreach ($result as $candidate) {
public function frameResponse(\FrameResponseObject $frameResponseObject) { $group_id = $this->params[0]; $user = \lms_steam::get_current_user(); try { $steam_group = !empty($group_id) ? \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $group_id) : FALSE; } catch (Exception $ex) { include "bad_link.php"; exit; } $group_is_private = FALSE; if ($steam_group && is_object($steam_group)) { switch ((string) $steam_group->get_attribute("OBJ_TYPE")) { case "course": $group = new koala_group_course($steam_group); // TODO: Passt der backlink? $backlink = PATH_URL . SEMESTER_URL . "/" . $group->get_semester()->get_name() . "/" . h($group->get_name()) . "/"; break; default: $group = new \koala_group_default($steam_group); // TODO: Passt der backlink? $backlink = PATH_URL . "groups/" . $group->get_id() . "/"; // Determine if group is public or private $parent = $group->get_parent_group(); if ($parent->get_id() == STEAM_PRIVATE_GROUP) { $group_is_private = TRUE; } break; } } if ($group_is_private) { if (!$steam_group->is_member($user) && !\lms_steam::is_koala_admin($user)) { throw new Exception(gettext("You have no rights to access this group"), E_USER_RIGHTS); } } if (!$steam_group->check_access_write($user)) { throw new Exception(str_replace("%USER", $user->get_login(), sr_replace("%GROUP", $group->get_id(), gettext("Access denied: User %USER has no right to delete the group %GROUP"))), E_USER_RIGHTS); } if ($_SERVER["REQUEST_METHOD"] == "POST") { $values = $_POST["values"]; $env = $steam_group->get_environment(); // TODO: Passt der link? $upper_link = PATH_URL . "groups/" . (is_object($env) ? "?cat=" . $env->get_id() : ""); $group_name = $group->get_display_name(); $members = $group->get_members(); $inventory = $group->get_workroom()->get_inventory_raw(); $deleted = TRUE; foreach ($inventory as $object) { if (!$object instanceof \steam_user) { try { \lms_steam::delete($object); } catch (Exception $ex3) { \logging::write_log(LOG_DEBUGLOG, "groups_delete:error deleting object from group workroom\t" . $login . " \t" . $group->get_display_name() . " \t" . $steam_group->get_id() . " \t" . $object->get_id()); } } } if ($steam_group->delete()) { $user->get_attributes(array(OBJ_NAME, USER_FIRSTNAME, USER_FULLNAME)); foreach ($members as $member) { $cache = get_cache_function($member->get_name()); $cache->drop("lms_steam::user_get_groups", $member->get_name(), TRUE); $cache->drop("lms_steam::user_get_groups", $member->get_name(), FALSE); $cache->drop("lms_steam::user_get_profile", $member->get_name()); $cache->drop("lms_portal::get_menu_html", $member->get_name(), TRUE); } $cache = get_cache_function($steam_group->get_id()); $cache->drop("lms_steam::group_get_members", $steam_group->get_id()); foreach ($members as $member) { \lms_steam::mail($member, $user, PLATFORM_NAME . ": " . str_replace("%NAME", h($group_name), gettext("Group %NAME has been deleted.")), str_replace("%USER", $user->get_name() . " (" . $user->get_attribute(USER_FIRSTNAME) . " " . $user->get_attribute(USER_FULLNAME) . ")", str_replace("%NAME", h($group_name), gettext("The group '%NAME' has been deleted from he koaLA System by %USER."))) . "\n\n-- \n" . str_replace("%NAME", h($group_name), gettext("This system generated notification message was sent to you as a former member of the deleted group \"%NAME\""))); } $_SESSION["confirmation"] = str_replace("%NAME", h($group_name), gettext("The group '%NAME' has been deleted. A notification has been sent to former members.")); header("Location: " . $upper_link); exit; } else { throw new Exception("Deletion of group failed"); } } $content = \Group::getInstance()->loadTemplate("group_delete.template.html"); $content->setVariable("FORM_ACTION", ""); $content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure?")); $content->setVariable("INFO_DELETE_GROUP", str_replace("%GROUP_NAME", h($group->get_name()), gettext("You are going to delete '%GROUP_NAME'.")) . "<br />" . gettext("All data of this group will be removed from the system including weblogs, wikis, forums and documents. All members of this group will be notified about the deletion automatically.") . "<br /><br /><strong>" . gettext("The deletion process may take several minutes.")) . "</strong>"; $content->setVariable("LABEL_DELETE_IT", gettext("Yes, delete this group")); $content->setVariable("DELETE_BACK_LINK", $_SERVER["HTTP_REFERER"]); $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]); $content->setVariable("LABEL_RETURN", gettext("back")); $frameResponseObject->setTitle("Group"); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($content->get()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; }
if ($group->add_member($new_member)) { $confirmations[] = h($new_member->get_full_name()); // PROCEDURE FOR COURSE ADMINS if ($group->get_attribute("OBJ_TYPE") == "course_staff") { // TODO: fct to add an admin? set_sanction_all does not seem to work... :( $steam_group->set_sanction_all($new_member); } if ($group->get_attribute("OBJ_TYPE") == "course_tutorial" || $group->get_attribute("OBJ_TYPE") == "group_tutorial_koala") { $no_of_learners = (int) $group->get_attribute("GROUP_NO_MEMBERS"); $group->set_attribute("GROUP_NO_MEMBERS", $no_of_learners + count($_REQUEST["add"])); } $group_name = koala_object::get_koala_object($group)->get_display_name(); $message = str_replace("%NAME", $new_member->get_full_name(), gettext("Dear %NAME,")) . "\n\n"; $message .= str_replace("%GROUP", $group_name, gettext("You were added to '%GROUP' as a new member.")) . "\n\n"; $message .= gettext("This is an automatically generated message.") . " " . gettext("If you haven't been informed about this membership in advance, please contact the sender of this message.") . "\n\n" . str_replace("%GROUP", "<a href=\"" . $backlink . "\">" . $group_name . "</a>", gettext("See '%GROUP' for further information.")); lms_steam::mail($new_member, $user, PLATFORM_NAME . ": " . str_replace("%GROUP", h($group_name), gettext("You were added to '%GROUP' as a new member")), $message); $cache = get_cache_function($new_member->get_name(), 60); $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), TRUE); $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), FALSE); $cache->drop("lms_steam::user_get_groups", $new_member->get_name()); } else { $problems[] = h($new_member->get_full_name()); } } $portal->set_confirmation(str_replace('%NAME', implode(', ', $confirmations), gettext('%NAME successfully added to group.'))); if (count($problems) > 0) { $portal->set_problem_description('%NAME', implode(', ', $problems), gettext('%NAME could not be added to group.')); } } $content = new HTML_TEMPLATE_IT(); if ($group->get_maxsize() > 0 && $group->get_maxsize() <= $group->count_members()) {
public function frameResponse(\FrameResponseObject $frameResponseObject) { $path = $this->params; $portal = \lms_portal::get_instance(); $user = \lms_steam::get_current_user(); $group_id = $path[1]; $content = \Semester::getInstance()->loadTemplate("search_persons.template.html"); if (!($steam_group = \steam_factory::get_object($GLOBALS['STEAM']->get_id(), $group_id))) { throw new \Exception('Group not found: ' . $group_id); } if (!$steam_group instanceof \steam_group) { throw new \Exception('Is not a group: ' . $group_id); } // always try to use the correct specialized group: if (!isset($group)) { $group = \koala_object::get_koala_object($steam_group); } else { if ($group instanceof \koala_object) { $group = \koala_object::get_koala_object($group->get_steam_object()); } else { throw new \Exception("No 'group' param provided"); } } // TODO: Passt der Link? $backlink = $group->get_url(); if (!$group->is_admin($user)) { throw new \Exception("No admin of " . $group->get_groupname() . ": " . $user->get_name()); } if (!empty($_REQUEST["add"]) && count($_REQUEST["add"]) > 0) { $login = key($_REQUEST["add"]); $new_member = \steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $login); if ($group instanceof \koala_group_tutorial) { if ($group->get_course_group()->get_attribute("EXCLUSIVE_TUTORIAL_MEMBERSHIP") === "TRUE") { $course_learners_group = $group->steam_group_course_learners; $subgroups = $course_learners_group->get_subgroups(); foreach ($subgroups as $sg) { if (($sg->get_attribute("OBJ_TYPE") === "course_tutorial" || $sg->get_attribute("OBJ_TYPE") === "group_tutorial_koala") && $sg->is_member($new_member) && $sg != $steam_group) { $already_member_and_exclusive = true; $in_group = $sg; } } } } if (isset($already_member_and_exclusive) && $already_member_and_exclusive) { if (!isset($_POST['confirmed']) || $_POST['confirmed'] != "true") { $content->setVariable("WARNING_TEXT", "<p/>" . gettext("Attention! The user you want to add already became member in another tutorial in the meantime.")); } if (isset($_POST['confirmed']) && $_POST['confirmed'] === "true") { if ($group->add_member($new_member)) { // PROCEDURE FOR COURSE ADMINS if ($group->get_attribute("OBJ_TYPE") === "course_staff") { // TODO: fct to add an admin? set_sanction_all does not seem to work... :( $steam_group->set_sanction_all($new_member); } if ($group->get_attribute("OBJ_TYPE") == "course_tutorial" || $group->get_attribute("OBJ_TYPE") == "group_tutorial_koala") { $no_of_learners = (int) $group->get_attribute("GROUP_NO_MEMBERS"); $group->set_attribute("GROUP_NO_MEMBERS", $no_of_learners + count($_REQUEST["add"])); } $group_name = \koala_object::get_koala_object($group)->get_display_name(); $message = str_replace("%NAME", $new_member->get_full_name(), gettext("Dear %NAME,")) . "\n\n"; $message .= str_replace("%GROUP", $group_name, gettext("You were added to '%GROUP' as a new member.")) . "\n\n"; $message .= gettext("This is an automatically generated message.") . " " . gettext("If you haven't been informed about this membership in advance, please contact the sender of this message.") . "\n\n" . str_replace("%GROUP", "<a href=\"" . $backlink . "\">" . $group_name . "</a>", gettext("See '%GROUP' for further information.")); \lms_steam::mail($new_member, $user, PLATFORM_NAME . ": " . str_replace("%GROUP", h($group_name), gettext("You were added to '%GROUP' as a new member")), $message); $cache = get_cache_function($new_member->get_name()); $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), TRUE); $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), FALSE); $cache->drop("lms_steam::user_get_groups", $new_member->get_name()); $cache->drop("lms_steam::user_get_profile", $new_member->get_name()); $cache->drop("lms_portal::get_menu_html", $new_member->get_name(), TRUE); $cache = get_cache_function($group->get_id()); $cache->drop("lms_steam::group_get_members", $group->get_id()); $portal->set_confirmation(str_replace("%NAME", $new_member->get_full_name(), gettext("%NAME successfully added to group."))); } } } else { if ($group->add_member($new_member)) { // PROCEDURE FOR COURSE ADMINS if ($group->get_attribute("OBJ_TYPE") === "course_staff") { // TODO: fct to add an admin? set_sanction_all does not seem to work... :( $steam_group->set_sanction_all($new_member); } if ($group->get_attribute("OBJ_TYPE") == "course_tutorial" || $group->get_attribute("OBJ_TYPE") == "group_tutorial_koala") { $no_of_learners = (int) $group->get_attribute("GROUP_NO_MEMBERS"); $group->set_attribute("GROUP_NO_MEMBERS", $no_of_learners + count($_REQUEST["add"])); } $group_name = \koala_object::get_koala_object($group)->get_display_name(); $message = str_replace("%NAME", $new_member->get_full_name(), gettext("Dear %NAME,")) . "\n\n"; $message .= str_replace("%GROUP", $group_name, gettext("You were added to '%GROUP' as a new member.")) . "\n\n"; $message .= gettext("This is an automatically generated message.") . " " . gettext("If you haven't been informed about this membership in advance, please contact the sender of this message.") . "\n\n" . str_replace("%GROUP", "<a href=\"" . $backlink . "\">" . $group_name . "</a>", gettext("See '%GROUP' for further information.")); \lms_steam::mail($new_member, $user, PLATFORM_NAME . ": " . str_replace("%GROUP", h($group_name), gettext("You were added to '%GROUP' as a new member")), $message); $cache = get_cache_function($new_member->get_name()); $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), TRUE); $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), FALSE); $cache->drop("lms_steam::user_get_groups", $new_member->get_name()); $cache->drop("lms_steam::user_get_profile", $new_member->get_name()); $cache->drop("lms_portal::get_menu_html", $new_member->get_name(), TRUE); $cache = get_cache_function($group->get_id()); $cache->drop("lms_steam::group_get_members", $group->get_id()); $portal->set_confirmation(str_replace("%NAME", $new_member->get_full_name(), gettext("%NAME successfully added to group."))); } } } if ($group->get_maxsize() > 0 && $group->get_maxsize() <= $group->count_members()) { $html_content = "<div class=\"infoBar\">" . gettext("The group is full! You can not add any further members, because the maximum size of the group has been reached. Please increase this value to add more members.") . "</div>"; } else { $content->setVariable("HEAD_SEARCH", gettext("Search")); $content->setVariable("INFO_TEXT", gettext("Here you can lookup some people.") . " " . str_replace("%GROUP", $group->get_display_name(), gettext("You can add a search result as member to '<b>%GROUP</b>'."))); if (!empty($_REQUEST["pattern"])) { $content->setVariable("VALUE_PATTERN", $_REQUEST["pattern"]); } $content->setVariable("LABEL_CHECK_NAME", gettext("Name")); $content->setVariable("LABEL_CHECK_LOGIN", gettext("Email address or login")); $content->setVariable("LABEL_SEARCH", gettext("Search")); $content->setVariable("GROUP_ID", $group->get_id()); $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>"); // SEARCH RESULTS if (!empty($_REQUEST["pattern"])) { $cache = get_cache_function($user->get_name(), 60); $result = $cache->call("lms_steam::search_user", $_REQUEST["pattern"], $_REQUEST["lookin"]); if ($_REQUEST["lookin"] == "name") { $content->setVariable("CHECKED_NAME", 'checked="checked"'); } else { $content->setVariable("CHECKED_LOGIN", 'checked="checked"'); } // PROCEED RESULT SET $html_people = \Semester::getInstance()->loadTemplate("list_users.template.html"); $no_people = count($result); if ($no_people > 0) { if (isset($_REQUEST["backlink"])) { $tmp_backlink = $_REQUEST["backlink"]; } else { if (isset($backlink)) { $tmp_backlink = $backlink; } } //$start = $portal->set_paginator( 10, $no_people, "(" . gettext( "%TOTAL people in result set" ) . ")", "?pattern=" . $_REQUEST[ "pattern" ] . "&lookin=" . $_REQUEST[ "lookin" ] . "&group=" . $_REQUEST["group"] . "&backlink=" . $tmp_backlink ); $paginator = \lms_portal::get_paginator(10, $no_people, "(" . gettext("%TOTAL people in result set") . ")", "?pattern=" . $_REQUEST["pattern"] . "&lookin=" . $_REQUEST["lookin"] . "&group=" . $_REQUEST["group"] . "&backlink=" . $tmp_backlink); $start = $paginator["startIndex"]; $end = $start + 10 > $no_people ? $no_people : $start + 10; $html_people->setVariable("PAGINATOR", $paginator["html"]); $html_people->setVariable("LABEL_CONTACTS", gettext("Results") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_people), gettext("%a-%z out of %s")) . ")"); $html_people->setCurrentBlock("BLOCK_CONTACT_LIST"); $html_people->setVariable("LABEL_NAME_POSITION", gettext("Name, position")); $html_people->setVariable("LABEL_SUBJECT_AREA", gettext("Subject area")); $html_people->setVariable("LABEL_COMMUNICATION", gettext("Communication")); $html_people->setVariable("TH_MANAGE_CONTACT", gettext("Action")); for ($i = $start; $i < $end; $i++) { $person = $result[$i]; $html_people->setCurrentBlock("BLOCK_CONTACT"); // TODO: Passt der Link? $html_people->setVariable("CONTACT_LINK", PATH_URL . "user/" . $person["OBJ_NAME"] . "/"); // TODO: Passt der Link? $icon_link = PATH_URL . "download/" . $person["OBJ_ICON"] . "/usericon/30/40"; $html_people->setVariable("CONTACT_IMAGE", $icon_link); $html_people->setVariable("CONTACT_NAME", h($person["USER_FIRSTNAME"]) . " " . h($person["USER_FULLNAME"])); $html_people->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?to=" . $person["OBJ_NAME"]); $html_people->setVariable("LABEL_MESSAGE", gettext("Message")); $html_people->setVariable("LABEL_SEND", gettext("Send")); $html_people->setVariable("OBJ_DESC", h($person["OBJ_DESC"])); $p = new \steam_object($GLOBALS["STEAM"]->get_id(), $person["OBJ_ID"]); //if the group is a tutorial and the course has exclusive subgroups for tutorials set, we have to //see if our person is already member in one of the other tutorials. $already_member_and_exclusive = false; if ($group instanceof \koala_group_tutorial) { if ($group->get_course_group()->get_attribute("EXCLUSIVE_TUTORIAL_MEMBERSHIP") === "TRUE") { $course_learners_group = $steam_group->get_parent_group(); $subgroups = $course_learners_group->get_subgroups(); foreach ($subgroups as $sg) { if (($sg->get_attribute("OBJ_TYPE") === "course_tutorial" || $sg->get_attribute("OBJ_TYPE") === "group_tutorial_koala") && $sg->is_member($p) && $sg != $steam_group) { $already_member_and_exclusive = true; $in_group = $sg; } } } } if (!$group->is_member($p)) { if ($already_member_and_exclusive) { $html_people->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><small><b>" . gettext("Attention: User already in tutorial") . " " . $in_group->get_name() . "<p /></b></small><input type=\"hidden\" name=\"confirmed\" value=\"true\"/><input type=\"submit\" name=\"add[" . h($person["OBJ_NAME"]) . "]\" value=\"" . gettext("Add anyhow") . "\"/></td>"); } else { $html_people->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><input type=\"submit\" name=\"add[" . h($person["OBJ_NAME"]) . "]\" value=\"" . gettext("Add") . "\"/></td>"); } } else { $html_people->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\">" . gettext("Already a member.") . "</td>"); } $html_people->parse("BLOCK_CONTACT"); } $html_people->parse("BLOCK_CONTACT_LIST"); } else { $html_people->setVariable("LABEL_CONTACTS", gettext("No results.")); } $content->setVariable("HTML_USER_LIST", $html_people->get()); } else { $content->setVariable("CHECKED_NAME", 'checked="checked"'); } } /* $portal->set_page_title( gettext( "Add member" ) ); // give input focus to search field: $portal->add_javascript_onload("group_add_member", "document.getElementById('pattern').focus();"); if(!isset($html_content)) { $portal->set_page_main( array( $group->get_link(), array( "name" => gettext( "Add member" ) ) ), $content->get(), "" ); } else { $portal->set_page_main( array( $group->get_link(), array( "name" => gettext( "Add member" ) ) ), $html_content, "" ); } $portal->show_html(); */ $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($content->get()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; }
$ctc[] = $user; $acontact->set_attribute("USER_CONTACTS_TOCONFIRM", $ctc); } $admin_steam->disconnect(); // contacts to confirm of user $new_tc = array(); foreach ($toconfirm as $tc) { if (!is_object($tc) || $tc->get_id() == $contact->get_id()) { $continue; } $new_tc[] = $tc; } $user->set_attribute("USER_CONTACTS_TOCONFIRM", $new_tc); // WRITE MAIL TO CONTACT $message = str_replace("%NAME", $contact_attributes["USER_FIRSTNAME"] . " " . $contact_attributes["USER_FULLNAME"], gettext("Dear %NAME")) . ",\n\n" . str_replace("%NAME", $user_attributes["USER_FIRSTNAME"] . " " . $user_attributes["USER_FULLNAME"], gettext("%NAME would like to add you as contact.")) . "\n\n" . gettext("Here is the memo:") . "\n\n" . $_POST["message"] . "\n\n" . "<a href=\"" . PATH_URL . "contact_confirm.php?id=" . $user->get_id() . "\">" . gettext("Confirm this contact.") . "</a>"; lms_steam::mail($contact, $user, PLATFORM_NAME . ": " . str_replace("%NAME", $user_attributes["USER_FIRSTNAME"] . " " . $user_attributes["USER_FULLNAME"], gettext("Confirmation Request from %NAME")), $message); require_once 'Cache/Lite.php'; $cache = new Cache_Lite(array("cacheDir" => PATH_CACHE)); $cache = get_cache_function($user->get_name()); $cache->clean($user->get_name()); $cache->clean($user->get_id()); $cache = get_cache_function($contact->get_name()); $cache->clean($contact->get_name()); $cache->clean($contact->get_id()); header("Location: " . $_POST["backlink"]); exit; } else { $portal->set_problem_description(gettext("Your message is too short."), gettext("Please write one sentence why you would like to add them as contact.")); } } $content = new HTML_TEMPLATE_IT();
public function frameResponse(\FrameResponseObject $frameResponseObject) { $path = $this->params; $user = \lms_steam::get_current_user(); $public = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_PUBLIC_GROUP, CLASS_GROUP); $id = $path[0]; $portal = \lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); $portal_user = $portal->get_user(); try { $steam_group = !empty($id) ? \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id) : FALSE; } catch (\Exception $ex) { include "bad_link.php"; exit; } $group_is_private = FALSE; if ($steam_group && is_object($steam_group)) { switch ((string) $steam_group->get_attribute("OBJ_TYPE")) { case "course": $group = new \koala_group_course($steam_group); // TODO: Passt der backlink? $backlink = PATH_URL . SEMESTER_URL . "/" . $group->get_semester()->get_name() . "/" . h($group->get_name()) . "/"; break; default: $group = new \koala_group_default($steam_group); // TODO: Passt der backlink? $backlink = PATH_URL . "groups/" . $group->get_id() . "/"; // Determine if group is public or private $parent = $group->get_parent_group(); if ($parent->get_id() == STEAM_PRIVATE_GROUP) { $group_is_private = TRUE; } break; } } if ($group_is_private) { if (!$steam_group->is_member($user) && !\lms_steam::is_koala_admin($user)) { throw new \Exception(gettext("You have no rights to access this group"), E_USER_RIGHTS); } } $content = \Group::getInstance()->loadTemplate("membership_requests.template.html"); $content->setVariable("INFO_TEXT", gettext("The people listed are interested in becoming a member of your group.") . " " . gettext("Here, you can choose wether to affirm their membership or cancel the request.") . " " . gettext("In both cases, the user concerned will automatically get informed by mail about your decision.")); // always try to use the correct specialized group: if ($group instanceof \koala_object) { $group = \koala_object::get_koala_object($group->get_steam_object()); } else { if ($group instanceof \steam_object) { $group = \koala_object::get_koala_object($group); } else { throw new \Exception("No 'group' param provided"); } } $type = $group->get_attribute("OBJ_TYPE"); switch ($type) { case "group_tutorial_koala": // TODO: Passt der backlink? $backlink = $backlink . "tutorials/" . $group->get_id() . "/"; break; case "course_tutorial": // TODO: Passt der backlink? $backlink = $backlink . "tutorials/" . $group->get_id() . "/"; break; default: // TODO: Passt der backlink? $backlink = $backlink . "members/"; } if (!$group->is_admin($user)) { // throw new Exception( $user->get_name() . " is no admin of " . $group->get_name() ); header("Location: " . PATH_URL . "error.php?error=" . E_USER_RIGHTS); } if ($_SERVER["REQUEST_METHOD"] == "POST") { if (isset($_POST['affirm']) && is_array($_POST['affirm'])) { $candidate = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), key($_POST["affirm"])); if ($group instanceof \koala_group_tutorial) { if ($group->get_course_group()->get_attribute("EXCLUSIVE_TUTORIAL_MEMBERSHIP") === "TRUE") { $course_learners_group = $group->steam_group_course_learners; $subgroups = $course_learners_group->get_subgroups(); foreach ($subgroups as $sg) { if (($sg->get_attribute("OBJ_TYPE") === "course_tutorial" || $sg->get_attribute("OBJ_TYPE") === "group_tutorial_koala") && $sg->is_member($candidate) && $sg != $steam_group) { $already_member_and_exclusive = true; $in_group = $sg; } } } } if ($already_member_and_exclusive) { if (!isset($_POST['confirmed']) || $_POST['confirmed'] != "true") { $content->setCurrentBlock("BLOCK_WARNING"); $content->setVariable("WARNING_TEXT", gettext("Attention! The user whose membership you wish to affirm already became member in another tutorial in the meantime.")); $content->parse("BLOCK_WARNING"); } if (isset($_POST['confirmed']) && $_POST['confirmed'] === "true") { $group->add_member($candidate); $group->remove_membership_request($candidate); $subject = str_replace("%GROUP", $group->get_name(), gettext("Welcome to '%GROUP'")); $message = gettext("Your membership was affirmed."); $portal->set_confirmation(str_replace("%NAME", $candidate->get_attribute("USER_FIRSTNAME") . " " . $candidate->get_attribute("USER_FULLNAME"), gettext("Membership of %NAME affirmed."))); // uncache group members page: $cache = get_cache_function($group->get_id(), CACHE_LIFETIME_STATIC); $cache->drop("lms_steam::group_get_members", $group->get_id()); // uncache menu so that course/group appears: $cache = get_cache_function($candidate->get_name()); $cache->drop("lms_steam::user_get_profile", $candidate->get_name()); $cache->drop("lms_portal::get_menu_html", $candidate->get_name(), TRUE); } } else { $group->add_member($candidate); $group->remove_membership_request($candidate); $subject = str_replace("%GROUP", $group->get_name(), gettext("Welcome to '%GROUP'")); $message = gettext("Your membership was affirmed."); $portal->set_confirmation(str_replace("%NAME", $candidate->get_attribute("USER_FIRSTNAME") . " " . $candidate->get_attribute("USER_FULLNAME"), gettext("Membership of %NAME affirmed."))); // uncache group members page: $cache = get_cache_function($group->get_id(), CACHE_LIFETIME_STATIC); $cache->drop("lms_steam::group_get_members", $group->get_id()); // uncache menu so that course/group appears: $cache = get_cache_function($candidate->get_name()); $cache->drop("lms_steam::user_get_profile", $candidate->get_name()); $cache->drop("lms_portal::get_menu_html", $candidate->get_name(), TRUE); } } elseif (isset($_POST['cancel']) && is_array($_POST['cancel'])) { $candidate = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), key($_POST["cancel"])); $group->remove_membership_request($candidate); $subject = str_replace("%GROUP", $group->get_name(), gettext("Your membership for '%GROUP' was rejected")); $message = gettext("Your membership was rejected."); $portal->set_confirmation(str_replace("%NAME", $candidate->get_attribute("USER_FIRSTNAME") . " " . $candidate->get_attribute("USER_FULLNAME"), gettext("Membership of %NAME rejected."))); } //$candidate->mail( $subject, $message, $user->get_attribute( "USER_EMAIL" )); \lms_steam::mail($candidate, $user, $subject, $message); } $result = $group->get_membership_requests(); $html_people = \Group::getInstance()->loadTemplate("list_users.template.html"); $no_people = count($result); if ($no_people > 0) { $paginator = \lms_portal::get_paginator(10, $no_people, "(" . gettext("%TOTAL membership requests") . ")"); $start = $paginator["startIndex"]; //$start = $portal->set_paginator( 10, $no_people, "(" . gettext( "%TOTAL membership requests" ). ")" ); $end = $start + 10 > $no_people ? $no_people : $start + 10; $content->setVariable("PAGINATOR", $paginator["html"]); $html_people->setVariable("LABEL_CONTACTS", gettext("Membership requests") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_people), gettext("%a-%z out of %s")) . ")"); $html_people->setCurrentBlock("BLOCK_CONTACT_LIST"); $html_people->setVariable("LABEL_NAME_POSITION", gettext("Name, position")); $html_people->setVariable("LABEL_SUBJECT_AREA", gettext("Subject area")); $html_people->setVariable("LABEL_COMMUNICATION", gettext("Communication")); $html_people->setVariable("TH_MANAGE_CONTACT", gettext("Action")); foreach ($result as $candidate) { $person = $candidate->get_attributes(array("USER_FIRSTNAME", "USER_FULLNAME", "OBJ_ICON", "OBJ_NAME", "OBJ_DESC")); $html_people->setCurrentBlock("BLOCK_CONTACT"); $html_people->setVariable("CONTACT_LINK", PATH_URL . "user/" . h($person["OBJ_NAME"]) . "/"); if (is_object($person["OBJ_ICON"])) { // TODO: Passt der link? $icon_link = PATH_URL . "cached/get_document.php?id=" . $person["OBJ_ICON"]->get_id() . "&type=usericon"; } else { // TODO: Passt der link? $icon_link = PATH_STYLE . "images/anonymous.jpg"; } $html_people->setVariable("CONTACT_IMAGE", $icon_link); $html_people->setVariable("CONTACT_NAME", h($person["USER_FIRSTNAME"]) . " " . h($person["USER_FULLNAME"])); $html_people->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?to=" . h($person["OBJ_NAME"])); $html_people->setVariable("LABEL_MESSAGE", gettext("Message")); $html_people->setVariable("LABEL_SEND", gettext("Send")); //if the group is a tutorial and the course has exclusive subgroups for tutorials set, we have to //see if our candidate is already member in one of the other tutorials. $already_member_and_exclusive = false; if ($group instanceof \koala_group_tutorial) { if ($group->get_course_group()->get_attribute("EXCLUSIVE_TUTORIAL_MEMBERSHIP") === "TRUE") { $course_learners_group = $group->steam_group_course_learners; $subgroups = $course_learners_group->get_subgroups(); foreach ($subgroups as $sg) { if (($sg->get_attribute("OBJ_TYPE") === "course_tutorial" || $sg->get_attribute("OBJ_TYPE") === "group_tutorial_koala") && $sg->is_member($candidate) && $sg != $steam_group) { $already_member_and_exclusive = true; $in_group = $sg; } } } } if ($already_member_and_exclusive) { $html_people->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><small><b>" . gettext("Attention: User already in tutorial") . " " . $in_group->get_name() . "<p /></b></small><input type=\"hidden\" name=\"confirmed\" value=\"true\"/><input type=\"submit\" name=\"affirm[" . $candidate->get_id() . "]\" value=\"" . gettext("Affirm anyhow") . "\"> " . gettext("or") . " <input type=\"submit\" name=\"cancel[" . $candidate->get_id() . "]\" value=\"" . gettext("Decline") . "\"/></td>"); } else { $html_people->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><input type=\"submit\" name=\"affirm[" . $candidate->get_id() . "]\" value=\"" . gettext("Affirm") . "\"> " . gettext("or") . " <input type=\"submit\" name=\"cancel[" . $candidate->get_id() . "]\" value=\"" . gettext("Decline") . "\"/></td>"); } $html_people->setVariable("OBJ_DESC", h($person["OBJ_DESC"])); $html_people->parse("BLOCK_CONTACT"); } $html_people->parse("BLOCK_CONTACT_LIST"); $content->setVariable("HTML_USER_LIST", $html_people->get()); } else { $content->setVariable("LABEL_NO_REQUESTS", "<h3>" . gettext("No membership request found.") . "</h3>"); } $frameResponseObject->setTitle("Group"); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($content->get()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; }
$footer = "<br /><br />--- <br />" . gettext("This E-Mail was sent to %GROUP in koaLA."); $footer = str_replace("%GROUP", $lms_grp->get_display_name(), $footer); $subject = gettext("Circular") . ": " . $subject; } $body = $values["body"]; // Prevent the usage of HTML-Code in Mail body and subject as this is a possible // security issue when mails are shown in a browser $body = str_replace('<', '<', $body); $body = str_replace('>', '>', $body); $subject = str_replace('<', '<', $subject); $subject = str_replace('>', '>', $subject); if (isset($footer)) { $body .= $footer; } // Finally, we are sending the mail and set success to true lms_steam::mail($receiver, $user, $subject, $body); $success = true; } else { if (!$error) { $portal->set_problem_description(gettext("Please enter a subject for your message.")); } $error = true; } } } if ($success) { // If we have sent an email, we can send the user to where he came from and inform him about this $_SESSION["confirmation"] = str_replace("%NAME", $receiver->get_name(), gettext("Mail has been sent")); header("Location: " . $values["backlink"]); } else { if (!$error) {
} if ($group instanceof koala_group_default && !$group->is_member($user)) { //throw new Exception( $user->get_name() . " is not a member of " . $group->get_groupname() ); header("Location: " . $values["return_to"]); exit; } $values = $_POST["values"]; if (defined("LOG_DEBUGLOG")) { logging::write_log(LOG_DEBUGLOG, "group_cancel\t" . $user->get_name() . " leaves " . $steam_group->get_identifier()); } logging::start_timer("leave_group"); if ($group->remove_member($user)) { $group_name = $group->get_display_name(); $short_confirmation = str_replace("%GROUP", $group_name, gettext("Your membership in the group '%GROUP' has been terminated.")); $confirmation = str_replace("%NAME", $user->get_full_name(), gettext("Dear %NAME,")) . "\n\n" . $short_confirmation . "\n\n" . gettext("Your koaLA Team"); lms_steam::mail($user, "\"" . PLATFORM_NAME . " System\"<no_reply@" . STEAM_SERVER . ">", PLATFORM_NAME . ": " . str_replace("%GROUP", $group_name, gettext("Your membership in the group '%GROUP' has been terminated")), $confirmation); $cache = get_cache_function($user->get_name()); $cache->drop("lms_steam::user_get_groups", $user->get_name(), TRUE); $cache->drop("lms_steam::user_get_groups", $user->get_name(), FALSE); $cache->drop("lms_steam::user_get_profile", $user->get_name()); $cache->drop("lms_portal::get_menu_html", $user->get_name(), TRUE); $cache = get_cache_function($group->get_id()); $cache->drop("lms_steam::group_get_members", $group->get_id()); $_SESSION["confirmation"] = $short_confirmation; if (defined("LOG_DEBUGLOG")) { logging::append_log(LOG_DEBUGLOG, " runtime=" . logging::print_timer("leave_group")); } header("Location: " . $values["return_to"]); exit; } else { throw new Exception("Cannot delete membership.");
$hide_user = true; //add the instructors/tutors if (strlen($values["tutors_obj_name"]) > 0) { $paul_tutors_obj_name = explode("+", $values["tutors_obj_name"]); foreach ($paul_tutors_obj_name as $paul_tutor_obj_name) { $paul_tutor = steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $paul_tutor_obj_name); if ($paul_tutor->get_id() === $user->get_id()) { $hide_user = false; } $staff->add_member($paul_tutor); // Falls konfiguriert, automatische E-Mail-Benachrichtigung der Instructors if (defined("PAUL_INSTRUCTOR_NOTIFICATION") && PAUL_INSTRUCTOR_NOTIFICATION === TRUE) { $message = str_replace("%NAME", $paul_tutor->get_attribute("USER_FIRSTNAME") . " " . $paul_tutor->get_attribute("USER_FULLNAME"), gettext("Hallo %NAME,")) . "\n\n"; $message .= str_replace("%GROUP", $course = $values["name"], gettext("You have been automatically added to the staff of course '%GROUP' because of your membership in that course in the PAUL system.")) . "\n\n"; $message .= gettext("This is an automatically generated email."); lms_steam::mail($paul_tutor, lms_steam::get_current_user(), PLATFORM_NAME . ": " . str_replace("%GROUP", $course = $values["name"], gettext("You have been added to the staff of course '%GROUP'.")), $message); } } } if ($hide_user) { $new_course->set_attribute("COURSE_HIDDEN_STAFF", array($user->get_id())); } // uncomment below if koala can handle admins vs tutors //$admins->add_member( $user ); // RIGHTS MANAGEMENT ======================================= $course_calendar = $new_course->get_calendar(); $learners_workroom = $learners->get_workroom(); $course_workroom = $new_course->get_workroom(); $staff->set_sanction_all($staff); $staff->sanction_meta(SANCTION_ALL, $staff); $learners->set_sanction_all($staff);
public function frameResponse(\FrameResponseObject $frameResponseObject) { $group_id = $this->params[0]; $portal = \lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); $user = \lms_steam::get_current_user(); //TODO: Was soll dieses $em hier?? //$em = \lms_steam::get_extensionmanager(); if (!($steam_group = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $group_id))) { include "bad_link.php"; exit; } if (!$steam_group instanceof \steam_group) { throw new \Exception("Is not a group: " . $_GET["id"]); } $group = \koala_object::get_koala_object($steam_group); if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($group instanceof \koala_group_course && !($group->is_staff($user) || $group->is_learner($user))) { //throw new \Exception( $user->get_name() . " is not a member of " . $group->get_groupname() ); header("Location: " . $values["return_to"]); exit; } if ($group instanceof \koala_group_default && !$group->is_member($user)) { //throw new \Exception( $user->get_name() . " is not a member of " . $group->get_groupname() ); header("Location: " . $values["return_to"]); exit; } $values = $_POST["values"]; if (defined("LOG_DEBUGLOG")) { \logging::write_log(LOG_DEBUGLOG, "group_cancel\t" . $user->get_name() . " leaves " . $steam_group->get_identifier()); } \logging::start_timer("leave_group"); if ($group->remove_member($user)) { $group_name = $group->get_display_name(); $short_confirmation = str_replace("%GROUP", $group_name, gettext("Your membership in the group '%GROUP' has been terminated.")); $confirmation = str_replace("%NAME", $user->get_full_name(), gettext("Dear %NAME,")) . "\n\n" . $short_confirmation . "\n\n" . gettext("Your koaLA Team"); \lms_steam::mail($user, "\"" . PLATFORM_NAME . " System\"<no_reply@" . STEAM_SERVER . ">", PLATFORM_NAME . ": " . str_replace("%GROUP", $group_name, gettext("Your membership in the group '%GROUP' has been terminated")), $confirmation); $cache = get_cache_function($user->get_name()); $cache->drop("lms_steam::user_get_groups", $user->get_name(), TRUE); $cache->drop("lms_steam::user_get_groups", $user->get_name(), FALSE); $cache->drop("lms_steam::user_get_profile", $user->get_name()); $cache->drop("lms_portal::get_menu_html", $user->get_name(), TRUE); $cache = get_cache_function($group->get_id()); $cache->drop("lms_steam::group_get_members", $group->get_id()); $_SESSION["confirmation"] = $short_confirmation; if (defined("LOG_DEBUGLOG")) { \logging::append_log(LOG_DEBUGLOG, " runtime=" . \logging::print_timer("leave_group")); } header("Location: " . $values["return_to"]); exit; } else { throw new \Exception("Cannot delete membership."); } if (defined("LOG_DEBUGLOG")) { \logging::append_log(LOG_DEBUGLOG, "failed. runtime=" . \logging::print_timer("leave_group")); } } $content = \Group::getInstance()->loadTemplate("groups_cancel_membership.template.html"); $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]); $content->setVariable("LABEL_RETURN", gettext("back")); if ($group instanceof \koala_group_course && !($group->is_staff($user) || $group->is_learner($user))) { if (empty($_SESSION['confirmation'])) { // don't warn if we came here on successful membership cancel... if ($group instanceof \koala_group_course) { $portal->set_problem_description(gettext("You are not member of this course.")); } else { $portal->set_problem_description(gettext("You are not member of this group.")); } } } else { if ($group instanceof \koala_group_default && !$group->is_member($user)) { if (empty($_SESSION['confirmation'])) { // don't warn if we came here on successful membership cancel... if ($group instanceof \koala_group_course) { $portal->set_problem_description(gettext("You are not member of this course.")); } else { $portal->set_problem_description(gettext("You are not member of this group.")); } } } else { $redirect = $_SERVER["HTTP_REFERER"]; if ($group instanceof \koala_group_default && !$group->is_public()) { $redirect = PATH_URL . "user/" . \lms_steam::get_current_user()->get_name() . "/groups/"; } $content->setVariable("DELETE_BACK_LINK", $redirect); $content->setVariable("FORM_ACTION", PATH_URL . "group/cancelGroup/\t" . $group_id); $content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure?")); $content->setVariable("INFO_CANCEL_MEMBERSHIP", str_replace("%NAME", $group->get_display_name(), gettext("You are going to cancel your membership in <b>'%NAME'</b>."))); $content->setVariable("BUTTON_SUBMIT", "<input type=\"submit\" name=\"values[delete]\" value=\"" . gettext("Yes, cancel my membership") . "\"/>"); } } /* $portal->set_page_main( "", $content->get(), "" ); $portal->show_html(); */ $frameResponseObject->setTitle("Group"); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($content->get()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; }
//throw new Exception( "User is in buddy list yet." ); $is_buddy = TRUE; } } if (!$is_buddy) { $buddies[] = $contact; $user->set_attribute("USER_FAVOURITES", $buddies); } $contact->contact_confirm(); logging::write_log(LOG_MESSAGES, "CONFIRMED\t" . $user->get_name() . "\t" . $contact->get_name()); $message = str_replace("%NAME", $user_attributes["USER_FIRSTNAME"] . " " . $user_attributes["USER_FULLNAME"], gettext("%NAME has confirmed you as a contact.")); $message .= " " . gettext("You can visit her/his profile here:"); $message .= " <a href=\"" . PATH_URL . "user/" . $user->get_name() . "/\">"; $message .= str_replace("%NAME", $user_attributes["USER_FIRSTNAME"] . " " . $user_attributes["USER_FULLNAME"], gettext("%NAME's profile")) . "</a>"; //$contact->mail( "LLMS: " . str_replace( "%NAME", $user_attributes[ "USER_FIRSTNAME" ] . " " . $user_attributes[ "USER_FULLNAME" ], gettext( "%NAME has confirmed your contact" ) ), $message, $user_attributes[ "USER_EMAIL" ] ); lms_steam::mail($contact, $user, PLATFORM_NAME . ": " . str_replace("%NAME", $user_attributes["USER_FIRSTNAME"] . " " . $user_attributes["USER_FULLNAME"], gettext("%NAME has confirmed your contact")), $message); // require_once( "Cache/Lite.php" ); // $cache = new Cache_Lite( array( "cacheDir" => PATH_CACHE ) ); $cache = get_cache_function($user->get_name()); $cache->clean($user->get_name()); $cache->clean($user->get_id()); $cache = get_cache_function($contact->get_name()); $cache->clean($contact->get_name()); $cache->clean($contact->get_id()); $_SESSION["confirmation"] = str_replace("%NAME", $contact->get_name(), gettext("Confirmed contact request from %NAME")); } else { if (isset($_POST["deny"])) { $_SESSION["confirmation"] = str_replace("%NAME", $contact->get_name(), gettext("Denied contact request from %NAME")); } } // remove contact from the "to confirm" list