ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilForumPostingDraftsBlockGUI Class Reference

Class ilForumPostingDraftsBlockGUI. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 
 getHTML ()
 {} More...
 
 fillRow ($draft)
 {} More...
 
 fillDataSection ()
 {} More...
 
- Public Member Functions inherited from ilBlockGUI
 __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 Member Functions

static getBlockType ()
 {} More...
 
static isRepositoryObject ()
 {} More...
 
- Static Public Member Functions inherited from ilBlockGUI
static getBlockType ()
 
static isRepositoryObject ()
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 

Static Public Attributes

static $block_type = 'pdfrmpostdraft'
 

Protected Member Functions

 getOverview ()
 Get overview. More...
 
- Protected Member Functions inherited from ilBlockGUI
 fillRowColor ($a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 

Private Attributes

 $settings
 

Additional Inherited Members

- 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 28 of file class.ilForumPostingDraftsBlockGUI.php.

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

29  {
30  global $DIC;
31 
32  parent::__construct();
33 
34  $this->settings = $DIC->settings();
35 
36  $this->lng->loadLanguageModule('forum');
37 
38  $this->setLimit(5);
39  $this->setImage(ilUtil::getImagePath('icon_frm.svg'));
40  $this->setTitle($this->lng->txt('frm_my_posting_drafts'));
41  $this->setAvailableDetailLevels(3);
42  $this->allow_moving = true;
43  }
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.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilForumPostingDraftsBlockGUI::executeCommand ( )
Returns
string

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

49  {
50  $cmd = $this->ctrl->getCmd('getHTML');
51  return $this->$cmd();
52  }

◆ fillDataSection()

ilForumPostingDraftsBlockGUI::fillDataSection ( )

{}

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

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

99  {
100  require_once './Modules/Forum/classes/class.ilForumPostDraft.php';
101  require_once './Modules/Forum/classes/class.ilForumUtil.php';
102  require_once './Services/Link/classes/class.ilLink.php';
103 
104  $drafts_instances = ilForumPostDraft::getDraftInstancesByUserId($this->user->getId());
105 
106  $draft_as_array = array();
107  $data = array();
108  if (is_array($drafts_instances) && count($drafts_instances) > 0) {
109  foreach ($drafts_instances as $draft) {
110  $is_thread = false;
111  if ((int) $draft->getThreadId() == 0) {
112  $is_thread = true;
113  }
114 
115  $draft_as_array['subject'] = $draft->getPostSubject();
116  $draft_as_array['draft_id'] = $draft->getDraftId();
117 
118  $information = ilForumUtil::collectPostInformationByPostId($draft->getPostId());
119  $draft_as_array['source'] = implode('/', $information);
120  $draft_as_array['create_date'] = $draft->getPostDate();
121 
122  $obj_id = ilForum::_lookupObjIdForForumId($draft->getForumId());
123  $ref_id = end(ilObject::_getAllReferences($obj_id));
124 
125  if ($is_thread) {
126  $params['cmd'] = 'editThreadDraft';
127  $params['draft_id'] = $draft->getDraftId();
128  $draft_as_array['href'] = ilLink::_getLink($ref_id, 'frm', $params);
129  } else {
130  $params['thr_pk'] = $draft->getThreadId();
131  $params['pos_pk'] = $draft->getPostId();
132  $params['cmd'] = 'viewThread';
133  $draft_as_array['href'] = ilLink::_getLink($ref_id, 'frm', $params) . '#draft_' . $draft->getDraftId();
134  }
135 
136  $data[] = $draft_as_array;
137  }
138  }
139  $this->setData($data);
140 
141  if ($this->getCurrentDetailLevel() > 1 && count($this->data) > 0) {
142  $this->setRowTemplate('tpl.pd_frm_posting_drafts_row.html', 'Modules/Forum');
143  if ($this->getCurrentDetailLevel() > 2) {
144  $this->setColSpan(2);
145  }
146  parent::fillDataSection();
147  } else {
148  $this->setEnableNumInfo(false);
149  if (count($this->data) == 0) {
150  $this->setEnableDetailRow(false);
151  }
152  $this->setDataSection($this->getOverview());
153  }
154  }
static getDraftInstancesByUserId($user_id)
$params
Definition: disable.php:11
Add some data
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.
Create styles array
The data for the language used.
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 85 of file class.ilForumPostingDraftsBlockGUI.php.

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

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

◆ getBlockType()

static ilForumPostingDraftsBlockGUI::getBlockType ( )
static

{}

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

58  {
59  return self::$block_type;
60  }

◆ getHTML()

ilForumPostingDraftsBlockGUI::getHTML ( )

{}

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

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

74  {
75  if ($this->getCurrentDetailLevel() == 0 || !$this->settings->get('save_post_drafts', 0) || !$this->settings->get('block_activated_pdfrmpostdraft', 0)) {
76  return '';
77  } else {
78  return parent::getHTML();
79  }
80  }
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 159 of file class.ilForumPostingDraftsBlockGUI.php.

References ilBlockGUI\$tpl, and data.

Referenced by fillDataSection().

160  {
161  $tpl = new ilTemplate('tpl.pd_frm_posting_drafts_row.html', true, true, 'Modules/Forum');
162  $tpl->setCurrentBlock('overview');
163  $tpl->setVariable('NUM_FRM_POSTING_DRAFTS', count($this->data));
164  if (count($this->data) == 1) {
165  $tpl->setVariable('TXT_FRM_POSTING_DRAFTS', $this->lng->txt('frm_posting_draft'));
166  } else {
167  $tpl->setVariable('TXT_FRM_POSTING_DRAFTS', $this->lng->txt('frm_posting_drafts'));
168  }
169  $tpl->parseCurrentBlock();
170 
171  return $tpl->get();
172  }
Add some data
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ isRepositoryObject()

static ilForumPostingDraftsBlockGUI::isRepositoryObject ( )
static

{}

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

66  {
67  return false;
68  }

Field Documentation

◆ $block_type

ilForumPostingDraftsBlockGUI::$block_type = 'pdfrmpostdraft'
static

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

◆ $settings

ilForumPostingDraftsBlockGUI::$settings
private

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


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