/** * Show delete confirmation */ public function delete() { global $tpl, $ilSetting, $ilErr; $this->ctrl->setReturnByClass(get_class($this->getContainer()), ''); $to_delete = array(); if ((int) $_GET['item_ref_id']) { $to_delete = array((int) $_GET['item_ref_id']); } if (isset($_POST['id']) and is_array($_POST['id'])) { $to_delete = $_POST['id']; } if (!$to_delete) { $ilErr->raiseError($this->lng->txt('no_checkbox'), $ilErr->MESSAGE); } include_once './Services/Utilities/classes/class.ilConfirmationGUI.php'; $confirm = new ilConfirmationGUI(); $confirm->setFormAction($this->ctrl->getFormActionByClass(get_class($this->getContainer()), 'cancel')); $confirm->setHeaderText(''); $confirm->setCancel($this->lng->txt('cancel'), 'cancelDelete'); $confirm->setConfirm($this->lng->txt('delete'), 'performDelete'); foreach ($to_delete as $delete) { $obj_id = ilObject::_lookupObjId($delete); $type = ilObject::_lookupType($obj_id); $confirm->addItem('id[]', $delete, call_user_func(array(ilObjectFactory::getClassByType($type), '_lookupTitle'), $obj_id), ilUtil::getTypeIconPath($type, $obj_id)); } $msg = $this->lng->txt("info_delete_sure"); if (!$ilSetting->get('enable_trash')) { $msg .= "<br/>" . $this->lng->txt("info_delete_warning_no_trash"); } ilUtil::sendQuestion($msg); $tpl->setContent($confirm->getHTML()); }
public function run() { if (!$this->enabled) { return; } global $rbacreview; $usr_ids = ilObjUser::_getUserIdsByInactivationPeriod($this->period); foreach ($usr_ids as $usr_id) { if ($usr_id == ANONYMOUS_USER_ID || $usr_id == SYSTEM_USER_ID) { continue; } $continue = true; foreach ($this->include_roles as $role_id) { if ($rbacreview->isAssigned($usr_id, $role_id)) { $continue = false; break; } } if ($continue) { continue; } $user = ilObjectFactory::getInstanceByObjId($usr_id); $user->delete(); } }
/** * 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); } }
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(); }
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")); } }
/** * 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.'); }
/** * 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() . '".'); } }
protected function resetCustomLPDataForUserIds(array $a_user_ids, $a_recursive = true) { /* @var ilObjTest $testOBJ */ require_once 'Services/Object/classes/class.ilObjectFactory.php'; $testOBJ = ilObjectFactory::getInstanceByObjId($this->obj_id); $testOBJ->removeTestResults($a_user_ids); // :TODO: there has to be a better way $test_ref_id = (int) $_REQUEST["ref_id"]; if ($test_ref_id) { require_once "Modules/Course/classes/Objectives/class.ilLOSettings.php"; $course_obj_id = ilLOSettings::isObjectiveTest($test_ref_id); if ($course_obj_id) { // is test initial and/or qualified? $lo_settings = ilLOSettings::getInstanceByObjId($course_obj_id); $is_i = $lo_settings->getInitialTest() == $test_ref_id; $is_q = $lo_settings->getQualifiedTest() == $test_ref_id; // remove objective results data require_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php"; ilLOUserResults::deleteResultsFromLP($course_obj_id, $a_user_ids, $is_i, $is_q); // refresh LP - see ilLPStatusWrapper::_updateStatus() require_once "Services/Tracking/classes/class.ilLPStatusFactory.php"; $lp_status = ilLPStatusFactory::_getInstance($course_obj_id); if (strtolower(get_class($lp_status)) != "illpstatus") { foreach ($a_user_ids as $user_id) { $lp_status->_updateStatus($course_obj_id, $user_id); } } } } }
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; }
/** * 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() . '".'); } }
/** * 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() . '".'); } }
public function run() { global $rbacreview; $status = ilCronJobResult::STATUS_NO_ACTION; $usr_ids = ilObjUser::_getUserIdsByInactivityPeriod($this->period); $counter = 0; foreach ($usr_ids as $usr_id) { if ($usr_id == ANONYMOUS_USER_ID || $usr_id == SYSTEM_USER_ID) { continue; } $continue = true; foreach ($this->include_roles as $role_id) { if ($rbacreview->isAssigned($usr_id, $role_id)) { $continue = false; break; } } if ($continue) { continue; } $user = ilObjectFactory::getInstanceByObjId($usr_id); $user->delete(); $counter++; } if ($counter) { $status = ilCronJobResult::STATUS_OK; } $result = new ilCronJobResult(); $result->setStatus($status); return $result; }
private function getDeveloperRubricCardFormCommandRow($form_action) { global $ilUser; include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; //configure the command row $rubric_commandrow_tpl = new ilTemplate('tpl.lp_rubricform_commandrow.html', true, true, 'Services/Tracking'); $select_prop = new ilSelectInputGUI('Title', 'selected_cmdrubric'); $options = array('behavior_1' => $this->lng->txt('rubric_option_behavior_1'), 'behavior_2' => $this->lng->txt('rubric_option_behavior_2'), 'behavior_3' => $this->lng->txt('rubric_option_behavior_3'), 'behavior_4' => $this->lng->txt('rubric_option_behavior_4'), 'behavior_5' => $this->lng->txt('rubric_option_behavior_5'), 'add_group' => $this->lng->txt('rubric_option_add_group'), 'del_group' => $this->lng->txt('rubric_option_del_group'), 'add_criteria' => $this->lng->txt('rubric_option_add_criteria'), 'del_criteria' => $this->lng->txt('rubric_option_del_criteria')); $select_prop->setOptions($options); $rubric_commandrow_tpl->setVariable('RURBRIC_COMMANDROW_SELECT', $select_prop->render()); $rubric_commandrow_tpl->setVariable('RUBRIC_SAVE', $this->lng->txt('save')); $rubric_commandrow_tpl->setVariable('RUBRIC_EXECUTE', $this->lng->txt('execute')); $rubric_commandrow_tpl->setVariable('FORM_ACTION', $form_action); $rubric_commandrow_tpl->setVariable('PASSING_GRADE_VALUE', "{$this->passing_grade}"); if (!is_null($this->rubric_locked)) { $rubric_commandrow_tpl->setVariable('RUBRIC_DISABLED', 'disabled'); $rubric_commandrow_tpl->setVariable('RUBRIC_LOCK', $this->lng->txt('rubric_card_unlock')); $tmp_user = ilObjectFactory::getInstanceByObjId($this->rubric_owner, false); if ($this->rubric_owner !== $ilUser->getId()) { $rubric_commandrow_tpl->setVariable('USER_LOCK', 'disabled'); } ilUtil::sendInfo($this->lng->txt('rubric_locked_info') . ' ' . $tmp_user->getFullName() . ' ' . $this->rubric_locked); } else { $rubric_commandrow_tpl->setVariable('RUBRIC_LOCK', $this->lng->txt('rubric_card_lock')); } $rubric_commandrow_tpl->setVariable('EXPORT', $this->lng->txt('rubric_option_export_pdf')); return $rubric_commandrow_tpl; }
/** * @param string $rcp * @throws ilMailException */ protected function handleCurrentRecipient($rcp) { require_once 'Services/Mail/exceptions/class.ilMailException.php'; if (is_numeric($rcp)) { /** * @var $rcp ilObjUser */ $rcp = ilObjectFactory::getInstanceByObjId($rcp, false); if (!$rcp) { throw new ilMailException('no_recipient_found'); } $this->setCurrentRecipient($rcp->getEmail()); $this->initLanguage($rcp->getId()); } else { if (is_string($rcp) && ilUtil::is_email($rcp)) { $this->setCurrentRecipient($rcp); $this->initLanguageByIso2Code(); } else { if ($rcp instanceof ilObjUser) { /** * @var $rcp ilObjUser */ $this->setCurrentRecipient($rcp->getEmail()); $this->initLanguage($rcp->getId()); } else { throw new ilMailException('no_recipient_found'); } } } }
/** * Constructor * @access public * @param string $a_target scriptname * @param string $a_session_variable session_variable * @param ilWorkspaceTree $a_tree workspace tree * @param ilWorkspaceAccessHandler $a_access_handler workspace access handler */ public function __construct($a_type, $a_target, $a_session_variable, ilWorkspaceTree $a_tree, ilWorkspaceAccessHandler $a_access_handler) { global $ilCtrl; $this->ctrl = $ilCtrl; $this->type = $a_type; $this->access = $a_access_handler; parent::__construct($a_target); // #11173 if (!$a_tree->readRootId()) { // create (workspace) root folder $root = ilObjectFactory::getClassByType("wsrt"); $root = new $root(null); $root->create(); $root_id = $a_tree->createReference($root->getId()); $a_tree->addTree($a_tree->getTreeId(), $root_id); $a_tree->setRootId($root_id); } $this->tree = $a_tree; $this->root_id = $this->tree->readRootId(); $this->order_column = 'title'; $this->setSessionExpandVariable($a_session_variable); // reset filter $this->filter = array(); $this->addFilter('wsrt'); $this->addFilter('wfld'); $this->addFormItemForType('wsrt'); $this->addFormItemForType('wfld'); $this->setFiltered(true); $this->setFilterMode(IL_FM_POSITIVE); }
function __construct($ref_id) { $this->courseObject = ilObjectFactory::getInstanceByRefId($ref_id); $this->courseParticipants = new ilCourseParticipants($this->courseObject->getId()); $this->emailsFound = array(); $this->emailsNotFound = array(); }
public function sortCallback($a_assignment_a, $a_assignment_b) { $user_a = ilObjectFactory::getInstanceByObjId($a_assignment_a->getUserId()); $user_b = ilObjectFactory::getInstanceByObjId($a_assignment_b->getUserId()); $user_name_a = $user_a->getLastName() . ', ' . $user_a->getFirstName(); $user_name_b = $user_b->getLastName() . ', ' . $user_b->getFirstName(); return strcmp($user_name_a, $user_name_b); }
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; }
/** * Get pairs of Participants groups. * * This method can be used to list groups in a * HTML <select>. The index in the returned array * corresponds to the groups' obj_id and the value * is the groups' title. * * @param integer $overviewId * @return array Where index = obj_id and value = group title */ public function getGroupPairs($overviewId) { $pairs = array(); $rawData = $this->getList(array(), array("overview_id" => $overviewId)); foreach ($rawData['items'] as $item) { $object = ilObjectFactory::getInstanceByObjId($item->obj_id, false); $pairs[$item->obj_id] = $object->getTitle(); } return $pairs; }
/** * Constructor * * @access private * @param * @return */ private function __construct($a_user_id) { global $ilUser; if ($ilUser->getId() == $a_user_id) { $this->user = $ilUser; } else { $this->user = ilObjectFactory::getInstanceByObjId($a_user_id, false); } $this->settings = ilCalendarSettings::_getInstance(); $this->read(); }
/** * 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()); } } } }
/** * handler for begin of element * * @param resource $a_xml_parser xml parser * @param string $a_name element name * @param array $a_attribs element attributes array */ function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { global $objDefinition, $ilAccess, $tree; switch ($a_name) { case 'Settings': $this->options = array(); $this->source_id = (int) $a_attribs["source_id"]; if (ilObject::_isInTrash($this->source_id)) { throw new ilSaxParserException("Source id " . $this->source_id . " is in trash"); } $this->target_id = (int) $a_attribs["target_id"]; if (ilObject::_isInTrash($this->target_id)) { throw new ilSaxParserException("target id" . $this->target_id . " is in trash"); } $this->default_action = ilCopyWizardSettingsXMLParser::getActionForString($a_attribs["default_action"]); break; case 'Option': $id = (int) $a_attribs["id"]; if (ilObject::_isInTrash($id)) { throw new ilSaxParserException("Id {$id} is in trash"); } if (!$tree->isInTree($id)) { throw new ilSaxParserException("Id {$id} does not exist"); } $action = ilCopyWizardSettingsXMLParser::getActionForString($a_attribs["action"]); $type = ilObjectFactory::getTypeByRefId($id); switch ($action) { case ilCopyWizardOptions::COPY_WIZARD_COPY: $perm_copy = $ilAccess->checkAccess('copy', '', $id); $copy = $objDefinition->allowCopy($type); if ($perm_copy && $copy) { $this->options[$id] = array("type" => $action); } elseif ($copy && !$perm_copy) { throw new ilSaxParserException("Missing copy permission for object " . $id); } elseif (!$copy) { throw new ilSaxParserException("Copy for object " . $id . " of type " . $type . " is not supported"); } break; case ilCopyWizardOptions::COPY_WIZARD_LINK: $perm_link = $ilAccess->checkAccess('write', '', $id); $link = $objDefinition->allowLink($type); if ($perm_link && $link) { $this->options[$id] = array("type" => $action); } elseif ($copy && !$perm_link) { throw new ilSaxParserException("Missing write permission for object " . $id); } elseif (!$link) { throw new ilSaxParserException("Link for object " . $id . " of type " . $type . " is not supported"); } break; } } }
/** * 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(); }
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')); } }
/** * Init xml writer * @return bool * @throws UnexpectedValueException Thrown if obj_id is not of type webr */ protected function init() { $this->xmlClear(); if (!$this->obj_id) { throw new UnexpectedValueException('No obj_id given: '); } include_once './Services/Object/classes/class.ilObjectFactory.php'; if (!($this->weblink = ilObjectFactory::getInstanceByObjId($this->obj_id, false))) { throw new UnexpectedValueException('Invalid obj_id given: ' . $this->obj_id); } if ($this->weblink->getType() != 'webr') { throw new UnexpectedValueException('Invalid obj_id given. Object is not of type webr'); } }
/** * 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(); }
protected function initPlugin() { // active plugin? include_once 'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php'; if (ilRepositoryObjectPluginSlot::isTypePluginWithLP(ilObject::_lookupType($this->obj_id))) { $obj = ilObjectFactory::getInstanceByObjId($this->obj_id); if ($obj && $obj instanceof ilLPStatusPluginInterface) { $this->status = $obj; } } else { if (ilRepositoryObjectPluginSlot::isTypePluginWithLP(ilObject::_lookupType($this->obj_id), false)) { $this->status = self::INACTIVE_PLUGIN; } } }