4 require_once(
'./Services/Object/classes/class.ilObject2.php');
5 require_once(
'./Modules/DataCollection/classes/Table/class.ilDclTable.php');
6 require_once(
'./Modules/DataCollection/classes/Helpers/class.ilDclCache.php');
7 require_once(
'./Modules/DataCollection/classes/class.ilObjDataCollectionAccess.php');
30 $result =
$ilDB->query(
"SELECT * FROM il_dcl_data WHERE id = " .
$ilDB->quote($this->getId(),
"integer"));
41 protected function doCreate($clone_mode =
false) {
51 $main_table->setObjId($this->
getId());
52 $main_table->setTitle($this->
getTitle());
53 $main_table->setAddPerm(1);
54 $main_table->setEditPerm(1);
55 $main_table->setDeletePerm(0);
56 $main_table->setDeleteByOwner(1);
57 $main_table->setEditByOwner(1);
58 $main_table->setLimited(0);
59 $main_table->setIsVisible(
true);
60 $main_table->doCreate();
88 $table->doDelete(
false,
true);
91 $query =
"DELETE FROM il_dcl_data WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
118 public static function sendNotification($a_action, $a_table_id, $a_record_id = NULL) {
121 $ilAccess = $DIC[
'ilAccess'];
124 if (
$_GET[
'ref_id'] == SYSTEM_FOLDER_ID) {
130 if ($dclObj->getNotification() != 1) {
134 $obj_dcl = $obj_table->getCollectionObject();
137 require_once(
'./Services/Notification/classes/class.ilNotification.php');
139 if (!
sizeof($users)) {
146 require_once(
'./Services/Link/classes/class.ilLink.php');
151 require_once(
'./Services/Language/classes/class.ilLanguageFactory.php');
154 require_once(
'./Services/Mail/classes/class.ilMail.php');
155 require_once(
'./Services/User/classes/class.ilObjUser.php');
156 require_once(
'./Services/Language/classes/class.ilLanguageFactory.php');
157 require_once(
'./Services/User/classes/class.ilUserUtil.php');
158 foreach (array_unique($users) as $idx => $user_id) {
162 $ilDclTable =
new ilDclTable($record->getTableId());
163 if ($user_id !=
$ilUser->getId() && $ilDclTable->hasPermissionToViewRecord(filter_input(INPUT_GET,
'ref_id'), $record, $user_id)) {
166 $ulng->loadLanguageModule(
'dcl');
168 $subject = sprintf($ulng->txt(
'dcl_change_notification_subject'), $obj_dcl->getTitle());
171 $message .= $ulng->txt(
'dcl_change_notification_dcl_' . $a_action) .
":\n\n";
172 $message .= $ulng->txt(
'obj_dcl') .
": " . $obj_dcl->getTitle() .
"\n\n";
173 $message .= $ulng->txt(
'dcl_table') .
": " . $obj_table->getTitle() .
"\n\n";
174 $message .= $ulng->txt(
'dcl_record') .
":\n";
175 $message .=
"------------------------------------\n";
177 if (!$record->getTableId()) {
178 $record->setTableId($a_table_id);
182 if ($tableview_id = $record->getTable()->getFirstTableViewId(
$_GET[
'ref_id'], $user_id)) {
183 $visible_fields = ilDclTableView::find($tableview_id)->getVisibleFields();
184 if (empty($visible_fields)) {
188 foreach ($visible_fields as $field) {
189 if ($field->isStandardField()) {
190 $value = $record->getStandardFieldPlainText($field->getId());
191 } elseif ($record_field = $record->getRecordField($field->getId())) {
192 $value = $record_field->getPlainText();
196 $t .= $field->getTitle() .
": " . $value .
"\n";
202 $message .=
"------------------------------------\n";
205 $message .= $ulng->txt(
'dcl_change_notification_link') .
": " . $link .
"\n\n";
207 $message .= $ulng->txt(
'dcl_change_why_you_receive_this_email');
209 $mail_obj =
new ilMail(ANONYMOUS_USER_ID);
210 $mail_obj->appendInstallationSignature(
true);
224 public function getFirstVisibleTableId() {
227 $ilDB = $DIC[
'ilDB'];
232 WHERE obj_id = ' .
$ilDB->quote($this->getId(),
'integer') .
234 ORDER BY -table_order DESC ');
238 if (!
$result->numRows() && $only_visible) {
242 WHERE obj_id = ' .
$ilDB->quote($this->getId(),
'integer') .
' 243 ORDER BY -table_order DESC ');
254 foreach ($table_order as
$title) {
257 $table->setOrder($order);
275 public function doCloneObject($new_obj, $a_target_id, $a_copy_id = NULL, $a_omit_tree =
false) {
280 if(!$cp_options->isRootNode($this->getRefId()))
285 $new_obj->cloneStructure($this->
getRefId());
332 $this->
setRating($original->getRating());
340 foreach ($original->getTables() as $table) {
342 $new_table->setObjId($this->
getId());
343 $new_table->cloneStructure($table);
350 $table->afterClone();
359 $this->is_online = $a_val;
367 return $this->is_online;
375 $this->rating = $a_val;
383 return $this->rating;
391 $this->public_notes = $a_val;
399 return $this->public_notes;
407 $this->approval = $a_val;
415 return $this->approval;
431 return $this->notification;
462 $ilDB = $DIC[
'ilDB'];
464 $query =
"SELECT id FROM il_dcl_table WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer") .
465 " ORDER BY -table_order DESC";
469 while ($rec =
$ilDB->fetchAssoc($set)) {
486 if ($table->getIsVisible() && $table->getVisibleTableViews($this->ref_id)) {
487 $tables[$table->getId()] = $table;
505 $ilDB = $DIC[
'ilDB'];
506 $result =
$ilDB->query(
'SELECT * FROM il_dcl_table WHERE obj_id = ' .
$ilDB->quote($obj_id,
'integer') .
' AND title = ' static _lookupLogin($a_user_id)
lookup login
const TYPE_DATACOLLECTION
static setCloneOf($old, $new, $type)
static _getTableIdByTitle($title, $obj_id)
doCreate($clone_mode=false)
reorderTables($table_order)
setPublicNotes($a_val)
setPublicNotes
static hasReadAccess($ref, $user_id=0)
static _lookupFullname($a_user_id)
Lookup Full Name.
static updateNotificationTime($type, $id, array $user_ids, $page_id=false)
Update the last mail timestamp for given object and users.
static getTableCache($table_id=0)
Class ilDclBaseFieldModel.
static getNotificationsForObject($type, $id, $page_id=null, $ignore_threshold=false)
Get all users for given object.
getNotification()
getNotification
const TYPE_DATA_COLLECTION
static _hasReadAccess($ref)
static getNamePresentation($a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false)
Default behaviour is:
static _getInstance($a_copy_id)
Get instance of copy wizard options.
This class handles base functions for mail handling.
static hasWriteAccess($ref, $user_id=0)
static getRecordCache($record_id=0)
static _hasTableByTitle($title, $obj_id)
Checks if a DataCollection has a table with a given title.
getPublicNotes()
getPublicNotes
Create styles array
The data for the language used.
static _getLanguageOfUser($a_usr_id)
Get language object of user.
cloneStructure($original_id)
Attention only use this for objects who have not yet been created (use like: $x = new ilObjDataCollec...
setApproval($a_val)
setApproval
setOnline($a_val)
setOnline
setRating($a_val)
setRating
Class ilObject2 This is an intermediate progress of ilObject class.
Class ilObjDataCollection.
static _hasWriteAccess($ref)
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
doCloneObject($new_obj, $a_target_id, $a_copy_id=NULL, $a_omit_tree=false)
Clone DCL.
setNotification($a_val)
setNotification