5require_once 
"./Services/Object/classes/class.ilObject2GUI.php";
 
   35    public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
 
   39        $this->lng = 
$DIC->language();
 
   40        $this->ctrl = 
$DIC->ctrl();
 
   41        $this->help = 
$DIC[
"ilHelp"];
 
   42        $this->tpl = 
$DIC[
"tpl"];
 
   43        $this->tabs = 
$DIC->tabs();
 
   44        $this->nav_history = 
$DIC[
"ilNavigationHistory"];
 
   45        $this->toolbar = 
$DIC->toolbar();
 
   46        $this->
user = $DIC->user();
 
   47        $this->tree = 
$DIC->repositoryTree();
 
   48        $this->locator = 
$DIC[
"ilLocator"];
 
   51        parent::__construct($a_id, $a_id_type, $a_parent_node_id);
 
   53        $lng->loadLanguageModule(
"poll");
 
   66        $ilCtrl->redirect($this, 
"render");
 
   75        include_once 
"Services/Object/classes/class.ilObjectActivation.php";
 
   76        $this->lng->loadLanguageModule(
'rep');
 
   79        $section->setTitle($this->lng->txt(
'rep_activation_availability'));
 
   83        $act_obj_info = $act_ref_info = 
"";
 
   85            $act_obj_info = 
' ' . $this->lng->txt(
'rep_activation_online_object_info');
 
   86            $act_ref_info = $this->lng->txt(
'rep_activation_access_ref_info');
 
   90        $online->setInfo($this->lng->txt(
'poll_activation_online_info') . $act_obj_info);
 
   93        include_once 
"Services/Form/classes/class.ilDateDurationInputGUI.php";
 
   95        $dur->setShowTime(
true);
 
  102        $section->setTitle($this->lng->txt(
'poll_voting_period_and_results'));
 
  106        $vdur->setShowTime(
true);
 
  112            $lng->txt(
"poll_view_results_always"),
 
  116            $lng->txt(
"poll_view_results_never"),
 
  120            $lng->txt(
"poll_view_results_after_vote"),
 
  124            $lng->txt(
"poll_view_results_after_period"),
 
  130        $show_result_as->setRequired(
true);
 
  132            $lng->txt(
"poll_barchart"),
 
  135        $show_result_as->addOption($result_bar);
 
  137            $lng->txt(
"poll_piechart"),
 
  140        $a_form->
addItem($show_result_as);
 
  143        $sort->setRequired(
true);
 
  144        $sort->addOption(
new ilRadioOption(
$lng->txt(
"poll_result_sorting_answers"), 0));
 
  149        $section->setTitle($this->lng->txt(
'poll_comments'));
 
  159        include_once 
"Services/Object/classes/class.ilObjectActivation.php";
 
  161        $a_values[
"online"] = $this->
object->IsOnline();
 
  162        $a_values[
"results"] = $this->
object->getViewResults();
 
  163        $a_values[
"access_period"][
"start"] = $this->
object->getAccessBegin()
 
  166        $a_values[
"access_period"][
"end"] = $this->
object->getAccessEnd()
 
  169        $a_values[
"voting_period"][
"start"] = $this->
object->getVotingPeriodBegin()
 
  172        $a_values[
"voting_period"][
"end"] = $this->
object->getVotingPeriodEnd()
 
  175        $a_values[
"sort"] = $this->
object->getSortResultByVotes();
 
  176        $a_values[
"comment"] = $this->
object->getShowComments();
 
  177        $a_values[
"show_results_as"] = $this->
object->getShowResultsAs();
 
  183        if (!$a_form->
getInput(
"voting_period") &&
 
  186            $a_form->
getItemByPostVar(
"results")->setAlert($this->lng->txt(
"poll_view_results_after_period_impossible"));
 
  189        return parent::validateCustom($a_form);
 
  194        $this->
object->setViewResults($a_form->
getInput(
"results"));
 
  195        $this->
object->setOnline($a_form->
getInput(
"online"));
 
  196        $this->
object->setSortResultByVotes($a_form->
getInput(
"sort"));
 
  197        $this->
object->setShowComments($a_form->
getInput(
"comment"));
 
  198        $this->
object->setShowResultsAs($a_form->
getInput(
"show_results_as"));
 
  200        include_once 
"Services/Object/classes/class.ilObjectActivation.php";
 
  202        if ($period->getStart() && $period->getEnd()) {
 
  204            $this->
object->setAccessBegin($period->getStart()->get(
IL_CAL_UNIX));
 
  205            $this->
object->setAccessEnd($period->getEnd()->get(
IL_CAL_UNIX));
 
  211        if ($period->getStart() && $period->getEnd()) {
 
  212            $this->
object->setVotingPeriod(1);
 
  213            $this->
object->setVotingPeriodBegin($period->getStart()->get(
IL_CAL_UNIX));
 
  214            $this->
object->setVotingPeriodEnd($period->getEnd()->get(
IL_CAL_UNIX));
 
  216            $this->
object->setVotingPeriodBegin(
null);
 
  217            $this->
object->setVotingPeriodEnd(
null);
 
  218            $this->
object->setVotingPeriod(0);
 
  227        $ilHelp->setScreenIdComponent(
"poll");
 
  230            $this->tabs_gui->addTab(
 
  232                $lng->txt(
"content"),
 
  233                $this->ctrl->getLinkTarget($this, 
"")
 
  238            $this->tabs_gui->addTab(
 
  240                $lng->txt(
"settings"),
 
  241                $this->ctrl->getLinkTarget($this, 
"edit")
 
  244            $this->tabs_gui->addTab(
 
  246                $lng->txt(
"poll_result"),
 
  247                $this->ctrl->getLinkTarget($this, 
"showParticipants")
 
  250            $this->tabs_gui->addTab(
 
  253                $this->ctrl->getLinkTargetByClass(
"ilexportgui", 
"")
 
  268        $next_class = 
$ilCtrl->getNextClass($this);
 
  271        $tpl->getStandardTemplate();
 
  276            $link = 
$ilCtrl->getLinkTargetByClass(
"ilrepositorygui", 
"frameset");
 
  277            $ilNavigationHistory->addItem($this->node_id, $link, 
"poll");
 
  280        switch ($next_class) {
 
  281            case "ilinfoscreengui":
 
  283                $this->infoScreenForward();
 
  286            case "ilcommonactiondispatchergui":
 
  287                include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
 
  289                $this->ctrl->forwardCommand($gui);
 
  292            case "ilpermissiongui":
 
  294                $ilTabs->activateTab(
"id_permissions");
 
  295                include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
 
  297                $this->ctrl->forwardCommand($perm_gui);
 
  300            case "ilobjectcopygui":
 
  301                include_once 
"./Services/Object/classes/class.ilObjectCopyGUI.php";
 
  303                $cp->setType(
"poll");
 
  304                $this->ctrl->forwardCommand($cp);
 
  309                $ilTabs->activateTab(
"export");
 
  310                include_once(
"./Services/Export/classes/class.ilExportGUI.php");
 
  312                $exp_gui->addFormat(
"xml");
 
  313                $ilCtrl->forwardCommand($exp_gui);
 
  317                return parent::executeCommand();
 
  344        $ilTabs->activateTab(
"content");
 
  347            if ($this->object->countVotes()) {
 
  348                $url = 
$ilCtrl->getLinkTarget($this, 
"showParticipants");
 
  350                    " <a href=\"" . 
$url . 
"\">»" . 
$lng->txt(
"poll_result") . 
"</a>");
 
  356        $tpl->setPermanentLink(
'poll', $this->node_id);
 
  358        $tpl->setContent($a_form->getHTML());
 
  366        include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
 
  368        $form->setFormAction(
$ilCtrl->getFormAction($this, 
"saveQuestion"));
 
  372        $question->setRequired(
true);
 
  373        $question->setCols(40);
 
  374        $question->setRows(2);
 
  375        $question->setValue($this->object->getQuestion());
 
  376        $question->setDisabled($a_read_only);
 
  377        $form->addItem($question);
 
  381        $img->setDisabled($a_read_only);
 
  385        $file = $this->
object->getImageFullPath(
true);
 
  391        $anonymous->setRequired(
true);
 
  393        $option->setInfo(
$lng->txt(
"poll_mode_anonymous_info"));
 
  394        $anonymous->addOption($option);
 
  396        $option->setInfo(
$lng->txt(
"poll_mode_personal_info"));
 
  397        $anonymous->addOption($option);
 
  398        $anonymous->setValue($this->object->getNonAnonymous());
 
  399        $anonymous->setDisabled($a_read_only);
 
  400        $form->addItem($anonymous);
 
  403        $nanswers->setRequired(
true);
 
  404        $nanswers->setMinValue(1);
 
  405        $nanswers->setSize(3);
 
  406        $nanswers->setValue($this->object->getMaxNumberOfAnswers());
 
  407        $nanswers->setDisabled($a_read_only);
 
  408        $form->addItem($nanswers);
 
  411        $answers->setRequired(
true);
 
  412        $answers->setMulti(
true, 
true);
 
  413        $answers->setDisabled($a_read_only);
 
  414        $form->addItem($answers);
 
  416        $multi_answers = array();
 
  417        foreach ($this->object->getAnswers() as $idx => $item) {
 
  419                $answers->setValue($item[
"answer"]);
 
  421            $multi_answers[] = $item[
"answer"];
 
  423        $answers->setMultiValues($multi_answers);
 
  426            $form->addCommandButton(
"saveQuestion", 
$lng->txt(
"save"));
 
  435        if (
$form->checkInput()) {
 
  436            $this->
object->setQuestion(
$form->getInput(
"question"));
 
  437            $this->
object->setNonAnonymous(
$form->getInput(
"mode"));
 
  439            $image = 
$form->getItemByPostVar(
"image");
 
  440            if ($_FILES[
"image"][
"tmp_name"]) {
 
  441                $this->
object->uploadImage($_FILES[
"image"]);
 
  442            } elseif ($image->getDeletionFlag()) {
 
  443                $this->
object->deleteImage();
 
  446            $nr_of_anwers = $this->
object->saveAnswers(
$form->getInput(
"answers"));
 
  449            $this->
object->setMaxNumberOfAnswers(min(
$form->getInput(
"nanswers"), $nr_of_anwers));
 
  451            if ($this->object->update()) {
 
  453                $this->ctrl->redirect($this, 
"render");
 
  457        $form->setValuesByPost();
 
  467        if (!$this->object->getNonAnonymous()) {
 
  473            $lng->txt(
"poll_result_answers"),
 
  474            $ilCtrl->getLinkTarget($this, 
"showParticipants")
 
  478            $lng->txt(
"poll_result_users"),
 
  479            $ilCtrl->getLinkTarget($this, 
"showParticipantVotes")
 
  482        $ilTabs->activateSubTab($a_active);
 
  496        $ilTabs->activateTab(
"participants");
 
  499        include_once 
"Modules/Poll/classes/class.ilPollAnswerTableGUI.php";
 
  511            !$this->object->getNonAnonymous()) {
 
  516        $ilTabs->activateTab(
"participants");
 
  519        include_once 
"Modules/Poll/classes/class.ilPollUserTableGUI.php";
 
  535        $ilTabs->activateTab(
"participants");
 
  537        include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
  539        $cgui->setHeaderText(
$lng->txt(
"poll_delete_votes_sure"));
 
  541        $cgui->setFormAction($this->ctrl->getFormAction($this));
 
  542        $cgui->setCancel(
$lng->txt(
"cancel"), 
"showParticipants");
 
  543        $cgui->setConfirm(
$lng->txt(
"confirm"), 
"deleteAllVotes");
 
  545        $tpl->setContent($cgui->getHTML());
 
  558        $this->
object->deleteAllVotes();
 
  560        $ilCtrl->redirect($this, 
"showParticipants");
 
  569        if ($this->object->getMaxNumberOfAnswers() > 1) {
 
  570            if (
sizeof(
$_POST[
"aw"]) > $this->object->getMaxNumberOfAnswers()) {
 
  573            if (!
sizeof(
$_POST[
"aw"])) {
 
  577            if ((
int) !
$_POST[
"aw"]) {
 
  583            unset(
$_SESSION[
"last_poll_vote"][$this->object->getId()]);
 
  591        include_once 
"Services/Link/classes/class.ilLink.php";
 
  601        include_once 
"./Services/Notification/classes/class.ilNotification.php";
 
  605        include_once 
"Services/Link/classes/class.ilLink.php";
 
  615        include_once 
"./Services/Notification/classes/class.ilNotification.php";
 
  619        include_once 
"Services/Link/classes/class.ilLink.php";
 
  628        include_once 
"./Services/Notification/classes/class.ilNotification.php";
 
  631            $this->object->getId(),
 
  639        include_once 
"./Services/Notification/classes/class.ilSystemNotification.php";
 
  641        $ntf->setLangModules(array(
"poll"));
 
  642        $ntf->setRefId($this->ref_id);
 
  644        if ($this->object->getNonAnonymous()) {
 
  645            $ntf->setChangedByUserId(
$ilUser->getId());
 
  648        $ntf->setSubjectLangId(
'poll_vote_notification_subject');
 
  649        $ntf->setIntroductionLangId(
'poll_vote_notification_body');
 
  650        $ntf->setGotoLangId(
'poll_vote_notification_link');
 
  651        $ntf->setReasonLangId(
'poll_vote_notification_reason');
 
  653        $notified = $ntf->sendMail(
$users, 
null, 
"read");
 
  671        if (is_object($this->
object)) {
 
  672            $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, 
""), 
"", $this->node_id);
 
  681    public static function _goto($a_target)
 
  686        $ilAccess = 
$DIC->access();
 
  688        $id = explode(
"_", $a_target);
 
  692        if ($ilAccess->checkAccess(
"write", 
"", 
$ref_id)) {
 
  693            $_GET[
"baseClass"] = 
"ilRepositoryGUI";
 
  695            $_GET[
"cmd"] = 
"showParticipants";
 
  696            include(
"ilias.php");
 
  703            include_once 
"Services/Link/classes/class.ilLink.php";
 
An exception for terminatinating execution or to throw for unit testing.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
@classDescription Date and time handling
Export User Interface Class.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.
static getNotificationsForObject($type, $id, $page_id=null, $ignore_threshold=false)
Get all users for given object.
static updateNotificationTime($type, $id, array $user_ids, $page_id=false)
Update the last mail timestamp for given object and users.
getHTML()
return user view
render($a_form=null)
Render object context.
static _goto($a_target)
Deep link.
initEditCustomForm(ilPropertyFormGUI $a_form)
Add custom fields to update form.
executeCommand()
execute command
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
validateCustom(ilPropertyFormGUI $a_form)
Validate custom values (if not possible with checkInput())
setTabs()
create tabs (repository/workspace switch)
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
Constructor.
getType()
Functions that must be overwritten.
addLocatorItems()
Functions to be overwritten.
initQuestionForm($a_read_only=false)
getEditFormCustomValues(array &$a_values)
Add values to custom edit fields.
setParticipantsSubTabs($a_active)
const VIEW_RESULTS_ALWAYS
const SHOW_RESULTS_AS_PIECHART
const VIEW_RESULTS_AFTER_VOTE
const SHOW_RESULTS_AS_BARCHART
const VIEW_RESULTS_AFTER_PERIOD
New implementation of ilObjectGUI.
getAccessHandler()
Get access handler.
prepareOutput($a_show_subobjects=true)
prepare output
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
getCreationMode()
get creation mode
const TIMINGS_DEACTIVATED
GUI class for the workflow of copying objects.
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
static _getAllReferences($a_id)
get all reference ids of object
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
TableGUI class for poll answers.
TableGUI class for poll users.
This class represents an option in a radio group.
Wrapper classes for system notifications.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!array_key_exists('StateId', $_REQUEST)) $id
if(isset($_POST['submit'])) $form
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file