当前位置: 首页>>代码示例>>PHP>>正文


PHP FrameResponseObject::setConfirmText方法代码示例

本文整理汇总了PHP中FrameResponseObject::setConfirmText方法的典型用法代码示例。如果您正苦于以下问题:PHP FrameResponseObject::setConfirmText方法的具体用法?PHP FrameResponseObject::setConfirmText怎么用?PHP FrameResponseObject::setConfirmText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FrameResponseObject的用法示例。


在下文中一共展示了FrameResponseObject::setConfirmText方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute(\FrameResponseObject $frameResponseObject)
 {
     $steam = $GLOBALS["STEAM"];
     $id = $this->id;
     if ($this->params[1] == "group" || $this->params[1] == "user") {
         $category = $this->params[1];
     } else {
         throw new \Exception("category isn't set");
     }
     if ($category == "user" && $id != 0) {
         $user = \steam_factory::get_object($steam->get_id(), $id);
         $user_data = $user->get_attributes(array(OBJ_NAME, OBJ_DESC, USER_FIRSTNAME, USER_FULLNAME, USER_EMAIL, USER_ADRESS, OBJ_ICON, "bid:user_callto", "bid:user_im_adress", "bid:user_im_protocol"));
         //    $user_email_forwarding = $user->get_email_forwarding();
     } elseif ($category == "group" && $id != 0) {
         $group = \steam_factory::get_object($steam->get_id(), $id);
         $group_data = $group->get_attributes(array(OBJ_NAME, OBJ_DESC));
     }
     $user_favourites = $steam->get_current_steam_user()->get_buddies();
     if (count($user_favourites) == 0) {
         $user_favourites = array();
     }
     if ($category == "user") {
         array_push($user_favourites, $user);
     } else {
         if ($category == "group") {
             array_push($user_favourites, $group);
         }
     }
     $steam->get_current_steam_user()->set_attribute("USER_FAVOURITES", $user_favourites);
     //$frameResponseObject->setConfirmText(gettext("Favorite added successfully"));
     $frameResponseObject->setConfirmText("Favorit erfolgreich hinzugefügt!");
     $widget = new \Widgets\JSWrapper();
     $url = 'self.location.href="' . PATH_URL . 'favorite/index' . '"';
     $widget->setJs($url);
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
开发者ID:rolwi,项目名称:koala,代码行数:37,代码来源:Add.class.php

示例2: frameResponse

 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;
 }
开发者ID:rolwi,项目名称:koala,代码行数:36,代码来源:Mail.class.php

示例3: execute


//.........这里部分代码省略.........
                         if (isset($_POST["extensions_available"]) && !empty($_POST["extensions_available"])) {
                             $extensions_available = explode("/", $_POST["extensions_available"]);
                             if (isset($_POST["extensions_enabled"])) {
                                 $extensions_enabled = $_POST["extensions_enabled"];
                             } else {
                                 $extensions_enabled = array();
                             }
                             if (isset($_POST["extensions_enabled_add"])) {
                                 $extensions_enabled = array_merge($extensions_enabled, explode("/", $_POST["extensions_enabled_add"]));
                             }
                             if (is_array($extensions_available)) {
                                 foreach ($extensions_available as $extension_name) {
                                     $extension = \lms_steam::get_extensionmanager()->get_extension($extension_name);
                                     if (!is_object($extension)) {
                                         continue;
                                     }
                                     if (array_search($extension_name, $extensions_enabled) === FALSE) {
                                         $extension->disable_for($koala_course);
                                     } else {
                                         $extension->enable_for($koala_course);
                                     }
                                 }
                             }
                         }
                         $cache = get_cache_function("ORGANIZATION");
                         $cache->drop("lms_steam::semester_get_courses", $current_semester->get_id());
                         header("Location: " . PATH_URL . "semester/index" . "/" . $current_semester->get_name() . "/" . $new_course->get_name() . "/");
                         exit;
                     }
                 }
             }
         }
         if (!empty($problems)) {
             $frameResponseObject->setConfirmText($problems, $hints);
             //$portal->set_problem_description( $problems, $hints );
         }
     }
     if (!empty($_GET["lsf_course_id"])) {
         $lsf_client = new hislsf_soap();
         $course_infos = $lsf_client->get_course_information(SYNC_HISLSF_SEMESTER, $_GET["lsf_course_id"]);
         if (empty($course_infos) && empty($problems)) {
             $frameResponseObject->setConfirmText(gettext("Error getting course data from HIS/LSF."));
             //$portal->set_problem_description(gettext("Error getting course data from HIS/LSF.") );
         } else {
             if (empty($course_infos["course_dsc"])) {
                 $course_infos["course_dsc"] = "keine Beschreibung vorhanden.";
             } else {
                 $course_infos["course_dsc"] = unhtmlentities($course_infos["course_dsc"]);
             }
             $values = array("lsf_id" => $course_infos["course_lsf_id"], "id" => $course_infos["course_id"], "name" => $course_infos["course_name"], "tutors" => $course_infos["course_tutors"], "short_dsc" => $course_infos["course_type"], "long_dsc" => $course_infos["course_dsc"]);
         }
         $_SESSION["LSF_COURSE_INFO"] = "";
     }
     $content = \Course::getInstance()->loadTemplate("courses_create.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "courses_create.template.html" );
     $content->setVariable("FORM_ACTION", PATH_URL . "course/create" . "/" . $current_semester->get_name() . "/");
     $content->setVariable("VALUE_SEMESTER", h($current_semester->get_name()));
     //$content->setVariable( "INFO_TEXT", gettext( "Creating a course means..." ) );
     $content->setVariable("CONFIRMATION_TEXT", str_replace("%SEMESTER", h($current_semester->get_attribute("OBJ_DESC")), gettext("You are going to create a new course in <b>%SEMESTER</b>.")) . " " . gettext("Please fill out the requested meta data at first.") . " " . gettext("At the bottom, you can determine the manner of participant management.") . " " . gettext("Also you can add further course admins later on."));
     $content->setVariable("LABEL_GENERAL_INFORMATION", gettext("General Information"));
     $content->setVariable("LABEL_COURSE_ID", gettext("Course ID"));
     $content->setVariable("VALUE_COURSE_ID", isset($values) ? h($values["id"]) : '');
     $content->setVariable("LABEL_COURSE_NAME", gettext("Name"));
     $content->setVariable("VALUE_COURSE_NAME", isset($values) ? h($values["name"]) : '');
     $content->setVariable("LABEL_COURSE_SHORT_INFORMATION", gettext("Short Info"));
开发者ID:rolwi,项目名称:koala,代码行数:67,代码来源:Create.class.php

示例4: execute

 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_guest_allowed( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$portal_user = $portal->get_user();
     //$path = $request->getPath();
     $current_semester = $this->params[1];
     $group_course = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "Courses." . $this->params[0] . "." . $this->params[1]);
     $group = new \koala_group_course($group_course);
     //$html_handler_course = new \koala_html_course($course);
     if (!$group instanceof \koala_group) {
         throw new \Exception("Variable group not set.");
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if (isset($_POST["remove"]) && is_array($_POST["remove"])) {
             $id = key($_POST["remove"]);
             $member_to_kick = \steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $id);
             $group->remove_member($member_to_kick);
             $frameResponseObject->setConfirmText(str_replace("%NAME", h($member_to_kick->get_attribute("USER_FIRSTNAME")) . " " . h($member_to_kick->get_attribute("USER_FULLNAME")), gettext("User %NAME successfully removed from group members.")));
             //$portal->set_confirmation( str_replace( "%NAME", h($member_to_kick->get_attribute( "USER_FIRSTNAME" ))." " . h($member_to_kick->get_attribute( "USER_FULLNAME" )), gettext( "User %NAME successfully removed from group members." ) ) );
             // clear caches:
             $cache = get_cache_function($member_to_kick->get_name());
             $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), TRUE);
             $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), FALSE);
             $cache->drop("lms_steam::user_get_profile", $member_to_kick->get_name());
             $cache->drop("lms_portal::get_menu_html", $member_to_kick->get_name(), TRUE);
             $cache = get_cache_function($group->get_id());
             $cache->drop("lms_steam::group_get_members", $group->get_id());
         } else {
             if (isset($_POST["hide"]) && is_array($_POST["hide"])) {
                 $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
                 if (!is_array($hidden_members)) {
                     $hidden_members = array();
                 }
                 $users_to_hide = array_keys($_POST["hide"]);
                 $displayed_staff_members = array();
                 $displayed_staff_members = array_keys($_POST["displayed_staff_member"]);
                 $tmp1_users_to_hide = array_unique(array_merge($hidden_members, $users_to_hide));
                 $tmp2_users_to_hide = array_diff($tmp1_users_to_hide, $displayed_staff_members);
                 $final_users_to_hide = array_unique(array_merge($tmp2_users_to_hide, $users_to_hide));
                 $group->get_steam_group()->set_attribute("COURSE_HIDDEN_STAFF", $final_users_to_hide);
             } else {
                 $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
                 if (!is_array($hidden_members)) {
                     $hidden_members = array();
                 }
                 $displayed_staff_members = array();
                 $displayed_staff_members = array_keys($_POST["displayed_staff_member"]);
                 $users_to_hide = array();
                 $users_to_hide = array_diff($hidden_members, $displayed_staff_members);
                 $group->get_steam_group()->set_attribute("COURSE_HIDDEN_STAFF", $users_to_hide);
             }
             $frameResponseObject->setConfirmText("Sucessfully updated the visibility of course staff");
             //$portal->set_confirmation( "Sucessfully updated the visibility of course staff" );
         }
     }
     $cache = get_cache_function($group->get_id(), CACHE_LIFETIME_STATIC);
     switch (get_class($group)) {
         case "koala_group_course":
             $html_handler_group = new \koala_html_course($group);
             $html_handler_group->set_context("staff");
             //$members = $cache->call( "lms_steam::group_get_members", $group->steam_group_staff->get_id() );
             $members = \lms_steam::group_get_members($group->steam_group_staff->get_id());
             break;
         default:
             $html_handler_group = new \koala_html_group($group);
             $html_handler_group->set_context("staff");
             //$members = $cache->call( "lms_steam::group_get_members", $group->get_id() );
             $members = \lms_steam::group_get_members($group->get_id());
             break;
     }
     $is_admin = $group->is_admin($user);
     $content = \Course::getInstance()->loadTemplate("list_staff.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "list_staff.template.html" );
     $no_members = count($members);
     //DONE
     if ($no_members > 0) {
         $pageIterator = \lms_portal::get_paginator(10, $no_members, "(" . str_replace("%NAME", h($group->get_name()), gettext("%TOTAL members in %NAME")) . ")");
         $content->setVariable("PAGEITERATOR", $pageIterator["html"]);
         $start = $pageIterator["startIndex"];
         //$start = $portal->set_paginator( $content, 10, $no_members, "(" . str_replace( "%NAME", h($group->get_name()), gettext( "%TOTAL members in %NAME" ) ) . ")" );
         $end = $start + 10 > $no_members ? $no_members : $start + 10;
         $content->setVariable("LABEL_CONTACTS", gettext("staff member") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_members), gettext("%a-%z out of %s")) . ")");
         $content->setCurrentBlock("BLOCK_CONTACT_LIST");
         $content->setVariable("LABEL_NAME_POSITION", gettext("Name, position"));
         !COURSE_STAFF_FACULTY_AND_FOCUS or $content->setVariable("LABEL_SUBJECT_AREA", gettext("Origin/Focus"));
         $content->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
         if (\lms_steam::is_koala_admin($user) || !COURSE_KOALAADMIN_ONLY && $is_admin) {
             !COURSE_STAFFLIST_MANAGE or $content->setVariable("TH_MANAGE_CONTACT", gettext("Action"));
             !COURSE_STAFFLIST_HIDE or $content->setVariable("TH_STAFF_MEMBER_VISIBILITY", gettext("hidden"));
             !COURSE_STAFFLIST_HIDE or $content->setVariable("STAFF_MEMBER_VISIBILITY_TITLE", gettext("Selected staff members will not be visible on the course start page."));
         }
         !COURSE_STAFF_EXTENSIONS or $content->setVariable("TH_MANAGE_EXTENSIONS", "Status");
         $content->setVariable("BEGIN_HTML_FORM", "<form method=\"POST\" action=\"\">");
         $content->setVariable("END_HTML_FORM", "</form>");
         $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
         if (!is_array($hidden_members)) {
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Staff.class.php

示例5: frameResponse

 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;
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Configuration.class.php

示例6: execute


//.........这里部分代码省略.........
             $user->set_attribute("OBJ_ICON", 0);
             // set the default user icon by acquiring OBJ_ICON from icons module
             $user->set_acquire_attribute("OBJ_ICON", $GLOBALS["STEAM"]->get_module("icons"));
             // delete previous user icon object
             if ($old_icon instanceof steam_document) {
                 if ($old_icon->get_path() != "/images/doctypes/user_unknown.jpg" && $old_icon->check_access_write($user)) {
                     $this->clean_iconcache($old_icon);
                     $old_icon->delete();
                 }
             }
             $confirmText = gettext("Your profile icon has been deleted.");
             $this->clean_usericoncache($user);
         } else {
             // upload new icon
             if (count($_FILES) == 0) {
                 $problem = gettext("No image specified.") . " ";
                 $hint = gettext("Please choose an image on your local disk to upload.") . " ";
             }
             if (strpos($_FILES["icon"]["type"], "image") === FALSE) {
                 $problem .= gettext("File is not an image.") . " ";
                 $hint .= gettext("The icon has to be an image file (JPG, GIF or PNG).");
             }
             if ((int) $_FILES["icon"]["size"] > 256000) {
                 $problem .= gettext("File is larger than 250 KByte.");
                 $hint .= gettext("It is only allowed to upload profile icons with file size smaller than 250 KByte.");
             }
             if (empty($problem)) {
                 $user->set_acquire_attribute("OBJ_ICON", 0);
                 $user->delete_value("OBJ_ICON");
                 $old_icon = $user->get_attribute("OBJ_ICON");
                 ob_start();
                 readfile($_FILES["icon"]["tmp_name"]);
                 $content = ob_get_contents();
                 ob_end_clean();
                 $filename = str_replace(array("\\", "'"), array("", ""), $_FILES["icon"]["name"]);
                 if ($old_icon instanceof steam_document && $old_icon->check_access_write($user)) {
                     $new_icon = $old_icon;
                     $new_icon->set_attribute("OBJ_NAME", $filename);
                     $new_icon->set_content($content);
                     $new_icon->set_attribute("DOC_MIME_TYPE", $_FILES["icon"]["type"]);
                 } else {
                     $new_icon = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $filename, $content, $_FILES["icon"]["type"], FALSE);
                     $new_icon->set_attribute("OBJ_TYPE", "document_icon_usericon");
                 }
                 $user->set_attribute("OBJ_ICON", $new_icon);
                 $all_user = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "sTeam");
                 $new_icon->set_read_access($all_user);
                 $GLOBALS["STEAM"]->buffer_flush();
                 // clean cache-related data
                 $this->clean_usericoncache($user);
                 $confirmText = gettext("Your profile icon has been changed.");
             } else {
                 $frameResponseObject->setProblemDescription($problem);
             }
         }
     }
     $content = \Profile::getInstance()->loadTemplate("profile_icon.template.html");
     //$content = new \HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "profile_icon.template.html" );
     //$content->setVariable( "INFO_TEXT", gettext( "Your buddy icon is what we use to represent you when you're in koaLA." ) );
     if (PLATFORM_ID == "bid") {
         $content->setVariable("INFO_TEXT", "Hier können Sie ein Benutzerbild hinterlegen. Dieses wird beispielsweise an Ihren Dokumenten und Forenbeiträgen zusammen mit Ihrem Namen angezeigt.");
     } else {
         $content->setVariable("INFO_TEXT", "Das Benutzerbild wird Sie in " . PLATFORM_NAME . " repräsentieren");
     }
     $content->setVariable("WINDOW_CONFIRM_TEXT", gettext("Are you sure you want to delete your current buddy icon?"));
     $content->setVariable("LABEL_DELETE", gettext("DELETE"));
     $user->delete_value("OBJ_ICON");
     $icon = $user->get_attribute("OBJ_ICON");
     if ($icon instanceof \steam_object) {
         $icon_id = $icon->get_id();
         // if user icon is acquired (= default icon) hide the delete button
         if (is_object($user->get_acquire_attribute("OBJ_ICON"))) {
             $content->setVariable("HIDE_BUTTON", "style='display:none;'");
         }
     } else {
         $icon_id = 0;
         $content->setVariable("HIDE_BUTTON", "style='display:none;'");
     }
     // use it in 140x185 standard thumb size to optimize sharing of icon cache data
     $icon_link = $icon_id == 0 ? PATH_URL . "styles/standard/images/anonymous.jpg" : PATH_URL . "download/image/" . $icon_id . "/140/185";
     $content->setVariable("USER_IMAGE", $icon_link);
     $content->setVariable("LABEL_YOUR_BUDDY_ICON", gettext("This is your buddy icon at the moment."));
     $content->setVariable("LABEL_REPLACE", gettext("Replace with an image"));
     $content->setVariable("LABEL_UPLOAD_INFO", gettext("The uploaded file has to be an image file (JPG, GIF or PNG), should have the dimensions of 140 x 185 pixels and <b>may not be larger than 250 KByte</b>. "));
     $content->setVariable("LABEL_UPLOAD", gettext("Upload"));
     if (PLATFORM_ID == "bid") {
         $breadcrumb = array(array("name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), "link" => PATH_URL . "home"), array("name" => gettext("Profile"), "link" => PATH_URL . "profile/"), array("name" => gettext("Your buddy icon")));
     } else {
         $breadcrumb = array(array("name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), "link" => PATH_URL . "profile/" . "index/" . $user->get_name() . "/"), array("name" => gettext("Profile"), "link" => PATH_URL . "profile/index/" . $user->get_name() . "/"), array("name" => gettext("Your buddy icon")));
     }
     $frameResponseObject->setHeadline($breadcrumb);
     $frameResponseObject->setConfirmText($confirmText);
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
     //$portal->set_page_main($breadcrumb, $content->get(), "");
     //return $portal->get_html();
 }
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Image.class.php

示例7: frameResponse

 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.");
     }
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Users.class.php

示例8: execute

 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //if (!defined("OBJ_ID")) define( "OBJ_ID", $weblog->get_id() );
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $weblogId);
     if (!defined("OBJ_ID")) {
         define("OBJ_ID", $weblog->get_id());
     }
     $env = $weblog->get_environment();
     $grp = $env->get_creator();
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     $accessmergel = FALSE;
     if (isset($weblog) && is_object($weblog)) {
         $creator = $weblog->get_creator();
         if ($weblog->get_attribute(KOALA_ACCESS) == PERMISSION_UNDEFINED && \lms_steam::get_current_user()->get_id() != $creator->get_id() && !\lms_steam::is_koala_admin(lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         if (get_magic_quotes_gpc()) {
             if (!empty($values['name'])) {
                 $values['name'] = stripslashes($values['name']);
             }
             if (!empty($values['dsc'])) {
                 $values['dsc'] = stripslashes($values['dsc']);
             }
         }
         if (empty($values["name"])) {
             $problems = gettext("The name of the weblog is missing.");
             $hints = gettext("Please type in a name.");
         }
         if (strpos($values["name"], "/")) {
             if (!isset($problems)) {
                 $problems = "";
             }
             $problems .= gettext("Please don't use the \"/\"-char in the name of the weblog.");
         }
         if (empty($problems)) {
             $group_members = $grp;
             $group_admins = 0;
             $group_staff = 0;
             // check if group is a course
             $grouptype = (string) $grp->get_attribute("OBJ_TYPE");
             if ($grouptype == "course") {
                 $group_staff = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".staff");
                 $group_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
                 $group_members = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
                 $workroom = $group_members->get_workroom();
             } else {
                 $workroom = $grp->get_workroom();
             }
             if (!isset($weblog) || !is_object($weblog)) {
                 $weblog_new = \steam_weblog::create_steam_structure($GLOBALS["STEAM"], $values["name"], $values["dsc"], $env);
                 $_SESSION["confirmation"] = str_replace("%NAME", h($values["name"]), gettext("New weblog '%NAME' created."));
             } else {
                 $weblog->set_attribute(OBJ_NAME, $values["name"]);
                 $weblog->set_attribute(OBJ_DESC, $values["dsc"]);
                 $frameResponseObject->setConfirmText(gettext("The changes have been saved."));
                 //$portal->set_confirmation( gettext( "The changes have been saved." ));
                 $weblog_new = $weblog;
             }
             //var_dump($weblog_new);die;
             $koala_weblog = new \lms_weblog($weblog_new);
             $access = (int) $values["access"];
             //var_dump($access);
             $access_descriptions = \lms_weblog::get_access_descriptions($grp);
             //var_dump(!$accessmergel);die;
             //if (!$accessmergel) $koala_weblog->set_access( $access, $access_descriptions[$access]["members"] , $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins );
             // HIER DER NEUE CODE::ENDE
             $GLOBALS["STEAM"]->buffer_flush();
             $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
             $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_CALENDAR, array("WEBLOG_LANGUAGE"));
             $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             if (!isset($weblog) || !is_object($weblog)) {
                 header("Location: " . $backlink);
                 exit;
             }
         } else {
             //TODO:PROBLEMDESCRIPTION
             //$portal->set_problem_description( $problems, isset($hints)?$hints:"" );
         }
     }
     $content = \Weblog::getInstance()->loadTemplate("object_new.template.html");
     //$content = new HTML_TEMPLATE_IT( PATH_TEMPLATES );
     //$content->loadTemplateFile( "object_new.template.html" );
     if (isset($weblog) && is_object($weblog)) {
         $content->setVariable("INFO_TEXT", str_replace("%NAME", h($weblog->get_name()), gettext("You are going to edit the weblog '<b>%NAME</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Save changes"));
         $pagetitle = gettext("Preferences");
         if (empty($values)) {
             $values = array();
             $values["name"] = $weblog->get_name();
             $values["dsc"] = $weblog->get_attribute(OBJ_DESC);
             $values["access"] = $weblog->get_attribute(KOALA_ACCESS);
         }
         $breadcrumbheader = gettext("Preferences");
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Edit.class.php

示例9: execute

 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_guest_allowed( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$portal_user = $portal->get_user();
     //$path = $request->getPath();
     $current_semester = $this->params[1];
     $group_course = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "Courses." . $this->params[0] . "." . $this->params[1]);
     $course = new \koala_group_course($group_course);
     //$html_handler_course = new \koala_html_course($course);
     $group = $course;
     /*if ( ! $group instanceof koala_group )
     		throw new Exception( "Variable group not set." );
     		*/
     if (COURSE_PARTICIPANTS_STAFF_ONLY && !$group->is_admin($user)) {
         header("location:../");
         exit;
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if (is_array($_POST["remove"])) {
             $id = key($_POST["remove"]);
             $member_to_kick = \steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $id);
             $group->remove_member($member_to_kick);
             $frameResponseObject->setConfirmText(str_replace("%NAME", h($member_to_kick->get_attribute("USER_FIRSTNAME")) . " " . h($member_to_kick->get_attribute("USER_FULLNAME")), gettext("User %NAME successfully removed from group members.")));
             //$portal->set_confirmation( str_replace( "%NAME", h($member_to_kick->get_attribute( "USER_FIRSTNAME" ))." " . h($member_to_kick->get_attribute( "USER_FULLNAME" )), gettext( "User %NAME successfully removed from group members." ) ) );
             // clear caches:
             $cache = get_cache_function($member_to_kick->get_name());
             $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), TRUE);
             $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), FALSE);
             $cache->drop("lms_steam::user_get_profile", $member_to_kick->get_name());
             $cache->drop("lms_portal::get_menu_html", $member_to_kick->get_name(), TRUE);
             $cache = get_cache_function($group->get_id());
             $cache->drop("lms_steam::group_get_members", $group->get_id());
         }
     }
     $cache = get_cache_function($group->get_id(), CACHE_LIFETIME_STATIC);
     switch (get_class($group)) {
         case "koala_group_course":
             $html_handler_group = new \koala_html_course($group);
             $html_handler_group->set_context("members");
             $members = $cache->call("lms_steam::group_get_members", $group->steam_group_learners->get_id());
             break;
         default:
             $html_handler_group = new \koala_html_group($group);
             $html_handler_group->set_context("members");
             $members = $cache->call("lms_steam::group_get_members", $group->get_id());
             break;
     }
     $is_admin = $group->is_admin($user);
     $content = \Course::getInstance()->loadTemplate("list_users.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "list_users.template.html" );
     $is_member = $group->is_member($user);
     //echo "is_member? " . $is_member;
     $privacy_deny_participants = $group->get_attribute("GROUP_PRIVACY");
     //echo "attribute: ''" . $privacy_deny_participants . "''";
     if ($privacy_deny_participants == PERMISSION_GROUP_PRIVACY_DENY_PARTICIPANTS && !$is_member) {
         //echo "*** deny ***";
         $content->setVariable("LABEL_PRIVACY_DENY_PARTICIPANTS", gettext("Participants are hidden."));
     } else {
         //echo "*** permit ***";
         $no_members = count($members);
         if ($no_members > 0) {
             switch (get_class($group)) {
                 case "koala_group_course":
                     $groupname = $group->get_course_id();
                     break;
                 default:
                     $groupname = $group->get_name();
                     break;
             }
             if (!USER_LIST_NO_PAGEING) {
                 $pageIterator = \lms_portal::get_paginator(10, $no_members, "(" . str_replace("%NAME", h($groupname), gettext("%TOTAL members in %NAME")) . ")");
                 $content->setVariable("PAGEITERATOR", $pageIterator["html"]);
                 $start = $pageIterator["startIndex"];
                 //$start = $portal->set_paginator( $content, 10, $no_members, "(" . str_replace( "%NAME", h($groupname), gettext( "%TOTAL members in %NAME" ) ) . ")" );
                 $end = $start + 10 > $no_members ? $no_members : $start + 10;
                 $content->setVariable("LABEL_CONTACTS", gettext("Members") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_members), gettext("%a-%z out of %s")) . ")");
             } else {
                 //if (count($members) > 10) {
                 $content->setVariable("LABEL_CONTACTS", gettext("Members") . " (Anzahl " . count($members) . ")");
                 $content->setCurrentBlock("BLOCK_FILTER");
                 $content->setVariable("HELP_TEXT", "Benutzer lassen sich einfacher finden, indem Sie den Filter verwenden. Tippen Sie einfach einen Teil des Benutzernamen oder der Benutzerkennung in das Textfeld.");
                 $content->setVariable('LABEL_FILTER', "<b>" . gettext('Filter') . "</b>");
                 $start = 0;
                 $end = count($members);
                 //TODO: identify get_filter_html
                 if (COURSE_PARTICIPANTS_EXTENSIONS) {
                     /*	$extensions = $group->get_extensions();
                     		 $html = "";
                     		 foreach($extensions as $extension) {
                     			$html .= $extension->get_filter_html($portal, "filter_user", "extension_data");
                     			}
                     			$content->setCurrentBlock("BLOCK_EXTENSION_FILTER");
                     			$content->setVariable("EXTENSION_FILTER", $html);
                     			$content->parse("BLOCK_EXTENSION_FILTER");
                     			}*/
                     $content->parse("BLOCK_FILTER");
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Learners.class.php


注:本文中的FrameResponseObject::setConfirmText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。