ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilForumPostingDraftsBlockGUI Class Reference

Class ilForumPostingDraftsBlockGUI. More...

+ Inheritance diagram for ilForumPostingDraftsBlockGUI:
+ Collaboration diagram for ilForumPostingDraftsBlockGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 
 getBlockType ()
 
 getHTML ()
 {} More...
 
 fillRow ($draft)
 {} More...
 
 fillDataSection ()
 {} More...
 
- Public Member Functions inherited from ilBlockGUI
 getBlockType ()
 
 __construct ()
 Constructor. More...
 
 addHeaderLink ($a_href, $a_text, $status=true)
 
 getHeaderLinks ()
 
 setData ($a_data)
 Set Data. More...
 
 getData ()
 Get Data. More...
 
 setBigMode ($a_bigmode)
 Set Big Mode. More...
 
 getBigMode ()
 Get Big Mode. More...
 
 setBlockId ($a_block_id=0)
 Set Block Id. More...
 
 getBlockId ()
 Get Block Id. More...
 
 setAvailableDetailLevels ($a_max, $a_min=0)
 Set Available Detail Levels. More...
 
 setCurrentDetailLevel ($a_currentdetaillevel)
 Set Current Detail Level. More...
 
 setGuiObject (&$a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 Get GuiObject. More...
 
 getCurrentDetailLevel ()
 Get Current Detail Level. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setImage ($a_image)
 Set Image. More...
 
 getImage ()
 Get Image. More...
 
 setOffset ($a_offset)
 Set Offset. More...
 
 getOffset ()
 Get Offset. More...
 
 correctOffset ()
 
 setLimit ($a_limit)
 Set Limit. More...
 
 getLimit ()
 Get Limit. More...
 
 setEnableEdit ($a_enableedit)
 Set EnableEdit. More...
 
 getEnableEdit ()
 Get EnableEdit. More...
 
 setRepositoryMode ($a_repositorymode)
 Set RepositoryMode. More...
 
 getRepositoryMode ()
 Get RepositoryMode. More...
 
 setFooterInfo ($a_footerinfo, $a_hide_and_icon=false)
 Set Footer Info. More...
 
 getFooterInfo ($a_hide_and_icon=false)
 Get Footer Info. More...
 
 setSubtitle ($a_subtitle)
 Set Subtitle. More...
 
 getSubtitle ()
 Get Subtitle. More...
 
 setRefId ($a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 Get Ref Id (only used if isRepositoryObject() is true). More...
 
 setAdminCommands ($a_admincommands)
 Set Administration Commmands. More...
 
 getAdminCommands ()
 Get Administration Commmands. More...
 
 setColSpan ($a_colspan)
 Set Columns Span. More...
 
 getColSpan ()
 Get Columns Span. More...
 
 setEnableDetailRow ($a_enabledetailrow)
 Set EnableDetailRow. More...
 
 getEnableDetailRow ()
 Get EnableDetailRow. More...
 
 setEnableNumInfo ($a_enablenuminfo)
 Set Enable Item Number Info. More...
 
 getEnableNumInfo ()
 Get Enable Item Number Info. More...
 
 setProperties ($a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty ($a_property)
 
 setProperty ($a_property, $a_value)
 
 setRowTemplate ($a_rowtemplatename, $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getDetailParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 Get Row Template Name. More...
 
 getRowTemplateDir ()
 Get Row Template Directory. More...
 
 addBlockCommand ( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
 Add Block Command. More...
 
 getBlockCommands ()
 Get Block commands. More...
 
 addHeaderCommand ($a_href, $a_text, $a_as_close=false)
 Add Header Block Command. More...
 
 getHeaderCommands ()
 Get Header Block commands. More...
 
 addFooterLink ( $a_text, $a_href="", $a_onclick="", $a_block_id="", $a_top=false, $a_omit_separator=false, $a_checked=false)
 Add a footer text/link. More...
 
 getFooterLinks ()
 Get footer links. More...
 
 clearFooterLinks ()
 Clear footer links. More...
 
 handleDetailLevel ()
 Handle read/write current detail level. More...
 
 getHTML ()
 Handle config status. More...
 
 fillHeaderCommands ()
 Fill header commands block. More...
 
 fillHeaderTitleBlock ()
 Fill header title block (title and. More...
 
 setDataSection ($a_content)
 Call this from overwritten fillDataSection(), if standard row based data is not used. More...
 
 fillDataSection ()
 Standard implementation for row based data. More...
 
 fillRow ($a_set)
 
 fillFooter ()
 
 fillPreviousNext ()
 Fill previous/next row. More...
 
 setPreviousNextLinks ()
 Get previous/next linkbar. More...
 
 fillFooterLinks ($a_top=false, $a_numinfo="")
 Fill footer links. More...
 
 fillDetailRow ()
 Fill Detail Setting Row. More...
 

Static Public Attributes

static $block_type = 'pdfrmpostdraft'
 

Protected Member Functions

 isRepositoryObject ()
 
 getOverview ()
 Get overview. More...
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 fillRowColor ($a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 

Private Attributes

 $settings
 

Additional Inherited Members

- Static Public Member Functions inherited from ilBlockGUI
static getScreenMode ()
 Get Screen Mode for current command. More...
 
- Protected Attributes inherited from ilBlockGUI
 $data = array()
 
 $colspan = 1
 
 $enablenuminfo = true
 
 $detail_min = 0
 
 $detail_max = 0
 
 $bigmode = false
 
 $footer_links = array()
 
 $block_id = 0
 
 $header_commands = array()
 
 $allow_moving = true
 
 $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
 $enabledetailrow = true
 
 $header_links = array()
 
 $footerinfo = false
 
 $footerinfo_icon = false
 
 $block_commands = array()
 
 $max_count = false
 
 $close_command = false
 
 $image = false
 
 $property = false
 
 $nav_value = ""
 
 $css_row = ""
 
 $dropdown
 
 $tpl
 
 $main_tpl
 
 $user
 
 $ctrl
 
 $access
 
 $lng
 
 $obj_def
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilForumPostingDraftsBlockGUI::__construct ( )

Constructor.

Definition at line 25 of file class.ilForumPostingDraftsBlockGUI.php.

References $DIC, ilUtil\getImagePath(), ilBlockGUI\setAvailableDetailLevels(), ilBlockGUI\setImage(), ilBlockGUI\setLimit(), settings(), and ilBlockGUI\setTitle().

26  {
27  global $DIC;
28 
29  parent::__construct();
30 
31  $this->settings = $DIC->settings();
32 
33  $this->lng->loadLanguageModule('forum');
34 
35  $this->setLimit(5);
36  $this->setImage(ilUtil::getImagePath('icon_frm.svg'));
37  $this->setTitle($this->lng->txt('frm_my_posting_drafts'));
38  $this->setAvailableDetailLevels(3);
39  $this->allow_moving = true;
40  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
setImage($a_image)
Set Image.
setTitle($a_title)
Set Title.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
setLimit($a_limit)
Set Limit.
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilForumPostingDraftsBlockGUI::executeCommand ( )
Returns
string

Definition at line 45 of file class.ilForumPostingDraftsBlockGUI.php.

46  {
47  $cmd = $this->ctrl->getCmd('getHTML');
48  return $this->$cmd();
49  }

◆ fillDataSection()

ilForumPostingDraftsBlockGUI::fillDataSection ( )

{}

Definition at line 95 of file class.ilForumPostingDraftsBlockGUI.php.

References ilBlockGUI\$data, PHPMailer\PHPMailer\$params, ilObject\_getAllReferences(), ilLink\_getLink(), ilForum\_lookupObjIdForForumId(), ilForumUtil\collectPostInformationByPostId(), data, ilBlockGUI\getCurrentDetailLevel(), ilForumPostDraft\getDraftInstancesByUserId(), getOverview(), ilBlockGUI\setColSpan(), ilBlockGUI\setData(), ilBlockGUI\setDataSection(), ilBlockGUI\setEnableDetailRow(), ilBlockGUI\setEnableNumInfo(), ilBlockGUI\setRowTemplate(), and user().

96  {
97  $drafts_instances = ilForumPostDraft::getDraftInstancesByUserId($this->user->getId());
98 
99  $draft_as_array = array();
100  $data = array();
101  if (is_array($drafts_instances) && count($drafts_instances) > 0) {
102  foreach ($drafts_instances as $draft) {
103  $is_thread = false;
104  if ((int) $draft->getThreadId() == 0) {
105  $is_thread = true;
106  }
107 
108  $draft_as_array['subject'] = $draft->getPostSubject();
109  $draft_as_array['draft_id'] = $draft->getDraftId();
110 
111  $information = ilForumUtil::collectPostInformationByPostId($draft->getPostId());
112  $draft_as_array['source'] = implode('/', $information);
113  $draft_as_array['create_date'] = $draft->getPostDate();
114 
115  $obj_id = ilForum::_lookupObjIdForForumId($draft->getForumId());
116  $ref_id = end(ilObject::_getAllReferences($obj_id));
117 
118  if ($is_thread) {
119  $params['cmd'] = 'editThreadDraft';
120  $params['draft_id'] = $draft->getDraftId();
121  $draft_as_array['href'] = ilLink::_getLink($ref_id, 'frm', $params);
122  } else {
123  $params['thr_pk'] = $draft->getThreadId();
124  $params['pos_pk'] = $draft->getPostId();
125  $params['cmd'] = 'viewThread';
126  $draft_as_array['href'] = ilLink::_getLink($ref_id, 'frm', $params) . '#draft_' . $draft->getDraftId();
127  }
128 
129  $data[] = $draft_as_array;
130  }
131  }
132  $this->setData($data);
133 
134  if ($this->getCurrentDetailLevel() > 1 && count($this->data) > 0) {
135  $this->setRowTemplate('tpl.pd_frm_posting_drafts_row.html', 'Modules/Forum');
136  if ($this->getCurrentDetailLevel() > 2) {
137  $this->setColSpan(2);
138  }
139  parent::fillDataSection();
140  } else {
141  $this->setEnableNumInfo(false);
142  if (count($this->data) == 0) {
143  $this->setEnableDetailRow(false);
144  }
145  $this->setDataSection($this->getOverview());
146  }
147  }
static getDraftInstancesByUserId($user_id)
static _lookupObjIdForForumId($a_for_id)
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
user()
Definition: user.php:4
static _getAllReferences($a_id)
get all reference ids of object
setColSpan($a_colspan)
Set Columns Span.
static collectPostInformationByPostId($post_id)
setData($a_data)
Set Data.
$this data['403_header']
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setEnableDetailRow($a_enabledetailrow)
Set EnableDetailRow.
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ fillRow()

ilForumPostingDraftsBlockGUI::fillRow (   $draft)

{}

Definition at line 82 of file class.ilForumPostingDraftsBlockGUI.php.

References ilDatePresentation\formatDate(), ilBlockGUI\getCurrentDetailLevel(), and IL_CAL_DATETIME.

83  {
84  $this->tpl->setVariable('SUBJECT', $draft['subject']);
85  $this->tpl->setVariable('SOURCE', $draft['source']);
86  $this->tpl->setVariable("HREF", $draft['href']);
87  if ($this->getCurrentDetailLevel() > 2) {
88  $this->tpl->setVariable('CREATE_DATE', ilDatePresentation::formatDate(new ilDateTime($draft['create_date'], IL_CAL_DATETIME)));
89  }
90  }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
Date and time handling
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ getBlockType()

ilForumPostingDraftsBlockGUI::getBlockType ( )

Definition at line 54 of file class.ilForumPostingDraftsBlockGUI.php.

54  : string
55  {
56  return self::$block_type;
57  }

◆ getHTML()

ilForumPostingDraftsBlockGUI::getHTML ( )

{}

Definition at line 70 of file class.ilForumPostingDraftsBlockGUI.php.

References ilBlockGUI\getCurrentDetailLevel(), and settings().

71  {
72  if ($this->getCurrentDetailLevel() == 0 || !$this->settings->get('save_post_drafts', 0) || !$this->settings->get('block_activated_pdfrmpostdraft', 0)) {
73  return '';
74  } else {
75  return parent::getHTML();
76  }
77  }
settings()
Definition: settings.php:2
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ getOverview()

ilForumPostingDraftsBlockGUI::getOverview ( )
protected

Get overview.

Definition at line 152 of file class.ilForumPostingDraftsBlockGUI.php.

References ilBlockGUI\$tpl, and data.

Referenced by fillDataSection().

153  {
154  $tpl = new ilTemplate('tpl.pd_frm_posting_drafts_row.html', true, true, 'Modules/Forum');
155  $tpl->setCurrentBlock('overview');
156  $tpl->setVariable('NUM_FRM_POSTING_DRAFTS', count($this->data));
157  if (count($this->data) == 1) {
158  $tpl->setVariable('TXT_FRM_POSTING_DRAFTS', $this->lng->txt('frm_posting_draft'));
159  } else {
160  $tpl->setVariable('TXT_FRM_POSTING_DRAFTS', $this->lng->txt('frm_posting_drafts'));
161  }
162  $tpl->parseCurrentBlock();
163 
164  return $tpl->get();
165  }
special template class to simplify handling of ITX/PEAR
$this data['403_header']
+ Here is the caller graph for this function:

◆ isRepositoryObject()

ilForumPostingDraftsBlockGUI::isRepositoryObject ( )
protected

Definition at line 62 of file class.ilForumPostingDraftsBlockGUI.php.

62  : bool
63  {
64  return false;
65  }

Field Documentation

◆ $block_type

ilForumPostingDraftsBlockGUI::$block_type = 'pdfrmpostdraft'
static

Definition at line 15 of file class.ilForumPostingDraftsBlockGUI.php.

◆ $settings

ilForumPostingDraftsBlockGUI::$settings
private

Definition at line 20 of file class.ilForumPostingDraftsBlockGUI.php.


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