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; }
/** * @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'); } } } }
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(); } }
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; }
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); } } } } }
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); }
/** * 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(); }
/** * 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'); } }
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; } } }
protected function checkNotConfirmedUserAccounts() { global $ilDB; $this->log->write('Cron: Start ' . __METHOD__); require_once 'Services/Registration/classes/class.ilRegistrationSettings.php'; $oRegSettigs = new ilRegistrationSettings(); $query = 'SELECT usr_id FROM usr_data ' . 'WHERE reg_hash IS NOT NULL ' . 'AND active = %s ' . 'AND create_date < %s'; $res = $ilDB->queryF($query, array('integer', 'timestamp'), array(0, date('Y-m-d H:i:s', time() - (int) $oRegSettigs->getRegistrationHashLifetime()))); while ($row = $ilDB->fetchAssoc($res)) { $oUser = ilObjectFactory::getInstanceByObjId((int) $row['usr_id']); $oUser->delete(); $this->log->write('Cron: Deleted ' . $oUser->getLogin() . ' [' . $oUser->getId() . '] ' . __METHOD__); } $this->log->write('Cron: End ' . __METHOD__); }
/** * Import XML * * @param * @return */ function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) { include_once './Modules/File/classes/class.ilObjFile.php'; // case i container if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) { $newObj = ilObjectFactory::getInstanceByObjId($new_id, false); $newObj->createLMTree(); $newObj->setImportDirectory(dirname(rtrim($this->getImportDirectory(), '/'))); } else { // Shouldn't happen $GLOBALS['ilLog']->write(__METHOD__ . ': Called in non container mode'); return false; } $mess = $newObj->importFromDirectory($this->getImportDirectory(), true); $GLOBALS['ilLog']->write(__METHOD__ . ': Import message is: ' . $mess); $a_mapping->addMapping("Modules/LearningModule", "lm", $a_id, $newObj->getId()); }
/** * Import XML * * @param * @return */ public function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) { include_once 'Modules/Forum/classes/class.ilObjForum.php'; // case i container if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) { $newObj = ilObjectFactory::getInstanceByObjId($new_id, false); } else { $newObj = new ilObjForum(); $newObj->setType('frm'); $newObj->create(true); } include_once 'Modules/Forum/classes/class.ilForumXMLParser.php'; $parser = new ilForumXMLParser($newObj, $a_xml); $parser->setImportDirectory($this->getImportDirectory()); $parser->setImportInstallId($this->getInstallId()); $parser->startParsing(); $a_mapping->addMapping("Modules/Forum", "frm", $a_id, $newObj->getId()); }
/** * Import XML * * @param * @return */ function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) { include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; ilObjQuestionPool::_setImportDirectory($this->getImportDirectory()); // Container import => test object already created if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) { $newObj = ilObjectFactory::getInstanceByObjId($new_id, false); } else { // Shouldn't happen $GLOBALS['ilLog']->write(__METHOD__ . ': Called in non container mode'); return false; } list($xml_file, $qti_file) = $this->parseXmlFileNames(); if (!@file_exists($xml_file)) { $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot find xml definition: ' . $xml_file); return false; } if (!@file_exists($qti_file)) { $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot find xml definition: ' . $qti_file); return false; } include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; ilObjQuestionPool::_setImportDirectory($this->getImportDirectory()); // FIXME: Copied from ilObjQuestionPoolGUI::importVerifiedFileObject // TODO: move all logic to ilObjQuestionPoolGUI::importVerifiedFile and call // this method from ilObjQuestionPoolGUI and ilTestImporter $GLOBALS['ilLog']->write(__METHOD__ . ': xml file: ' . $xml_file . ", qti file:" . $qti_file); $newObj->setOnline(true); $newObj->saveToDb(); // start parsing of QTI files include_once "./Services/QTI/classes/class.ilQTIParser.php"; $qtiParser = new ilQTIParser($qti_file, IL_MO_PARSE_QTI, $newObj->getId(), null); $result = $qtiParser->startParsing(); // import page data if (strlen($xml_file)) { include_once "./Modules/LearningModule/classes/class.ilContObjParser.php"; $contParser = new ilContObjParser($newObj, $xml_file, basename($this->getImportDirectory())); $contParser->setQuestionMapping($qtiParser->getImportMapping()); $contParser->startParsing(); } $a_mapping->addMapping("Modules/TestQuestionPool", "qpl", $a_id, $newObj->getId()); ilObjQuestionPool::_setImportDirectory(null); }
/** * Import XML * * @param * @return */ function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) { if ($a_entity == "glo") { // case i container if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) { $newObj = ilObjectFactory::getInstanceByObjId($new_id, false); $xml_file = $this->getImportDirectory() . '/' . basename($this->getImportDirectory()) . '.xml'; $GLOBALS['ilLog']->write(__METHOD__ . ': Using XML file ' . $xml_file); } else { if ($new_id = $a_mapping->getMapping('Modules/Glossary', 'glo', "new_id")) { $newObj = ilObjectFactory::getInstanceByObjId($new_id, false); $xml_file = $this->getImportDirectory() . '/' . basename($this->getImportDirectory()) . '.xml'; $GLOBALS['ilLog']->write(__METHOD__ . ': Using XML file ' . $xml_file); } else { // Shouldn't happen $GLOBALS['ilLog']->write(__METHOD__ . ': Called in non container mode'); $GLOBALS['ilLog']->logStack(); return false; } } if (!file_exists($xml_file)) { $GLOBALS['ilLog']->write(__METHOD__ . ': ERROR Cannot find ' . $xml_file); return false; } include_once './Modules/LearningModule/classes/class.ilContObjParser.php'; $contParser = new ilContObjParser($newObj, $xml_file, basename($this->getImportDirectory())); $contParser->startParsing(); ilObject::_writeImportId($newObj->getId(), $newObj->getImportId()); // write term map for taxonomies to mapping object $term_map = $contParser->getGlossaryTermMap(); foreach ($term_map as $k => $v) { $a_mapping->addMapping("Services/Taxonomy", "tax_item", "glo:term:" . $k, $v); // 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", "glo:term:" . $k, $newObj->getId()); $a_mapping->addMapping("Services/AdvancedMetaData", "advmd_sub_item", "advmd:term:" . $k, $v); } // ??? $a_mapping->addMapping("Services/Taxonomy", "tax_item", "glo:term:" . $k, $v); $a_mapping->addMapping("Modules/Glossary", "glo", $a_id, $newObj->getId()); $a_mapping->addMapping("Services/AdvancedMetaData", "parent", $a_id, $newObj->getId()); $this->current_glo = $newObj; } }
/** * Get ilObjectPlugin for object id * * @param int $a_obj_id * @return ilObjectPlugin */ protected static function initPluginObj($a_obj_id) { if (!isset(self::$plugins[$a_obj_id])) { self::$plugins[$a_obj_id] = false; // active plugin? include_once 'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php'; if (ilRepositoryObjectPluginSlot::isTypePluginWithLP(ilObject::_lookupType($a_obj_id))) { $obj = ilObjectFactory::getInstanceByObjId($a_obj_id); if ($obj && $obj instanceof ilLPStatusPluginInterface) { self::$plugins[$a_obj_id] = $obj; } } else { if (ilRepositoryObjectPluginSlot::isTypePluginWithLP(ilObject::_lookupType($a_obj_id), false)) { self::$plugins[$a_obj_id] = self::INACTIVE_PLUGIN; } } } return self::$plugins[$a_obj_id]; }
/** * Import XML * * @param * @return */ function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) { // Container import => test object already created if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) { $newObj = ilObjectFactory::getInstanceByObjId($new_id, false); #$newObj->setImportDirectory(dirname(rtrim($this->getImportDirectory(),'/'))); } else { // Shouldn't happen $GLOBALS['ilLog']->write(__METHOD__ . ': Called in non container mode'); return false; } include_once "./Services/Survey/classes/class.SurveyImportParser.php"; list($xml_file) = $this->parseXmlFileNames(); if (!@file_exists($xml_file)) { $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot find xml definition: ' . $xml_file); return false; } $import = new SurveyImportParser(-1, $xml_file, TRUE); $import->setSurveyObject($newObj); $import->startParsing(); if (is_array($_SESSION["import_mob_xhtml"])) { include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; include_once "./Services/RTE/classes/class.ilRTE.php"; include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; foreach ($_SESSION["import_mob_xhtml"] as $mob) { $importfile = dirname($xml_file) . "/" . $mob["uri"]; if (file_exists($importfile)) { $media_object =& ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE); ilObjMediaObject::_saveUsage($media_object->getId(), "svy:html", $newObj->getId()); $newObj->setIntroduction(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $newObj->getIntroduction())); $newObj->setOutro(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $newObj->getOutro())); } else { global $ilLog; $ilLog->write("Error: Could not open XHTML mob file for test introduction during test import. File {$importfile} does not exist!"); } } $newObj->setIntroduction(ilRTE::_replaceMediaObjectImageSrc($newObj->getIntroduction(), 1)); $newObj->setOutro(ilRTE::_replaceMediaObjectImageSrc($newObj->getOutro(), 1)); $newObj->saveToDb(); } $a_mapping->addMapping("Modules/Survey", "svy", $a_id, $newObj->getId()); return true; }
/** * Import XML * * @param * @return */ function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) { // Container import => test object already created include_once "./Modules/Test/classes/class.ilObjTest.php"; ilObjTest::_setImportDirectory($this->getImportDirectory()); if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) { $newObj = ilObjectFactory::getInstanceByObjId($new_id, false); } else { // Shouldn't happen $GLOBALS['ilLog']->write(__METHOD__ . ': Called in non container mode'); return false; } list($xml_file, $qti_file) = $this->parseXmlFileNames(); if (!@file_exists($xml_file)) { $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot find xml definition: ' . $xml_file); return false; } if (!@file_exists($qti_file)) { $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot find xml definition: ' . $qti_file); return false; } // FIXME: Copied from ilObjTestGUI::importVerifiedFileObject // TODO: move all logic to ilObjTest::importVerifiedFile and call // this method from ilObjTestGUI and ilTestImporter $newObj->mark_schema->flush(); // Important: The container question pool is the test object implicitly. If we do not pass a valid object id here, there will be problems concerning // filesystem path determinations $qpl_id = $newObj->getId(); // start parsing of QTI files include_once "./Services/QTI/classes/class.ilQTIParser.php"; $qtiParser = new ilQTIParser($qti_file, IL_MO_PARSE_QTI, $qpl_id, array()); $qtiParser->setTestObject($newObj); $result = $qtiParser->startParsing(); $newObj->saveToDb(); // import page data include_once "./Modules/LearningModule/classes/class.ilContObjParser.php"; $contParser = new ilContObjParser($newObj, $xml_file, basename($this->getImportDirectory())); $contParser->setQuestionMapping($qtiParser->getImportMapping()); $contParser->startParsing(); $a_mapping->addMapping("Modules/Test", "tst", $a_id, $newObj->getId()); ilObjTest::_setImportDirectory(); }
/** * get ims manifest xml * * @param string $sid * @param int $ref_id * * @return xml following scorm.dtd */ function getIMSManifestXML($sid, $ref_id) { $this->initAuth($sid); $this->initIlias(); if (!$this->__checkSession($sid)) { return $this->__raiseError($this->__getMessage(), $this->__getMessageCode()); } if (!strlen($ref_id)) { return $this->__raiseError('No ref id given. Aborting!', 'Client'); } global $rbacsystem, $tree, $ilLog; // get obj_id if (!($obj_id = ilObject::_lookupObjectId($ref_id))) { return $this->__raiseError('No exercise found for id: ' . $ref_id, 'Client'); } if (ilObject::_isInTrash($ref_id)) { return $this->__raiseError("Parent with ID {$ref_id} has been deleted.", 'Client'); } // Check access $permission_ok = false; foreach ($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id) { if ($rbacsystem->checkAccess('read', $ref_id)) { $permission_ok = true; break; } } if (!$permission_ok) { return $this->__raiseError('No permission to read the object with id: ' . $ref_id, 'Server'); } $lm_obj = ilObjectFactory::getInstanceByObjId($obj_id, false); if (!is_object($lm_obj) || $lm_obj->getType() != "sahs") { return $this->__raiseError('Wrong obj id or type for scorm object with id ' . $ref_id, 'Server'); } // get scorm xml require_once "./Modules/ScormAicc/classes/SCORM/class.ilSCORMObject.php"; require_once "./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php"; $imsFilename = $lm_obj->getDataDirectory() . DIRECTORY_SEPARATOR . "imsmanifest.xml"; if (!file_exists($imsFilename)) { return $this->__raiseError('Could not find manifest file for object with ref id ' . $ref_id, 'Server'); } return file_get_contents($imsFilename); }
/** * @return mixed */ public function getGalleryUsers() { $this->pluginObj = ilPlugin::getPluginObject('Services', 'Repository', 'robj', 'AdobeConnect'); $this->pluginObj->includeClass('class.ilAdobeConnectRoles.php'); $xavcRoles = new ilAdobeConnectRoles($_GET['ref_id']); $members = $xavcRoles->getUsers(); // MEMBERS if (count($members)) { foreach ($members as $member_id) { if (!($usr_obj = ilObjectFactory::getInstanceByObjId($member_id, false))) { continue; } if (!$usr_obj->getActive()) { continue; } $user_data[$usr_obj->getId()] = array('id' => $usr_obj->getId(), 'user' => $usr_obj); } } return $user_data; }
/** * Handle an event in a listener. * * @param string $a_component component, e.g. "Modules/Forum" or "Services/User" * @param string $a_event event e.g. "createUser", "updateUser", "deleteUser", ... * @param array $a_parameter parameter array (assoc), array("name" => ..., "phone_office" => ...) */ static function handleEvent($a_component, $a_event, $a_parameter) { global $ilLog; $ilLog->write(__METHOD__ . ': Listening to event from: ' . $a_component); switch ($a_component) { case 'Services/User': switch ($a_event) { case 'afterCreation': $user = $a_parameter['user_obj']; $this->handleMembership($user); break; } break; case 'Modules/Course': switch ($a_event) { case 'addSubscriber': case 'addParticipant': if (ilObjUser::_lookupAuthMode($a_parameter['usr_id']) == 'ecs') { if (!($user = ilObjectFactory::getInstanceByObjId($a_parameter['usr_id']))) { $GLOBALS['ilLog']->write(__METHOD__ . ': No valid user found for usr_id ' . $a_parameter['usr_id']); return true; } include_once './Services/WebServices/ECS/classes/class.ilECSImport.php'; $server_id = ilECSImport::lookupServerId($a_parameter['usr_id']); $GLOBALS['ilLog']->write(__METHOD__ . ': Found server id: ' . $server_id); include_once 'Services/WebServices/ECS/classes/class.ilECSSetting.php'; $settings = ilECSSetting::getInstanceByServerId($server_id); $end = new ilDateTime(time(), IL_CAL_UNIX); $end->increment(IL_CAL_MONTH, $settings->getDuration()); if ($user->getTimeLimitUntil() < $end->get(IL_CAL_UNIX)) { $user->setTimeLimitUntil($end->get(IL_CAL_UNIX)); $user->update(); } self::_sendNotification($settings, $user); unset($user); } break; } break; } }
/** * Fill table row */ protected function fillRow($member) { global $lng, $ilCtrl; include_once "./Services/Object/classes/class.ilObjectFactory.php"; $member_id = $member["usr_id"]; if (!($mem_obj = ilObjectFactory::getInstanceByObjId($member_id, false))) { continue; } // name and login $this->tpl->setVariable("TXT_NAME", $member["name"]); $this->tpl->setVariable("TXT_LOGIN", "[" . $member["login"] . "]"); // image $this->tpl->setVariable("USR_IMAGE", $mem_obj->getPersonalPicturePath("xxsmall")); $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture")); // submission: // see if files have been resubmmited after solved $last_sub = ilExAssignment::getLastSubmission($this->ass_id, $member_id); if ($last_sub) { $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME)); } else { $last_sub = "---"; } // nr of submitted files $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("exc_files_returned")); $sub_cnt = count(ilExAssignment::getDeliveredFiles($this->exc_id, $this->ass_id, $member_id)); $this->tpl->setVariable("VAL_SUBMITTED_FILES", $sub_cnt); // download command $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id); if ($sub_cnt > 0) { // #15126 include_once "./Services/UIComponent/Button/classes/class.ilLinkButton.php"; $button = ilLinkButton::getInstance(); $button->setCaption("exc_download_files"); $button->setUrl($ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned")); $button->setOmitPreventDoubleSubmission(true); $this->tpl->setVariable("BTN_DOWNLOAD", $button->render()); } $this->tpl->parseCurrentBlock(); }
/** * Import XML * * @param * @return */ function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) { include_once './Modules/File/classes/class.ilObjFile.php'; // case i container if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) { $newObj = ilObjectFactory::getInstanceByObjId($new_id, false); } else { $newObj = new ilObjFile(); $newObj->create(true); } include_once "./Modules/File/classes/class.ilFileXMLParser.php"; $parser = new ilFileXMLParser($newObj, $a_xml); $parser->setImportDirectory($this->getImportDirectory()); $parser->startParsing(); $newObj->createProperties(false, false); $parser->setFileContents(); $this->current_obj = $newObj; $newObj->update(); // this is necessary for case ii (e.g. wiki import) $a_mapping->addMapping("Modules/File", "file", $a_id, $newObj->getId()); $a_mapping->addMapping("Services/MetaData", "md", $a_id . ":0:file", $newObj->getId() . ":0:file"); }
/** * Import XML * * @param * @return */ function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) { // Container import => test object already created if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) { $newObj = ilObjectFactory::getInstanceByObjId($new_id, false); #$newObj->setImportDirectory(dirname(rtrim($this->getImportDirectory(),'/'))); } else { // Shouldn't happen $GLOBALS['ilLog']->write(__METHOD__ . ': Called in non container mode'); return false; } include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php"; list($xml_file) = $this->parseXmlFileNames(); if (!@file_exists($xml_file)) { $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot find xml definition: ' . $xml_file); return false; } // import qti data $qtiresult = $newObj->importObject($xml_file); $a_mapping->addMapping("Modules/SurveyQuestionPool", "spl", $a_id, $newObj->getId()); return true; }
/** * */ protected function uninstallCustom() { /** * @var $ilDB ilDB */ global $ilDB; if ($ilDB->tableExists('rep_robj_xavc_data')) { $ilDB->dropTable('rep_robj_xavc_data'); } if ($ilDB->tableExists('rep_robj_xavc_settings')) { $ilDB->dropTable('rep_robj_xavc_settings'); } if ($ilDB->tableExists('rep_robj_xavc_users')) { $ilDB->dropTable('rep_robj_xavc_users'); } if ($ilDB->tableExists('rep_robj_xavc_members')) { $ilDB->dropTable('rep_robj_xavc_members'); } if ($ilDB->tableExists('rep_robj_xavc_gloperm')) { $ilDB->dropTable('rep_robj_xavc_gloperm'); } if ($ilDB->sequenceExists('rep_robj_xavc_gloperm')) { $ilDB->dropSequence('rep_robj_xavc_gloperm'); } foreach (array('cb_extended', 'cb_simple') as $settings_tpl) { $ilDB->manipulateF('DELETE FROM adm_settings_template WHERE type = %s AND title = %s', array('text', 'text'), array('xavc', $settings_tpl)); } foreach (array('il_xavc_admin', 'il_xavc_member') as $tpl) { $obj_ids = ilObject::_getIdsForTitle($tpl, 'rolt'); foreach ($obj_ids as $obj_id) { $obj = ilObjectFactory::getInstanceByObjId($obj_id, false); if (!$obj instanceof ilObjRoleTemplate) { continue; } $obj->delete(); } } }
/** * 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->link = ilObjectFactory::getInstanceByObjId($new_id, false); } else { include_once './Modules/WebResource/classes/class.ilObjLinkResource.php'; $this->link = new ilObjLinkResource(); $this->link->setType('webr'); $this->link->create(true); } try { include_once './Modules/WebResource/classes/class.ilWebLinkXmlParser.php'; $parser = new ilWebLinkXmlParser($this->link, $a_xml); $parser->setMode(ilWebLinkXmlParser::MODE_CREATE); $parser->start(); $a_mapping->addMapping('Modules/WebResource', 'webr', $a_id, $this->link->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() . '".'); } }
/** * 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() . '".'); } }
function getDefaultAdminRole() { $local_roles = $this->__getLocalRoles(); foreach ($local_roles as $role_id) { if ($tmp_role =& ilObjectFactory::getInstanceByObjId($role_id, false)) { if (!strcmp($tmp_role->getTitle(), "il_crs_admin_" . $this->getRefId())) { return $role_id; } } } return false; }
function __showRolesTable($a_result_set, $a_from = "") { if (!$this->ilAccess->checkAccess("cat_administrate_users", "", $_GET["ref_id"])) { ilUtil::sendFailure($this->lng->txt("permission_denied"), true); $this->ctrl->redirect($this, ""); } $tbl =& $this->parent_gui->__initTableGUI(); $tpl =& $tbl->getTemplateObject(); // SET FORMAACTION $tpl->setCurrentBlock("tbl_form_header"); $this->ctrl->setParameter($this, 'obj_id', $_GET['obj_id']); $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $tpl->parseCurrentBlock(); // SET FOOTER BUTTONS $tpl->setVariable("COLUMN_COUNTS", 4); $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg")); $tpl->setCurrentBlock("tbl_action_button"); $tpl->setVariable("BTN_NAME", "assignSave"); $tpl->setVariable("BTN_VALUE", $this->lng->txt("change_assignment")); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("tbl_action_row"); $tpl->setVariable("TPLPATH", $this->tpl->tplPath); $tpl->parseCurrentBlock(); $tmp_obj =& ilObjectFactory::getInstanceByObjId($_GET['obj_id']); $title = $this->lng->txt('role_assignment') . ' (' . $tmp_obj->getFullname() . ')'; $tbl->setTitle($title, "icon_role.svg", $this->lng->txt("role_assignment")); $tbl->setHeaderNames(array('', $this->lng->txt("title"), $this->lng->txt('description'), $this->lng->txt("type"))); $tbl->setHeaderVars(array("", "title", "description", "type"), array("ref_id" => $this->object->getRefId(), "cmd" => "assignRoles", "obj_id" => $_GET['obj_id'], "cmdClass" => "ilobjcategorygui", "cmdNode" => $_GET["cmdNode"])); $tbl->setColumnWidth(array("4%", "35%", "45%", "16%")); $this->set_unlimited = true; $this->parent_gui->__setTableGUIBasicData($tbl, $a_result_set, $a_from, true); $tbl->render(); $this->tpl->setVariable("ROLES_TABLE", $tbl->tpl->get()); return true; }
/** * read subscribers * * @access protected */ protected function readSubscribers() { global $ilDB; $this->subscribers = array(); $query = "SELECT usr_id FROM il_subscribers " . "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " . "ORDER BY sub_time "; $res = $this->ilDB->query($query); while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { // DELETE SUBSCRIPTION IF USER HAS BEEN DELETED if (!ilObjectFactory::getInstanceByObjId($row->usr_id, false)) { $this->deleteSubscriber($row->usr_id); } $this->subscribers[] = $row->usr_id; } return true; }