Пример #1
0
 /**
  * Show membership limitations
  *
  * @access protected
  * @return
  */
 protected function fillMembershipLimitation()
 {
     global $ilAccess, $ilCtrl;
     include_once 'Modules/Course/classes/class.ilObjCourseGrouping.php';
     if (!($items = ilObjCourseGrouping::_getGroupingItems($this->container))) {
         return true;
     }
     $mem = new ilCustomInputGUI($this->lng->txt('groupings'));
     $tpl = new ilTemplate('tpl.membership_limitation_form.html', true, true, 'Services/Membership');
     $tpl->setVariable('LIMIT_INTRO', $this->lng->txt($this->type . '_grp_info_reg'));
     foreach ($items as $ref_id) {
         $obj_id = ilObject::_lookupObjId($ref_id);
         $type = ilObject::_lookupType($obj_id);
         $title = ilObject::_lookupTitle($obj_id);
         if ($ilAccess->checkAccess('visible', '', $ref_id, $type)) {
             include_once './Services/Link/classes/class.ilLink.php';
             $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $ref_id);
             $tpl->setVariable('LINK_ITEM', $ilCtrl->getLinkTargetByClass("ilrepositorygui", ""));
             $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
             $tpl->setVariable('ITEM_LINKED_TITLE', $title);
         } else {
             $tpl->setVariable('ITEM_TITLE');
         }
         $tpl->setCurrentBlock('items');
         $tpl->setVariable('TYPE_ICON', ilObject::_getIcon($obj_id, tiny, $type));
         $tpl->setVariable('ALT_ICON', $this->lng->txt('obj_' . $type));
         $tpl->parseCurrentBlock();
     }
     $mem->setHtml($tpl->get());
     if (!ilObjCourseGrouping::_checkGroupingDependencies($this->container)) {
         $mem->setAlert($this->container->getMessage());
         $this->enableRegistration(false);
     }
     $this->form->addItem($mem);
 }
 /**
  * fill registration type
  *
  * @access protected
  * @return
  */
 protected function fillRegistrationType()
 {
     global $ilUser;
     if ($this->container->getSubscriptionLimitationType() == IL_CRS_SUBSCRIPTION_DEACTIVATED) {
         $reg = new ilCustomInputGUI($this->lng->txt('mem_reg_type'));
         #$reg->setHtml($this->lng->txt('crs_info_reg_deactivated'));
         $reg->setAlert($this->lng->txt('crs_info_reg_deactivated'));
         #ilUtil::sendFailure($this->lng->txt('crs_info_reg_deactivated'));
         #$reg = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
         #$reg->setValue($this->lng->txt('crs_info_reg_deactivated'));
         #$reg->setAlert($this->lng->txt('grp_reg_deactivated_alert'));
         $this->form->addItem($reg);
         // Disable registration
         $this->enableRegistration(false);
         return true;
     }
     switch ($this->container->getSubscriptionType()) {
         case IL_CRS_SUBSCRIPTION_DIRECT:
             // no "request" info if waiting list is active
             if ($this->isWaitingListActive()) {
                 return true;
             }
             $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
             $txt->setValue($this->lng->txt('crs_info_reg_direct'));
             $this->form->addItem($txt);
             break;
         case IL_CRS_SUBSCRIPTION_PASSWORD:
             $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
             $txt->setValue($this->lng->txt('crs_subscription_options_password'));
             $pass = new ilTextInputGUI($this->lng->txt('passwd'), 'grp_passw');
             $pass->setInputType('password');
             $pass->setSize(12);
             $pass->setMaxLength(32);
             #$pass->setRequired(true);
             $pass->setInfo($this->lng->txt('crs_info_reg_password'));
             $txt->addSubItem($pass);
             $this->form->addItem($txt);
             break;
         case IL_CRS_SUBSCRIPTION_CONFIRMATION:
             // no "request" info if waiting list is active
             if ($this->isWaitingListActive()) {
                 return true;
             }
             $txt = new ilNonEditableValueGUI($this->lng->txt('mem_reg_type'));
             $txt->setValue($this->lng->txt('crs_subscription_options_confirmation'));
             $sub = new ilTextAreaInputGUI($this->lng->txt('crs_reg_subject'), 'subject');
             $sub->setValue($_POST['subject']);
             $sub->setInfo($this->lng->txt('crs_info_reg_confirmation'));
             $sub->setCols(40);
             $sub->setRows(5);
             if ($this->participants->isSubscriber($ilUser->getId())) {
                 $sub_data = $this->participants->getSubscriberData($ilUser->getId());
                 $sub->setValue($sub_data['subject']);
                 $sub->setInfo('');
                 ilUtil::sendFailure($this->lng->txt('crs_reg_user_already_subscribed'));
                 $this->enableRegistration(false);
             }
             $txt->addSubItem($sub);
             $this->form->addItem($txt);
             break;
         default:
             return true;
     }
     return true;
 }