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)
 
   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);
 
   68                 $act_type->
setInfo($act_ref_info);
 
   71                         $opt->
setInfo($this->lng->txt(
'poll_availability_limitless_info'));
 
   72                         $act_type->addOption($opt);
 
   75                         $opt->
setInfo($this->lng->txt(
'poll_availability_until_info'));
 
   77                                 $date = $this->
object->getAccessBegin();
 
   79                                 $start = 
new ilDateTimeInputGUI($this->lng->txt(
'rep_activation_limited_start'),
'access_begin');
 
   82                                 $opt->addSubItem($start);
 
   84                                 $date = $this->
object->getAccessEnd();
 
   86                                 $end = 
new ilDateTimeInputGUI($this->lng->txt(
'rep_activation_limited_end'),
'access_end');                      
 
   89                                 $opt->addSubItem($end);
 
   97                         $act_type->addOption($opt);
 
  105                 $section->setTitle($this->lng->txt(
'poll_voting_period_and_results'));
 
  110                         $opt = 
new ilRadioOption($this->lng->txt(
'poll_voting_period_unlimited'), 0);           
 
  111                         $prd->addOption($opt);
 
  113                         $opt = 
new ilRadioOption($this->lng->txt(
'poll_voting_period_limited'), 1);                     
 
  114                         $prd->addOption($opt);
 
  116                         $date = $this->
object->getVotingPeriodBegin();
 
  118                         $start = 
new ilDateTimeInputGUI($this->lng->txt(
'poll_voting_period_start'),
'period_begin');
 
  123                         $date = $this->
object->getVotingPeriodEnd();
 
  125                         $end = 
new ilDateTimeInputGUI($this->lng->txt(
'poll_voting_period_end'),
'period_end');                  
 
  147                 $a_values[
"online"] = $this->
object->IsOnline();
 
  150                 $a_values[
"results"] = $this->
object->getViewResults();
 
  151                 $a_values[
"access_type"] = $this->
object->getAccessType();
 
  155                 $a_values[
"period"] = $this->
object->getVotingPeriod();
 
  156                 $a_values[
"period_begin"] = $this->
object->getVotingPeriodBegin();
 
  157                 $a_values[
"period_end"] = $this->
object->getVotingPeriodEnd();
 
  162                 $this->
object->setViewResults($a_form->
getInput(
"results"));
 
  163                 $this->
object->setOnline($a_form->
getInput(
"online"));
 
  165                 include_once 
"Services/Object/classes/class.ilObjectActivation.php";
 
  166                 $this->
object->setAccessType($a_form->
getInput(
"access_type"));
 
  170                         $this->
object->setAccessBegin($date->get(
IL_CAL_UNIX));
 
  172                         $this->
object->setAccessEnd($date->get(
IL_CAL_UNIX));
 
  175                 $this->
object->setVotingPeriod($a_form->
getInput(
"period"));
 
  176                 if($this->object->getVotingPeriod())
 
  179                         $this->
object->setVotingPeriodBegin($date->get(
IL_CAL_UNIX));
 
  181                         $this->
object->setVotingPeriodEnd($date->get(
IL_CAL_UNIX));
 
  187                 global 
$lng, $ilHelp;
 
  189                 $ilHelp->setScreenIdComponent(
"poll");
 
  193                         $this->tabs_gui->addTab(
"content",
 
  194                                 $lng->txt(
"content"),
 
  195                                 $this->ctrl->getLinkTarget($this, 
""));
 
  200                         $this->tabs_gui->addTab(
"settings",
 
  201                                 $lng->txt(
"settings"),
 
  202                                 $this->ctrl->getLinkTarget($this, 
"edit"));                     
 
  204                         $this->tabs_gui->addTab(
"participants",
 
  205                                 $lng->txt(
"poll_result"),
 
  206                                 $this->ctrl->getLinkTarget($this, 
"showParticipants"));         
 
  208                         $this->tabs_gui->addTab(
"export",
 
  210                                         $this->ctrl->getLinkTargetByClass(
"ilexportgui", 
""));
 
  219                 global 
$ilCtrl, 
$tpl, $ilTabs, $ilNavigationHistory;
 
  221                 $next_class = $ilCtrl->getNextClass($this);
 
  222                 $cmd = $ilCtrl->getCmd();
 
  224                 $tpl->getStandardTemplate();
 
  230                         $link = $ilCtrl->getLinkTargetByClass(
"ilrepositorygui", 
"frameset");                           
 
  231                         $ilNavigationHistory->addItem($this->node_id, $link, 
"poll");
 
  236                         case "ilinfoscreengui":
 
  238                                 $this->infoScreenForward();     
 
  241                         case "ilcommonactiondispatchergui":
 
  242                                 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
 
  244                                 $this->ctrl->forwardCommand($gui);
 
  247                         case "ilpermissiongui":
 
  249                                 $ilTabs->activateTab(
"id_permissions");
 
  250                                 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
 
  252                                 $this->ctrl->forwardCommand($perm_gui);
 
  255                         case "ilobjectcopygui":
 
  256                                 include_once 
"./Services/Object/classes/class.ilObjectCopyGUI.php";
 
  258                                 $cp->setType(
"poll");
 
  259                                 $this->ctrl->forwardCommand($cp);
 
  264                                 $ilTabs->activateTab(
"export");
 
  265                                 include_once(
"./Services/Export/classes/class.ilExportGUI.php");
 
  267                                 $exp_gui->addFormat(
"xml");
 
  268                                 $ilCtrl->forwardCommand($exp_gui);
 
  295                 $ilTabs->activateTab(
"content");
 
  299                         if($this->object->countVotes())
 
  301                                 $url = $ilCtrl->getLinkTarget($this, 
"showParticipants");
 
  303                                         " <a href=\"".$url.
"\">»".$lng->txt(
"poll_result").
"</a>");                               
 
  309                 include_once(
'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php');
 
  312                 $tpl->setContent($a_form->getHTML().$plink->getHTML());         
 
  319                 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
 
  321                 $form->setFormAction($ilCtrl->getFormAction($this, 
"saveQuestion"));
 
  322                 $form->setTitle($lng->txt(
"obj_poll"));
 
  326                 $question->setCols(40);
 
  327                 $question->setRows(2);
 
  328                 $question->setValue($this->object->getQuestion());
 
  329                 $question->setDisabled($a_read_only);
 
  330                 $form->addItem($question);
 
  332                 $dimensions = 
" (".ilObjPoll::getImageSize().
"px)";             
 
  334                 $img->setDisabled($a_read_only);
 
  335                 $form->addItem(
$img);
 
  338                 $file = $this->
object->getImageFullPath(
true);
 
  344                 $answers = 
new ilTextInputGUI($lng->txt(
"poll_answers"), 
"answers");
 
  346                 $answers->setMulti(
true, 
true);
 
  347                 $answers->setDisabled($a_read_only);
 
  348                 $form->addItem($answers);                       
 
  350                 $multi_answers = array();               
 
  351                 foreach($this->object->getAnswers() as $idx => $item)
 
  355                                 $answers->setValue($item[
"answer"]);
 
  357                         $multi_answers[] = $item[
"answer"];
 
  359                 $answers->setMultiValues($multi_answers);
 
  363                         $form->addCommandButton(
"saveQuestion", $lng->txt(
"save"));
 
  372                 if($form->checkInput())
 
  374                         $this->
object->setQuestion($form->getInput(
"question"));
 
  376                         $image = $form->getItemByPostVar(
"image");                              
 
  377                         if($_FILES[
"image"][
"tmp_name"]) 
 
  379                                 $this->
object->uploadImage($_FILES[
"image"]);
 
  381                         else if($image->getDeletionFlag())
 
  383                                 $this->
object->deleteImage();
 
  386                         $this->
object->saveAnswers($form->getInput(
"answers"));
 
  388                         if($this->object->update())
 
  391                                 $this->ctrl->redirect($this, 
"render");
 
  395                 $form->setValuesByPost();
 
  409                 $ilTabs->activateTab(
"participants");
 
  411                 include_once 
"Modules/Poll/classes/class.ilPollAnswerTableGUI.php";
 
  413                 $tpl->setContent($tbl->getHTML());              
 
  426                 $ilTabs->activateTab(
"participants");
 
  428                 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
 
  430                 $cgui->setHeaderText($lng->txt(
"poll_delete_votes_sure"));
 
  432                 $cgui->setFormAction($this->ctrl->getFormAction($this));
 
  433                 $cgui->setCancel($lng->txt(
"cancel"), 
"showParticipants");
 
  434                 $cgui->setConfirm($lng->txt(
"confirm"), 
"deleteAllVotes");
 
  436                 $tpl->setContent($cgui->getHTML());
 
  449                 $this->
object->deleteAllVotes();
 
  451                 $ilCtrl->redirect($this, 
"showParticipants");
 
  460                         $this->
object->saveVote($ilUser->getId(), 
$_POST[
"aw"]);
 
  463                 include_once 
"Services/Link/classes/class.ilLink.php";
 
  481                 if (is_object($this->
object))
 
  483                         $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, 
""), 
"", 
$this->node_id);
 
  496                 $id = explode(
"_", $a_target);          
 
  499                 $container_id = $tree->getParentId($id[0]);
 
  502                 include_once 
"Services/Link/classes/class.ilLink.php";