function getStructureObjects($sid, $ref_id) { $this->initAuth($sid); $this->initIlias(); if (!$this->__checkSession($sid)) { return $this->__raiseError($this->__getMessage(), $this->__getMessageCode()); } if (!($target_obj =& ilObjectFactory::getInstanceByRefId($ref_id, false))) { return $this->__raiseError('No valid reference id given.', 'Client'); } $structureReaderClassname = "ilSoap" . strtoupper($target_obj->getType()) . "StructureReader"; $filename = "./webservice/soap/classes/class." . $structureReaderClassname . ".php"; if (!file_exists($filename)) { return $this->__raiseError("Object type '" . $target_obj->getType() . "'is not supported.", 'Client'); } include_once $filename; $structureReader = new $structureReaderClassname($target_obj); include_once './webservice/soap/classes/class.ilSoapStructureObjectXMLWriter.php'; $xml_writer = new ilSoapStructureObjectXMLWriter(); $structureObject =& $structureReader->getStructureObject(); $xml_writer->setStructureObject($structureObject); if (!$xml_writer->start()) { return $this->__raiseError('Cannot create object xml !', 'Server'); } return $xml_writer->getXML(); }
/** * Import XML * * @param * @return */ function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) { include_once './Modules/Category/classes/class.ilObjCategory.php'; if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) { $refs = ilObject::_getAllReferences($new_id); $this->category = ilObjectFactory::getInstanceByRefId(end($refs), false); } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) { $this->category = ilObjectFactory::getInstanceByRefId($new_id, false); } elseif (!$this->category instanceof ilObjCategory) { $this->category = new ilObjCategory(); $this->category->create(true); } include_once './Modules/Category/classes/class.ilCategoryXmlParser.php'; try { $parser = new ilCategoryXmlParser($a_xml, 0); $parser->setCategory($this->category); $parser->setMode(ilCategoryXmlParser::MODE_UPDATE); $parser->startParsing(); $a_mapping->addMapping('Modules/Category', 'cat', $a_id, $this->category->getId()); } catch (ilSaxParserException $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".'); } catch (Excpetion $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".'); } foreach ($a_mapping->getMappingsOfEntity('Services/Container', 'objs') as $old => $new) { $type = ilObject::_lookupType($new); // see ilGlossaryImporter::importXmlRepresentation() // see ilTaxonomyDataSet::importRecord() $a_mapping->addMapping("Services/Taxonomy", "tax_item", $type . ":obj:" . $old, $new); // this is since 4.3 does not export these ids but 4.4 tax node assignment needs it $a_mapping->addMapping("Services/Taxonomy", "tax_item_obj_id", $type . ":obj:" . $old, $new); } }
/** * Import XML * * @param * @return */ function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) { include_once './Modules/Group/classes/class.ilObjGroup.php'; if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) { $refs = ilObject::_getAllReferences($new_id); $this->group = ilObjectFactory::getInstanceByRefId(end($refs), false); #$this->group = ilObjectFactory::getInstanceByObjId($new_id,false); } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) { $this->group = ilObjectFactory::getInstanceByRefId($new_id, false); } elseif (!$this->group instanceof ilObjGroup) { $this->group = new ilObjGroup(); $this->group->create(true); } include_once './Modules/Group/classes/class.ilGroupXMLParser.php'; #$GLOBALS['ilLog']->write($a_xml); try { $parser = new ilGroupXMLParser($a_xml, 0); $parser->setGroup($this->group); $parser->setMode(ilGroupXMLParser::$UPDATE); $parser->startParsing(); $a_mapping->addMapping('Modules/Group', 'grp', $a_id, $this->group->getId()); } catch (ilSaxParserException $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".'); } catch (ilWebLinkXMLParserException $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".'); } }
function showMoveCopyQuestion() { $tempobj = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]); $source_obj = ilLMObjectFactory::getInstance($tempobj, $_GET["sourceId"], true); $source_obj->setLMId($tempobj->getId()); $target_obj = ilLMObjectFactory::getInstance($tempobj, $_GET["targetId"], true); $target_obj->setLMId($tempobj->getId()); //vd($source_obj->getType()); //vd($target_obj->getType()); $this->tpl = new ilTemplate("tpl.wysiwyg_popup_movecopyquestion.html", false, true, "Services/COPage"); $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); if ($source_obj->getType() == "st" && $target_obj->getType() == "pg") { $this->tpl->setVariable("TXT_ST_ON_PG", $this->lng->txt("cont_st_on_pg")); $this->tpl->setVariable("BTN_CLOSE2", $this->lng->txt("close")); } else { if ($source_obj->getType() == "pg" && $target_obj->getType() == "pg" || $source_obj->getType() == "st" && $target_obj->getType() == "st") { $this->tpl->setVariable("TXT_SET_AFTER", $this->lng->txt("cont_set_after")); $this->tpl->setVariable("TXT_SET_BEFORE", $this->lng->txt("cont_set_before")); } if ($source_obj->getType() == "st" && $target_obj->getType() == "st") { $this->tpl->setVariable("TXT_SET_INTO", $this->lng->txt("cont_set_into")); } $this->tpl->setVariable("TXT_MOVE_OBJECT", $this->lng->txt("cont_move_object")); $this->tpl->setVariable("TXT_COPY_OBJECT", $this->lng->txt("cont_copy_object")); $this->tpl->setVariable("BTN_SUBMIT", $this->lng->txt("save")); $this->tpl->setVariable("BTN_CLOSE", $this->lng->txt("close")); } }
/** * Import XML * * @param * @return */ function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) { include_once './Modules/Category/classes/class.ilObjCategory.php'; if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) { $refs = ilObject::_getAllReferences($new_id); $this->category = ilObjectFactory::getInstanceByRefId(end($refs), false); } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) { $this->category = ilObjectFactory::getInstanceByRefId($new_id, false); } elseif (!$this->category instanceof ilObjCategory) { $this->category = new ilObjCategory(); $this->category->create(true); } include_once './Modules/Category/classes/class.ilCategoryXmlParser.php'; try { $parser = new ilCategoryXmlParser($a_xml, 0); $parser->setCategory($this->category); $parser->setMode(ilCategoryXmlParser::MODE_UPDATE); $parser->startParsing(); $a_mapping->addMapping('Modules/Category', 'cat', $a_id, $this->category->getId()); } catch (ilSaxParserException $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".'); } catch (Excpetion $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".'); } }
/** * Import XML * * @param * @return */ function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) { include_once './Modules/Course/classes/class.ilCourseXMLParser.php'; include_once './Modules/Course/classes/class.ilObjCourse.php'; if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) { $refs = ilObject::_getAllReferences($new_id); $this->course = ilObjectFactory::getInstanceByRefId(end($refs), false); #$this->course = ilObjectFactory::getInstanceByObjId($new_id,false); } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) { $this->course = ilObjectFactory::getInstanceByRefId($new_id, false); } elseif (!$this->course instanceof ilObjCourse) { $this->course = new ilObjCourse(); $this->course->create(true); } try { $parser = new ilCourseXMLParser($this->course); $parser->setXMLContent($a_xml); $parser->startParsing(); $a_mapping->addMapping('Modules/Course', 'crs', $a_id, $this->course->getId()); } catch (ilSaxParserException $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".'); } catch (Exception $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".'); } }
/** * clone objectives * * @access public * @param int target id * @param int copy id * */ public function ilClone($a_target_id, $a_copy_id) { global $ilLog; $ilLog->write(__METHOD__ . ': Start cloning learning objectives...'); $query = "SELECT * FROM crs_objectives " . "WHERE crs_id = " . $this->db->quote($this->course_obj->getId(), 'integer') . ' ' . "ORDER BY position "; $res = $this->db->query($query); if (!$res->numRows()) { $ilLog->write(__METHOD__ . ': ... no objectives found.'); return true; } if (!is_object($new_course = ilObjectFactory::getInstanceByRefId($a_target_id, false))) { $ilLog->write(__METHOD__ . ': Cannot init new course object.'); return true; } while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $new_objective = new ilCourseObjective($new_course); $new_objective->setTitle($row->title); $new_objective->setDescription($row->description); $objective_id = $new_objective->add(); $ilLog->write(__METHOD__ . ': Added new objective nr: ' . $objective_id); // Clone crs_objective_tst entries include_once 'Modules/Course/classes/class.ilCourseObjectiveQuestion.php'; $objective_qst = new ilCourseObjectiveQuestion($row->objective_id); $objective_qst->cloneDependencies($objective_id, $a_copy_id); $ilLog->write(__METHOD__ . ': Finished objective question dependencies: ' . $objective_id); // Clone crs_objective_lm entries (assigned course materials) include_once 'Modules/Course/classes/class.ilCourseObjectiveMaterials.php'; $objective_material = new ilCourseObjectiveMaterials($row->objective_id); $objective_material->cloneDependencies($objective_id, $a_copy_id); } $ilLog->write(__METHOD__ . ': Finished cloning objectives.'); }
function __construct($ref_id) { $this->courseObject = ilObjectFactory::getInstanceByRefId($ref_id); $this->courseParticipants = new ilCourseParticipants($this->courseObject->getId()); $this->emailsFound = array(); $this->emailsNotFound = array(); }
function check() { global $ilObjDataCache, $ilUser; include_once './Services/LinkChecker/classes/class.ilLinkChecker.php'; foreach (ilUtil::_getObjectsByOperations('webr', 'write', $ilUser->getId(), -1) as $node) { if (!is_object($tmp_webr =& ilObjectFactory::getInstanceByRefId($node, false))) { continue; } $tmp_webr->initLinkResourceItemsObject(); // Set all link to valid. After check invalid links will be set to invalid $link_checker =& new ilLinkChecker($this->db); $link_checker->setMailStatus(true); $link_checker->setCheckPeriod($this->__getCheckPeriod()); $link_checker->setObjId($tmp_webr->getId()); $tmp_webr->items_obj->updateValidByCheck($this->__getCheckPeriod()); foreach ($link_checker->checkWebResourceLinks() as $invalid) { $tmp_webr->items_obj->readItem($invalid['page_id']); $tmp_webr->items_obj->setActiveStatus(false); $tmp_webr->items_obj->setValidStatus(false); $tmp_webr->items_obj->setDisableCheckStatus(true); $tmp_webr->items_obj->setLastCheckDate(time()); $tmp_webr->items_obj->update(false); } $tmp_webr->items_obj->updateLastCheck($this->__getCheckPeriod()); foreach ($link_checker->getLogMessages() as $message) { $this->log->write($message); } } return true; }
private function initSettingsWithTestObject() { $testOBJ = ilObjectFactory::getInstanceByRefId($this->contextRefId); $testOBJ->loadFromDb(); $this->setGenericFeedbackEnabled($testOBJ->getGenericAnswerFeedback()); $this->setSpecificFeedbackEnabled($testOBJ->getSpecificAnswerFeedback()); $this->setHintProvidingEnabled($testOBJ->isOfferingQuestionHintsEnabled()); $this->setBestSolutionEnabled($testOBJ->getInstantFeedbackSolution()); }
function __construct() { global $tpl, $ilCtrl, $ilTabs; $this->ctrl = $ilCtrl; $this->tpl = $tpl; $tpl->getStandardTemplate(); $this->course = ilObjectFactory::getInstanceByRefId($_GET['ref_id']); $this->ctrl = $ilCtrl; $this->tabs = $ilTabs; }
/** * Use a registration code and assign the logged in user * to the (parent) course/group that offer the code. * * @todo: throw an error if registration fails (max members, availibility...) * * @param string $a_code * @param int $a_endnode Reference id of node in tree * @return */ protected static function useCode($a_code, $a_endnode) { global $tree, $ilUser; $obj_ids = self::lookupObjectsByCode($a_code); foreach ($tree->getPathId($a_endnode) as $ref_id) { if (in_array(ilObject::_lookupObjId($ref_id), $obj_ids)) { if ($obj = ilObjectFactory::getInstanceByRefId($ref_id, false)) { $obj->register($ilUser->getId()); } } } }
/** * Get xml * @param object $a_entity * @param object $a_schema_version * @param object $a_id * @return */ public function getXmlRepresentation($a_entity, $a_schema_version, $a_id) { $course_ref_id = end(ilObject::_getAllReferences($a_id)); $course = ilObjectFactory::getInstanceByRefId($course_ref_id, false); if (!$course instanceof ilObjCourse) { $GLOBALS['ilLog']->write(__METHOD__ . $a_id . ' is not instance of type course'); return ''; } $this->writer = new ilCourseXMLWriter($course); $this->writer->setMode(ilCourseXMLWriter::MODE_EXPORT); $this->writer->start(); return $this->writer->xmlDumpMem(false); }
/** * Get xml * @param object $a_entity * @param object $a_schema_version * @param object $a_id * @return */ public function getXmlRepresentation($a_entity, $a_schema_version, $a_id) { $ref_ref_id = end(ilObject::_getAllReferences($a_id)); $ref = ilObjectFactory::getInstanceByRefId($ref_ref_id, false); if (!$ref instanceof ilContainerReference) { $GLOBALS['ilLog']->write(__METHOD__ . $a_id . ' is not instance of type category!'); return ''; } $writer = $this->initWriter($ref); $writer->setMode(ilContainerReferenceXmlWriter::MODE_EXPORT); $writer->export(false); return $writer->getXml(); }
/** * Get xml * @param object $a_entity * @param object $a_schema_version * @param object $a_id * @return */ public function getXmlRepresentation($a_entity, $a_schema_version, $a_id) { $group_ref_id = end(ilObject::_getAllReferences($a_id)); $group = ilObjectFactory::getInstanceByRefId($group_ref_id, false); if (!$group instanceof ilObjGroup) { $GLOBALS['ilLog']->write(__METHOD__ . $a_id . ' is not instance of type group'); return ''; } include_once './Modules/Group/classes/class.ilGroupXMLWriter.php'; $this->writer = new ilGroupXMLWriter($group); $this->writer->setMode(ilGroupXMLWriter::MODE_EXPORT); $this->writer->start(); return $this->writer->getXML(); }
/** * Get xml * @param object $a_entity * @param object $a_schema_version * @param object $a_id * @return */ public function getXmlRepresentation($a_entity, $a_schema_version, $a_id) { $cat_ref_id = end(ilObject::_getAllReferences($a_id)); $category = ilObjectFactory::getInstanceByRefId($cat_ref_id, false); if (!$category instanceof ilObjCategory) { $GLOBALS['ilLog']->write(__METHOD__ . $a_id . ' is not instance of type category!'); return ''; } include_once './Modules/Category/classes/class.ilCategoryXmlWriter.php'; $writer = new ilCategoryXmlWriter($category); $writer->setMode(ilCategoryXmlWriter::MODE_EXPORT); $writer->export(false); return $writer->getXml(); }
/** * add an File with id. * * @param string $session_id current session * @param int $target_id refid of parent in repository * @param string $file_xml qti xml description of test * * @return int reference id in the tree, 0 if not successful */ function addFile($sid, $target_id, $file_xml) { $this->initAuth($sid); $this->initIlias(); if (!$this->__checkSession($sid)) { return $this->__raiseError($this->__getMessage(), $this->__getMessageCode()); } global $rbacsystem, $tree, $ilLog, $ilAccess; if (!($target_obj =& ilObjectFactory::getInstanceByRefId($target_id, false))) { return $this->__raiseError('No valid target given.', 'Client'); } if (ilObject::_isInTrash($target_id)) { return $this->__raiseError("Parent with ID {$target_id} has been deleted.", 'CLIENT_TARGET_DELETED'); } // Check access $allowed_types = array('cat', 'grp', 'crs', 'fold', 'root'); if (!in_array($target_obj->getType(), $allowed_types)) { return $this->__raiseError('No valid target type. Target must be reference id of "course, group, category or folder"', 'Client'); } if (!$ilAccess->checkAccess('create', '', $target_id, "file")) { return $this->__raiseError('No permission to create Files in target ' . $target_id . '!', 'Client'); } // create object, put it into the tree and use the parser to update the settings include_once './Modules/File/classes/class.ilFileXMLParser.php'; include_once './Modules/File/classes/class.ilFileException.php'; include_once './Modules/File/classes/class.ilObjFile.php'; $file = new ilObjFile(); try { $fileXMLParser = new ilFileXMLParser($file, $file_xml); if ($fileXMLParser->start()) { global $ilLog; $ilLog->write(__METHOD__ . ': File type: ' . $file->getFileType()); $file->create(); $file->createReference(); $file->putInTree($target_id); $file->setPermissions($target_id); // we now can save the file contents since we know the obj id now. $fileXMLParser->setFileContents(); #$file->update(); return $file->getRefId(); } else { return $this->__raiseError("Could not add file", "Server"); } } catch (ilFileException $exception) { return $this->__raiseError($exception->getMessage(), $exception->getCode() == ilFileException::$ID_MISMATCH ? "Client" : "Server"); } }
/** * add an exercise with id. * * @param string $session_id current session * @param int $target_id refid of parent in repository * @param string $exercise_xml qti xml description of test * * @return int reference id in the tree, 0 if not successful */ function addExercise($sid, $target_id, $exercise_xml) { $this->initAuth($sid); $this->initIlias(); if (!$this->__checkSession($sid)) { return $this->__raiseError($this->__getMessage(), $this->__getMessageCode()); } global $rbacsystem, $tree, $ilLog; if (!($target_obj =& ilObjectFactory::getInstanceByRefId($target_id, false))) { return $this->__raiseError('No valid target given.', 'Client'); } if (ilObject::_isInTrash($target_id)) { return $this->__raiseError("Parent with ID {$target_id} has been deleted.", 'CLIENT_OBJECT_DELETED'); } // Check access $allowed_types = array('cat', 'grp', 'crs', 'fold', 'root'); if (!in_array($target_obj->getType(), $allowed_types)) { return $this->__raiseError('No valid target type. Target must be reference id of "course, group, category or folder"', 'Client'); } if (!$rbacsystem->checkAccess('create', $target_id, "exc")) { return $this->__raiseError('No permission to create exercises in target ' . $target_id . '!', 'Client'); } // create object, put it into the tree and use the parser to update the settings include_once './Modules/Exercise/classes/class.ilObjExercise.php'; include_once './Modules/Exercise/classes/class.ilExerciseXMLParser.php'; include_once './Modules/Exercise/classes/class.ilExerciseException.php'; $exercise = new ilObjExercise(); $exercise->create(); $exercise->createReference(); $exercise->putInTree($target_id); $exercise->setPermissions($target_id); $exercise->saveData(); // we need this as workaround because file and member objects need to be initialised $exercise->read(); $exerciseXMLParser = new ilExerciseXMLParser($exercise, $exercise_xml); try { if ($exerciseXMLParser->start()) { $exerciseXMLParser->getAssignment()->update(); return $exercise->update() ? $exercise->getRefId() : -1; } throw new ilExerciseException("Could not parse XML"); } catch (ilExerciseException $exception) { return $this->__raiseError($exception->getMessage(), $exception->getCode() == ilExerciseException::$ID_MISMATCH ? "Client" : "Server"); } }
/** * Sends a notification message to all users responsible for vat assignment. * * @access public * @static * @param ilPaymentObject $oPaymentObject */ public static function _sendNotificationToVATAdministration($oPaymentObject) { global $ilSetting, $lng, $ilClientIniFile; $payment_vat_admins = $ilSetting->get('payment_vat_admins'); $users = explode(',', $payment_vat_admins); $subject = $lng->txt('payment_vat_assignment_notification_subject'); $tmp_obj = ilObjectFactory::getInstanceByRefId($oPaymentObject->getRefId()); $message = sprintf($lng->txt('payment_vat_assignment_notification_body'), $tmp_obj->getTitle()) . "\n\n"; $message .= "------------------------------------------------------------\n"; $message .= sprintf($lng->txt('payment_vat_assignment_notification_intro'), $ilClientIniFile->readVariable('client', 'name'), ILIAS_HTTP_PATH . '/?client_id=' . CLIENT_ID); include_once 'Services/Mail/classes/class.ilMail.php'; $mail_obj = new ilMail(ANONYMOUS_USER_ID); foreach ((array) $users as $login) { if (strlen(trim($login)) && (int) ilObjUser::_lookupId(trim($login))) { $success = $mail_obj->sendMail(trim($login), '', '', $subject, $message, array(), array("system")); } } }
protected function getStartObjects() { $data = array(); $counter = 0; foreach ($this->start_obj->getStartObjects() as $start_id => $item) { $tmp_obj = ilObjectFactory::getInstanceByRefId($item['item_ref_id']); $data[$item['item_ref_id']]['id'] = $start_id; $data[$item['item_ref_id']]['title'] = $tmp_obj->getTitle(); $data[$item['item_ref_id']]['type'] = $this->lng->txt('obj_' . $tmp_obj->getType()); $data[$item['item_ref_id']]['icon'] = ilObject::_getIcon($tmp_obj->getId(), 'tiny'); $counter += 10; $data[$item['item_ref_id']]['pos'] = $counter; if (strlen($tmp_obj->getDescription())) { $data[$item['item_ref_id']]['description'] = $tmp_obj->getDescription(); } } return $data; }
public function __construct() { global $tpl, $ilCtrl, $ilToolbar, $ilTabs, $lng, $ilAccess, $ilDB, $ilLocator; $this->ctrl = $ilCtrl; $this->tpl = $tpl; $this->toolbar = $ilToolbar; $this->tabs = $ilTabs; $this->ref_id = (int) $_GET['ref_id']; $this->crs = ilObjectFactory::getInstanceByRefId($this->ref_id); $this->definition = srCertificateDefinition::where(array('ref_id' => $this->ref_id))->first(); $this->pl = ilCertificatePlugin::getInstance(); $this->lng = $lng; $this->access = $ilAccess; $this->db = $ilDB; $this->ctrl->saveParameter($this, 'ref_id'); $this->tpl->addJavaScript($this->pl->getStyleSheetLocation('uihk_certificate.js')); $this->lng->loadLanguageModule('common'); $ilLocator->addRepositoryItems(); $this->tpl->setVariable("LOCATOR", $ilLocator->getHTML()); }
/** * Apply action */ public function apply() { global $rbacreview, $rbacadmin; $source = $this->initSourceObject(); // Check if role folder already exists $rolf_id = $rbacreview->getRoleFolderIdOfObject($source->getRefId()); if (!$rolf_id) { $source->createRoleFolder(); } $rolf_id = $rbacreview->getRoleFolderIdOfObject($source->getRefId()); $GLOBALS['ilLog']->write(__METHOD__ . ': Current role folder id is: ' . $rolf_id); // Create role $rolf = ilObjectFactory::getInstanceByRefId($rolf_id, false); $role = $rolf->createRole(ilObject::_lookupTitle($this->getRoleTemplateId()), ilObject::_lookupDescription($this->getRoleTemplateId())); $GLOBALS['ilLog']->write(__METHOD__ . ': Using rolt: ' . $this->getRoleTemplateId() . ' with title "' . ilObject::_lookupTitle($this->getRoleTemplateId() . '". ')); // Copy template permissions $rbacadmin->copyRoleTemplatePermissions($this->getRoleTemplateId(), ROLE_FOLDER_ID, $rolf->getRefId(), $role->getId(), true); // Set permissions $ops = $rbacreview->getOperationsOfRole($role->getId(), $source->getType(), $rolf->getRefId()); $rbacadmin->grantPermission($role->getId(), $ops, $source->getRefId()); return true; }
protected function getStartObjects($a_obj_course, $crs_start) { $starters = $crs_start->getStartObjects(); /* if(!count($starters)) { ilUtil::sendInfo($this->lng->txt('crs_no_starter_created')); } */ $data = array(); foreach ($starters as $start_id => $item) { $tmp_obj = ilObjectFactory::getInstanceByRefId($item['item_ref_id']); $data[$item['item_ref_id']]['id'] = $start_id; $data[$item['item_ref_id']]['title'] = $tmp_obj->getTitle(); $data[$item['item_ref_id']]['type'] = $this->lng->txt('obj_' . $tmp_obj->getType()); $data[$item['item_ref_id']]['icon'] = ilObject::_getIcon($tmp_obj->getId(), 'tiny'); if (strlen($tmp_obj->getDescription())) { $data[$item['item_ref_id']]['description'] = $tmp_obj->getDescription(); } } return $data; }
public function run() { global $ilLog, $ilUser, $ilDB; $status = ilCronJobResult::STATUS_NO_ACTION; include_once './Services/LinkChecker/classes/class.ilLinkChecker.php'; $counter = 0; foreach (ilUtil::_getObjectsByOperations('webr', 'write', $ilUser->getId(), -1) as $node) { if (!is_object($tmp_webr = ilObjectFactory::getInstanceByRefId($node, false))) { continue; } $tmp_webr->initLinkResourceItemsObject(); // Set all link to valid. After check invalid links will be set to invalid $link_checker =& new ilLinkChecker($ilDB); $link_checker->setMailStatus(true); $link_checker->setCheckPeriod($this->__getCheckPeriod()); $link_checker->setObjId($tmp_webr->getId()); $tmp_webr->items_obj->updateValidByCheck($this->__getCheckPeriod()); foreach ($link_checker->checkWebResourceLinks() as $invalid) { $tmp_webr->items_obj->readItem($invalid['page_id']); $tmp_webr->items_obj->setActiveStatus(false); $tmp_webr->items_obj->setValidStatus(false); $tmp_webr->items_obj->setDisableCheckStatus(true); $tmp_webr->items_obj->setLastCheckDate(time()); $tmp_webr->items_obj->update(false); } $tmp_webr->items_obj->updateLastCheck($this->__getCheckPeriod()); foreach ($link_checker->getLogMessages() as $message) { $ilLog->write($message); $counter++; } } if ($counter) { $status = ilCronJobResult::STATUS_OK; } $result = new ilCronJobResult(); $result->setStatus($status); return $result; }
public function send() { include_once './Services/Link/classes/class.ilLink.php'; $obj = new ilObjectFactory(); $instance = $obj->getInstanceByRefId($_GET['ref_id']); $link = ilLink::_getLink($_GET['ref_id'], $instance->getType(), array(), ''); global $lng; foreach ($this->getRecipients() as $rcp) { $this->initLanguage($rcp); $this->initMail(); $this->setSubject(sprintf($lng->txt('rubric_exercise_graded') . ' ' . ilObject::_lookupTitle($this->getObjId()) . ' ' . $lng->txt('rubric_is_now_available'), $this->getObjectTitle(true))); $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage())); $this->appendBody("\n\n"); $this->appendBody($lng->txt('rubric_exercise_graded') . ' ' . ilObject::_lookupTitle($this->getObjId()) . ' ' . $lng->txt('rubric_is_now_available')); $this->appendBody("\n"); $this->appendBody($this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)); $this->appendBody("\n"); $this->appendBody("\n\n"); $this->appendBody($link); $this->getMail()->appendInstallationSignature(true); $this->sendMail(array($rcp), array('system')); } }
/** * Import XML * * @param * @return */ function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) { include_once './Modules/Folder/classes/class.ilObjFolder.php'; if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) { $this->folder = ilObjectFactory::getInstanceByObjId($new_id, false); } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) { $this->folder = ilObjectFactory::getInstanceByRefId($new_id, false); } elseif (!$this->folder instanceof ilObjFolder) { $this->folder = new ilObjFolder(); $this->folder->create(true); } include_once './Modules/Folder/classes/class.ilFolderXmlParser.php'; #$GLOBALS['ilLog']->write($a_xml); try { $parser = new ilFolderXmlParser($this->folder, $a_xml); $parser->start(); $a_mapping->addMapping('Modules/Folder', 'fold', $a_id, $this->folder->getId()); } catch (ilSaxParserException $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".'); } catch (ilWebLinkXMLParserException $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".'); } }
/** * Delete references * * @static */ public static function deleteReferences($a_target_id) { global $ilLog; include_once './Services/ContainerReference/classes/class.ilContainerReference.php'; if (!($source_id = ilContainerReference::_lookupSourceId($a_target_id))) { return true; } foreach (ilObject::_getAllReferences($source_id) as $ref_id) { if (!($instance = ilObjectFactory::getInstanceByRefId($ref_id, false))) { continue; } switch ($instance->getType()) { case 'crsr': case 'catr': $instance->delete(); $ilLog->write(__METHOD__ . ': Deleted reference object of type ' . $instance->getType() . ' with Id ' . $instance->getId()); break; default: $ilLog->write(__METHOD__ . ': Unexpected object type ' . $instance->getType() . ' with Id ' . $instance->getId()); break; } } return true; }
/** * Sync category * @param ilECSNodeMappingAssignment $ass */ protected function syncCategory(ilECSNodeMappingAssignment $ass, $parent_id) { include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php'; $data = new ilECSCmsData($ass->getCSId()); // Check if node is imported => create // perform title update // perform position update include_once './Services/WebServices/ECS/classes/class.ilECSImport.php'; $obj_id = ilECSImport::lookupObjIdByContentId($this->getServer()->getServerId(), $this->mid, $data->getCmsId()); if ($obj_id) { $refs = ilObject::_getAllReferences($obj_id); $ref_id = end($refs); $cat = ilObjectFactory::getInstanceByRefId($ref_id, false); if ($cat instanceof ilObject and $this->default_settings['title_update']) { $GLOBALS['ilLog']->write(__METHOD__ . ': Updating cms category '); $GLOBALS['ilLog']->write(__METHOD__ . ': Title is ' . $data->getTitle()); $cat->deleteTranslation($GLOBALS['lng']->getDefaultLanguage()); $cat->addTranslation($data->getTitle(), $cat->getLongDescription(), $GLOBALS['lng']->getDefaultLanguage(), 1); $cat->setTitle($data->getTitle()); $cat->update(); } else { $GLOBALS['ilLog']->write(__METHOD__ . ': Updating cms category -> nothing to do'); } return $ref_id; } elseif ($this->getGlobalSettings()->isEmptyContainerCreationEnabled()) { $GLOBALS['ilLog']->write(__METHOD__ . ': Creating new cms category'); // Create category include_once './Modules/Category/classes/class.ilObjCategory.php'; $cat = new ilObjCategory(); $cat->setTitle($data->getTitle()); $cat->create(); // true for upload $cat->createReference(); $cat->putInTree($parent_id); $cat->setPermissions($parent_id); $cat->deleteTranslation($GLOBALS['lng']->getDEfaultLanguage()); $cat->addTranslation($data->getTitle(), $cat->getLongDescription(), $GLOBALS['lng']->getDefaultLanguage(), 1); // set imported $import = new ilECSImport($this->getServer()->getServerId(), $cat->getId()); $import->setMID($this->mid); $import->setContentId($data->getCmsId()); $import->setImported(true); $import->save(); return $cat->getRefId(); } else { $GLOBALS['ilLog']->write(__METHOD__ . ': Creation of empty containers is disabled.'); return 0; } }
function __showObjectSelect($a_result, $a_type) { include_once "./Services/Object/classes/class.ilObjectFactory.php"; foreach ($a_result as $obj) { $tmp_obj =& ilObjectFactory::getInstanceByRefId($obj["id"]); $this->tpl->setCurrentBlock("OBJ_SELECT_ROW"); $this->tpl->setVariable("OBJ_ROW_TITLE", $tmp_obj->getTitle()); $this->tpl->setVariable("OBJ_ROW_ID", $tmp_obj->getRefId()); $this->tpl->setVariable("OBJ_ROW_DESCRIPTION", $tmp_obj->getDescription()); $this->tpl->parseCurrentBlock(); unset($tmp_obj); } $this->tpl->setCurrentBlock("OBJ_SELECT"); $this->tpl->setVariable("OBJ_SELECT_TITLE", $this->lng->txt("title")); $this->tpl->setVariable("OBJ_SELECT_DESCRIPTION", $this->lng->txt("description")); $this->tpl->setVariable("OBJ_BTN1_VALUE", $this->lng->txt("select")); $this->tpl->setVariable("OBJ_BTN2_VALUE", $this->lng->txt("cancel")); $this->tpl->parseCurrentBlock(); }
function __initCourseObject() { global $tree; if ($this->container_obj->getType() == 'crs') { // Container is course $this->course_obj =& $this->container_obj; } else { $course_ref_id = $tree->checkForParentType($this->container_obj->getRefId(), 'crs'); $this->course_obj =& ilObjectFactory::getInstanceByRefId($course_ref_id); } return true; }