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