ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 26 of file class.ilPollCommentsHandler.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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

39  {
40  $this->notes = $notes;
41  $this->http = $http;
42  $this->refinery = $refinery;
43  $this->redraw_url = $redraw_url;
44  }
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 96 of file class.ilPollCommentsHandler.php.

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

Referenced by commentJSCall().

96  : string
97  {
100  $ref_id,
101  'poll',
102  $obj_id
103  );
104  }
$ref_id
Definition: ltiauth.php:66
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.
+ 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 54 of file class.ilPollCommentsHandler.php.

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

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

◆ getListCommentsJSCallForPoll()

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

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

References ilNoteGUI\getListCommentsJSCall().

Referenced by commentJSCall().

109  : string {
111  $ajax_hash,
112  "ilPoll.redrawComments(" . $ref_id . ");"
113  );
114  }
$ref_id
Definition: ltiauth.php:66
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 84 of file class.ilPollCommentsHandler.php.

References $context, and lookupObjectId().

Referenced by getNumberOfCommentsForRedraw().

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

◆ getNumberOfCommentsForRedraw()

ilPollCommentsHandler::getNumberOfCommentsForRedraw ( )

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

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

63  : void
64  {
65  $poll_id = 0;
66  if ($this->http->wrapper()->query()->has('poll_id')) {
67  $poll_id = $this->http->wrapper()->query()->retrieve(
68  'poll_id',
69  $this->refinery->kindlyTo()->int()
70  );
71  }
72 
73  $number = $this->getNumberOfComments($poll_id);
74 
75  if ($number > 0) {
76  echo "(" . $number . ")";
77  } else {
78  echo "";
79  }
80 
81  exit();
82  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ getRedrawURL()

ilPollCommentsHandler::getRedrawURL ( )

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

References $redraw_url.

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

◆ lookupObjectId()

ilPollCommentsHandler::lookupObjectId ( int  $ref_id)
protected

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

References ilObject\_lookupObjectId().

Referenced by commentJSCall(), and getNumberOfComments().

91  : int
92  {
94  }
$ref_id
Definition: ltiauth.php:66
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 29 of file class.ilPollCommentsHandler.php.

Referenced by __construct().

◆ $notes

NotesService ilPollCommentsHandler::$notes
protected

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

Referenced by __construct().

◆ $redraw_url

string ilPollCommentsHandler::$redraw_url
protected

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

Referenced by __construct(), and getRedrawURL().

◆ $refinery

Refinery ilPollCommentsHandler::$refinery
protected

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

Referenced by __construct().


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