4 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
27 parent::__construct($a_id);
28 $this->lng = $DIC->language();
43 include_once
"Modules/Poll/classes/class.ilObjPoll.php";
45 $this->answers = $this->poll->getAnswers();
66 if (!
sizeof($this->answers)) {
70 include_once
"Modules/Poll/classes/class.ilObjPollAccess.php";
76 if (!$this->
mayVote($a_user_id) &&
90 if ($a_user_id == ANONYMOUS_USER_ID) {
94 if ($this->poll->hasUserVoted($a_user_id)) {
98 if ($this->poll->getVotingPeriod() &&
99 ($this->poll->getVotingPeriodBegin() >
time() ||
100 $this->poll->getVotingPeriodEnd() <
time())) {
110 $this->poll->getVotingPeriod() &&
111 $this->poll->getVotingPeriodEnd() >
time()) {
119 if (!$this->active) {
123 switch ($this->poll->getViewResults()) {
135 if ($this->poll->hasUserVoted($a_user_id)) {
146 if (!
sizeof($this->answers)) {
147 return $lng->txt(
"poll_block_message_no_answers");
150 if (!$this->active) {
151 if (!$this->poll->isOnline()) {
152 return $lng->txt(
"poll_block_message_offline");
154 if ($this->poll->getAccessBegin() >
time()) {
156 return sprintf(
$lng->txt(
"poll_block_message_inactive"), $date);
168 return $this->poll->getShowResultsAs();
177 return $this->poll->getShowComments();
const VIEW_RESULTS_AFTER_PERIOD
showComments()
Are Comments enabled or disabled.
const VIEW_RESULTS_AFTER_VOTE
const VIEW_RESULTS_ALWAYS
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
static _isActivated($a_ref_id)
Is activated?
getPoll()
Get poll object.
setRefId($a_id)
Set ref id (needed for poll access)
showResultsAs()
Show Results as (Barchart or Piechart)
This is the super class of all custom blocks.
maySeeResults($a_user_id)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
hasAnyContent($a_user_id, $a_ref_id)
Check if user will see any content (vote/result)
__construct($a_id=0)
Constructor.