28 $result =
$ilDB->query(
"SELECT * FROM il_dcl_data WHERE id = " .
$ilDB->quote($this->getId(),
"integer"));
39 protected function doCreate($clone_mode =
false)
43 $ilLog = $DIC[
'ilLog'];
45 $ilLog->write(
'doCreate');
50 $main_table->setObjId($this->
getId());
51 $main_table->setTitle($this->
getTitle());
52 $main_table->setAddPerm(1);
53 $main_table->setEditPerm(1);
54 $main_table->setDeletePerm(0);
55 $main_table->setDeleteByOwner(1);
56 $main_table->setEditByOwner(1);
57 $main_table->setLimited(0);
58 $main_table->setIsVisible(
true);
59 $main_table->doCreate();
65 "id" => array(
"integer", $this->
getId()),
66 "is_online" => array(
"integer", (
int) $this->
getOnline()),
67 "rating" => array(
"integer", (
int) $this->
getRating()),
69 "approval" => array(
"integer", (
int) $this->
getApproval()),
91 $table->doDelete(
false,
true);
94 $query =
"DELETE FROM il_dcl_data WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
102 $ilDB = $DIC[
'ilDB'];
107 "id" => array(
"integer", $this->
getId()),
108 "is_online" => array(
"integer", (
int) $this->
getOnline()),
109 "rating" => array(
"integer", (
int) $this->
getRating()),
110 "public_notes" => array(
"integer", (
int) $this->
getPublicNotes()),
111 "approval" => array(
"integer", (
int) $this->
getApproval()),
115 "id" => array(
"integer", $this->
getId()),
126 public function sendNotification($a_action, $a_table_id, $a_record_id = null)
130 $ilAccess = $DIC[
'ilAccess'];
141 $obj_dcl = $obj_table->getCollectionObject();
145 if (!
sizeof($users)) {
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');
210 $mail_obj->appendInstallationSignature(
true);
232 public function getFirstVisibleTableId()
236 $ilDB = $DIC[
'ilDB'];
242 WHERE obj_id = ' .
$ilDB->quote($this->getId(),
'integer') .
244 ORDER BY -table_order DESC ' 249 if (!
$result->numRows() && $only_visible) {
254 WHERE obj_id = ' .
$ilDB->quote($this->getId(),
'integer') .
' 255 ORDER BY -table_order DESC ' 270 foreach ($table_order as
$title) {
273 $table->setOrder($order);
290 public function doCloneObject($new_obj, $a_target_id, $a_copy_id = null, $a_omit_tree =
false)
296 if (!$cp_options->isRootNode($this->getRefId())) {
300 $new_obj->cloneStructure($this->
getRefId());
348 $this->
setRating($original->getRating());
356 foreach ($original->getTables() as $table) {
358 $new_table->setObjId($this->
getId());
359 $new_table->cloneStructure($table);
366 $table->afterClone();
376 $this->is_online = $a_val;
385 return $this->is_online;
394 $this->rating = $a_val;
403 return $this->rating;
412 $this->public_notes = $a_val;
421 return $this->public_notes;
430 $this->approval = $a_val;
439 return $this->approval;
457 return $this->notification;
491 $ilDB = $DIC[
'ilDB'];
493 $query =
"SELECT id FROM il_dcl_table WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer") .
494 " ORDER BY -table_order DESC";
498 while ($rec =
$ilDB->fetchAssoc($set)) {
519 if ($table->getIsVisible() && $table->getVisibleTableViews($this->ref_id)) {
520 $tables[$table->getId()] = $table;
539 $ilDB = $DIC[
'ilDB'];
541 'SELECT * FROM il_dcl_table WHERE obj_id = ' .
$ilDB->quote($obj_id,
'integer') .
' AND title = ' 555 if (preg_match_all(
'/<.*?br.*?>/', $body, $matches)) {
556 $matches = array_unique($matches[0]);
557 $brNewLineMatches = array_map(
static function($match):
string {
558 return $match .
"\n";
562 $body = str_replace(
"\r",
'', $body);
564 $body = str_replace($brNewLineMatches,
"\n", $body);
566 $body = str_replace($matches,
"\n", $body);
568 return str_replace(
"\n",
"\r\n", $body);
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.
doCloneObject($new_obj, $a_target_id, $a_copy_id=null, $a_omit_tree=false)
Clone DCL.
static getTableCache($table_id=0)
Class ilDclBaseFieldModel.
static getNotificationsForObject($type, $id, $page_id=null, $ignore_threshold=false)
Get all users for given object.
prepareMessageText(string $body)
getNotification()
getNotification
const TYPE_DATA_COLLECTION
static _hasReadAccess($ref)
static _getInstance($a_copy_id)
Get instance of copy wizard options.
getId()
get object id public
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.
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, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
getPublicNotes()
getPublicNotes
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 ilObjDataCollection.
static _hasWriteAccess($ref)
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
setNotification($a_val)
setNotification