Skip to content

Commit

Permalink
Merge branch 'trunk' into release_6-0_xapi
Browse files Browse the repository at this point in the history
  • Loading branch information
bheyser committed Nov 17, 2019
2 parents 9611564 + 12efee2 commit bd4f1b3
Show file tree
Hide file tree
Showing 10 changed files with 205 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */

/**
* Classic table for rep object lists, including checkbox
*
* @author [email protected]
*/
class ilDashObjectsTableGUI extends ilTable2GUI
{
/**
* @var ilCtrl
*/
protected $ctrl;

/**
* @var ilLanguage
*/
protected $lng;

/**
* Constructor
*/
function __construct($a_parent_obj, $a_parent_cmd, $sub_id)
{
global $DIC;

$this->id = "dash_obj_".$sub_id;
$this->lng = $DIC->language();
$this->ctrl = $DIC->ctrl();

parent::__construct($a_parent_obj, $a_parent_cmd);

//$this->setData($this->getItems());
$this->setTitle($this->lng->txt(""));

$this->addColumn("", "", "", true);

$this->setEnableNumInfo(false);
$this->setEnableHeader(false);

//$this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
$this->setRowTemplate("tpl.dash_obj_row.html", "Services/Dashboard");

//$this->addMultiCommand("", $this->lng->txt(""));
//$this->addCommandButton("", $this->lng->txt(""));
$this->setLimit(9999);
}

/**
* Get items
*
* @return array[]
*/
/*
protected function getItems()
{
$items = [];
return $items;
}*/

/**
* Fill table row
*/
protected function fillRow($a_set)
{
$tpl = $this->tpl;
$ctrl = $this->ctrl;
$lng = $this->lng;

$tpl->setVariable("ID", $a_set["ref_id"]);
$tpl->setVariable("ICON", ilObject::_getIcon($a_set["obj_id"]));
$tpl->setVariable("TITLE", $a_set["title"]);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php declare(strict_types=1);

/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */

/**
* Dashboard objects table renderer
*/
class ilDashObjectsTableRenderer
{
protected $parent_gui;

/**
* Constructor
* @param $parent_gui
*/
public function __construct($parent_gui)
{
$this->parent_gui = $parent_gui;
}


/**
* @inheritDoc
*/
public function render(array $groupedItems): string
{
$cnt = 0;
$html = "";
foreach ($groupedItems as $group) {

$items = $group->getItems();
if (count($items) > 0) {
$table = new ilDashObjectsTableGUI($this->parent_gui, "render", $cnt++);
$table->setTitle($group->getLabel());
$table->setData($group->getItems());
$html .= $table->getHTML();
}
}
return $html;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class ilPDMembershipBlockGUI extends ilPDSelectedItemsBlockGUI
public function __construct()
{
parent::__construct();
$this->lng->loadLanguageModule("dash");
$this->lng->loadLanguageModule("mmbr");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ protected function getGroupedCommandsForView() : array
foreach ($sortings as $sorting) {
$this->ctrl->setParameter($this, 'sorting', $sorting);
$sortingCommands[] = [
'txt' => $this->lng->txt('pd_sort_by_' . $sorting),
'txt' => $this->lng->txt('dash_sort_by_' . $sorting),
'url' => $this->ctrl->getLinkTarget($this, 'changePDItemSorting'),
'xxxasyncUrl' => $this->ctrl->getLinkTarget($this, 'changePDItemSorting', '', true),
'active' => $sorting === $effectiveSorting,
Expand Down Expand Up @@ -497,7 +497,7 @@ function manageObject()

$button2 = ilSubmitButton::getInstance();
$button2->setCaption('cancel');
$button2->setCommand('getHTML');
$button2->setCommand('cancel');
$top_tb->addStickyItem($button2);

$top_tb->setCloseFormTag(false);
Expand All @@ -508,8 +508,20 @@ function manageObject()
$bot_tb->addStickyItem($button2);
$bot_tb->setOpenFormTag(false);

return $top_tb->getHTML() . $this->getHTML() . $bot_tb->getHTML();
return $top_tb->getHTML() . $this->renderManageList() . $bot_tb->getHTML();
}

/**
* Cancel
*
* @param
* @return
*/
protected function cancel()
{
$this->ctrl->returnToParent($this);
}


public function confirmRemoveObject()
{
Expand All @@ -522,7 +534,7 @@ public function confirmRemoveObject()
}

if ($this->viewSettings->isSelectedItemsViewActive()) {
$question = $this->lng->txt('rep_info_sure_remove_from_favs');
$question = $this->lng->txt('dash_info_sure_remove_from_favs');
$cmd = 'confirmedRemove';
} else {
$question = $this->lng->txt('mmbr_info_delete_sure_unsubscribe');
Expand Down Expand Up @@ -559,7 +571,7 @@ public function confirmedRemove()
}

foreach ($refIds as $ref_id) {
// @todo: decline and remove favourites
$this->favourites->remove($this->user->getId(), $ref_id);
}

// #12909
Expand Down Expand Up @@ -611,13 +623,12 @@ public function confirmedUnsubscribe()
}

include_once './Modules/Forum/classes/class.ilForumNotification.php';
ilForumNotification::checkForumsExistsDelete($ref_id, $ilUser->getId());
ilForumNotification::checkForumsExistsDelete($ref_id, $this->user->getId());
}
}

ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
$this->ctrl->setParameterByClass('ildashboardgui', 'view', $this->viewSettings->getCurrentView());
$this->ctrl->redirectByClass('ildashboardgui', 'show');
ilUtil::sendSuccess($this->lng->txt('mmbr_unsubscribed_from_objs'), true);
$this->ctrl->returnToParent($this);
}

//
Expand Down Expand Up @@ -757,4 +768,24 @@ protected function getLegacyContent(): string
return $renderer->render($grouped_items, false);
}

protected function renderManageList(): string
{
$groupedCommands = $this->getGroupedCommandsForView();
foreach ($groupedCommands as $group) {
foreach ($group as $command) {
$this->addBlockCommand(
(string) $command['url'],
(string) $command['txt'],
(string) $command['asyncUrl']
);
}
}

$grouped_items = $this->blockView->getItemGroups();

$renderer = new ilDashObjectsTableRenderer($this);

return $renderer->render($grouped_items);
}

}
23 changes: 22 additions & 1 deletion Services/Dashboard/classes/class.ilDashboardGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function __construct()
$this->lng->loadLanguageModule("pdesk");
$this->lng->loadLanguageModule("pd"); // #16813
$this->lng->loadLanguageModule("dash");
$this->lng->loadLanguageModule("mmbr");

// catch hack attempts
if ($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID)
Expand Down Expand Up @@ -221,6 +222,26 @@ function executeCommand()
$this->show();
break;

case "ilpdselecteditemsblockgui":
$block = new ilPDSelectedItemsBlockGUI();
$ret = $this->ctrl->forwardCommand($block);
if($ret!= "") {
$this->displayHeader();
$this->tpl->setContent($ret);
$this->tpl->printToStdout();
}
break;

case "ilpdmembershipblockgui":
$block = new ilPDMembershipBlockGUI();
$ret = $this->ctrl->forwardCommand($block);
if($ret!= "") {
$this->displayHeader();
$this->tpl->setContent($ret);
$this->tpl->printToStdout();
}
break;

case 'ilcontactgui':
require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
if(!ilBuddySystem::getInstance()->isEnabled())
Expand Down Expand Up @@ -791,7 +812,7 @@ function initColumn($a_column_gui)
*/
function displayHeader()
{
$this->tpl->setTitle($this->lng->txt("personal_desktop"));
$this->tpl->setTitle($this->lng->txt("dash_dashboard"));
}

/**
Expand Down
7 changes: 7 additions & 0 deletions Services/Dashboard/templates/default/tpl.dash_obj_row.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<tr>
<td>
<input type="checkbox" name="id[]" value="{ID}" />
<img src="{ICON}" class="ilIcon">
{TITLE}
</td>
</tr>
11 changes: 11 additions & 0 deletions Services/Membership/classes/class.ilMembershipOverviewGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ function executeCommand()

switch ($next_class)
{
case "ilpdmembershipblockgui":
$ctrl->setReturn($this, "show");
$block = new ilPDMembershipBlockGUI();
$ret = $this->ctrl->forwardCommand($block);
if($ret!= "") {
//$this->displayHeader();
$this->main_tpl->setContent($ret);
//$this->tpl->printToStdout();
}
break;

default:
if (in_array($cmd, array("show")))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<tr class="{CSS_ROW}">
<!-- BEGIN img_cell -->
<td class="std" valign="top" nowrap="1" width="1">
<img src="{IMG_ITEM}" alt="{ALT_ITEM}" title="{ALT_ITEM}" border="0" />
<img class="ilIcon" src="{IMG_ITEM}" alt="{ALT_ITEM}" title="{ALT_ITEM}" border="0" />
</td>
<!-- END img_cell -->
<!-- BEGIN blank_cell -->
Expand Down
3 changes: 2 additions & 1 deletion lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -11081,7 +11081,6 @@ registration#:#registration_codes_override_info#:#Diese Einstellung hat Vorrang
registration#:#registration_codes_override_global_info#:#Diese Einstellungen werden evtl. durch Registrierungscodes aufgehoben.
crs#:#event_list_registered_only#:#Nur Angemeldete
didactic#:#didactic_default_type#:#Standard
rep#:#rep_info_sure_remove_from_favs#:#Sollen die folgenden Objekte wirklich aus Ihren Favoriten entfernt werden?
mmbr#:#mmbr_info_delete_sure_unsubscribe#:#ollen Sie sich wirklich aus den folgenden Objekten abmelden?
file#:#repository_disk_quota#:#Disk-Quota für Magazin
pd#:#pd_remove_multiple#:#Mehrere Objekte entfernen
Expand Down Expand Up @@ -15726,3 +15725,5 @@ cmix#:#highscore_top_num#:#Länge der Bestenliste
cmix#:#highscore_top_num_description#:#Bestimmt, wie viele Einträge in der Bestenliste angezeigt werden.
cmix#:#highscore_top_num_unit#:#Platzierungen
cmix#:#download_certificate#:#Zertifikat herunterladen
dash#:#dash_info_sure_remove_from_favs#:#Sollen die folgenden Objekte wirklich aus Ihren Favoriten entfernt werden?
mmbr#:#mmbr_unsubscribed_from_objs#:#Sie wurden von den ausgewählten Objekten abgemeldet.
3 changes: 2 additions & 1 deletion lang/ilias_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -11048,7 +11048,6 @@ registration#:#registration_codes_override_info#:#This setting overrides any val
registration#:#registration_codes_override_global_info#:#These settings may be overridden by registration codes.
crs#:#event_list_registered_only#:#Only Registered
didactic#:#didactic_default_type#:#Default
rep#:#rep_info_sure_remove_from_favs#:#Are you sure you want to remove the following objects from your Favourites?
mmbr#:#mmbr_info_delete_sure_unsubscribe#:#Are you sure you want to unsubscribe from the following objects?
file#:#repository_disk_quota#:#Soft Disk Quota for Repository
pd#:#pd_remove_multiple#:#Remove Multiple Objects
Expand Down Expand Up @@ -15709,3 +15708,5 @@ cmix#:#highscore_top_num#:#Length of Top Ranking
cmix#:#highscore_top_num_description#:#Specify how many ranks are to be included in the top ranking list.
cmix#:#highscore_top_num_unit#:#entries
cmix#:#download_certificate#:#Download Certificate
dash#:#dash_info_sure_remove_from_favs#:#Are you sure you want to remove the following objects from your Favourites?
mmbr#:#mmbr_unsubscribed_from_objs#:#You have been unsubscribed from the selected objects.

0 comments on commit bd4f1b3

Please sign in to comment.