本文整理汇总了PHP中ilObjectFactory::getInstanceByObjId方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjectFactory::getInstanceByObjId方法的具体用法?PHP ilObjectFactory::getInstanceByObjId怎么用?PHP ilObjectFactory::getInstanceByObjId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjectFactory
的用法示例。
在下文中一共展示了ilObjectFactory::getInstanceByObjId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
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;
}
示例2: handleCurrentRecipient
/**
* @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');
}
}
}
}
示例3: run
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();
}
}
示例4: getDeveloperRubricCardFormCommandRow
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;
}
示例5: resetCustomLPDataForUserIds
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);
}
}
}
}
}
示例6: sortCallback
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);
}
示例7: getGroupPairs
/**
* 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;
}
示例8: __construct
/**
* 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();
}
示例9: init
/**
* 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');
}
}
示例10: initPlugin
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;
}
}
}
示例11: checkNotConfirmedUserAccounts
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__);
}
示例12: importXmlRepresentation
/**
* 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());
}
示例13: importXmlRepresentation
/**
* 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());
}
示例14: importXmlRepresentation
/**
* 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);
}
示例15: importXmlRepresentation
/**
* 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;
}
}