public function frameResponse(\FrameResponseObject $frameResponseObject) { $user = $GLOBALS["STEAM"]->get_current_steam_user(); $pyramidRoom = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $pyramiddiscussionExtension = \Pyramiddiscussion::getInstance(); $pyramiddiscussionExtension->addCSS(); // mail form got submitted if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["send_mail"])) { $basegroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_BASEGROUP"); $admingroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINGROUP"); if ($admingroup->is_member($user)) { $title = "Rundmail zur Pyramidendiskussion: " . $pyramidRoom->get_name(); $content = nl2br($_POST["content"]); if ($basegroup->get_id() != $admingroup->get_id()) { $basegroup->mail($title, $content); $admingroup->mail($title, $content); } else { $basegroup->mail($title, $content); } $frameResponseObject->setConfirmText("Rundmail erfolgreich gesendet."); } } $content = $pyramiddiscussionExtension->loadTemplate("pyramiddiscussion_mail.template.html"); $content->setCurrentBlock("BLOCK_PYRAMID_MAIL"); $content->setVariable("PYRAMID_MAIL", "Rundmail erstellen"); $content->setVariable("CONTENT_LABEL", "Inhalt:"); $content->setVariable("SEND_MAIL", "Rundmail senden"); $content->setVariable("BACK_LABEL", "Zurück"); $content->setVariable("BACK_URL", $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id); $content->parse("BLOCK_PYRAMID_MAIL"); $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->addWidget($rawWidget); $frameResponseObject->setHeadline(array(array("name" => "Pyramidendiskussion", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id), array("name" => "Rundmail erstellen"))); return $frameResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $user = $GLOBALS["STEAM"]->get_current_steam_user(); $userID = $user->get_id(); $pyramidRoom = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $pyramiddiscussionExtension = \Pyramiddiscussion::getInstance(); $pyramiddiscussionExtension->addCSS(); $pyramiddiscussionExtension->addJS(); $content = $pyramiddiscussionExtension->loadTemplate("pyramiddiscussion_index.template.html"); $admingroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINGROUP"); $basegroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_BASEGROUP"); $startElements = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAX"); $maxcol = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAXCOL"); $deadlines = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_DEADLINES"); $user_management = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT"); $deadlines_used = false; $currentUserGroup = 0; $objtype = $pyramidRoom->get_attribute("OBJ_TYPE"); if (!strStartsWith($objtype, "container_pyramiddiscussion")) { $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml("Objekt " . $this->id . " ist keine Pyramidendiskussion."); $frameResponseObject->addWidget($rawWidget); return $frameResponseObject; } // if one or more deadlines past by since the last visit on this page, change the phase $phase = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ACTCOL"); if ($phase != 0 && $phase <= $maxcol && $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_USEDEADLINES") == "yes" && $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES") == 0) { $currentDeadline = $deadlines[$phase]; while (true) { if ($currentDeadline > time()) { break; } else { $phase++; $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ACTCOL", $phase); if ($phase == $maxcol + 1) { break; } $currentDeadline = $deadlines[$phase]; } } } $adminoptions_change = -1; if (isset($this->params[1])) { $adminoptions_change = $this->params[1]; } // if current user is admin display actionbar if ($admingroup->is_member($user)) { $adminconfig = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINCONFIG"); if (array_key_exists($userID, $adminconfig)) { $options = $adminconfig[$userID]; // change show/hide settings if ($adminoptions_change != -1) { if ($adminoptions_change == 1) { $options["show_adminoptions"] = "true"; } else { $options["show_adminoptions"] = "false"; } $adminconfig[$userID] = $options; $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ADMINCONFIG", $adminconfig); } } else { $adminconfig[$userID] = array(); $options = $adminconfig[$userID]; $options["show_adminoptions"] = "true"; $adminconfig[$userID] = $options; $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ADMINCONFIG", $adminconfig); } if ($options["show_adminoptions"] == "true") { $actionbar = new \Widgets\Actionbar(); $actions = array(array("name" => "Konfiguration", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "configuration/" . $this->id), array("name" => "Teilnehmerverwaltung", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "users/" . $this->id), array("name" => "Rundmail erstellen", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "mail/" . $this->id), array("name" => "Adminmodus ausschalten", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id . "/0")); $actionbar->setActions($actions); $frameResponseObject->addWidget($actionbar); } else { $actionbar = new \Widgets\Actionbar(); $actions = array(array("name" => "Adminmodus einschalten", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id . "/1")); $actionbar->setActions($actions); $frameResponseObject->addWidget($actionbar); } } // display the general information block $content->setCurrentBlock("BEGIN BLOCK_PYRAMID_INFORMATION"); $content->setVariable("JS_URL", $pyramiddiscussionExtension->getAssetUrl()); $content->setVariable("GENERAL_INFORMATION", "Allgemeine Informationen"); $content->setVariable("PHASE_LABEL", "Aktueller Status:"); // if user is an admin and adminoptions are shown, display a select box to change the current phase if (isset($options["show_adminoptions"]) && $options["show_adminoptions"] == "true") { for ($count = 0; $count <= $maxcol + 2; $count++) { $content->setCurrentBlock("BLOCK_PHASE_OPTION"); $content->setVariable("PHASE_ID", $count); if ($count == 0) { $content->setVariable("PHASE_VALUE", "Gruppeneinteilungsphase"); } else { if ($count <= $maxcol) { $content->setVariable("PHASE_VALUE", $count . ". Diskussionsphase"); } else { if ($count == $maxcol + 1) { $content->setVariable("PHASE_VALUE", "Endphase"); } else { $content->setVariable("PHASE_VALUE", "Pyramide einfrieren"); } } } if ($count == $phase) { $content->setVariable("PHASE_SELECTED", "selected"); } $content->setVariable("CHANGE_PHASE", "Ändern"); $params = "{ id : " . $pyramidRoom->get_id() . ", action : 'phase', newphase : document.getElementById('phase').value }"; $content->setVariable("CHANGE_PHASE_ACTION", "sendRequest('Index', " . $params . ", '" . $pyramidRoom->get_id() . "', 'reload');"); $content->parse("BLOCK_PHASE_OPTION"); } } else { $content->setCurrentBlock("BLOCK_PYRAMID_PHASE_NOADMIN"); if ($phase == 0) { $content->setVariable("PHASE_VALUE", "Gruppeneinteilungsphase"); } else { if ($phase <= $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAXCOL")) { $content->setVariable("PHASE_VALUE", $phase . ". Diskussionsphase"); } else { if ($phase == $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAXCOL") + 1) { $content->setVariable("PHASE_VALUE", "Endphase"); } else { $content->setVariable("PHASE_VALUE", "Pyramide eingefroren"); } } } $content->parse("BLOCK_PYRAMID_PHASE_NOADMIN"); } $content->setVariable("DEADLINE_LABEL", "Deadline:"); // display current deadline if deadlines are used and override is off if ($pyramidRoom->get_attribute("PYRAMIDDISCUSSION_USEDEADLINES") == "yes" && $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES") == 0 && $phase != 0 && $phase <= $maxcol) { $content->setVariable("DEADLINE_VALUE", date("d.m.Y H:i", (int) $deadlines[$phase])); $content->setVariable("DISPLAY_OVERRIDE", "none"); $deadlines_used = true; // if user is admin, adminoptions are shown, deadlines are used but override is on, display a dialog to stop the override } else { if ($pyramidRoom->get_attribute("PYRAMIDDISCUSSION_USEDEADLINES") == "yes" && $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES") == 1 && isset($options["show_adminoptions"]) && $options["show_adminoptions"] == "true") { $content->setVariable("DEADLINE_VALUE", "Aktuelle Phase wurde trotz der Verwendung von Deadlines manuell gesetzt. Die Deadlines werden im Moment nicht berücksichtigt."); $content->setVariable("DEADLINE_OVERRIDE_LABEL", "Deadlines aktivieren"); $params = "{ id : " . $pyramidRoom->get_id() . ", action : 'deadlines' }"; $content->setVariable("DEADLINE_OVERRIDE_ACTION", "sendRequest('Index', " . $params . ", '" . $pyramidRoom->get_id() . "', 'reload');"); } else { $content->setVariable("DEADLINE_VALUE", "keine"); $content->setVariable("DISPLAY_OVERRIDE", "none"); } } $content->setVariable("INFO_LABEL", "Infotext:"); $content->setVariable("INFO_VALUE", nl2br($pyramidRoom->get_attribute("OBJ_DESC"))); $content->parse("BEGIN BLOCK_PYRAMID_INFORMATION"); // display pyramid $content->setCurrentBlock("BLOCK_PYRAMID"); // create array to store the users for all positions $users = array(); for ($count = 1; $count <= $maxcol; $count++) { for ($count2 = 1; $count2 <= $startElements / pow(2, $count - 1); $count2++) { $users[$count . $count2] = array(); } } // for every phase $maxuser = 1; for ($count = 1; $count <= $maxcol; $count++) { // if deadlines are used, display deadline of every phase on the top of the phase if ($pyramidRoom->get_attribute("PYRAMIDDISCUSSION_USEDEADLINES") == "yes" && $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES") == 0 && $phase <= $maxcol) { $content->setCurrentBlock("BLOCK_PYRAMID_DEADLINE"); $content->setVariable("DEADLINE_ID", "deadline" . $count); $content->setVariable("DEADLINE_DATE", date("d.m.Y H:i", (int) $deadlines[$count])); $content->parse("BLOCK_PYRAMID_DEADLINE"); } // create user array for ($count2 = 1; $count2 <= $startElements / pow(2, $count - 1); $count2++) { $position = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_" . $count . "_" . $count2); $positionGroup = $position->get_attribute("PYRAMIDDISCUSSION_RELGROUP"); $positionMembers = $positionGroup->get_members(); // add the users from the positions in the first phase to their corresponding arrays if ($count == 1) { if ($positionMembers instanceof \steam_user) { $users[$count . $count2] = $positionMembers->get_id(); if ($positionMembers->get_id() == $userID) { $currentUserGroup = $positionGroup->get_id(); } } else { foreach ($positionMembers as $positionMember) { array_push($users[$count . $count2], $positionMember->get_id()); if ($positionMember->get_id() == $userID) { $currentUserGroup = $positionGroup->get_id(); } } } if (count($users[$count . $count2]) > $maxuser) { $maxuser = count($users[$count . $count2]); } // add users to the arrays of the positions for all other phases } else { $users[$count . $count2] = array_merge($users[$count - 1 . ($count2 * 2 - 1)], $users[$count - 1 . $count2 * 2]); } } // for every position in a phase for ($count2 = 1; $count2 <= $startElements / pow(2, $count - 1); $count2++) { $position = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_" . $count . "_" . $count2); $positionGroup = $position->get_attribute("PYRAMIDDISCUSSION_RELGROUP"); $positionMembers = $positionGroup->get_members(); // get the names from all users of the current position (that still take part in the discussion) $participants = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT"); foreach ($users[$count . $count2] as $currentUserID) { if (!isset($participants[$currentUserID])) { $participants[$currentUserID] = 0; $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT", $participants); } if ($participants[$currentUserID] == 0 || $participants[$currentUserID] >= $count) { $currentMember = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $currentUserID); } } // get position read states $read_states = $position->get_attribute("PYRAMIDDISCUSSION_POS_READ_STATES"); if (!is_array($read_states)) { $read_states = array(); } // determine if there are unread comments for the current position $comments_read = 1; $comments = $position->get_annotations(); foreach ($comments as $comment) { $comment_read_states = $comment->get_attribute("PYRAMIDDISCUSSION_COMMENT_READ_STATES"); if (!is_array($comment_read_states)) { $comment_read_states = array(); } if (!array_key_exists($userID, $comment_read_states) || $comment_read_states[$userID] != "1") { $comments_read = 0; break; } } $read = false; $content->setCurrentBlock("BLOCK_PYRAMID_POSITION"); $state = "phase" . $count . " "; if ($count <= $phase && count($users[$count . $count2]) > 0) { $state = $state . "active "; } else { if (!($phase == 0 && $count == 1) || $phase != 0 && count($users[$count . $count2]) == 0) { $state = $state . "inactive "; $content->setVariable("POSITION_ACTION_HIDDEN", "hidden"); $read = true; } else { $state = $state . "active "; } } if (in_array($userID, $users[$count . $count2])) { $state = $state . "my "; if ($phase != 0) { if ($phase == $count && (!isset($user_management[$currentUserID]) || $user_management[$currentUserID] == 0 || $user_management[$currentUserID] >= $count)) { // current discussion phase $content->setVariable("POSITION_ACTION_LABEL", "Position lesen<br>und bearbeiten"); $content->setVariable("COMMENTS_URL", 'href="' . $pyramiddiscussionExtension->getExtensionUrl() . 'ViewPosition/' . $pyramidRoom->get_id() . '/' . $position->get_id() . '#comments"'); } else { if ($count < $phase) { // previous discussion phase $content->setVariable("POSITION_ACTION_LABEL", "Position lesen"); $content->setVariable("COMMENTS_URL", 'href="' . $pyramiddiscussionExtension->getExtensionUrl() . 'ViewPosition/' . $pyramidRoom->get_id() . '/' . $position->get_id() . '#comments"'); } } $content->setVariable("POSITION_ACTION_URL", $pyramiddiscussionExtension->getExtensionUrl() . "ViewPosition/" . $pyramidRoom->get_id() . "/" . $position->get_id()); if (array_key_exists($userID, $read_states) && $read_states[$userID] == "1" || $position->get_content() == "0" || $position->get_content() == "") { $read = true; } } else { // group choosing phase, my position $content->setVariable("POSITION_ACTION_LABEL", "Position<br>verlassen"); $params = "{ id : " . $position->get_id() . ", pyramid : " . $pyramidRoom->get_id() . ", action : 'join', formergroup : " . $currentUserGroup . ", newgroup : " . $positionGroup->get_id() . " }"; $content->setVariable("POSITION_ACTION_URL", "javascript:sendRequest('EditPosition', " . $params . ", '" . $position->get_id() . "', 'reload');"); $read = true; } } else { if ($phase != 0) { if ($count < $phase) { // previous discussion phase, other positions (reading allowed) $content->setVariable("POSITION_ACTION_LABEL", "Position lesen"); $content->setVariable("POSITION_ACTION_URL", $pyramiddiscussionExtension->getExtensionUrl() . "ViewPosition/" . $pyramidRoom->get_id() . "/" . $position->get_id()); if (array_key_exists($userID, $read_states) && $read_states[$userID] == "1" || $position->get_content() == "0" || $position->get_content() == "") { $read = true; } $content->setVariable("COMMENTS_URL", 'href="' . $pyramiddiscussionExtension->getExtensionUrl() . 'ViewPosition/' . $pyramidRoom->get_id() . '/' . $position->get_id() . '#comments"'); } else { if ($phase == $count) { // current discussion phase, other positions (reading not allowed) $content->setVariable("POSITION_ACTION_HIDDEN", "hidden"); $read = true; } } } else { // group choosing phase, other positions $content->setVariable("POSITION_ACTION_LABEL", "Position<br>beitreten"); $params = "{ id : " . $position->get_id() . ", pyramid : " . $pyramidRoom->get_id() . ", action : 'join', formergroup : " . $currentUserGroup . ", newgroup : " . $positionGroup->get_id() . " }"; $content->setVariable("POSITION_ACTION_URL", "javascript:sendRequest('EditPosition', " . $params . ", '" . $position->get_id() . "', 'reload');"); $read = true; } } if ($read) { $state = $state . "read"; $content->setVariable("READSTATUS_ICON", "read_position"); $content->setVariable("READSTATUS_TITLE", "Position gelesen"); } else { $state = $state . "unread"; $content->setVariable("READSTATUS_ICON", "not_read_position"); $content->setVariable("READSTATUS_TITLE", "Position ungelesen"); } if ($phase > 0 && $phase != $maxcol + 2 && (isset($options["show_adminoptions"]) && $options["show_adminoptions"] == "true")) { $content->setVariable("POSITION_ACTION_URL", $pyramiddiscussionExtension->getExtensionUrl() . "ViewPosition/" . $pyramidRoom->get_id() . "/" . $position->get_id()); $content->setVariable("POSITION_ACTION_HIDDEN", ""); $content->setVariable("POSITION_ACTION_LABEL", "Position lesen<br>und bearbeiten"); $content->setVariable("COMMENTS_URL", 'href="' . $pyramiddiscussionExtension->getExtensionUrl() . 'ViewPosition/' . $pyramidRoom->get_id() . '/' . $position->get_id() . '#comments"'); } $content->setVariable("POSITION_ID", "position" . $count . $count2); $content->setVariable("POSITION_STATE", $state); $content->setVariable("POSITION_LABEL", "Position " . $count . "-" . $count2); $content->setVariable("ASSETURL", $pyramiddiscussionExtension->getAssetUrl()); if ($comments_read == 1) { $content->setVariable("ANNOTATION_COUNT", count($comments)); $content->setVariable("ANNOTATION_TITLE", "Keine ungelesenen Kommentare vorhanden"); $content->setVariable("COMMENTSTATUS_ICON", "no_comments"); } else { $content->setVariable("ANNOTATION_COUNT", "<b>" . count($comments) . "</b>"); $content->setVariable("ANNOTATION_TITLE", "Ungelesene Kommentare vorhanden"); $content->setVariable("COMMENTSTATUS_ICON", "comments"); } foreach ($users[$count . $count2] as $currentUserID) { if (!isset($user_management[$currentUserID]) || $user_management[$currentUserID] == 0 || $user_management[$currentUserID] >= $count) { $currentUser = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $currentUserID); $pic_id = $currentUser->get_attribute("OBJ_ICON")->get_id(); $pic_link = $pic_id == 0 ? PATH_URL . "styles/standard/images/anonymous.jpg" : PATH_URL . "download/image/" . $pic_id . "/15/20"; $content->setCurrentBlock("BLOCK_PYRAMID_POSITION_USER"); $content->setVariable("USER_URL", PATH_URL . "user/index/" . $currentUser->get_name()); $content->setVariable("PIC_URL", $pic_link); $content->setVariable("USER_NAME", $currentUser->get_full_name()); $content->parse("BLOCK_PYRAMID_POSITION_USER"); } } $content->parse("BLOCK_PYRAMID_POSITION"); } } $heights = array(); $heights[0] = 5; // gap switch ($maxuser) { case 1: $heights[1] = 106; break; case 2: $heights[1] = 126; break; case 3: $heights[1] = 146; break; case 4: $heights[1] = 166; break; default: $heights[1] = 176; break; } $heights[2] = 2 * $heights[1] - 0.5 * $heights[1] + 1 * $heights[0]; $heights[3] = 3 * $heights[1] + 2 * $heights[0]; $heights[4] = 4 * $heights[1] + 3 * $heights[0]; $heights[5] = 8 * $heights[1] + 7 * $heights[0]; $heights[6] = 16 * $heights[1] + 15 * $heights[0]; $heights[7] = 32 * $heights[1] + 31 * $heights[0]; // special case if ($maxcol == 3) { $heights[3] = 2 * $heights[1] + 1 * $heights[0]; } $css = ""; for ($count = 1; $count <= $maxcol; $count++) { $css = $css . ".phase" . $count . " { width: 120px; height: " . $heights[$count] . "px; } \n"; } // background triangle $triangle = $startElements * ($heights[0] + $heights[1]) * 0.5 + 16; $triangle_end = array(0, 300, 450, 600, 720); if ($startElements <= 16) { $css = $css . "\n\t\t\t.pyramid_triangle {\n\t \t\t\tborder-color: transparent transparent transparent #FDF1A7;\n\t \t\t\tborder-style: solid;\n\t \t\t\tborder-width: " . $triangle . "px 0px " . $triangle . "px " . $triangle_end[$maxcol - 1] . "px;\n\t \t\t\twidth:0px;\n\t \t\t\theight:0px;\n\t\t\t}"; } $content->setVariable("CSS_HEIGHTS", $css); $content->setVariable("JS_STARTPOSITIONS", $startElements); $content->setVariable("JS_GAP", $heights[0]); $content->setVariable("JS_HEIGHT", $heights[1]); $content->setVariable("JS_DEADLINES", $deadlines_used); $content->setVariable("EMPTY_DIV_HEIGHT", $startElements * ($heights[0] + $heights[1]) + 16 . "px"); $content->parse("BLOCK_PYRAMID"); $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->addWidget($rawWidget); $frameResponseObject->setHeadline("Pyramidendiskussion: " . $pyramidRoom->get_name()); return $frameResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $user = $GLOBALS["STEAM"]->get_current_steam_user(); $pyramidRoom = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $pyramiddiscussionExtension = \Pyramiddiscussion::getInstance(); $pyramiddiscussionExtension->addCSS(); $pyramiddiscussionExtension->addJS(); $basegroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_BASEGROUP"); $admingroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINGROUP"); $content = $pyramiddiscussionExtension->loadTemplate("pyramiddiscussion_configuration.template.html"); // if user is no admin display error msg if (!$admingroup->is_member($user)) { $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml("Error: Kein Administrator"); $frameResponseObject->addWidget($rawWidget); return $frameResponseObject; } // change configuration if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["change_options"])) { $pyramidRoom->set_name($_POST["title"]); $pyramidRoom->set_attribute("OBJ_DESC", $_POST["info"]); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ACTCOL", $_POST["phase"]); if (isset($_POST["use_deadlines"]) && $_POST["use_deadlines"] == "on") { $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_USEDEADLINES", "yes"); $deadlines = $_POST["deadline"]; $deadlineArray = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_DEADLINES"); for ($count = 1; $count <= count($deadlines); $count++) { $deadline = $deadlines[$count]; $time = substr($deadline, 11); $deadline = substr($deadline, 0, 10); $deadline = mktime(substr($time, 0, 2), substr($time, 3, 2), 0, substr($deadline, 3, 2), substr($deadline, 0, 2), substr($deadline, 6, 4)); $deadlineArray[$count] = $deadline; } $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_DEADLINES", $deadlineArray); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES", 0); } else { $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_USEDEADLINES", "no"); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES", 0); } $frameResponseObject->setConfirmText("Änderungen erfolgreich gespeichert."); } $phase = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ACTCOL"); $maxcol = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAXCOL"); $deadlines = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_DEADLINES"); // display configuration table $content->setCurrentBlock("BLOCK_PYRAMID_OPTIONS"); $content->setVariable("PYRAMID_OPTIONS", "Konfiguration der Pyramidendiskussion"); $content->setVariable("TITLE_LABEL", "Diskussionsthema:"); $content->setVariable("TITLE_VALUE", $pyramidRoom->get_name()); $content->setVariable("INFO_LABEL", "Infotext:"); $content->setVariable("INFO_VALUE", $pyramidRoom->get_attribute("OBJ_DESC")); $content->setVariable("START_LABEL", "Anzahl der Startfelder:"); $content->setVariable("START_VALUE", $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAX")); $content->setVariable("BASEGROUP_LABEL", "Basisgruppe:"); $content->setVariable("BASEGROUP_VALUE", $basegroup->get_name()); $content->setVariable("ADMINGROUP_LABEL", "Admingruppe:"); $content->setVariable("ADMINGROUP_VALUE", $admingroup->get_name()); $content->setVariable("EDITOR_LABEL", "Editor-Typ:"); $editortype = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_EDITOR"); if ($editortype == "text/plain") { $content->setVariable("EDITOR_VALUE", "Einfacher Text"); } else { if ($editortype == "text/html") { $content->setVariable("EDITOR_VALUE", "HTML Notation"); } else { $content->setVariable("EDITOR_VALUE", "Wiki Notation"); } } $content->setVariable("PHASE_LABEL", "Aktuelle Phase:"); for ($count = 0; $count <= $maxcol + 2; $count++) { $content->setCurrentBlock("BLOCK_PHASE_OPTION"); $content->setVariable("PHASE_ID", $count); if ($count == 0) { $content->setVariable("PHASE_VALUE", "Gruppeneinteilungsphase"); } else { if ($count <= $maxcol) { $content->setVariable("PHASE_VALUE", $count . ". Diskussionsphase"); } else { if ($count == $maxcol + 1) { $content->setVariable("PHASE_VALUE", "Endphase"); } else { $content->setVariable("PHASE_VALUE", "Pyramide einfrieren"); } } } if ($count == $phase) { $content->setVariable("PHASE_SELECTED", "selected"); } $content->parse("BLOCK_PHASE_OPTION"); } $content->setVariable("DEADLINES_LABEL", "Benutze Deadlines:"); if (count($deadlines) > 0 && $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_USEDEADLINES") == "yes") { $content->setVariable("DEADLINES_SELECTED", "checked"); } $content->setVariable("MAX_PHASE", $maxcol); $content->setVariable("DEADLINE_PHASE_LABEL", "Diskussionsphase"); $content->setVariable("DEADLINE_LABEL", "Deadline"); for ($count = 1; $count <= $maxcol; $count++) { $hours = 0; $minutes = 0; $content->setCurrentBlock("BLOCK_DEADLINE_ENTRY"); $content->setVariable("DEADLINE_PHASE", $count); if (array_key_exists($count, $deadlines)) { $content->setVariable("DEADLINE_PHASE_VALUE", date("d.m.Y H:i", (int) $deadlines[$count])); } else { $content->setVariable("DEADLINE_PHASE_VALUE", date("d.m.Y H:i", time() + 172800 * ($count - 1))); } $content->parse("BLOCK_DEADLINE_ENTRY"); } $content->setVariable("SAVE_CHANGES", "Änderungen speichern"); $content->setVariable("BACK_LABEL", "Zurück"); $content->setVariable("BACK_LINK", $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id); $content->parse("BLOCK_PYRAMID_OPTIONS"); $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->addWidget($rawWidget); $frameResponseObject->setHeadline(array(array("name" => "Pyramidendiskussion", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id), array("name" => "Konfiguration"))); return $frameResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $user = $GLOBALS["STEAM"]->get_current_steam_user(); $pyramidRoom = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $pyramiddiscussionExtension = \Pyramiddiscussion::getInstance(); $pyramiddiscussionExtension->addCSS(); $basegroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_BASEGROUP"); $admingroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINGROUP"); $content = $pyramiddiscussionExtension->loadTemplate("pyramiddiscussion_users.template.html"); // if user is no admin display error msg if (!$admingroup->is_member($user)) { $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml("Error: Kein Administrator"); $frameResponseObject->addWidget($rawWidget); return $frameResponseObject; } $members = $basegroup->get_members(); $admins = $admingroup->get_members(); foreach ($admins as $admin) { if (!$basegroup->is_member($admin)) { array_push($members, $admin); } } $maxcol = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAXCOL"); $maxstart = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAX"); $participants = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT"); foreach ($members as $member) { if (!isset($participants[$member->get_id()])) { $participants[$member->get_id()] = 0; } } // save changes if form got submitted if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["change_users"])) { $previousstartpositions_post = $_POST["previousstartposition"]; $startpositions_post = $_POST["startposition"]; $deactivate_post = $_POST["deactivate"]; if (isset($_POST["admin"])) { $admin_post = $_POST["admin"]; } else { $admin_post = array(); } $formeradmin_post = $_POST["formeradmin"]; for ($count = 0; $count < count($members); $count++) { if ($members[$count] instanceof \steam_user && $members[$count]->get_name() != "root") { // change startposition $currentUserID = $members[$count]->get_id(); if ($previousstartpositions_post[$currentUserID] == "") { $previousstartpositions_post[$currentUserID] = 0; } if ($previousstartpositions_post[$currentUserID] != $startpositions_post[$currentUserID]) { if ($previousstartpositions_post[$currentUserID] != 0) { $oldPosition = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_1_" . $previousstartpositions_post[$currentUserID]); $oldPositionGroup = $oldPosition->get_attribute("PYRAMIDDISCUSSION_RELGROUP"); $oldPositionGroup->remove_member($members[$count]); $userGroupID = 0; } if ($startpositions_post[$currentUserID] != 0) { $newPosition = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_1_" . $startpositions_post[$currentUserID]); $newPositionGroup = $newPosition->get_attribute("PYRAMIDDISCUSSION_RELGROUP"); $newPositionGroup->add_member($members[$count]); $userGroupID = $newPositionGroup->get_id(); } } else { if ($previousstartpositions_post[$currentUserID] != 0) { $userPosition = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_1_" . $previousstartpositions_post[$currentUserID]); $helpGroup = $userPosition->get_attribute("PYRAMIDDISCUSSION_RELGROUP"); $userGroupID = $helpGroup->get_id(); } else { $userGroupID = 0; } } $participants[$currentUserID] = $deactivate_post[$currentUserID]; if (!isset($admin_post[$currentUserID])) { if ($formeradmin_post[$currentUserID] == "on" && $admingroup->is_admin($user)) { // take adminrights (and remove user from the discussion if basegroup = admingroup) if ($admingroup == $basegroup) { if ($userGroupID != 0) { $userGroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $userGroupID); $userGroup->remove_member($members[$count]); } $admingroup->remove_member($members[$count]); } else { $admingroup->remove_member($members[$count]); } if (!$basegroup->is_member($members[$count])) { unset($members[$count]); $members = array_values($members); } } } else { if ($formeradmin_post[$currentUserID] == "off") { // give adminrights $admingroup->add_member($members[$count]); } } } } $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT", $participants); $frameResponseObject->setConfirmText("Änderungen erfolgreich gespeichert."); } // save users of the startpositions to arrays $startpositions = array(); for ($count = 1; $count <= $maxstart; $count++) { $startpositions[$count] = array(); $position = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_1_" . $count); $positionGroup = $position->get_attribute("PYRAMIDDISCUSSION_RELGROUP"); $positionMembers = $positionGroup->get_members(); for ($count2 = 0; $count2 < count($positionMembers); $count2++) { array_push($startpositions[$count], $positionMembers[$count2]->get_id()); } } // display users $content->setCurrentBlock("BLOCK_PYRAMID_USERS"); $content->setVariable("LOGIN_LABEL", "Login"); $content->setVariable("NAME_LABEL", "Name"); $content->setVariable("START_LABEL", "Startposition"); $content->setVariable("DEACTIVATE_LABEL", "Hat mitgemacht bis"); $content->setVariable("ADMIN_LABEL", "Admin"); for ($count = 0; $count < count($members); $count++) { if ($members[$count] instanceof \steam_user && $members[$count]->get_name() != "root") { $content->setCurrentBlock("BLOCK_PYRAMID_USERS_ELEMENT"); $content->setVariable("USER_LOGIN", $members[$count]->get_name()); $content->setVariable("USER_NAME", $members[$count]->get_full_name()); $content->setVariable("USER_ID", $members[$count]->get_id()); for ($count2 = 0; $count2 <= $maxstart; $count2++) { $content->setCurrentBlock("BLOCK_POSITION_OPTION"); $content->setVariable("POSITION_ID", $count2); if ($count2 == 0) { if ($maxstart >= 10) { $content->setVariable("POSITION_VALUE", "--"); } else { $content->setVariable("POSITION_VALUE", "-"); } } else { $content->setVariable("POSITION_VALUE", $count2); if (in_array($members[$count]->get_id(), $startpositions[$count2])) { $content->setVariable("POSITION_SELECTED", "selected"); $content->setVariable("PREVIOUSSTART_VALUE", $count2); } } $content->parse("BLOCK_POSITION_OPTION"); } for ($count2 = 0; $count2 <= $maxcol - 1; $count2++) { $content->setCurrentBlock("BLOCK_PHASE_OPTION"); $content->setVariable("PHASE_ID", $count2); if ($count2 == 0) { $content->setVariable("PHASE_VALUE", "Komplette Diskussion"); } else { $content->setVariable("PHASE_VALUE", $count2 . ". Diskussionsphase"); } if ($count2 == $participants[$members[$count]->get_id()]) { $content->setVariable("PHASE_SELECTED", "selected"); } $content->parse("BLOCK_PHASE_OPTION"); } if ($admingroup->is_member($members[$count])) { $content->setVariable("ADMIN_SELECTED", "checked"); $content->setVariable("FORMER_ADMIN", "on"); } else { $content->setVariable("FORMER_ADMIN", "off"); } if (!$admingroup->is_admin($user)) { $content->setVariable("ADMIN_DISABLED", "disabled"); } $content->parse("BLOCK_PYRAMID_USERS_ELEMENT"); } } $content->setVariable("SAVE_CHANGES", "Änderungen speichern"); $content->setVariable("BACK_LINK", $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id); $content->setVariable("BACK_LABEL", "Zurück"); $content->parse("BLOCK_PYRAMID_USERS"); $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->addWidget($rawWidget); $frameResponseObject->setHeadline(array(array("name" => "Pyramidendiskussion", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id), array("name" => "Teilnehmerverwaltung"))); return $frameResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $user = $GLOBALS["STEAM"]->get_current_steam_user(); $pyramidPosition = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $positionGroup = $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_RELGROUP"); $pyramidRoom = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->pyramiddiscussion); $phase = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ACTCOL"); $basegroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_BASEGROUP"); $admingroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINGROUP"); $adminconfig = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINCONFIG"); $pyramiddiscussionExtension = \Pyramiddiscussion::getInstance(); $pyramiddiscussionExtension->addCSS(); $pyramiddiscussionExtension->addJS(); $content = $pyramiddiscussionExtension->loadTemplate("pyramiddiscussion_viewposition.template.html"); // if a new comment was submitted if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["add_comment"])) { $new_comment = \steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), $_POST["title"], stripslashes($_POST["content"])); $new_comment->set_read_access($basegroup); $new_comment->set_read_access($admingroup); $new_comment->set_write_access($basegroup); $new_comment->set_write_access($admingroup); $read_states = array(); $read_states[$user->get_id()] = 1; $new_comment->set_attribute("PYRAMIDDISCUSSION_COMMENT_READ_STATES", $read_states); $pyramidPosition->add_annotation($new_comment); } // if a comment edit got submitted if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["edit_comment"])) { $comment = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_POST["edit_id"]); $comment->set_content($_POST["content"]); $comment->set_name($_POST["title"]); $read_states = array(); $read_states[$user->get_id()] = 1; $comment->set_attribute("PYRAMIDDISCUSSION_COMMENT_READ_STATES", $read_states); } // check if user is admin and if adminoptions are shown $showadmin = 1; if ($admingroup->is_member($user)) { if (array_key_exists($user->get_id(), $adminconfig)) { $options = $adminconfig[$user->get_id()]; if (isset($options["show_adminoptions"]) && $options["show_adminoptions"] == "false") { $showadmin = 0; } } } else { $showadmin = 0; } // get names of the users participating in this position $participants = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT"); $positionMembers = $positionGroup->get_members(); $names = ""; $users = array(); while (count($positionMembers) > 0) { $currentMember = array_pop($positionMembers); if ($currentMember instanceof \steam_user) { if (!isset($participants[$currentMember->get_id()])) { $participants[$currentMember->get_id()] = 0; $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT", $participants); } if ($participants[$currentMember->get_id()] >= $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_COLUMN") || $participants[$currentMember->get_id()] == 0) { array_push($users, $currentMember->get_id()); } } else { $groupMembers = $currentMember->get_members(); for ($count = 0; $count < count($groupMembers); $count++) { array_push($positionMembers, $groupMembers[$count]); } } } // determine if current user already read this position $read_position = 0; $read_position_states = $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_POS_READ_STATES"); if (is_array($read_position_states)) { if (array_key_exists($user->get_id(), $read_position_states)) { $read_position = $read_position_states[$user->get_id()]; } } if ($pyramidPosition->get_content() == "0" || $pyramidPosition->get_content() == "") { $read_position = 1; } // display current position $content->setCurrentBlock("BLOCK_PYRAMID_POSITION"); if ($pyramidPosition->get_attribute("PYRAMIDDISCUSSION_POS_TITLE") != "0" && $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_POS_TITLE") != "") { $content->setVariable("PYRAMID_POSITION", $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_POS_TITLE")); } else { $content->setVariable("PYRAMID_POSITION", "Position_" . $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_COLUMN") . "_" . $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_ROW")); } $positionPhase = $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_COLUMN"); $positionRow = $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_ROW"); if ($positionPhase != 1) { $previous1 = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_" . ($positionPhase - 1) . "_" . ($positionRow * 2 - 1)); $previous2 = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_" . ($positionPhase - 1) . "_" . $positionRow * 2); $content->setVariable("PREVIOUS1_SHOW", "Position " . ($positionPhase - 1) . "-" . ($positionRow * 2 - 1) . " anzeigen"); $content->setVariable("PREVIOUS2_SHOW", "Position " . ($positionPhase - 1) . "-" . $positionRow * 2 . " anzeigen"); $content->setVariable("PREVIOUS1_HIDE", "Position " . ($positionPhase - 1) . "-" . ($positionRow * 2 - 1) . " ausblenden"); $content->setVariable("PREVIOUS2_HIDE", "Position " . ($positionPhase - 1) . "-" . $positionRow * 2 . " ausblenden"); $content->setVariable("PREVIOUS1_CONTENT", $previous1->get_content()); $content->setVariable("PREVIOUS2_CONTENT", $previous2->get_content()); } else { $content->setVariable("DISPLAY_PREVIOUS", "none"); } if ($read_position == 0) { $content->setVariable("POSITION_NEW", "(neu)"); // current user has now read this position if (is_array($read_position_states)) { $read_position_states[$user->get_id()] = 1; } else { $read_position_states = array(); $read_position_states[$user->get_id()] = 1; } $pyramidPosition->set_attribute("PYRAMIDDISCUSSION_POS_READ_STATES", $read_position_states); } $content->setVariable("ASSETURL", $pyramiddiscussionExtension->getAssetUrl()); $content->setVariable("EDIT_POSITION", "Position bearbeiten"); $content->setVariable("PARAMS_AJAX", "{ id : " . $pyramidPosition->get_id() . ", action : 'edit' }"); // do not display edit function if user is not member of this position and adminoptions are not shown if (!in_array($user->get_id(), $users) && $showadmin == 0) { $content->setVariable("DISPLAY_EDIT", "none"); } // do not display edit function if position is from a former phase and adminoptions are not shown if ($phase > $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_COLUMN") && $showadmin == 0) { $content->setVariable("DISPLAY_EDIT", "none"); } if ($phase == $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAXCOL") + 2) { $content->setVariable("DISPLAY_EDIT", "none"); } $content->setVariable("POSITION_TITLE", $pyramidPosition->get_attribute("OBJ_DESC")); if ($pyramidPosition->get_content() != "0") { $content->setVariable("POSITION_CONTENT", nl2br($pyramidPosition->get_content())); } $content->setVariable("POSITION_AUTHORS", "Autoren:"); foreach ($users as $currentAuthor) { $content->setCurrentBlock("BLOCK_POSITION_AUTHOR"); $currentAuthor = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $currentAuthor); $pic_id = $currentAuthor->get_attribute("OBJ_ICON")->get_id(); $pic_link = $pic_id == 0 ? PATH_URL . "styles/standard/images/anonymous.jpg" : PATH_URL . "download/image/" . $pic_id . "/42/56"; $content->setVariable("AUTHOR_URL", PATH_URL . "user/index/" . $currentAuthor->get_name()); $content->setVariable("AUTHOR_PIC", $pic_link); $content->setVariable("AUTHOR_NAME", $currentAuthor->get_full_name()); $content->parse("BLOCK_POSITION_AUTHOR"); } $content->setVariable("POSITION_LAST_CHANGED", "Zuletzt geändert:"); if ($pyramidPosition->get_attribute("DOC_LAST_MODIFIED") != 0) { $content->setVariable("POSITION_LAST_CHANGED_DATE", "am " . date("d.m.Y H:i", (int) $pyramidPosition->get_attribute("DOC_LAST_MODIFIED"))); } if (is_object($pyramidPosition->get_attribute("DOC_USER_MODIFIED"))) { $content->setVariable("POSITION_LAST_CHANGED_USER", "von " . $pyramidPosition->get_attribute("DOC_USER_MODIFIED")->get_full_name()); } // display comments $content->setVariable("COMMENTS_LABEL", "Kommentare"); $annotations = $pyramidPosition->get_annotations(); usort($annotations, "sortRepliesByDate"); if (count($annotations) == 0) { $content->setCurrentBlock("BLOCK_NO_COMMENTS"); $content->setVariable("NO_COMMENTS", "Keine Kommentare zu dieser Position vorhanden."); $content->parse("BLOCK_NO_COMMENTS"); } else { for ($count = 0; $count < count($annotations); $count++) { $author = $annotations[$count]->get_creator(); // determine if current user has read this comment $read_comment = 0; $read_comment_states = $annotations[$count]->get_attribute("PYRAMIDDISCUSSION_COMMENT_READ_STATES"); if (is_array($read_comment_states)) { if (array_key_exists($user->get_id(), $read_comment_states)) { $read_comment = $read_comment_states[$user->get_id()]; } } $content->setCurrentBlock("BLOCK_COMMENT"); if ($read_comment == 0) { $content->setVariable("COMMENT_NEW", "(neu)"); // current user has now read this comment if (is_array($read_comment_states)) { $read_comment_states[$user->get_id()] = 1; } else { $read_comment_states = array(); $read_comment_states[$user->get_id()] = 1; } $annotations[$count]->set_attribute("PYRAMIDDISCUSSION_COMMENT_READ_STATES", $read_comment_states); } $content->setVariable("COMMENT_CONTENT", nl2br($annotations[$count]->get_content())); $content->setVariable("COMMENT_CONTENT_NOBR", $annotations[$count]->get_content()); $content->setVariable("COMMENT_TITLE", $annotations[$count]->get_name()); $content->setVariable("COMMENT_ID", $annotations[$count]->get_id()); $content->setVariable("ASSET", $pyramiddiscussionExtension->getAssetUrl()); $content->setVariable("EDIT_COMMENT", "Kommentar bearbeiten"); // if user is not the author and admin options are not shown dont display edit button if ($author->get_id() != $user->get_id() && $showadmin == 0) { $content->setVariable("SHOW_COMMENT_EDIT", "none"); } if ($phase == $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAXCOL") + 2) { $content->setVariable("SHOW_COMMENT_EDIT", "none"); } $pic_id = $author->get_attribute("OBJ_ICON")->get_id(); $pic_link = $pic_id == 0 ? PATH_URL . "styles/standard/images/anonymous.jpg" : PATH_URL . "download/image/" . $pic_id . "/15/20"; $content->setVariable("COMMENT_AUTHOR", "von <img style='vertical-align:middle;' src=" . $pic_link . "> <a href=" . PATH_URL . "user/index/" . $author->get_name() . ">" . $author->get_full_name() . "</a>"); $content->setVariable("COMMENT_DATE", "am " . date("d.m.Y H:i", (int) $annotations[$count]->get_attribute("OBJ_CREATION_TIME"))); $content->parse("BLOCK_COMMENT"); } } $content->setVariable("CREATE_COMMENT", "Kommentar hinzufügen"); if ($phase == $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAXCOL") + 2) { $content->setVariable("DISPLAY_CREATE_COMMENT", "none"); } $content->setVariable("TITLE_LABEL", "Titel:"); $content->setVariable("NEW_TITLE", "Kommentar"); $content->setVariable("CONTENT_LABEL", "Kommentar:"); $content->setVariable("BACK_LABEL", "Abbrechen"); $content->setVariable("EDIT_COMMENT", "Kommentar bearbeiten"); $content->setVariable("EDIT_COMMENT_SUBMIT", "Änderungen speichern"); $content->setVariable("PYRAMID_BACK", "Zurück zur Pyramide"); $content->setVariable("PYRAMID_URL", $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->pyramiddiscussion); $content->parse("BLOCK_PYRAMID_POSITION"); $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->addWidget($rawWidget); $frameResponseObject->setHeadline(array(array("name" => "Pyramidendiskussion", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->pyramiddiscussion), array("name" => "Diskussionsphase " . $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_COLUMN") . " Position " . $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_ROW")))); return $frameResponseObject; }