Ejemplo n.º 1
0
 /**
  * Test member agreement
  * @group IL_Init
  */
 public function testMemberAgreement()
 {
     include_once 'Services/Membership/classes/class.ilMemberAgreement.php';
     global $ilDB;
     $agree = new ilMemberAgreement(9999, 8888);
     $agree->read();
     $agree->setAccepted(true);
     $agree->save();
     $agree = new ilMemberAgreement(9999, 8888);
     $agree->read();
     $sta = $agree->isAccepted();
     $this->assertEquals($sta, true);
     $agree->delete();
     $agree = new ilMemberAgreement(9999, 8888);
     $agree->read();
     $sta = $agree->isAccepted();
     $this->assertEquals($sta, false);
     $sta = ilMemberAgreement::_hasAccepted(9999, 8888);
     $this->assertEquals($sta, false);
     $agree = new ilMemberAgreement(9999, 8888);
     $agree->read();
     $agree->setAccepted(true);
     $agree->save();
     $sta = ilMemberAgreement::_hasAgreementsByObjId(8888);
     $this->assertEquals($sta, true);
     $sta = ilMemberAgreement::_hasAgreements();
     $this->assertEquals($sta, true);
     ilMemberAgreement::_deleteByUser(9999);
 }
 /**
  * Show Privacy settings
  *
  * @access public
  */
 public function showPrivacy()
 {
     $privacy = ilPrivacySettings::_getInstance();
     $this->tabs_gui->setTabActive('show_privacy');
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('ps_privacy_protection'));
     include_once 'Services/Membership/classes/class.ilMemberAgreement.php';
     if (ilMemberAgreement::_hasAgreements()) {
         $html = new ilNonEditableValueGUI();
         $html->setValue($this->lng->txt('ps_warning_modify'));
         $form->addItem($html);
     }
     $value = array();
     if ($privacy->enabledCourseExport()) {
         $value[] = "export_course";
     }
     if ($privacy->enabledGroupExport()) {
         $value[] = "export_group";
     }
     if ($privacy->courseConfirmationRequired()) {
         $value[] = "export_confirm_course";
     }
     if ($privacy->groupConfirmationRequired()) {
         $value[] = "export_confirm_group";
     }
     if ($privacy->enabledGroupAccessTimes()) {
         $value[] = "grp_access_times";
     }
     if ($privacy->enabledCourseAccessTimes()) {
         $value[] = "crs_access_times";
     }
     $group = new ilCheckboxGroupInputGUI($this->lng->txt('ps_profile_export'), 'profile_protection');
     $group->setValue($value);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_export_course'));
     $check->setValue('export_course');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_export_groups'));
     $check->setValue('export_group');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_export_confirm'));
     $check->setValue('export_confirm_course');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_export_confirm_group'));
     $check->setValue('export_confirm_group');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_show_grp_access'));
     $check->setValue('grp_access_times');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_show_crs_access'));
     $check->setValue('crs_access_times');
     $group->addOption($check);
     $form->addItem($group);
     $check = new ilCheckboxInputGui($this->lng->txt('enable_fora_statistics'), 'fora_statistics');
     $check->setInfo($this->lng->txt('enable_fora_statistics_desc'));
     $check->setChecked($privacy->enabledForaStatistics());
     $form->addItem($check);
     $check = new ilCheckboxInputGui($this->lng->txt('enable_anonymous_fora'), 'anonymous_fora');
     $check->setInfo($this->lng->txt('enable_anonymous_fora_desc'));
     $check->setChecked($privacy->enabledAnonymousFora());
     $form->addItem($check);
     $check = new ilCheckboxInputGui($this->lng->txt('enable_sahs_protocol_data'), 'enable_sahs_pd');
     $check->setInfo($this->lng->txt('enable_sahs_protocol_data_desc'));
     $check->setChecked($privacy->enabledSahsProtocolData());
     $form->addItem($check);
     $check = new ilCheckboxInputGui($this->lng->txt('rbac_log'), 'rbac_log');
     $check->setInfo($this->lng->txt('rbac_log_info'));
     $check->setChecked($privacy->enabledRbacLog());
     $form->addItem($check);
     $age = new ilNumberInputGUI($this->lng->txt('rbac_log_age'), 'rbac_log_age');
     $age->setInfo($this->lng->txt('rbac_log_age_info'));
     $age->setValue($privacy->getRbacLogAge());
     $age->setMinValue(1);
     $age->setMaxValue(24);
     $age->setSize(2);
     $age->setMaxLength(2);
     $check->addSubItem($age);
     $form->addCommandButton('save_privacy', $this->lng->txt('save'));
     $this->tpl->setContent($form->getHTML());
 }
 /**
  * Init field form
  * 
  * @param string $a_mode 
  * @return ilPropertyFormGUI
  */
 function initForm($a_mode = "create")
 {
     global $ilCtrl, $lng;
     include_once "Services/Membership/classes/class.ilMemberAgreement.php";
     if (ilMemberAgreement::_hasAgreements()) {
         $lng->loadLanguageModule("ps");
         ilUtil::sendInfo($lng->txt("ps_warning_modify"));
     }
     if ($this->field_definition) {
         $perms = $this->permissions->hasPermissions(ilUDFPermissionHelper::CONTEXT_FIELD, $this->field_definition["field_id"], array(array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_PROPERTY, ilUDFPermissionHelper::SUBACTION_FIELD_TITLE), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_PROPERTY, ilUDFPermissionHelper::SUBACTION_FIELD_PROPERTIES), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_VISIBLE_PERSONAL), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_VISIBLE_REGISTRATION), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_VISIBLE_LOCAL), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_VISIBLE_COURSES), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_VISIBLE_GROUPS), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_CHANGEABLE_PERSONAL), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_CHANGEABLE_LOCAL), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_REQUIRED), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_EXPORT), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_SEARCHABLE), array(ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS, ilUDFPermissionHelper::SUBACTION_FIELD_ACCESS_CERTIFICATE)));
         $perm_map = self::getAccessPermissions();
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     $name = new ilTextInputGUI($lng->txt("field_name"), "name");
     $name->setRequired(true);
     $form->addItem($name);
     if ($perms && !$perms[ilUDFPermissionHelper::ACTION_FIELD_EDIT_PROPERTY][ilUDFPermissionHelper::SUBACTION_FIELD_TITLE]) {
         $name->setDisabled(true);
     }
     // type
     $radg = new ilRadioGroupInputGUI($lng->txt("field_type"), "field_type");
     $radg->setRequired(true);
     $op1 = new ilRadioOption($lng->txt("udf_type_text"), UDF_TYPE_TEXT);
     $radg->addOption($op1);
     $op2 = new ilRadioOption($lng->txt("udf_type_select"), UDF_TYPE_SELECT);
     $radg->addOption($op2);
     $op3 = new ilRadioOption($lng->txt("udf_type_wysiwyg"), UDF_TYPE_WYSIWYG);
     $radg->addOption($op3);
     $form->addItem($radg);
     // select values
     $se_mu = new ilTextWizardInputGUI($lng->txt("value"), "selvalue");
     $se_mu->setRequired(true);
     $se_mu->setSize(32);
     $se_mu->setMaxLength(128);
     $se_mu->setValues(array(''));
     $op2->addSubItem($se_mu);
     if ($perms && !$perms[ilUDFPermissionHelper::ACTION_FIELD_EDIT_PROPERTY][ilUDFPermissionHelper::SUBACTION_FIELD_PROPERTIES]) {
         $se_mu->setDisabled(true);
         $se_mu->setRequired(false);
     }
     // access
     $acc = new ilCheckboxGroupInputGUI($lng->txt("access"), "access");
     $acc_values = array();
     foreach ($this->getAccessOptions() as $id => $caption) {
         $opt = new ilCheckboxOption($caption, $id);
         $acc->addOption($opt);
         if ($this->field_definition && $this->field_definition[$id]) {
             $acc_values[] = $id;
         }
         if ($perms && !$perms[ilUDFPermissionHelper::ACTION_FIELD_EDIT_ACCESS][$perm_map[$id]]) {
             $opt->setDisabled(true);
         }
     }
     $form->addItem($acc);
     if ($a_mode == "create") {
         $radg->setValue(UDF_TYPE_TEXT);
         $form->setTitle($lng->txt('add_new_user_defined_field'));
         $form->addCommandButton("create", $lng->txt("save"));
         $form->addCommandButton("listUserDefinedFields", $lng->txt("cancel"));
     } else {
         $name->setValue($this->field_definition["field_name"]);
         $radg->setValue($this->field_definition["field_type"]);
         $radg->setDisabled(true);
         $acc->setValue($acc_values);
         switch ($this->field_definition["field_type"]) {
             case UDF_TYPE_SELECT:
                 $se_mu->setValue($this->field_definition["field_values"]);
                 $form->setTitle($lng->txt("udf_update_select_field"));
                 break;
             case UDF_TYPE_TEXT:
                 $form->setTitle($lng->txt("udf_update_text_field"));
                 break;
             case UDF_TYPE_WYSIWYG:
                 $form->setTitle($lng->txt("udf_update_wysiwyg_field"));
                 break;
         }
         $form->addCommandButton("update", $lng->txt("save"));
         $form->addCommandButton("listUserDefinedFields", $lng->txt("cancel"));
     }
     return $form;
 }
 /**
  * Init field form
  * 
  * @param string $a_mode 
  * @return ilPropertyFormGUI
  */
 function initForm($a_mode = "create")
 {
     global $ilCtrl, $lng;
     include_once "Services/Membership/classes/class.ilMemberAgreement.php";
     if (ilMemberAgreement::_hasAgreements()) {
         $lng->loadLanguageModule("ps");
         ilUtil::sendInfo($lng->txt("ps_warning_modify"));
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     $name = new ilTextInputGUI($lng->txt("field_name"), "name");
     $name->setRequired(true);
     $form->addItem($name);
     // type
     $radg = new ilRadioGroupInputGUI($lng->txt("field_type"), "field_type");
     $radg->setRequired(true);
     $op1 = new ilRadioOption($lng->txt("udf_type_text"), UDF_TYPE_TEXT);
     $radg->addOption($op1);
     $op2 = new ilRadioOption($lng->txt("udf_type_select"), UDF_TYPE_SELECT);
     $radg->addOption($op2);
     $op3 = new ilRadioOption($lng->txt("udf_type_wysiwyg"), UDF_TYPE_WYSIWYG);
     $radg->addOption($op3);
     $form->addItem($radg);
     // select values
     $se_mu = new ilTextWizardInputGUI($lng->txt("value"), "selvalue");
     $se_mu->setRequired(true);
     $se_mu->setSize(32);
     $se_mu->setMaxLength(128);
     $se_mu->setValues(array(''));
     $op2->addSubItem($se_mu);
     // access
     $acc = new ilCheckboxGroupInputGUI($lng->txt("access"), "access");
     $acc_values = array();
     foreach ($this->getAccessOptions() as $id => $caption) {
         $opt = new ilCheckboxOption($caption, $id);
         $acc->addOption($opt);
         if ($this->field_definition && $this->field_definition[$id]) {
             $acc_values[] = $id;
         }
     }
     $form->addItem($acc);
     if ($a_mode == "create") {
         $radg->setValue(UDF_TYPE_TEXT);
         $form->setTitle($lng->txt('add_new_user_defined_field'));
         $form->addCommandButton("create", $lng->txt("save"));
         $form->addCommandButton("listUserDefinedFields", $lng->txt("cancel"));
     } else {
         $name->setValue($this->field_definition["field_name"]);
         $radg->setValue($this->field_definition["field_type"]);
         $radg->setDisabled(true);
         $acc->setValue($acc_values);
         switch ($this->field_definition["field_type"]) {
             case UDF_TYPE_SELECT:
                 $se_mu->setValue($this->field_definition["field_values"]);
                 $form->setTitle($lng->txt("udf_update_select_field"));
                 break;
             case UDF_TYPE_TEXT:
                 $form->setTitle($lng->txt("udf_update_text_field"));
                 break;
             case UDF_TYPE_WYSIWYG:
                 $form->setTitle($lng->txt("udf_update_wysiwyg_field"));
                 break;
         }
         $form->addCommandButton("update", $lng->txt("save"));
         $form->addCommandButton("listUserDefinedFields", $lng->txt("cancel"));
     }
     return $form;
 }
 /**
  * Show Privacy settings
  *
  * @access public
  */
 public function showPrivacy()
 {
     $privacy = ilPrivacySettings::_getInstance();
     $this->tabs_gui->setTabActive('show_privacy');
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('ps_privacy_protection'));
     include_once 'Services/Membership/classes/class.ilMemberAgreement.php';
     if (ilMemberAgreement::_hasAgreements()) {
         ilUtil::sendInfo($this->lng->txt('ps_warning_modify'));
     }
     $value = array();
     if ($privacy->enabledCourseExport()) {
         $value[] = "export_course";
     }
     if ($privacy->enabledGroupExport()) {
         $value[] = "export_group";
     }
     if ($privacy->courseConfirmationRequired()) {
         $value[] = "export_confirm_course";
     }
     if ($privacy->groupConfirmationRequired()) {
         $value[] = "export_confirm_group";
     }
     if ($privacy->enabledGroupAccessTimes()) {
         $value[] = "grp_access_times";
     }
     if ($privacy->enabledCourseAccessTimes()) {
         $value[] = "crs_access_times";
     }
     $group = new ilCheckboxGroupInputGUI($this->lng->txt('ps_profile_export'), 'profile_protection');
     $group->setValue($value);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_export_course'));
     $check->setValue('export_course');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_export_groups'));
     $check->setValue('export_group');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_export_confirm'));
     $check->setValue('export_confirm_course');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_export_confirm_group'));
     $check->setValue('export_confirm_group');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_show_grp_access'));
     $check->setValue('grp_access_times');
     $group->addOption($check);
     $check = new ilCheckboxOption();
     $check->setTitle($this->lng->txt('ps_show_crs_access'));
     $check->setValue('crs_access_times');
     $group->addOption($check);
     $form->addItem($group);
     include_once "Services/Administration/classes/class.ilAdministrationSettingsFormHandler.php";
     ilAdministrationSettingsFormHandler::addFieldsToForm(ilAdministrationSettingsFormHandler::FORM_PRIVACY, $form, $this);
     $form->addCommandButton('save_privacy', $this->lng->txt('save'));
     $this->tpl->setContent($form->getHTML());
 }