ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPollCommentsHandler Class Reference
+ Collaboration diagram for ilPollCommentsHandler:

Public Member Functions

 __construct (NotesService $notes, GlobalHttpState $http, Refinery $refinery, string $redraw_url)
 
 getRedrawURL ()
 
 commentJSCall (int $ref_id)
 Builds JavaScript Call to open CommentLayer via html link. More...
 
 getNumberOfCommentsForRedraw ()
 
 getNumberOfComments (int $ref_id)
 

Protected Member Functions

 lookupObjectId (int $ref_id)
 
 buildAjaxHashForPoll (int $ref_id, int $obj_id)
 
 getListCommentsJSCallForPoll (string $ajax_hash, int $ref_id)
 

Protected Attributes

NotesService $notes
 
GlobalHttpState $http
 
Refinery $refinery
 
string $redraw_url
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilPollCommentsHandler::__construct ( NotesService  $notes,
GlobalHttpState  $http,
Refinery  $refinery,
string  $redraw_url 
)

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

References $http, $notes, $redraw_url, $refinery, ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

38  {
39  $this->notes = $notes;
40  $this->http = $http;
41  $this->refinery = $refinery;
42  $this->redraw_url = $redraw_url;
43  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

Member Function Documentation

◆ buildAjaxHashForPoll()

ilPollCommentsHandler::buildAjaxHashForPoll ( int  $ref_id,
int  $obj_id 
)
protected

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

References ilCommonActionDispatcherGUI\buildAjaxHash(), and ilCommonActionDispatcherGUI\TYPE_REPOSITORY.

Referenced by commentJSCall().

95  : string
96  {
99  $ref_id,
100  'poll',
101  $obj_id
102  );
103  }
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, ?string $sub_type=null, ?int $sub_id=null, int $news_id=0)
Build ajax hash.
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ commentJSCall()

ilPollCommentsHandler::commentJSCall ( int  $ref_id)

Builds JavaScript Call to open CommentLayer via html link.

Definition at line 53 of file class.ilPollCommentsHandler.php.

References buildAjaxHashForPoll(), getListCommentsJSCallForPoll(), and lookupObjectId().

53  : string
54  {
55  $obj_id = $this->lookupObjectId($ref_id);
56  $ajax_hash = $this->buildAjaxHashForPoll($ref_id, $obj_id);
57 
58 
59  return $this->getListCommentsJSCallForPoll($ajax_hash, $ref_id);
60  }
getListCommentsJSCallForPoll(string $ajax_hash, int $ref_id)
buildAjaxHashForPoll(int $ref_id, int $obj_id)
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ getListCommentsJSCallForPoll()

ilPollCommentsHandler::getListCommentsJSCallForPoll ( string  $ajax_hash,
int  $ref_id 
)
protected

Definition at line 105 of file class.ilPollCommentsHandler.php.

References ilNoteGUI\getListCommentsJSCall().

Referenced by commentJSCall().

108  : string {
110  $ajax_hash,
111  "ilPoll.redrawComments(" . $ref_id . ");"
112  );
113  }
$ref_id
Definition: ltiauth.php:65
static getListCommentsJSCall(string $a_hash, ?string $a_update_code=null)
Get list comments js call.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNumberOfComments()

ilPollCommentsHandler::getNumberOfComments ( int  $ref_id)

Definition at line 83 of file class.ilPollCommentsHandler.php.

References $context, and lookupObjectId().

Referenced by getNumberOfCommentsForRedraw().

83  : int
84  {
85  $obj_id = $this->lookupObjectId($ref_id);
86  $context = $this->notes->data()->context($obj_id, 0, 'poll');
87  return $this->notes->domain()->getNrOfCommentsForContext($context);
88  }
$context
Definition: webdav.php:31
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNumberOfCommentsForRedraw()

ilPollCommentsHandler::getNumberOfCommentsForRedraw ( )

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

References exit, getNumberOfComments(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

62  : void
63  {
64  $poll_id = 0;
65  if ($this->http->wrapper()->query()->has('poll_id')) {
66  $poll_id = $this->http->wrapper()->query()->retrieve(
67  'poll_id',
68  $this->refinery->kindlyTo()->int()
69  );
70  }
71 
72  $number = $this->getNumberOfComments($poll_id);
73 
74  if ($number > 0) {
75  echo "(" . $number . ")";
76  } else {
77  echo "";
78  }
79 
80  exit();
81  }
static http()
Fetches the global http state from ILIAS.
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getRedrawURL()

ilPollCommentsHandler::getRedrawURL ( )

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

References $redraw_url.

45  : string
46  {
47  return $this->redraw_url;
48  }

◆ lookupObjectId()

ilPollCommentsHandler::lookupObjectId ( int  $ref_id)
protected

Definition at line 90 of file class.ilPollCommentsHandler.php.

References ilObject\_lookupObjectId().

Referenced by commentJSCall(), and getNumberOfComments().

90  : int
91  {
93  }
$ref_id
Definition: ltiauth.php:65
static _lookupObjectId(int $ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $http

GlobalHttpState ilPollCommentsHandler::$http
protected

Definition at line 28 of file class.ilPollCommentsHandler.php.

Referenced by __construct().

◆ $notes

NotesService ilPollCommentsHandler::$notes
protected

Definition at line 27 of file class.ilPollCommentsHandler.php.

Referenced by __construct().

◆ $redraw_url

string ilPollCommentsHandler::$redraw_url
protected

Definition at line 31 of file class.ilPollCommentsHandler.php.

Referenced by __construct(), and getRedrawURL().

◆ $refinery

Refinery ilPollCommentsHandler::$refinery
protected

Definition at line 29 of file class.ilPollCommentsHandler.php.

Referenced by __construct().


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