ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilPDMailBlockGUI Class Reference

ilPDMailBlockGUI: ilColumnGUI 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 Container Block StandardGUIRequest $request
 
ILIAS Container 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
 
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

Constructor & Destructor Documentation

◆ __construct()

ilPDMailBlockGUI::__construct ( )

Definition at line 41 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().

42  {
43  global $DIC;
44  $this->lng = $DIC->language();
45  $this->user = $DIC->user();
46  $this->ctrl = $DIC->ctrl();
47  $this->setting = $DIC->settings();
48  $this->rbacsystem = $DIC->rbac()->system();
49  $this->http = $DIC->http();
50  $this->refinery = $DIC->refinery();
51 
53 
54  $this->setLimit(5);
55  $this->setTitle($this->lng->txt('mail'));
56  $this->setPresentation(self::PRES_SEC_LIST);
57 
58  $umail = new ilMail($this->user->getId());
59  if ($this->rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId())) {
60  $this->has_access = true;
61  $this->getMails();
62  $this->setData($this->mails);
63  }
64  }
setLimit(int $a_limit)
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26
__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 90 of file class.ilPDMailBlockGUI.php.

References ILIAS\Repository\ctrl().

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

◆ getBlockType()

ilPDMailBlockGUI::getBlockType ( )

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

66  : string
67  {
68  return self::$block_type;
69  }

◆ getHTML()

ilPDMailBlockGUI::getHTML ( )

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

97  : string
98  {
99  if (!$this->has_access) {
100  return '';
101  }
102  return parent::getHTML();
103  }

◆ getListItemForData()

ilPDMailBlockGUI::getListItemForData ( array  $data)
protected

Definition at line 138 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_DATETIME, ILIAS\Repository\lng(), null, and ILIAS\Repository\ui().

138  : ?Item
139  {
140  $f = $this->ui->factory();
141 
143 
144  $avatar = null;
145  if ($user && $user->getId() !== ANONYMOUS_USER_ID) {
146  $avatar = $user->getAvatar();
147  $public_name_long = $user->getPublicName();
148  } elseif ($user) {
149  $avatar = $this->ui->factory()
150  ->symbol()
151  ->avatar()
152  ->picture(ilUtil::getImagePath('logo/ilias_logo_centered.png'), ilMail::_getIliasMailerName());
153  $public_name_long = ilMail::_getIliasMailerName();
154  } else {
155  $public_name_long = trim(($data['import_name'] ?? '') . ' (' . $this->lng->txt('user_deleted') . ')');
156  }
157 
158  $new_mail_subj = htmlentities($data['m_subject'], ENT_NOQUOTES, 'UTF-8');
159  $this->ctrl->setParameterByClass(ilMailFolderGUI::class, 'mobj_id', $this->inbox);
160  $this->ctrl->setParameterByClass(ilMailFolderGUI::class, 'mail_id', $data['mail_id']);
161  $new_mail_link = $this->ctrl->getLinkTargetByClass([ilMailGUI::class, ilMailFolderGUI::class], 'showMail');
162  $this->ctrl->clearParametersByClass(ilMailFolderGUI::class);
163 
164  $button = $f->link()->standard($new_mail_subj, $new_mail_link);
165 
166  $item = $f->item()->standard($button);
167  if ($avatar !== null) {
168  $item = $item->withLeadAvatar($avatar);
169  }
170 
171  $item = $item->withProperties([
172  $this->lng->txt('from') => $public_name_long,
173  $this->lng->txt('mail_sent_datetime') => ilDatePresentation::formatDate(new ilDateTime($data['send_time'], IL_CAL_DATETIME)),
174  ]);
175 
176  return $item;
177  }
ilObjUser $user
const IL_CAL_DATETIME
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)
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 105 of file class.ilPDMailBlockGUI.php.

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

Referenced by __construct().

105  : void
106  {
107  $umail = new ilMail($this->user->getId());
108  $mbox = new ilMailbox($this->user->getId());
109  $this->inbox = $mbox->getInboxFolder();
110 
111  $this->mails = $umail->getMailsOfFolder(
112  $this->inbox,
113  [
114  'status' => 'unread',
115  ]
116  );
117  $this->max_count = count($this->mails);
118  }
getMailsOfFolder(int $a_folder_id, array $filter=[])
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNoItemFoundContent()

ilPDMailBlockGUI::getNoItemFoundContent ( )

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

References ILIAS\Repository\lng().

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

◆ getOverview()

ilPDMailBlockGUI::getOverview ( )
protected

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

References ILIAS\Repository\lng().

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

◆ getScreenMode()

static ilPDMailBlockGUI::getScreenMode ( )
static

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

References $DIC, IL_SCREEN_CENTER, and IL_SCREEN_SIDE.

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

◆ isRepositoryObject()

ilPDMailBlockGUI::isRepositoryObject ( )
protected

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

71  : bool
72  {
73  return false;
74  }

◆ preloadData()

ilPDMailBlockGUI::preloadData ( array  $data)
protected

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

References ANONYMOUS_USER_ID, and ilMailUserCache\preloadUserObjects().

125  : void
126  {
127  $usr_ids = [];
128 
129  foreach ($data as $mail) {
130  if ($mail['sender_id'] && $mail['sender_id'] !== ANONYMOUS_USER_ID) {
131  $usr_ids[$mail['sender_id']] = $mail['sender_id'];
132  }
133  }
134 
136  }
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 30 of file class.ilPDMailBlockGUI.php.

◆ $has_access

bool ilPDMailBlockGUI::$has_access = false
private

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

◆ $http

readonly GlobalHttpState ilPDMailBlockGUI::$http
private

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

◆ $inbox

int ilPDMailBlockGUI::$inbox
protected

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

◆ $mails

array ilPDMailBlockGUI::$mails = []
protected

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

◆ $rbacsystem

ilRbacSystem ilPDMailBlockGUI::$rbacsystem
protected

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

◆ $refinery

readonly Refinery ilPDMailBlockGUI::$refinery
private

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

◆ $setting

ilSetting ilPDMailBlockGUI::$setting
protected

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


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