5 require_once
"./Services/Object/classes/class.ilObject2GUI.php";
20 function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
24 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
26 $lng->loadLanguageModule(
"poll");
39 $ilCtrl->redirect($this,
"render");
48 include_once
"Services/Object/classes/class.ilObjectActivation.php";
49 $this->lng->loadLanguageModule(
'rep');
52 $section->setTitle($this->lng->txt(
'rep_activation_availability'));
56 $act_obj_info = $act_ref_info =
"";
59 $act_obj_info =
' '.$this->lng->txt(
'rep_activation_online_object_info');
60 $act_ref_info = $this->lng->txt(
'rep_activation_access_ref_info');
64 $online->
setInfo($this->lng->txt(
'poll_activation_online_info').$act_obj_info);
67 include_once
"Services/Form/classes/class.ilDateDurationInputGUI.php";
76 $section->setTitle($this->lng->txt(
'poll_voting_period_and_results'));
95 $show_result_as =
new ilRadioGroupInputGUI($lng->txt(
"poll_show_results_as"),
"show_results_as");
99 $show_result_as->addOption($result_bar);
100 $show_result_as->addOption(
new ilRadioOption($lng->txt(
"poll_piechart"),
102 $a_form->
addItem($show_result_as);
106 $sort->addOption(
new ilRadioOption($lng->txt(
"poll_result_sorting_answers"), 0));
107 $sort->addOption(
new ilRadioOption($lng->txt(
"poll_result_sorting_votes"), 1));
111 $section->setTitle($this->lng->txt(
'poll_comments'));
121 include_once
"Services/Object/classes/class.ilObjectActivation.php";
123 $a_values[
"online"] = $this->
object->IsOnline();
124 $a_values[
"results"] = $this->
object->getViewResults();
125 $a_values[
"access_period"][
"start"] = $this->
object->getAccessBegin()
128 $a_values[
"access_period"][
"end"] = $this->
object->getAccessEnd()
131 $a_values[
"voting_period"][
"start"] = $this->
object->getVotingPeriodBegin()
134 $a_values[
"voting_period"][
"end"] = $this->
object->getVotingPeriodEnd()
137 $a_values[
"sort"] = $this->
object->getSortResultByVotes();
138 $a_values[
"comment"] = $this->
object->getShowComments();
139 $a_values[
"show_results_as"] = $this->
object->getShowResultsAs();
145 if(!$a_form->
getInput(
"voting_period") &&
149 $a_form->
getItemByPostVar(
"results")->setAlert($this->lng->txt(
"poll_view_results_after_period_impossible"));
152 return parent::validateCustom($a_form);
157 $this->
object->setViewResults($a_form->
getInput(
"results"));
158 $this->
object->setOnline($a_form->
getInput(
"online"));
159 $this->
object->setSortResultByVotes($a_form->
getInput(
"sort"));
160 $this->
object->setShowComments($a_form->
getInput(
"comment"));
161 $this->
object->setShowResultsAs($a_form->
getInput(
"show_results_as"));
163 include_once
"Services/Object/classes/class.ilObjectActivation.php";
165 if($period->getStart() && $period->getEnd())
168 $this->
object->setAccessBegin($period->getStart()->get(
IL_CAL_UNIX));
169 $this->
object->setAccessEnd($period->getEnd()->get(
IL_CAL_UNIX));
177 if($period->getStart() && $period->getEnd())
179 $this->
object->setVotingPeriod(1);
180 $this->
object->setVotingPeriodBegin($period->getStart()->get(
IL_CAL_UNIX));
181 $this->
object->setVotingPeriodEnd($period->getEnd()->get(
IL_CAL_UNIX));
186 $this->
object->setVotingPeriodBegin(null);
187 $this->
object->setVotingPeriodEnd(null);
188 $this->
object->setVotingPeriod(0);
194 global
$lng, $ilHelp;
196 $ilHelp->setScreenIdComponent(
"poll");
200 $this->tabs_gui->addTab(
"content",
201 $lng->txt(
"content"),
202 $this->ctrl->getLinkTarget($this,
""));
207 $this->tabs_gui->addTab(
"settings",
208 $lng->txt(
"settings"),
209 $this->ctrl->getLinkTarget($this,
"edit"));
211 $this->tabs_gui->addTab(
"participants",
212 $lng->txt(
"poll_result"),
213 $this->ctrl->getLinkTarget($this,
"showParticipants"));
215 $this->tabs_gui->addTab(
"export",
217 $this->ctrl->getLinkTargetByClass(
"ilexportgui",
""));
226 global
$ilCtrl,
$tpl, $ilTabs, $ilNavigationHistory;
228 $next_class = $ilCtrl->getNextClass($this);
229 $cmd = $ilCtrl->getCmd();
231 $tpl->getStandardTemplate();
237 $link = $ilCtrl->getLinkTargetByClass(
"ilrepositorygui",
"frameset");
238 $ilNavigationHistory->addItem($this->node_id, $link,
"poll");
243 case "ilinfoscreengui":
245 $this->infoScreenForward();
248 case "ilcommonactiondispatchergui":
249 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
251 $this->ctrl->forwardCommand($gui);
254 case "ilpermissiongui":
256 $ilTabs->activateTab(
"id_permissions");
257 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
259 $this->ctrl->forwardCommand($perm_gui);
262 case "ilobjectcopygui":
263 include_once
"./Services/Object/classes/class.ilObjectCopyGUI.php";
265 $cp->setType(
"poll");
266 $this->ctrl->forwardCommand($cp);
271 $ilTabs->activateTab(
"export");
272 include_once(
"./Services/Export/classes/class.ilExportGUI.php");
274 $exp_gui->addFormat(
"xml");
275 $ilCtrl->forwardCommand($exp_gui);
279 return parent::executeCommand();
302 $ilTabs->activateTab(
"content");
306 if($this->
object->countVotes())
308 $url = $ilCtrl->getLinkTarget($this,
"showParticipants");
310 " <a href=\"".$url.
"\">»".$lng->txt(
"poll_result").
"</a>");
316 $tpl->setPermanentLink(
'poll', $this->node_id);
318 $tpl->setContent($a_form->getHTML());
325 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
327 $form->setFormAction($ilCtrl->getFormAction($this,
"saveQuestion"));
328 $form->setTitle($lng->txt(
"obj_poll"));
332 $question->setCols(40);
333 $question->setRows(2);
334 $question->setValue($this->
object->getQuestion());
335 $question->setDisabled($a_read_only);
336 $form->addItem($question);
338 $dimensions =
" (".ilObjPoll::getImageSize().
"px)";
340 $img->setDisabled($a_read_only);
341 $form->addItem(
$img);
344 $file = $this->
object->getImageFullPath(
true);
352 $option =
new ilRadioOption($lng->txt(
"poll_mode_anonymous"), 0);
353 $option->
setInfo($lng->txt(
"poll_mode_anonymous_info"));
354 $anonymous->addOption($option);
355 $option =
new ilRadioOption($lng->txt(
"poll_mode_personal"), 1);
356 $option->
setInfo($lng->txt(
"poll_mode_personal_info"));
357 $anonymous->addOption($option);
358 $anonymous->setValue($this->
object->getNonAnonymous());
359 $anonymous->setDisabled($a_read_only);
360 $form->addItem($anonymous);
362 $nanswers =
new ilNumberInputGUI($lng->txt(
"poll_max_number_of_answers"),
"nanswers");
364 $nanswers->setMinValue(1);
365 $nanswers->setSize(3);
366 $nanswers->setValue($this->
object->getMaxNumberOfAnswers());
367 $nanswers->setDisabled($a_read_only);
368 $form->addItem($nanswers);
370 $answers =
new ilTextInputGUI($lng->txt(
"poll_answers"),
"answers");
372 $answers->setMulti(
true,
true);
373 $answers->setDisabled($a_read_only);
374 $form->addItem($answers);
376 $multi_answers =
array();
377 foreach($this->
object->getAnswers() as $idx => $item)
381 $answers->setValue($item[
"answer"]);
383 $multi_answers[] = $item[
"answer"];
385 $answers->setMultiValues($multi_answers);
389 $form->addCommandButton(
"saveQuestion", $lng->txt(
"save"));
398 if($form->checkInput())
400 $this->
object->setQuestion($form->getInput(
"question"));
401 $this->
object->setNonAnonymous($form->getInput(
"mode"));
403 $image = $form->getItemByPostVar(
"image");
404 if($_FILES[
"image"][
"tmp_name"])
406 $this->
object->uploadImage($_FILES[
"image"]);
408 else if($image->getDeletionFlag())
410 $this->
object->deleteImage();
413 $nr_of_anwers = $this->
object->saveAnswers($form->getInput(
"answers"));
416 $this->
object->setMaxNumberOfAnswers(min($form->getInput(
"nanswers"), $nr_of_anwers));
418 if($this->
object->update())
421 $this->ctrl->redirect($this,
"render");
425 $form->setValuesByPost();
433 if(!$this->
object->getNonAnonymous())
438 $ilTabs->addSubTab(
"result_answers", $lng->txt(
"poll_result_answers"),
439 $ilCtrl->getLinkTarget($this,
"showParticipants"));
440 $ilTabs->addSubTab(
"result_users", $lng->txt(
"poll_result_users"),
441 $ilCtrl->getLinkTarget($this,
"showParticipantVotes"));
443 $ilTabs->activateSubTab($a_active);
456 $ilTabs->activateTab(
"participants");
459 include_once
"Modules/Poll/classes/class.ilPollAnswerTableGUI.php";
461 $tpl->setContent(
$tbl->getHTML());
469 !$this->
object->getNonAnonymous())
475 $ilTabs->activateTab(
"participants");
478 include_once
"Modules/Poll/classes/class.ilPollUserTableGUI.php";
480 $tpl->setContent(
$tbl->getHTML());
493 $ilTabs->activateTab(
"participants");
495 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
497 $cgui->setHeaderText($lng->txt(
"poll_delete_votes_sure"));
499 $cgui->setFormAction($this->ctrl->getFormAction($this));
500 $cgui->setCancel($lng->txt(
"cancel"),
"showParticipants");
501 $cgui->setConfirm($lng->txt(
"confirm"),
"deleteAllVotes");
503 $tpl->setContent($cgui->getHTML());
516 $this->
object->deleteAllVotes();
518 $ilCtrl->redirect($this,
"showParticipants");
526 if($this->
object->getMaxNumberOfAnswers() > 1)
528 if(
sizeof(
$_POST[
"aw"]) > $this->
object->getMaxNumberOfAnswers())
548 $this->
object->saveVote($ilUser->getId(),
$_POST[
"aw"]);
557 include_once
"Services/Link/classes/class.ilLink.php";
565 include_once
"./Services/Notification/classes/class.ilNotification.php";
569 include_once
"Services/Link/classes/class.ilLink.php";
577 include_once
"./Services/Notification/classes/class.ilNotification.php";
581 include_once
"Services/Link/classes/class.ilLink.php";
590 include_once
"./Services/Notification/classes/class.ilNotification.php";
592 $this->
object->getId(), null,
true);
598 include_once
"./Services/Notification/classes/class.ilSystemNotification.php";
600 $ntf->setLangModules(
array(
"poll"));
601 $ntf->setRefId($this->ref_id);
603 if($this->
object->getNonAnonymous())
605 $ntf->setChangedByUserId($ilUser->getId());
608 $ntf->setSubjectLangId(
'poll_vote_notification_subject');
609 $ntf->setIntroductionLangId(
'poll_vote_notification_body');
610 $ntf->setGotoLangId(
'poll_vote_notification_link');
611 $ntf->setReasonLangId(
'poll_vote_notification_reason');
613 $notified = $ntf->sendMail($users, null,
"read");
632 if (is_object($this->
object))
634 $ilLocator->addItem($this->
object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$this->node_id);
643 public static function _goto($a_target)
645 global
$tree, $ilAccess;
647 $id = explode(
"_", $a_target);
651 if ($ilAccess->checkAccess(
"write",
"",
$ref_id))
653 $_GET[
"baseClass"] =
"ilRepositoryGUI";
655 $_GET[
"cmd"] =
"showParticipants";
656 include(
"ilias.php");
662 $container_id = $tree->getParentId(
$ref_id);
665 include_once
"Services/Link/classes/class.ilLink.php";
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
This class represents an option in a radio group.
const VIEW_RESULTS_AFTER_PERIOD
render($a_form=null)
Render object context.
const VIEW_RESULTS_AFTER_VOTE
setParticipantsSubTabs($a_active)
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
New implementation of ilObjectGUI.
GUI class for the workflow of copying objects.
const VIEW_RESULTS_ALWAYS
getAccessHandler()
Get access handler.
Class ilObject Basic functions for all objects.
const SHOW_RESULTS_AS_PIECHART
const TIMINGS_DEACTIVATED
static updateNotificationTime($type, $id, array $user_ids, $page_id=false)
Update the last mail timestamp for given object and users.
updateCustom(ilPropertyFormGUI $a_form)
initQuestionForm($a_read_only=false)
validateCustom(ilPropertyFormGUI $a_form)
setInfo($a_info)
Set Info.
getHTML()
return user view
static _getAllReferences($a_id)
get all reference ids of object
static getNotificationsForObject($type, $id, $page_id=null, $ignore_threshold=false)
Get all users for given object.
initEditCustomForm(ilPropertyFormGUI $a_form)
const SHOW_RESULTS_AS_BARCHART
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Export User Interface Class.
TableGUI class for poll answers.
static _lookupObjId($a_id)
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.
This class represents a text property in a property form.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Create new PHPExcel object
obj_idprivate
This class represents a text area property in a property form.
prepareOutput($a_show_subobjects=true)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static redirect($a_script)
http redirect to other script
static _goto($a_target)
Deep link.
Wrapper classes for system notifications.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
afterSave(ilObject $a_new_object)
TableGUI class for poll users.
Confirmation screen class.
getEditFormCustomValues(array &$a_values)