本文整理汇总了PHP中ilObject类的典型用法代码示例。如果您正苦于以下问题:PHP ilObject类的具体用法?PHP ilObject怎么用?PHP ilObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ilObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstanceByObject
/**
* Get settings handler for repository object
*
* @param ilObject $a_content_obj
* @return ilECSObjectSettings
*/
public static function getInstanceByObject(ilObject $a_content_obj)
{
switch ($a_content_obj->getType()) {
case 'crs':
include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
return new ilECSCourseSettings($a_content_obj);
case 'cat':
include_once 'Modules/Category/classes/class.ilECSCategorySettings.php';
return new ilECSCategorySettings($a_content_obj);
case 'file':
include_once 'Modules/File/classes/class.ilECSFileSettings.php';
return new ilECSFileSettings($a_content_obj);
case 'glo':
include_once 'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
return new ilECSGlossarySettings($a_content_obj);
case 'grp':
include_once 'Modules/Group/classes/class.ilECSGroupSettings.php';
return new ilECSGroupSettings($a_content_obj);
case 'lm':
include_once 'Modules/LearningModule/classes/class.ilECSLearningModuleSettings.php';
return new ilECSLearningModuleSettings($a_content_obj);
case 'wiki':
include_once 'Modules/Wiki/classes/class.ilECSWikiSettings.php';
return new ilECSWikiSettings($a_content_obj);
}
}
示例2: 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() . '".');
}
}
示例3: __construct
/**
* Constructor
*
* @access public
* @param
* @return
*/
public function __construct($a_parent_obj, $a_parent_cmd, $a_pool_ref_id)
{
global $lng, $ilCtrl;
$this->setId("cont_qpl");
$this->pool_ref_id = $a_pool_ref_id;
$this->pool_obj_id = ilObject::_lookupObjId($a_pool_ref_id);
parent::__construct($a_parent_obj, $a_parent_cmd);
$this->setTitle(ilObject::_lookupTitle($this->pool_obj_id));
// $qplSetting = new ilSetting("qpl");
$this->setFormName('sa_quest_browser');
// $this->addColumn('','f','1%');
$this->addColumn($this->lng->txt("title"), 'title', '');
$this->addColumn($this->lng->txt("cont_question_type"), 'ttype', '');
$this->addColumn($this->lng->txt("actions"), '', '');
// $this->setPrefix('q_id');
// $this->setSelectAllCheckbox('q_id');
$this->setRowTemplate("tpl.copy_sa_quest_row.html", "Services/COPage");
$this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
$this->setDefaultOrderField("title");
$this->setDefaultOrderDirection("asc");
// $this->setFilterCommand('filterQuestionBrowser');
// $this->setResetCommand('resetQuestionBrowser');
$this->initFilter();
$this->getQuestions();
}
示例4: parseObjectIds
/**
* Parse object data
* @return
* @param object $a_ids
*/
public function parseObjectIds($a_ids)
{
foreach ($a_ids as $object_id) {
$row = array();
$type = ilObject::_lookupType($object_id);
$row['title'] = ilObject::_lookupTitle($object_id);
$row['desc'] = ilObject::_lookupDescription($object_id);
$row['id'] = $object_id;
switch ($type) {
case 'crs':
case 'grp':
include_once './Services/Membership/classes/class.ilParticipants.php';
if (ilParticipants::hasParticipantListAccess($object_id)) {
$row['member'] = count(ilParticipants::getInstanceByObjId($object_id)->getParticipants());
} else {
$row['member'] = 0;
}
break;
case 'role':
global $rbacreview;
include_once './Services/User/classes/class.ilUserFilter.php';
$row['member'] = count(ilUserFilter::getInstance()->filter($rbacreview->assignedUsers($object_id)));
break;
}
$data[] = $row;
}
$this->setData($data ? $data : array());
}
示例5: putparam
function putparam($ref_id, $obj_id, $version, $aicc_data)
{
//aiccdata is a non standard ini format
//$data=parse_ini_file($tmpFilename, TRUE);
$data = $this->parseAICCData($aicc_data);
$hacp_id = ilObject::_lookupObjId($ref_id);
//choose either insert or update to be able to inherit superclass
global $ilDB, $ilUser, $ilLog;
$this->update = array();
$this->insert = array();
if (is_object($ilUser)) {
$user_id = $ilUser->getId();
foreach ($data as $key => $value) {
$set = $ilDB->queryF('
SELECT * FROM scorm_tracking WHERE user_id = %s
AND sco_id = %s
AND lvalue = %s
AND obj_id = %s', array('integer', 'integer', 'text', 'integer'), array($user_id, $obj_id, $key, $hacp_id));
if ($rec = $ilDB->fetchAssoc($set)) {
$this->update[] = array("left" => $key, "right" => $value);
} else {
$this->insert[] = array("left" => $key, "right" => $value);
}
}
}
//store
$this->store($hacp_id, $obj_id, 0);
$response = new ilHACPResponse($ref_id, $obj_id);
$response->sendOk();
}
示例6: 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() . '".');
}
}
示例7: 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);
}
}
示例8: fillRow
/**
* Fill table row
*/
protected function fillRow($a_set)
{
global $lng;
$this->tpl->setVariable("TXT_DEP_OBJ", $lng->txt("obj_" . ilObject::_lookupType($a_set["dep_obj"])) . ": " . ilObject::_lookupTitle($a_set["dep_obj"]));
$this->tpl->setVariable("TXT_DEL_OBJ", $lng->txt("obj_" . ilObject::_lookupType($a_set["del_obj"])) . ": " . ilObject::_lookupTitle($a_set["del_obj"]));
$this->tpl->setVariable("TXT_MESS", $a_set["message"]);
}
示例9: _getStatusInfo
function _getStatusInfo($a_obj_id)
{
$status_info = array();
include_once "Services/Object/classes/class.ilObjectLP.php";
$olp = ilObjectLP::getInstance($a_obj_id);
$collection = $olp->getCollectionInstance();
if ($collection) {
$status_info["items"] = $collection->getItems($a_obj_id);
foreach ($status_info["items"] as $item_id) {
$status_info["completed"][$item_id] = array();
}
$ref_ids = ilObject::_getAllReferences($a_obj_id);
$ref_id = end($ref_ids);
$possible_items = $collection->getPossibleItems($ref_id);
$chapter_ids = array_intersect(array_keys($possible_items), $status_info["items"]);
// fix order (adapt from possible items)
$status_info["items"] = $chapter_ids;
if ($chapter_ids) {
$status = self::_getObjectStatus($a_obj_id);
foreach ($chapter_ids as $item_id) {
$status_info["item_titles"][$item_id] = $possible_items[$item_id]["title"];
if (isset($status[$item_id])) {
foreach ($status[$item_id] as $user_id => $user_status) {
if ($user_status) {
$status_info["completed"][$item_id][] = $user_id;
}
}
}
}
}
}
return $status_info;
}
示例10: gatherCourseLPData
function gatherCourseLPData()
{
global $tree, $ilDB;
// process all courses
$all_courses = array_keys(ilObject::_getObjectsByType("crs"));
if ($all_courses) {
// gather objects in trash
$trashed_objects = $tree->getSavedNodeObjIds($all_courses);
include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
include_once "Services/Tracking/classes/class.ilLPStatusWrapper.php";
foreach ($all_courses as $crs_id) {
// trashed objects will not change
if (!in_array($crs_id, $trashed_objects)) {
// only if LP is active
$mode = ilLPObjSettings::_lookupMode($crs_id);
if ($mode == LP_MODE_DEACTIVATED || $mode == LP_MODE_UNDEFINED) {
continue;
}
// only save once per day
$ilDB->manipulate("DELETE FROM obj_lp_stat WHERE" . " obj_id = " . $ilDB->quote($crs_id, "integer") . " AND fulldate = " . $ilDB->quote(date("Ymd", $this->date), "integer"));
$members = new ilCourseParticipants($crs_id);
$members = $members->getMembers();
$in_progress = count(ilLPStatusWrapper::_lookupInProgressForObject($crs_id, $members));
$completed = count(ilLPStatusWrapper::_lookupCompletedForObject($crs_id, $members));
$failed = count(ilLPStatusWrapper::_lookupFailedForObject($crs_id, $members));
// calculate with other values - there is not direct method
$not_attempted = count($members) - $in_progress - $completed - $failed;
$set = array("type" => array("text", "crs"), "obj_id" => array("integer", $crs_id), "yyyy" => array("integer", date("Y", $this->date)), "mm" => array("integer", date("m", $this->date)), "dd" => array("integer", date("d", $this->date)), "fulldate" => array("integer", date("Ymd", $this->date)), "mem_cnt" => array("integer", count($members)), "in_progress" => array("integer", $in_progress), "completed" => array("integer", $completed), "failed" => array("integer", $failed), "not_attempted" => array("integer", $not_attempted));
$ilDB->insert("obj_lp_stat", $set);
}
}
}
}
示例11: 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() . '".');
}
}
示例12: getHTML
/**
* Get HTML for navigation history
*/
function getHTML()
{
global $ilNavigationHistory, $lng;
include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
$selection = new ilAdvancedSelectionListGUI();
$selection->setFormSelectMode("url_ref_id", "ilNavHistorySelect", true, "goto.php?target=navi_request", "ilNavHistory", "ilNavHistoryForm", "_top", $lng->txt("go"), "ilNavHistorySubmit");
$selection->setListTitle($lng->txt("last_visited"));
$selection->setId("lastvisited");
$selection->setSelectionHeaderClass("MMInactive");
$selection->setHeaderIcon(ilAdvancedSelectionListGUI::NO_ICON);
$selection->setItemLinkClass("small");
$selection->setUseImages(true);
include_once "./Services/Accessibility/classes/class.ilAccessKey.php";
$selection->setAccessKey(ilAccessKey::LAST_VISITED);
$items = $ilNavigationHistory->getItems();
//$sel_arr = array(0 => "-- ".$lng->txt("last_visited")." --");
reset($items);
$cnt = 0;
foreach ($items as $k => $item) {
if ($cnt++ > 20) {
break;
}
if (!isset($item["ref_id"]) || !isset($_GET["ref_id"]) || $item["ref_id"] != $_GET["ref_id"] || $k > 0) {
$obj_id = ilObject::_lookupObjId($item["ref_id"]);
$selection->addItem($item["title"], $item["ref_id"], $item["link"], ilObject::_getIcon($obj_id, "tiny", $item["type"]), $lng->txt("obj_" . $item["type"]), "_top");
}
}
$html = $selection->getHTML();
if ($html == "") {
$selection->addItem($lng->txt("no_items"), "", "#", "", "", "_top");
$selection->setUseImages(false);
$html = $selection->getHTML();
}
return $html;
}
示例13: getListByObject
/**
* Get list of roles assigned to an object
* @return
* @param object $result
*/
public static function getListByObject($a_str)
{
global $rbacreview, $ilDB;
include_once './Services/JSON/classes/class.ilJsonUtil.php';
$result = array();
if (strpos($a_str, '@') !== 0) {
return ilJsonUtil::encode($result);
}
$a_str = substr($a_str, 1);
$ilDB->setLimit(100);
$query = "SELECT ref_id, title FROM object_data ode " . "JOIN object_reference ore ON ode.obj_id = ore.obj_id " . "WHERE " . $ilDB->like('title', 'text', $a_str . '%') . ' ' . 'ORDER BY title';
$res = $ilDB->query($query);
$counter = 0;
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
$rolf = $rbacreview->getRoleFolderIdOfObject($row->ref_id);
if ($rolf) {
foreach ($rbacreview->getRolesOfRoleFolder($rolf, false) as $rol_id) {
$role = ilObject::_lookupTitle($rol_id);
$result[$counter] = new stdClass();
$result[$counter]->value = $role;
$result[$counter]->label = $role . " (" . $row->title . ")";
++$counter;
}
}
}
return ilJsonUtil::encode($result);
}
示例14: fillRow
/**
* Fill table row
*/
protected function fillRow($a_set)
{
global $lng;
$this->tpl->setVariable("REF_ID", $a_set["ref_id"]);
$this->tpl->setVariable("SUBSTYLE", $a_set["substyle"]);
$this->tpl->setVariable("CATEGORY", ilObject::_lookupTitle(ilObject::_lookupObjId($a_set["ref_id"])));
}
示例15: getXmlExportHeadDependencies
/**
* Get head dependencies
*
* @param string entity
* @param string target release
* @param array ids
* @return array array of array with keys "component", entity", "ids"
*/
function getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
{
if ($a_entity == "pg") {
// get all media objects and files of the page
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
include_once "./Modules/File/classes/class.ilObjFile.php";
$mob_ids = array();
$file_ids = array();
foreach ($a_ids as $pg_id) {
$pg_id = explode(":", $pg_id);
// get media objects
$mids = ilObjMediaObject::_getMobsOfObject($pg_id[0] . ":pg", $pg_id[1]);
foreach ($mids as $mid) {
if (ilObject::_lookupType($mid) == "mob") {
$mob_ids[] = $mid;
}
}
// get files
$files = ilObjFile::_getFilesOfObject($pg_id[0] . ":pg", $pg_id[1]);
foreach ($files as $file) {
if (ilObject::_lookupType($file) == "file") {
$file_ids[] = $file;
}
}
}
return array(array("component" => "Services/MediaObjects", "entity" => "mob", "ids" => $mob_ids), array("component" => "Modules/File", "entity" => "file", "ids" => $file_ids));
}
return array();
}