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();
122 case 'ilpermissiongui':
123 $this->tabs_gui->setTabActive(
'perm_settings');
124 require_once
'Services/AccessControl/classes/class.ilPermissionGUI.php';
126 $this->ctrl->forwardCommand($perm_gui);
144 if($this->rbacsystem->checkAccess(
'read', $this->object->getRefId()))
146 $this->tabs_gui->addTarget(
'settings', $this->ctrl->getLinkTarget($this,
'settings'),
array(
'saveSettings',
'settings',
'',
'view'),
'',
'');
149 if($this->rbacsystem->checkAccess(
'read', $this->object->getRefId()))
151 $this->tabs_gui->addTarget(
'tos_agreement_by_lng', $this->ctrl->getLinkTarget($this,
'showAgreementByLanguage'),
array(
'reset',
'confirmReset',
'showAgreementByLanguage',
'resetAgreementByLanguageFilter',
'applyAgreementByLanguageFilter'),
'',
'');
154 if($this->rbacsystem->checkAccess(
'read', $this->object->getRefId()) &&
158 $this->tabs_gui->addTarget(
'tos_acceptance_history', $this->ctrl->getLinkTarget($this,
'showAcceptanceHistory'),
array(
'showAcceptanceHistory',
'resetAcceptanceHistoryFilter',
'applyAcceptanceHistoryFilter'),
'',
'');
161 if($this->rbacsystem->checkAccess(
'edit_permission', $this->object->getRefId()))
163 $this->tabs_gui->addTarget(
'perm_settings', $this->ctrl->getLinkTargetByClass(
array(get_class($this),
'ilpermissiongui'),
'perm'),
array(
'perm',
'info',
'owner'),
'ilpermissiongui');
172 if(null == $this->form)
175 $this->form->setTitle($this->lng->txt(
'tos_tos_settings'));
176 $this->form->setFormAction($this->ctrl->getFormAction($this,
'saveSettings'));
179 $status->
setInfo($this->lng->txt(
'tos_status_desc'));
180 $this->form->addItem($status);
182 $this->form->addCommandButton(
'saveSettings', $this->lng->txt(
'save'));
191 if(!$this->rbacsystem->checkAccess(
'write', $this->object->getRefId()))
193 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
199 $has_documents =
false;
200 foreach($list[
'items'] as $item)
202 if($item[
'agreement_document'])
204 $has_documents =
true;
210 if($this->form->checkInput())
212 if($has_documents || !(
int)$this->form->getInput(
'tos_status'))
214 $this->
object->saveStatus((
int)$this->form->getInput(
'tos_status'));
221 (
int)$this->form->getInput(
'tos_status') &&
222 !$this->
object->getStatus()
235 protected function settings($init_from_database =
true)
237 if(!$this->rbacsystem->checkAccess(
'read', $this->object->getRefId()))
239 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
245 if($init_from_database)
247 $this->form->setValuesByArray(
array(
248 'tos_status' => $this->
object->getStatus()
253 $this->form->setValuesByPost();
256 $this->tpl->setContent($this->form->getHTML());
264 if(!$this->rbacsystem->checkAccess(
'write', $this->object->getRefId()))
266 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
270 $confirmation->setFormAction($this->ctrl->getFormAction($this,
'confirmReset'));
271 $confirmation->setConfirm($this->lng->txt(
'confirm'),
'reset');
272 $confirmation->setCancel($this->lng->txt(
'cancel'),
'showAgreementByLanguage');
273 $confirmation->setHeaderText($this->lng->txt(
'tos_sure_reset_tos'));
275 $this->tpl->setContent($confirmation->getHTML());
283 if(!$this->rbacsystem->checkAccess(
'write', $this->object->getRefId()))
285 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
288 $this->
object->resetAll();
289 $this->log->write(__METHOD__ .
': Terms of service reset by ' . $this->
user->getId() .
' [' . $this->
user->getLogin() .
']');
300 if(!$this->rbacsystem->checkAccess(
'read', $this->object->getRefId()))
302 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
305 $this->lng->loadLanguageModule(
'meta');
307 if($this->rbacsystem->checkAccess(
'write', $this->object->getRefId()))
309 $this->toolbar->setFormAction($this->ctrl->getFormAction($this,
'settings'));
310 $this->toolbar->addFormButton($this->lng->txt(
'tos_reset_tos_for_all_users'),
'confirmReset');
319 $this->tpl->setContent($table->getHTML());
327 if($this->
object->getLastResetDate() && $this->
object->getLastResetDate()->get(
IL_CAL_UNIX) != 0)
341 if(!$this->
object->getStatus())
349 $has_documents =
false;
350 foreach($list[
'items'] as $item)
352 if($item[
'agreement_document'])
354 $has_documents =
true;
371 $table->resetOffset();
372 $table->writeFilterToSession();
383 $table->resetOffset();
384 $table->resetFilter();
394 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceJsonResponse.php';
398 !isset(
$_GET[
'agreement_document']) ||
399 !strlen(
$_GET[
'agreement_document']) ||
400 !$this->rbacsystem->checkAccess(
'read', $this->object->getRefId()))
407 if(preg_match(
'/Customizing[\/\\\](global[\/\\\]agreement|clients[\/\\\]' . CLIENT_ID .
'[\/\\\]agreement)[\/\\\]agreement_([a-z]{2})\.html$/',
$file))
409 $content = file_get_contents(
$file);
410 if(strip_tags($content) === $content)
414 foreach($lines as $line)
416 $content .= nl2br(trim($line));
419 $response->setBody($content);
435 !$this->rbacsystem->checkAccess(
'read',
'', $this->object->getRefId()) ||
439 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
442 $this->lng->loadLanguageModule(
'meta');
448 $this->tpl->setContent($table->getHTML());
456 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceJsonResponse.php';
459 if(!isset(
$_GET[
'tosv_id']))
466 $response->setBody($entity->getText());
477 !$this->rbacsystem->checkAccess(
'read',
'', $this->object->getRefId()) ||
485 include_once
'Services/User/classes/class.ilUserAutoComplete.php';
487 $auto->setSearchFields(
array(
'login',
'firstname',
'lastname',
'email'));
488 $auto->enableFieldSearchableCheck(
false);
489 $auto->setMoreLinkAvailable(
true);
491 if(($_REQUEST[
'fetchall']))
496 echo $auto->getList($_REQUEST[
'term']);
506 $table->resetOffset();
507 $table->writeFilterToSession();
518 $table->resetOffset();
519 $table->resetFilter();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
const CONTEXT_ACCEPTANCE_HISTORY
New implementation of ilObjectGUI.
const CONTEXT_AGRREMENT_BY_LANGUAGE
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)
static formatDate(ilDateTime $date)
Format a date public.
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
applyAgreementByLanguageFilter()
Confirmation screen class.