本文整理汇总了PHP中lms_portal::get_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP lms_portal::get_instance方法的具体用法?PHP lms_portal::get_instance怎么用?PHP lms_portal::get_instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lms_portal
的用法示例。
在下文中一共展示了lms_portal::get_instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHtml
public function getHtml()
{
$portal = \lms_portal::get_instance();
$annotations = $this->data->get_annotations();
$annotations = array_reverse($annotations);
$lastAnnotation = 0;
foreach ($annotations as $annotation) {
$this->getContent()->setCurrentBlock("BLOCK_CHAT");
if ($lastAnnotation === 0) {
$lastAnnotation = $annotation->get_attribute("OBJ_CREATION_TIME");
$this->getContent()->setCurrentBlock("BLOCK_STATUS");
$this->getContent()->setVariable("STATUS_MESSAGE", "Diskussion mit " . $portal->get_user()->get_forename() . " " . $portal->get_user()->get_surname() . ".<br>" . getReadableDate($lastAnnotation));
$this->getContent()->parse("BLOCK_STATUS");
} else {
$tmp = $lastAnnotation;
$lastAnnotation = $annotation->get_attribute("OBJ_CREATION_TIME");
if ($lastAnnotation - $tmp > 600) {
$this->getContent()->setCurrentBlock("BLOCK_STATUS");
$this->getContent()->setVariable("STATUS_MESSAGE", getReadableDate($lastAnnotation));
$this->getContent()->parse("BLOCK_STATUS");
}
}
$this->getContent()->setCurrentBlock("BLOCK_OUTGOING");
$this->getContent()->setVariable("OUTGOING_MESSAGE", $annotation->get_content());
$this->getContent()->setVariable("OUTGOING_IMG", \lms_user::get_user_image_url(32, 32));
$this->getContent()->setVariable("OUTGOING_TITLE", $portal->get_user()->get_forename() . " " . $portal->get_user()->get_surname());
$this->getContent()->parse("BLOCK_OUTGOING");
$this->getContent()->parse("BLOCK_CHAT");
}
return $this->getContent()->get();
}
示例2: handle_path
function handle_path($path, $owner = FALSE, $portal = FALSE)
{
if (is_string($path)) {
$path = url_parse_rewrite_path($path);
}
if (!isset($portal) || !is_object($portal)) {
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
}
if (isset($path[0]) && is_numeric($path[0])) {
$steam_unit = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0]);
if (is_object($steam_unit) && $steam_unit->get_attribute("UNIT_TYPE") !== "units_pyramiddiscussion") {
return;
}
$koala_container = new koala_container_pyramiddiscussion($steam_unit, new units_pyramiddiscussion($owner->get_steam_object()));
$unit = $koala_container;
}
$portal_user = $portal->get_user();
$user = lms_steam::get_current_user();
$scg = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
//$current_semester = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), $scg->get_name() . "." . $path[0]);
$current_semester = $owner->get_semester();
//$backlink = PATH_URL . "extensions/units/" . $path[0] ."/" . $path[1] . "/units/";
$backlink = $owner->get_url() . $this->get_path_name() . "/";
$html_handler = new koala_html_course($owner);
$html_handler->set_context("units", array("subcontext" => "unit", "owner" => $owner, "unit" => $unit));
$course = $owner;
include PATH_EXTENSIONS . "units_pyramiddiscussion/modules/units_pyramiddiscussion.php";
}
示例3: getHtml
public function getHtml()
{
if (!self::$once) {
\lms_portal::get_instance()->set_prototype_enabled(false);
\lms_portal::get_instance()->add_javascript_src("jquery", PATH_URL . "widgets/js/jquery.js");
\lms_portal::get_instance()->add_javascript_src("StarRating", PATH_URL . "widgets/js/StarRating.js");
\lms_portal::get_instance()->add_css_style_link(PATH_URL . "widgets/css/StarRating.css");
self::$once = true;
}
$js = <<<END
\$(function(){
\t\$('.star' + {$this->id}).rating({
\t\t\talert("Hund");
\t\t}
\t});
});
END;
$this->getContent()->setVariable("STAR_ID", $this->id);
if ($this->readonly) {
$this->getContent()->setVariable("DISABLED", "disabled=\"disabled\"");
}
if ($this->checked) {
$this->getContent()->setVariable("CHECKED{$this->checked}", "checked=\"checked\"");
}
return "<script>" . $js . "</script>" . $this->getContent()->get();
}
示例4: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$path = $this->params;
$portal = \lms_portal::get_instance();
$user = \lms_steam::get_current_user();
if (!\lms_steam::is_steam_admin($user)) {
//TODO: REDIRECT!!
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$values = $_POST["values"];
$start_date = iso_to_unix($values["start"]);
$end_date = iso_to_unix($values["end"]);
// TODO PROBLEM CHECKING MISSING
$courses = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
$all_user = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
$new_semester = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), $values["name"], $courses, FALSE, $values["desc"]);
$new_semester_admins = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "admins", $new_semester, FALSE, "admin group for " . $values["desc"]);
$new_semester_admins->set_attribute("OBJ_TYPE", "semester_admins");
$new_semester_admins->add_member($user);
$new_semester->set_insert_access($new_semester_admins, TRUE);
$new_semester->set_read_access($all_user, TRUE);
$new_semester->set_attributes(array("SEMESTER_START_DATE" => $start_date, "SEMESTER_END_DATE" => $end_date));
// CACHE ZURÜCKSETZEN
$cache = get_cache_function("ORGANIZATION");
$cache->drop("lms_steam::get_semesters");
header("Location: " . PATH_URL . "semester/index/" . $values["name"] . "/all");
}
$content = \Semester::getInstance()->loadTemplate("semester_create.template.html");
$content->setVariable("INFO_TEXT", gettext("So, you want to start a new semester?") . " " . gettext("Please fill out the requested values on the right.") . "<br/><br/>" . str_replace("%SEMESTER", STEAM_CURRENT_SEMESTER, gettext("And don't forget to reset the current semester in the etc/koala.def.php, which is <b>%SEMESTER</b> at the moment.")));
$content->setVariable("LABEL_NAME", gettext("Shortname"));
$content->setVariable("INFO_NAME", gettext("IMPORTANT: Don't use any slashes, commas or dots in this name. Keep it short, like 'WS0607' or 'SS06'."));
$content->setVariable("LABEL_DESC", gettext("Name"));
$content->setVariable("INFO_DESC", gettext("Examples: 'Wintersemester 06/07', or 'Sommersemester 2006'"));
$content->setVariable("LABEL_START_DATE", gettext("Starting date of semester"));
$content->setVariable("LABEL_END_DATE", gettext("Ending date of semester"));
$content->setVariable("INFO_DATE_FORMAT", gettext("Please type in the date in the following format: YYYY-MM-DD"));
$content->setVariable("LABEL_CREATE", gettext("Create Semester"));
/* TODO: Portal anpassen
$portal->set_page_main(
array(array("link" => PATH_URL.SEMESTER_URL."/", "name" => gettext("Semester")), array("link" => "", "name" => gettext("Create new"))),
$content->get(),
""
);
*/
$rawHtml = new \Widgets\RawHtml();
$rawHtml->setHtml($content->get());
$frameResponseObject->addWidget($rawHtml);
return $frameResponseObject;
}
示例5: handle_path
function handle_path($path, $owner = FALSE, $portal = FALSE)
{
$r = "";
foreach ($path as $s) {
$r .= $s;
}
error_log("Path: " . $r);
if (is_string($path)) {
$path = url_parse_rewrite_path($path);
}
if (!isset($portal) || !is_object($portal)) {
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
}
$steam_unit = "";
$action = "";
if (isset($path[0]) && is_numeric($path[0])) {
$steam_unit = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0]);
if (is_object($steam_unit) && $steam_unit->get_attribute("UNIT_TYPE") !== "units_mediathing") {
return;
}
//TODO: cool. neues object von sich in sich ? Häh, geil!
$unit = new units_elearning($owner->get_steam_object());
$docextern = new koala_object_elearning($steam_unit, $unit);
if (isset($path[1])) {
$action = $path[1];
}
}
$portal_user = $portal->get_user();
$user = lms_steam::get_current_user();
$scg = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
$current_semester = $owner->get_semester();
$course = $owner;
$backlink = $owner->get_url() . $this->get_path_name() . "/";
$html_handler = new koala_html_course($owner);
if (count($path) > 1 && $path[1] == "create_exit") {
// sinnvolle aktionen hier
$action = "create_exit";
include PATH_EXTENSIONS . 'units_mediathing/modules/units_mediathing.php';
} else {
$action = "index";
include PATH_EXTENSIONS . 'units_mediathing/modules/units_mediathing.php';
}
}
示例6: handle_path
function handle_path($path, $owner = FALSE, $portal = FALSE)
{
if (is_string($path)) {
$path = url_parse_rewrite_path($path);
}
if (!isset($portal) || !is_object($portal)) {
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
}
$action = '';
if (isset($path[0]) && is_numeric($path[0])) {
$steam_unit = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0]);
if (is_object($steam_unit) && $steam_unit->get_attribute("UNIT_TYPE") !== "units_extern") {
return;
}
$unit = new units_extern($owner->get_steam_object());
$docextern = new koala_object_docextern($steam_unit, $unit);
if (isset($path[1])) {
$action = $path[1];
}
}
$portal_user = $portal->get_user();
$user = lms_steam::get_current_user();
$scg = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
//$current_semester = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), $scg->get_name() . "." . $path[0]);
$current_semester = $owner->get_semester();
$course = $owner;
//$backlink = PATH_URL . "extensions/units/" . $path[0] ."/" . $path[1] . "/units/";
$backlink = $owner->get_url() . $this->get_path_name() . "/";
$html_handler = new koala_html_course($owner);
$html_handler->set_context("units", array('subcontext' => 'unit', 'owner' => $owner, 'unit' => $docextern));
switch ($action) {
case 'edit':
include self::$PATH . 'modules/units_extern_edit.php';
exit;
break;
case 'delete':
include self::$PATH . 'modules/units_extern_delete.php';
exit;
break;
}
include PATH_EXTENSIONS . 'units_extern/modules/units_extern.php';
}
示例7: __construct
function __construct()
{
$this->portal = lms_portal::get_instance();
$this->portal->initialize(GUEST_NOT_ALLOWED);
$this->user = lms_steam::get_current_user();
$this->cache = get_cache_function($this->user->get_name(), 86400);
$this->request = $_REQUEST;
$this->post = $_POST;
switch ($this->request['action']) {
case "sort_inventory":
$this->sort_inventory();
break;
case "get_user_attribute":
$this->get_user_attribute();
break;
case "set_user_attribute":
$this->set_user_attribute();
break;
case "set_boxes":
$this->set_boxes();
break;
case "get_boxes":
$this->get_boxes();
break;
case "get_current_user":
$this->get_current_user();
break;
case "set_courses_units_boxes":
$this->set_courses_units_boxes();
break;
case "get_courses_units_boxes":
$this->get_courses_units_boxes();
break;
case "set_list_inventory_boxes":
$this->set_list_inventory_boxes();
break;
case "get_list_inventory_boxes":
$this->get_list_inventory_boxes();
break;
}
}
示例8: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$portal = \lms_portal::get_instance();
$content = \Wave::getInstance()->loadTemplate("wave.template.html");
if (strtolower($this->calledNamespace) === "wave" && strtolower($this->calledCommand) === "index") {
$sideId = $this->params[0];
$internalPath = $this->params;
array_shift($internalPath);
$sideUrl = $this->getExtension()->getExtensionUrl() . "Index/" . $sideId . "/";
} else {
$sideObject = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), WAVE_PATH_INTERN);
if ($sideObject instanceof \steam_object) {
$sideId = $sideObject->get_id();
$internalPath = $this->params;
$sideUrl = PATH_URL;
} else {
die("WAVE config broken (WAVE_PATH_INTERN: " . WAVE_PATH_INTERN . ")");
}
}
if (!isset($internalPath)) {
$internalPath = array();
}
$waveEngine = new \Wave\Model\WaveEngine($sideId, $internalPath, $sideUrl);
$waveSide = $waveEngine->getSide();
$waveObject = $waveEngine->getCurrentObject();
if ($waveObject instanceof \Wave\Model\WavePage) {
$content->setVariable("CONTENT", $waveObject->getHtml());
$rawHtml = new \Widgets\RawHtml();
$rawHtml->setHtml($content->get());
$frameResponseObject->addWidget($rawHtml);
return $frameResponseObject;
} else {
if ($waveObject instanceof \Wave\Model\WaveDownload) {
$waveObject->download();
die;
} else {
die("Not Wave-Object detected.");
}
}
}
示例9: handleRequest
public function handleRequest($pathArray)
{
$frame = lms_portal::get_instance();
//$frame->initialize(GUEST_NOT_ALLOWED, false);
$frame->init_login(GUEST_ALLOWED, false);
lms_steam::connect(STEAM_SERVER, STEAM_PORT, $frame->get_user()->get_login(), $frame->get_user()->get_password());
$urlRequestObject = new UrlRequestObject();
$urlRequestObject->setParams($pathArray);
$command = new \Wave\Commands\Index();
if ($command->validateData($urlRequestObject)) {
$command->processData($urlRequestObject);
try {
$frameResponeObject = $command->frameResponse(new FrameResponseObject());
} catch (steam_exception $e) {
if ($e->get_code() === 300) {
die("no read access");
}
}
$data = \Widgets\Widget::getData($frameResponeObject->getWidgets());
echo $data["html"];
}
}
示例10: handle_path
function handle_path($path, $owner = FALSE, $portal = FALSE)
{
if (!isset($portal) || !is_object($portal)) {
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
}
if (isset($path[0]) && is_numeric($path[0])) {
$steam_unit = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0]);
if (is_object($steam_unit) && $steam_unit->get_attribute("UNIT_TYPE") !== "units_pointlist") {
return;
}
$koala_container = new koala_container_pointlist($steam_unit, new units_pointlist($owner->get_steam_object()));
$unit = $koala_container;
}
$backlink = $owner->get_url() . $this->get_path_name() . "/";
$html_handler = new koala_html_course($owner);
$html_handler->set_context("units", array("subcontext" => "unit", "owner" => $owner, "unit" => $unit));
$user = lms_steam::get_current_user();
$course = $owner;
if (is_string($path)) {
$path = url_parse_rewrite_path($path);
}
if (!is_object($owner) || !$owner instanceof koala_group_course) {
throw new Exception("No owner (course) provided.", E_PARAMETER);
}
switch (TRUE) {
case isset($path[1]) && $path[1] == "sheets_edit":
include PATH_EXTENSIONS . "units_pointlist/modules/units_pointlist_sheets_edit.php";
break;
case isset($path[1]) && $path[1] == "export_excel":
include PATH_EXTENSIONS . "units_pointlist/modules/units_pointlist_excel.php";
break;
default:
include PATH_EXTENSIONS . "units_pointlist/modules/units_pointlist.php";
break;
}
}
示例11: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$portal = \lms_portal::get_instance();
$user = \lms_steam::get_current_user();
$frameResponseObject->setTitle(gettext("Your Desktop"));
// Cache for 7 Minutes
$cache = get_cache_function($user->get_name(), 420);
$feeds = $cache->call("koala_user::get_news_feeds_static", 0, 10, FALSE, $user);
$home = \Home::getInstance();
//$home->addJS();
$content = $home->loadTemplate("home.template.html");
$infobar = new \Widgets\InfoBar();
$infobar->setHeadline(gettext("Hallo") . " " . $portal->get_user()->get_forename() . " " . $portal->get_user()->get_surname() . "!");
$content->setVariable("INFOBAR", $infobar->getHtml());
$captionImage = new \Widgets\CaptionImage();
$captionImage->setLink(PATH_URL . "user/index/" . $user->get_name() . "/");
$captionImage->setLinkText(gettext("To your profile"));
$captionImage->setImageSrc(\lms_user::get_user_image_url(140, 185));
$captionImage->setImageAlt(gettext("Profile Image"));
$captionImage->setImageTitle(gettext("Complete your Profile"));
$content->setVariable("PROFILEIMAGE", $captionImage->getHtml());
$rawHtml = new \Widgets\RawHtml();
$rawHtml->addWidget($infobar);
$rawHtml->addWidget($captionImage);
$homeExtensions = \ExtensionMaster::getInstance()->getExtensionByType("IHomeExtension");
foreach ($homeExtensions as $homeExtension) {
$content->setCurrentBlock("HOME_EXTENSION");
$widget = $homeExtension->getWidget();
$rawHtml->addWidget($widget);
$content->setVariable("HOME_EXTENSION_CONTENT", $widget->getHtml());
$content->parse("HOME_EXTENSION");
}
$rawHtml->setHtml($content->get());
$frameResponseObject->addWidget($rawHtml);
return $frameResponseObject;
}
示例12: error
public static function error($error, $solution)
{
$portal = \lms_portal::get_instance();
$portal->set_problem_description($error, $solution);
}
示例13: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$portal = \lms_portal::get_instance();
if (!isset($messageboard) || !is_object($messageboard)) {
if (empty($this->params[0])) {
throw new \Exception("Environment not set.");
}
if (empty($this->params[1])) {
throw new \Exception("Group not set.");
}
if (!($env = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[0]))) {
throw new \Exception("Environment unknown.");
}
if (!($grp = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]))) {
throw new \Exception("Group unknown");
}
}
$accessmergel = FALSE;
if (isset($messageboard) && is_object($messageboard)) {
$creator = $messageboard->get_creator();
if ($messageboard->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;
}
}
// TODO: Passt der link?
$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 new message board 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 the forum name.");
}
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($messageboard) || !is_object($messageboard)) {
$new_forum = \steam_factory::create_messageboard($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["dsc"]);
$_SESSION["confirmation"] = str_replace("%NAME", h($values["name"]), gettext("New forum '%NAME' created."));
} else {
$messageboard->set_attribute(OBJ_NAME, $values["name"]);
$messageboard->set_attribute(OBJ_DESC, $values["dsc"]);
$portal->set_confirmation(gettext("The changes have been saved."));
$new_forum = $messageboard;
}
$koala_forum = new \lms_forum($new_forum);
$access = (int) $values["access"];
$access_descriptions = \lms_forum::get_access_descriptions($grp);
if (!$accessmergel) {
$koala_forum->set_access($access, $access_descriptions[$access]["members"], $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins);
}
$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_MESSAGEBOARD, array("FORUM_LANGUAGE"));
$cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
if (!isset($messageboard) || !is_object($messageboard)) {
header("Location: " . $backlink);
exit;
}
} else {
$portal->set_problem_description($problems, isset($hints) ? $hints : "");
}
}
$content = \Messageboard::getInstance()->loadTemplate("object_new.template.html");
if (isset($messageboard) && is_object($messageboard)) {
$content->setVariable("INFO_TEXT", str_replace("%NAME", h($messageboard->get_name()), gettext("You are going to edit the forum '<b>%NAME</b>'.")));
$content->setVariable("LABEL_CREATE", gettext("Save changes"));
$pagetitle = gettext("Preferences");
if (empty($values)) {
$values = array();
$values["name"] = $messageboard->get_name();
$values["dsc"] = $messageboard->get_attribute(OBJ_DESC);
$values["access"] = $messageboard->get_attribute(KOALA_ACCESS);
}
$breadcrumbheader = gettext("Preferences");
} else {
//.........这里部分代码省略.........
示例14: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$workplanExtension = \Workplan::getInstance();
$workplanExtension->addJS();
$workplanExtension->addJS($fileName = 'jsgantt.js');
$workplanExtension->addCSS($fileName = 'jsgantt.css');
$user = $GLOBALS["STEAM"]->get_current_steam_user();
$portal = \lms_portal::get_instance();
$objectID = $this->params[0];
$workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectID);
if (is_object($workplanContainer) && $workplanContainer instanceof \steam_room) {
$tabBar = new \Widgets\TabBar();
$tabBar->setTabs(array(array("name" => "Überblick", "link" => $this->getExtension()->getExtensionUrl() . "overview/" . $objectID), array("name" => "Tabelle", "link" => $this->getExtension()->getExtensionUrl() . "listView/" . $objectID), array("name" => "Gantt-Diagramm", "link" => $this->getExtension()->getExtensionUrl() . "ganttView/" . $objectID), array("name" => "Mitarbeiter", "link" => $this->getExtension()->getExtensionUrl() . "users/" . $objectID), array("name" => "Snapshots", "link" => $this->getExtension()->getExtensionUrl() . "snapshots/" . $objectID)));
$tabBar->setActiveTab(4);
$frameResponseObject->addWidget($tabBar);
$xmlfile = $workplanContainer->get_inventory_filtered(array(array("+", "class", CLASS_DOCUMENT)));
// if user submitted new snapshot dialog add a now annotation/snapshot
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["new_snapshot"])) {
$values = $_POST["values"];
$newannotation = \steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), $values["snapshotname"], strval($xmlfile[0]->get_version()), $workplanContainer);
$xmlfile[0]->add_annotation($newannotation);
$portal->set_confirmation("Snapshot " . $values["snapshotname"] . " erfolgreich erstellt.");
}
// display snapshot list
$content = $workplanExtension->loadTemplate("workplan_snapshots.template.html");
$snapshots = $xmlfile[0]->get_annotations();
$howmany = count($snapshots);
if ($howmany > 0) {
$content->setCurrentBlock("BLOCK_SNAPSHOTS_LIST");
$content->setVariable("NAME_LABEL", "Name");
$content->setVariable("DATE_LABEL", "Datum");
$content->setVariable("VIEW_LABEL", "Ansicht");
for ($count = count($snapshots) - 1; $count >= 0; $count--) {
$content->setCurrentBlock("BLOCK_SNAPSHOTS_LIST_ELEMENT");
$content->setVariable("ELEMENT_NAME", $snapshots[$count]->get_name());
$timestamp = $snapshots[$count]->get_attribute("OBJ_CREATION_TIME");
$content->setVariable("ELEMENT_DATE", strftime("%x %X", $timestamp));
$content->setVariable("ELEMENT_LIST", "Tabelle");
$content->setVariable("ELEMENT_GANTT", "Gantt-Diagramm");
$content->setVariable("WORKPLAN_VERSION", $snapshots[$count]->get_content());
$content->setVariable("WORKPLAN_ID", $objectID);
$content->setVariable("ANNOTATION_ID", $count);
$version = $snapshots[$count]->get_content();
if ($version == $xmlfile[0]->get_version()) {
$viewversion = $xmlfile[0];
} else {
$previousversions = $xmlfile[0]->get_previous_versions();
$viewversion = $previousversions[count($previousversions) - $version];
}
// change information of every snapshot to a form which is used to create the gantt view
$xml = simplexml_load_string($viewversion->get_content());
$helpToArray = $xml->children();
$list = array();
for ($counter = 0; $counter < count($helpToArray); $counter++) {
array_push($list, $helpToArray[$counter]);
}
usort($list, 'sort_xmllist');
$oids = "";
$names = "";
$start = "";
$end = "";
$depends = "";
$milestones = "";
for ($count2 = 0; $count2 < count($list); $count2++) {
$oids = $oids . $list[$count2]->oid . ",";
$names = $names . $list[$count2]->name . ",";
$start = $start . $list[$count2]->start . ",";
$end = $end . $list[$count2]->end . ",";
$depends = $depends . $list[$count2]->depends . ",";
if ($list[$count2]->getName() == 'milestone') {
$milestones = $milestones . "1,";
} else {
$milestones = $milestones . "0,";
}
}
$oids = "[" . substr($oids, 0, strlen($oids) - 1) . "]";
$names = "[" . substr($names, 0, strlen($names) - 1) . "]";
$start = "[" . substr($start, 0, strlen($start) - 1) . "]";
$end = "[" . substr($end, 0, strlen($end) - 1) . "]";
$depends = "[" . substr($depends, 0, strlen($depends) - 1) . "]";
$milestones = "[" . substr($milestones, 0, strlen($milestones) - 1) . "]";
$content->setVariable("WORKPLAN_OIDS", $oids);
$content->setVariable("WORKPLAN_NAMES", $names);
$content->setVariable("WORKPLAN_STARTS", $start);
$content->setVariable("WORKPLAN_ENDS", $end);
$content->setVariable("WORKPLAN_DEPENDS", $depends);
$content->setVariable("WORKPLAN_MILESTONES", $milestones);
$content->parse("BLOCK_SNAPSHOTS_LIST_ELEMENT");
}
$content->parse("BLOCK_SNAPSHOTS_LIST");
} else {
$content->setCurrentBlock("BLOCK_SNAPSHOTS_NO_LIST");
$content->setVariable("NO_SNAPSHOTS", "Keine Snapshots zu diesem Projektplan vorhanden.");
$content->parse("BLOCK_SNAPSHOTS_NO_LIST");
}
// if current user has the required rights display create snapshot dialog
$content->setCurrentBlock("BLOCK_NEW_SNAPSHOT");
$content->setVariable("WORKPLAN_ID", $objectID);
$content->setVariable("LABEL_NEW_SNAPSHOT", "Neuen Snapshot erstellen");
$content->setVariable("LABEL_NAME", "Name:*");
//.........这里部分代码省略.........
示例15: getHtml
public function getHtml()
{
\lms_portal::get_instance()->add_css_style_link(PATH_URL . "widgets/css/underconstruction.css");
$this->getContent()->setVariable("DUMMY", "");
return $this->getContent()->get();
}