4 require_once
'Services/Object/classes/class.ilObject2GUI.php';
5 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
6 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
7 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceTableDataProviderFactory.php';
8 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceAgreementByLanguageTableGUI.php';
9 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceAcceptanceHistoryTableGUI.php';
79 public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
87 $this->lng = $DIC[
'lng'];
88 $this->rbacsystem = $DIC[
'rbacsystem'];
89 $this->error = $DIC[
'ilErr'];
90 $this->log = $DIC[
'ilLog'];
91 $this->toolbar = $DIC[
'ilToolbar'];
92 $this->
user = $DIC[
'ilUser'];
94 parent::__construct($a_id, $a_id_type, $a_parent_node_id);
96 $this->lng->loadLanguageModule(
'tos');
99 $this->factory->setLanguageAdapter($this->lng);
100 $this->factory->setDatabaseAdapter($DIC[
'ilDB']);
116 $next_class = $this->ctrl->getNextClass($this);
117 $cmd = $this->ctrl->getCmd();
120 switch ($next_class) {
121 case 'ilpermissiongui':
122 $this->tabs_gui->setTabActive(
'perm_settings');
123 require_once
'Services/AccessControl/classes/class.ilPermissionGUI.php';
125 $this->ctrl->forwardCommand($perm_gui);
129 if ($cmd ==
'' || $cmd ==
'view') {
142 if ($this->rbacsystem->checkAccess(
'read', $this->object->getRefId())) {
143 $this->tabs_gui->addTarget(
'settings', $this->ctrl->getLinkTarget($this,
'settings'),
array(
'saveSettings',
'settings',
'',
'view'),
'',
'');
146 if ($this->rbacsystem->checkAccess(
'read', $this->object->getRefId())) {
147 $this->tabs_gui->addTarget(
'tos_agreement_by_lng', $this->ctrl->getLinkTarget($this,
'showAgreementByLanguage'),
array(
'reset',
'confirmReset',
'showAgreementByLanguage',
'resetAgreementByLanguageFilter',
'applyAgreementByLanguageFilter'),
'',
'');
150 if ($this->rbacsystem->checkAccess(
'read', $this->object->getRefId()) &&
153 $this->tabs_gui->addTarget(
'tos_acceptance_history', $this->ctrl->getLinkTarget($this,
'showAcceptanceHistory'),
array(
'showAcceptanceHistory',
'resetAcceptanceHistoryFilter',
'applyAcceptanceHistoryFilter'),
'',
'');
156 if ($this->rbacsystem->checkAccess(
'edit_permission', $this->object->getRefId())) {
157 $this->tabs_gui->addTarget(
'perm_settings', $this->ctrl->getLinkTargetByClass(
array(get_class($this),
'ilpermissiongui'),
'perm'),
array(
'perm',
'info',
'owner'),
'ilpermissiongui');
166 if (null == $this->form) {
168 $this->form->setTitle($this->lng->txt(
'tos_tos_settings'));
169 $this->form->setFormAction($this->ctrl->getFormAction($this,
'saveSettings'));
172 $status->
setInfo($this->lng->txt(
'tos_status_desc'));
173 $this->form->addItem($status);
175 $this->form->addCommandButton(
'saveSettings', $this->lng->txt(
'save'));
184 if (!$this->rbacsystem->checkAccess(
'write', $this->object->getRefId())) {
185 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
191 $has_documents =
false;
192 foreach (
$list[
'items'] as $item) {
193 if ($item[
'agreement_document']) {
194 $has_documents =
true;
200 if ($this->form->checkInput()) {
201 if ($has_documents || !(
int) $this->form->getInput(
'tos_status')) {
202 $this->
object->saveStatus((
int) $this->form->getInput(
'tos_status'));
209 (
int) $this->form->getInput(
'tos_status') &&
210 !$this->
object->getStatus()
222 protected function settings($init_from_database =
true)
224 if (!$this->rbacsystem->checkAccess(
'read', $this->object->getRefId())) {
225 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
231 if ($init_from_database) {
232 $this->form->setValuesByArray(
array(
233 'tos_status' => $this->
object->getStatus()
236 $this->form->setValuesByPost();
239 $this->tpl->setContent($this->form->getHTML());
247 if (!$this->rbacsystem->checkAccess(
'write', $this->object->getRefId())) {
248 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
252 $confirmation->setFormAction($this->ctrl->getFormAction($this,
'confirmReset'));
253 $confirmation->setConfirm($this->lng->txt(
'confirm'),
'reset');
254 $confirmation->setCancel($this->lng->txt(
'cancel'),
'showAgreementByLanguage');
255 $confirmation->setHeaderText($this->lng->txt(
'tos_sure_reset_tos'));
257 $this->tpl->setContent($confirmation->getHTML());
265 if (!$this->rbacsystem->checkAccess(
'write', $this->object->getRefId())) {
266 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
269 $this->
object->resetAll();
270 $this->log->write(__METHOD__ .
': Terms of service reset by ' . $this->
user->getId() .
' [' . $this->
user->getLogin() .
']');
281 if (!$this->rbacsystem->checkAccess(
'read', $this->object->getRefId())) {
282 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
285 $this->lng->loadLanguageModule(
'meta');
287 if ($this->rbacsystem->checkAccess(
'write', $this->object->getRefId())) {
288 $this->toolbar->setFormAction($this->ctrl->getFormAction($this,
'settings'));
289 $this->toolbar->addFormButton($this->lng->txt(
'tos_reset_tos_for_all_users'),
'confirmReset');
298 $this->tpl->setContent(
$table->getHTML());
306 if ($this->
object->getLastResetDate() && $this->
object->getLastResetDate()->get(
IL_CAL_UNIX) != 0) {
319 if (!$this->
object->getStatus()) {
326 $has_documents =
false;
327 foreach (
$list[
'items'] as $item) {
328 if ($item[
'agreement_document']) {
329 $has_documents =
true;
334 if (!$has_documents) {
346 $table->writeFilterToSession();
368 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceJsonResponse.php';
372 !isset(
$_GET[
'agreement_document']) ||
373 !strlen(
$_GET[
'agreement_document']) ||
374 !$this->rbacsystem->checkAccess(
'read', $this->object->getRefId())) {
380 if (preg_match(
'/Customizing[\/\\\](global[\/\\\]agreement|clients[\/\\\]' . CLIENT_ID .
'[\/\\\]agreement)[\/\\\]agreement_([a-z]{2})\.html$/',
$file)) {
381 $content = file_get_contents(
$file);
382 if (strip_tags($content) === $content) {
385 foreach ($lines as $line) {
386 $content .= nl2br(trim($line));
403 !$this->rbacsystem->checkAccess(
'read',
'', $this->object->getRefId()) ||
406 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
409 $this->lng->loadLanguageModule(
'meta');
415 $this->tpl->setContent(
$table->getHTML());
423 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceJsonResponse.php';
426 if (!isset(
$_GET[
'tosv_id'])) {
443 !$this->rbacsystem->checkAccess(
'read',
'', $this->object->getRefId()) ||
446 echo json_encode(
array());
450 include_once
'Services/User/classes/class.ilUserAutoComplete.php';
452 $auto->setSearchFields(
array(
'login',
'firstname',
'lastname',
'email'));
453 $auto->enableFieldSearchableCheck(
false);
454 $auto->setMoreLinkAvailable(
true);
456 if (($_REQUEST[
'fetchall'])) {
460 echo $auto->getList($_REQUEST[
'term']);
471 $table->writeFilterToSession();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
const CONTEXT_ACCEPTANCE_HISTORY
if(isset($_REQUEST['delete'])) $list
New implementation of ilObjectGUI.
const CONTEXT_AGRREMENT_BY_LANGUAGE
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
static setUseRelativeDates($a_status)
set use relative dates
Let this class derive from a real http response class in future.
getAgreementTextByFilenameAsynch()
showAgreementByLanguage()
static useRelativeDates()
check if relative dates are used
Auto completion class for user lists.
static stripOnlySlashes($a_str)
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getType()
Functions that must be overwritten.
settings($init_from_database=true)
addUserAutoComplete()
Show auto complete results.
Reload workbook from saved file
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
resetAcceptanceHistoryFilter()
resetAgreementByLanguageFilter()
applyAcceptanceHistoryFilter()
Create new PHPExcel object
obj_idprivate
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
Constructor.
getAcceptedContentAsynch()
prepareOutput($a_show_subobjects=true)
const USER_FOLDER_ID
Class ilObjUserFolder.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
if(empty($password)) $table
applyAgreementByLanguageFilter()
Confirmation screen class.