本文整理汇总了PHP中lms_portal类的典型用法代码示例。如果您正苦于以下问题:PHP lms_portal类的具体用法?PHP lms_portal怎么用?PHP lms_portal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了lms_portal类的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: get_instance
public static function get_instance()
{
if (self::$instance == null) {
self::$instance = new lms_portal();
}
return self::$instance;
}
示例5: 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;
}
示例6: 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';
}
}
示例7: 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';
}
示例8: __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;
}
}
示例9: 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.");
}
}
}
示例10: 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"];
}
}
示例11: 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;
}
}
示例12: 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;
}
示例13: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$forum_id = $this->params[0];
$portal = \lms_portal::get_instance();
$user = \lms_steam::get_current_user();
$rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
$author_id = isset($this->params[1]) ? $this->params[1] : null;
if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
include "bad_link.php";
exit;
}
if ($messageboard instanceof \steam_document) {
$thread = $messageboard;
$messageboard = $thread->get_annotating();
define("OBJ_ID", $thread->get_id());
if (!$thread->check_access_read($user)) {
throw new \Exception("No rights to view this.", E_USER_RIGHTS);
}
} else {
define("OBJ_ID", $messageboard->get_id());
if (!$messageboard->check_access_read($user)) {
throw new \Exception("No rights to view this.", E_USER_RIGHTS);
}
}
if (!$messageboard instanceof \steam_messageboard) {
include "bad_link.php";
exit;
}
$is_watching = FALSE;
if (is_array($rss_feeds)) {
foreach (array_keys($rss_feeds) as $item) {
if ($item == $messageboard->get_id()) {
$is_watching = TRUE;
}
}
}
$content = \Messageboard::getInstance()->loadTemplate("forum_all_topics.template.html");
$dsc = $messageboard->get_attribute("OBJ_DESC");
if (!empty($dsc)) {
$content->setCurrentBlock("BLOCK_DESCRIPTION");
$content->setVariable("FORUM_DESCRIPTION", get_formatted_output($dsc));
$content->parse("BLOCK_DESCRIPTION");
}
$grp = $messageboard->get_environment()->get_creator();
if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
$grp = $grp->get_parent_group();
}
$content->setVariable("CURRENT_DISCUSSIONS_LABEL", gettext("Current Thread"));
$content->setVariable("LABEL_SEARCH", gettext("Search"));
if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
\lms_steam::user_add_rssfeed($messageboard->get_id(), PATH_URL . "services/feeds/forum_public.php?id=" . $messageboard->get_id(), "discussion board", \lms_steam::get_link_to_root($messageboard));
$_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
header("Location: " . PATH_URL . "forums/" . $messageboard->get_id() . "/");
exit;
}
if (isset($_GET["action"]) && $_GET["action"] == "delete_bookmark") {
$user = \lms_steam::get_current_user();
$id = (int) $_GET["unsubscribe"];
$feeds = $user->get_attribute("USER_RSS_FEEDS");
if (!is_array($feeds)) {
$feeds = array();
}
unset($feeds[$id]);
$user->set_attribute("USER_RSS_FEEDS", $feeds);
$_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("subscription of '%NAME' canceled."));
header("Location: " . PATH_URL . "forums/" . $messageboard->get_id() . "/");
exit;
}
if (empty($_GET["pattern"]) && !isset($author_id)) {
$cache = get_cache_function(OBJ_ID, 300);
$discussions = $cache->call("lms_forum::get_discussions", OBJ_ID);
} elseif (isset($author_id)) {
$cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 300);
$discussions = $cache->call("lms_forum::search_user_posts", $messageboard->get_id(), $author_id);
} else {
$cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 300);
$discussions = $cache->call("lms_forum::search_pattern", $messageboard->get_id(), $_GET["pattern"]);
}
$content->setVariable("LABEL_ALL_TOPICS", gettext("All Threads"));
if ($messageboard->check_access_annotate(\lms_steam::get_current_user())) {
$content->setCurrentBlock("BLOCK_WRITE_ACCESS");
if (isset($author_id)) {
$content->setVariable("LABEL_THREADS_POSTED_IN", gettext("All Threads"));
// TODO: Passt der link?
$content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/");
} else {
$content->setVariable("LABEL_THREADS_POSTED_IN", gettext("Threads you've posted in"));
// TODO: Passt der link?
$content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/?author=" . \lms_steam::get_current_user()->get_name());
}
// TODO: Passt der link?
$content->setVariable("LINK_POST_NEW", PATH_URL . "messageboard/newDiscussion/" . $messageboard->get_id());
$content->setVariable("LABEL_POST_NEW_THREAD", gettext("Post a new thread"));
$content->parse("BLOCK_WRITE_ACCESS");
}
if ($messageboard->check_access_write(\lms_steam::get_current_user())) {
$content->setCurrentBlock("BLOCK_ADMIN");
$content->setVariable("LINK_EDIT", PATH_URL . "messageboard/editMessageboard/" . $messageboard->get_id());
$content->setVariable("LABEL_EDIT", gettext("Preferences"));
$content->setVariable("LINK_DELETE", PATH_URL . "messageboard/deleteMessageboard/" . $messageboard->get_id());
//.........这里部分代码省略.........
示例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: error
public static function error($error, $solution)
{
$portal = \lms_portal::get_instance();
$portal->set_problem_description($error, $solution);
}