/** * @return bool */ public function executeCommand() { if ($_GET['mode']) { $this->ctrl->saveParameter($this, 'mode'); $this->ctrl->setParameterByClass("ildatacollectionrecordlistgui", "mode", $_GET['mode']); } $this->ctrl->saveParameter($this, 'redirect'); if ($this->record_id) { $this->record = ilDataCollectionCache::getRecordCache($this->record_id); if (!$this->record->hasPermissionToEdit($this->parent_obj->ref_id) or !$this->record->hasPermissionToView($this->parent_obj->ref_id)) { $this->accessDenied(); } $this->table = $this->record->getTable(); $this->table_id = $this->table->getId(); } else { $this->table = ilDataCollectionCache::getTableCache($this->table_id); if (!ilObjDataCollectionAccess::hasAddRecordAccess($_GET['ref_id'])) { $this->accessDenied(); } } $cmd = $this->ctrl->getCmd(); switch ($cmd) { default: $this->{$cmd}(); break; } return true; }
/** * @param ilObjDataCollectionGUI $a_dcl_object */ public function __construct(ilObjDataCollectionGUI $a_dcl_object) { global $tpl, $ilCtrl; $this->dcl_gui_object = $a_dcl_object; $this->record_id = (int) $_REQUEST['record_id']; $this->record_obj = ilDataCollectionCache::getRecordCache($this->record_id); if (!$this->record_obj->hasPermissionToView((int) $_GET['ref_id'])) { ilUtil::sendFailure('dcl_msg_no_perm_view', true); $ilCtrl->redirectByClass('ildatacollectionrecordlistgui', 'listRecords'); } // content style (using system defaults) include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $tpl->setCurrentBlock("SyntaxStyle"); $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("ContentStyle"); $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $tpl->parseCurrentBlock(); $this->table = $this->record_obj->getTable(); // Comments include_once "./Services/Notes/classes/class.ilNoteGUI.php"; $repId = $this->dcl_gui_object->getDataCollectionObject()->getId(); $objId = (int) $this->record_id; $this->notesGUI = new ilNoteGUI($repId, $objId); $this->notesGUI->enablePublicNotes(true); $this->notesGUI->enablePublicNotesDeletion(true); $ilCtrl->setParameterByClass("ilnotegui", "record_id", $this->record_id); $ilCtrl->setParameterByClass("ilnotegui", "rep_id", $repId); if (isset($_GET['disable_paging']) && $_GET['disable_paging']) { $this->is_enabled_paging = false; } // Find current, prev and next records for navigation if ($this->is_enabled_paging) { $this->determineNextPrevRecords(); } }
/** * @param ilDataCollectionRecord $record * * @return bool */ private function recordBelongsToCollection(ilDataCollectionRecord $record) { $table = $record->getTable(); $obj_id = $this->parent_obj->object->getId(); $obj_id_rec = $table->getCollectionObject()->getId(); return $obj_id == $obj_id_rec; }