ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPDMailBlockGUI Class Reference

BlockGUI class for Personal Desktop Mail block. More...

+ Inheritance diagram for ilPDMailBlockGUI:
+ Collaboration diagram for ilPDMailBlockGUI:

Public Member Functions

 __construct ()
 
 getBlockType ()
 
 executeCommand ()
 
 getHTML ()
 
 getNoItemFoundContent ()
 
- Public Member Functions inherited from ilBlockGUI
 __construct ()
 
 getBlockType ()
 
 setData (array $a_data)
 
 getData ()
 
 setPresentation (int $type)
 
 getPresentation ()
 
 setBlockId (string $a_block_id="0")
 
 getBlockId ()
 
 setGuiObject (object $a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setOffset (int $a_offset)
 
 getOffset ()
 
 checkOffset (int $offset)
 
 setLimit (int $a_limit)
 
 getLimit ()
 
 setEnableEdit (bool $a_enableedit)
 
 getEnableEdit ()
 
 setRepositoryMode (bool $a_repositorymode)
 
 getRepositoryMode ()
 
 setSubtitle (string $a_subtitle)
 
 getSubtitle ()
 
 setRefId (int $a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 
 setAdminCommands (bool $a_admincommands)
 
 getAdminCommands ()
 
 setEnableNumInfo (bool $a_enablenuminfo)
 
 getEnableNumInfo ()
 
 setProperties (array $a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty (string $a_property)
 
 setProperty (string $a_property, string $a_value)
 
 setRowTemplate (string $a_rowtemplatename, string $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 
 getRowTemplateDir ()
 
 addBlockCommand (string $a_href, string $a_text, string $a_onclick="", ?RoundTrip $modal=null)
 
 getBlockCommands ()
 
 getHTML ()
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 getPaginationViewControl ()
 Fill previous/next row. More...
 
 getViewControlsForPanel ()
 
 sortObject ()
 
 addSortOption (string $option, string $label, bool $active)
 
 setSortTarget (string $target)
 
 addPresentation (string $label, string $target, bool $active)
 
 getNoItemFoundContent ()
 

Static Public Member Functions

static getScreenMode ()
 
- Static Public Member Functions inherited from ilBlockGUI
static getScreenMode ()
 

Static Public Attributes

static string $block_type = 'pdmail'
 

Protected Member Functions

 isRepositoryObject ()
 
 getMails ()
 
 getOverview ()
 
 preloadData (array $data)
 
 getListItemForData (array $data)
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 specialCharsAsEntities (string $string)
 
 initCommands ()
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 
 getLegacyContent ()
 Get legacy content. More...
 
 getListItemForData (array $data)
 Get list item for data array. More...
 
 handleNavigation ()
 Handle navigation. More...
 
 loadData ()
 Load data for current page. More...
 
 getListItemGroups ()
 Get items. More...
 
 addRepoCommands ()
 Add repo commands. More...
 
 getActionsForPanel ()
 
 send (string $output)
 Send. More...
 

Protected Attributes

ilRbacSystem $rbacsystem
 
ilSetting $setting
 
array $mails = []
 
int $inbox
 
- Protected Attributes inherited from ilBlockGUI
ILIAS UI Renderer $renderer
 
Factory $factory
 
object $gui_object
 
ILIAS Block StandardGUIRequest $request
 
ILIAS Block BlockManager $block_manager
 
bool $repositorymode = false
 
ILIAS DI UIServices $ui
 
array $data = array()
 
bool $enablenuminfo = true
 
array $footer_links = array()
 
string $block_id = "0"
 
bool $allow_moving = true
 
array $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
array $block_commands = array()
 
int $max_count = 0
 
bool $close_command = false
 
bool $image = false
 
array $property = []
 
string $nav_value = ""
 
string $css_row = ""
 
string $title = ""
 
bool $admincommands = false
 
array $dropdown
 
ilTemplate $tpl
 
ilGlobalTemplateInterface $main_tpl
 
ilObjUser $user
 
ilCtrl $ctrl
 
ilAccessHandler $access
 
ilLanguage $lng
 
ilObjectDefinition $obj_def
 
int $presentation
 
int $requested_ref_id
 

Private Attributes

readonly GlobalHttpState $http
 
readonly Refinery $refinery
 
int $requestMailObjId = 0
 
bool $has_access = false
 

Additional Inherited Members

- Data Fields inherited from ilBlockGUI
const PRES_MAIN_LEG = 0
 
const PRES_SEC_LEG = 1
 
const PRES_SEC_LIST = 2
 
const PRES_MAIN_LIST = 3
 
const PRES_MAIN_TILE = 4
 

Detailed Description

BlockGUI class for Personal Desktop Mail block.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e ilPDMailBlockGUI: ilColumnGUI

Definition at line 30 of file class.ilPDMailBlockGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPDMailBlockGUI::__construct ( )

Definition at line 44 of file class.ilPDMailBlockGUI.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), getMails(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilBlockGUI\setData(), ilBlockGUI\setLimit(), ilBlockGUI\setPresentation(), ilBlockGUI\setTitle(), and ILIAS\Repository\user().

45  {
46  global $DIC;
47  $this->lng = $DIC->language();
48  $this->user = $DIC->user();
49  $this->ctrl = $DIC->ctrl();
50  $this->setting = $DIC->settings();
51  $this->rbacsystem = $DIC->rbac()->system();
52  $this->http = $DIC->http();
53  $this->refinery = $DIC->refinery();
54 
56 
57  $this->setLimit(5);
58  $this->setTitle($this->lng->txt('mail'));
59  $this->setPresentation(self::PRES_SEC_LIST);
60 
61  $umail = new ilMail($this->user->getId());
62  if ($this->rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId())) {
63  $this->has_access = true;
64  $this->getMails();
65  $this->setData($this->mails);
66  }
67  }
setLimit(int $a_limit)
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
setTitle(string $a_title)
setData(array $a_data)
setPresentation(int $type)
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilPDMailBlockGUI::executeCommand ( )

Definition at line 93 of file class.ilPDMailBlockGUI.php.

References ILIAS\Repository\ctrl().

93  : string
94  {
95  $cmd = $this->ctrl->getCmd('getHTML');
96 
97  return $this->$cmd();
98  }
+ Here is the call graph for this function:

◆ getBlockType()

ilPDMailBlockGUI::getBlockType ( )

Definition at line 69 of file class.ilPDMailBlockGUI.php.

69  : string
70  {
71  return self::$block_type;
72  }

◆ getHTML()

ilPDMailBlockGUI::getHTML ( )

Definition at line 100 of file class.ilPDMailBlockGUI.php.

100  : string
101  {
102  if (!$this->has_access) {
103  return '';
104  }
105  return parent::getHTML();
106  }

◆ getListItemForData()

ilPDMailBlockGUI::getListItemForData ( array  $data)
protected

Definition at line 141 of file class.ilPDMailBlockGUI.php.

References Vendor\Package\$f, ilBlockGUI\$user, ilMail\_getIliasMailerName(), ANONYMOUS_USER_ID, ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), ilObjUser\getAvatar(), ilObject\getId(), ilUtil\getImagePath(), ilObjUser\getPublicName(), ilMailUserCache\getUserObjectById(), IL_CAL_DATE, ILIAS\Repository\lng(), null, and ILIAS\Repository\ui().

141  : ?Item
142  {
143  $f = $this->ui->factory();
144 
146 
147  $avatar = null;
148  if ($user && $user->getId() !== ANONYMOUS_USER_ID) {
149  $avatar = $user->getAvatar();
150  $public_name_long = $user->getPublicName();
151  } elseif ($user) {
152  $avatar = $this->ui->factory()
153  ->symbol()
154  ->avatar()
155  ->picture(ilUtil::getImagePath('logo/HeaderIconAvatar.svg'), ilMail::_getIliasMailerName());
156  $public_name_long = ilMail::_getIliasMailerName();
157  } else {
158  $public_name_long = trim(($data['import_name'] ?? '') . ' (' . $this->lng->txt('user_deleted') . ')');
159  }
160 
161  $new_mail_subj = htmlentities($data['m_subject'], ENT_NOQUOTES, 'UTF-8');
162  $this->ctrl->setParameterByClass(ilMailFolderGUI::class, 'mobj_id', $this->inbox);
163  $this->ctrl->setParameterByClass(ilMailFolderGUI::class, 'mail_id', $data['mail_id']);
164  $new_mail_link = $this->ctrl->getLinkTargetByClass([ilMailGUI::class, ilMailFolderGUI::class], 'showMail');
165  $this->ctrl->clearParametersByClass(ilMailFolderGUI::class);
166 
167  $button = $f->link()->standard($new_mail_subj, $new_mail_link);
168 
169  $item = $f->item()->standard($button);
170  if ($avatar !== null) {
171  $item = $item->withLeadAvatar($avatar);
172  }
173 
174  $item = $item->withProperties([
175  $this->lng->txt('from') => $public_name_long,
176  $this->lng->txt('mail_sent_datetime') => ilDatePresentation::formatDate(new ilDateTime($data['send_time'], IL_CAL_DATE)),
177  ]);
178 
179  return $item;
180  }
ilObjUser $user
const ANONYMOUS_USER_ID
Definition: constants.php:27
static getUserObjectById(int $usr_id)
static _getIliasMailerName()
getPublicName()
returns firstname lastname and login if profile is public, login otherwise
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Common interface to all items.
Definition: Item.php:31
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
const IL_CAL_DATE
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
+ Here is the call graph for this function:

◆ getMails()

ilPDMailBlockGUI::getMails ( )
protected

Definition at line 108 of file class.ilPDMailBlockGUI.php.

References ilMail\getMailsOfFolder(), and ILIAS\Repository\user().

Referenced by __construct().

108  : void
109  {
110  $umail = new ilMail($this->user->getId());
111  $mbox = new ilMailbox($this->user->getId());
112  $this->inbox = $mbox->getInboxFolder();
113 
114  $this->mails = $umail->getMailsOfFolder(
115  $this->inbox,
116  [
117  'status' => 'unread',
118  ]
119  );
120  $this->max_count = count($this->mails);
121  }
getMailsOfFolder(int $a_folder_id, array $filter=[])
Mail Box class Base class for creating and handling mail boxes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNoItemFoundContent()

ilPDMailBlockGUI::getNoItemFoundContent ( )

Definition at line 182 of file class.ilPDMailBlockGUI.php.

References ILIAS\Repository\lng().

182  : string
183  {
184  return $this->lng->txt('mail_no_mail_items');
185  }
+ Here is the call graph for this function:

◆ getOverview()

ilPDMailBlockGUI::getOverview ( )
protected

Definition at line 123 of file class.ilPDMailBlockGUI.php.

References ILIAS\Repository\lng().

123  : string
124  {
125  return '<div class="small">' . (count($this->mails)) . ' ' . $this->lng->txt('mails_pl') . '</div>';
126  }
+ Here is the call graph for this function:

◆ getScreenMode()

static ilPDMailBlockGUI::getScreenMode ( )
static

Definition at line 79 of file class.ilPDMailBlockGUI.php.

References $DIC, IL_SCREEN_CENTER, and IL_SCREEN_SIDE.

79  : string
80  {
81  global $DIC;
82  $cmd = '';
83  if ($DIC->http()->wrapper()->query()->has('cmd')) {
84  $cmd = $DIC->http()->wrapper()->query()->retrieve('cmd', $DIC->refinery()->kindlyTo()->string());
85  }
86  if ($cmd === 'showMail') {
87  return IL_SCREEN_CENTER;
88  }
89 
90  return IL_SCREEN_SIDE;
91  }
global $DIC
Definition: shib_login.php:22
const IL_SCREEN_CENTER
const IL_SCREEN_SIDE

◆ isRepositoryObject()

ilPDMailBlockGUI::isRepositoryObject ( )
protected

Definition at line 74 of file class.ilPDMailBlockGUI.php.

74  : bool
75  {
76  return false;
77  }

◆ preloadData()

ilPDMailBlockGUI::preloadData ( array  $data)
protected

Definition at line 128 of file class.ilPDMailBlockGUI.php.

References ANONYMOUS_USER_ID, and ilMailUserCache\preloadUserObjects().

128  : void
129  {
130  $usr_ids = [];
131 
132  foreach ($data as $mail) {
133  if ($mail['sender_id'] && $mail['sender_id'] !== ANONYMOUS_USER_ID) {
134  $usr_ids[$mail['sender_id']] = $mail['sender_id'];
135  }
136  }
137 
139  }
const ANONYMOUS_USER_ID
Definition: constants.php:27
static preloadUserObjects(array $usr_ids)
+ Here is the call graph for this function:

Field Documentation

◆ $block_type

string ilPDMailBlockGUI::$block_type = 'pdmail'
static

Definition at line 32 of file class.ilPDMailBlockGUI.php.

◆ $has_access

bool ilPDMailBlockGUI::$has_access = false
private

Definition at line 42 of file class.ilPDMailBlockGUI.php.

◆ $http

readonly GlobalHttpState ilPDMailBlockGUI::$http
private

Definition at line 34 of file class.ilPDMailBlockGUI.php.

◆ $inbox

int ilPDMailBlockGUI::$inbox
protected

Definition at line 41 of file class.ilPDMailBlockGUI.php.

◆ $mails

array ilPDMailBlockGUI::$mails = []
protected

Definition at line 40 of file class.ilPDMailBlockGUI.php.

◆ $rbacsystem

ilRbacSystem ilPDMailBlockGUI::$rbacsystem
protected

Definition at line 37 of file class.ilPDMailBlockGUI.php.

◆ $refinery

readonly Refinery ilPDMailBlockGUI::$refinery
private

Definition at line 35 of file class.ilPDMailBlockGUI.php.

◆ $requestMailObjId

int ilPDMailBlockGUI::$requestMailObjId = 0
private

Definition at line 36 of file class.ilPDMailBlockGUI.php.

◆ $setting

ilSetting ilPDMailBlockGUI::$setting
protected

Definition at line 38 of file class.ilPDMailBlockGUI.php.


The documentation for this class was generated from the following file: