本文整理汇总了PHP中ilObject::_getAllReferences方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObject::_getAllReferences方法的具体用法?PHP ilObject::_getAllReferences怎么用?PHP ilObject::_getAllReferences使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObject
的用法示例。
在下文中一共展示了ilObject::_getAllReferences方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hasParticipantListAccess
/**
* Check if (current) user has access to the participant list
* @param type $a_obj
* @param type $a_usr_id
*/
public static function hasParticipantListAccess($a_obj_id, $a_usr_id = null)
{
if (!$a_usr_id) {
$a_usr_id = $GLOBALS['ilUser']->getId();
}
// if write access granted => return true
$refs = ilObject::_getAllReferences($a_obj_id);
$ref_id = end($refs);
if ($GLOBALS['ilAccess']->checkAccess('write', '', $ref_id)) {
return true;
}
$part = self::getInstanceByObjId($a_obj_id);
if ($part->isAssigned($a_usr_id)) {
if ($part->getType() == 'crs') {
// Check for show_members
include_once './Modules/Course/classes/class.ilObjCourse.php';
if (!ilObjCourse::lookupShowMembersEnabled($a_obj_id)) {
return false;
}
}
return true;
}
// User is not assigned to course/group => no read access
return false;
}
示例2: _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;
}
示例3: initItems
protected function initItems($a_data)
{
global $ilAccess, $lng, $tree;
$data = array();
if (!$this->user_id) {
$is_admin = $ilAccess->checkAccess("visible", "", SYSTEM_FOLDER_ID);
}
foreach ($a_data as $id => $item) {
// workspace objects won't have references
$refs = ilObject::_getAllReferences($id);
if ($refs) {
foreach ($refs as $idx => $ref_id) {
// objects in trash are hidden
if (!$tree->isDeleted($ref_id)) {
if ($this->user_id) {
$readable = $ilAccess->checkAccessOfUser($this->user_id, "read", "", $ref_id, $a_type);
} else {
$readable = $is_admin;
}
$data[$ref_id] = array("obj_id" => $id, "ref_id" => $ref_id, "type" => ilObject::_lookupType($id), "title" => $item, "path" => $this->buildPath($ref_id), "readable" => $readable);
}
}
}
}
$this->setData($data);
}
示例4: getSinglePool
public function getSinglePool($CourseID, $PoolID)
{
global $ilUser, $ilObjDataCache;
$retval = array();
$items = ilParticipants::_getMembershipByType($ilUser->getId(), 'crs');
// $items = ilParticipants::_getMembershipByType(12855, 'crs');
$itemId = array_search($CourseID, $items);
if ($itemId !== FALSE && $itemId >= 0) {
$obj_id = $items[$itemId];
$item_references = ilObject::_getAllReferences($obj_id);
reset($item_references);
if (strcmp($this->iliasVersion, "4.2") === 0) {
require_once 'Modules/Course/classes/class.ilCourseItems.php';
foreach ($item_references as $ref_id) {
// Antique Ilias
$courseItems = new ilCourseItems($ref_id, 0, $ilUser->getId());
$courseItemList = $courseItems->getAllItems();
$retval = $this->mapItems($courseItemList, $PoolID);
$retval = $retval[0];
}
} else {
// Modern Ilias
$crs = new ilObjCourse($item_references, true);
$courseItemList = $crs->getSubItems();
$retval = $this->mapItems($courseItemList["_all"], $PoolID);
$retval = $retval[0];
}
}
return $retval;
}
示例5: getXmlRepresentation
/**
* 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)
{
$GLOBALS['ilLog']->write(__METHOD__ . ': Received id = ' . $a_id);
$writer = new ilContainerXmlWriter(end(ilObject::_getAllReferences($a_id)));
$writer->write();
return $writer->xmlDumpMem(false);
}
示例6: 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() . '".');
}
}
示例7: buildRef
/**
* @param $id
* @param $type
*
* @return bool|int
*/
protected function buildRef($id, $type)
{
if ($type == 'reference_id') {
if (!ilObjOrgUnit::_exists($id, true)) {
return false;
}
return $id;
} elseif ($type == 'external_id') {
$obj_id = ilObject::_lookupObjIdByImportId($id);
if (!ilObject::_hasUntrashedReference($obj_id)) {
return false;
}
$ref_ids = ilObject::_getAllReferences($obj_id);
if (!count($ref_ids)) {
return false;
}
foreach ($ref_ids as $ref_id) {
if (!ilObject::_isInTrash($ref_id)) {
return $ref_id;
}
}
return false;
} else {
return false;
}
}
示例8: handleEvent
/**
* 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" => ...)
*/
public static function handleEvent($a_component, $a_event, $a_params)
{
$obj_id = $a_params['obj_id'];
switch ($a_component) {
case 'Services/Object':
switch ($a_event) {
case 'toTrash':
include_once './Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($obj_id);
$olp->handleToTrash();
break;
case 'delete':
// ilRepUtil will raise "delete" even if only reference was deleted!
$all_ref = ilObject::_getAllReferences($obj_id);
if (!sizeof($all_ref)) {
include_once './Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($obj_id);
$olp->handleDelete();
}
break;
}
break;
case 'Services/Tree':
switch ($a_event) {
case 'moveTree':
if ($a_params['tree'] == 'tree') {
include_once './Services/Object/classes/class.ilObjectLP.php';
ilObjectLP::handleMove($a_params['source_id']);
}
break;
}
break;
}
return true;
}
示例9: 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() . '".');
}
}
示例10: 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);
}
}
示例11: 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() . '".');
}
}
示例12: __construct
/**
* Singleton Constructor
*
* @access protected
* @param int obj_id of container
*/
protected function __construct($a_obj_id, $a_usr_id)
{
global $ilDB, $lng;
$this->obj_id = $a_obj_id;
$this->usr_id = $a_usr_id;
$this->type = ilObject::_lookupType($a_obj_id);
$ref_ids = ilObject::_getAllReferences($this->obj_id);
$this->ref_id = current($ref_ids);
$this->readParticipant();
$this->readParticipantStatus();
}
示例13: checkObjectPermission
/**
* Checks read permission on obj id
*/
static function checkObjectPermission($a_obj_id)
{
global $ilAccess;
$refs = ilObject::_getAllReferences($a_obj_id);
foreach ($refs as $ref) {
if ($ilAccess->checkAccess("read", "", $ref)) {
return true;
}
}
return false;
}
示例14: getXmlRepresentation
/**
* Get xml representation
*
* @param string entity
* @param string target release
* @param string id
* @return string xml string
*/
public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
{
$refs = ilObject::_getAllReferences($a_id);
$sql_ref_id = current($refs);
include_once './Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php';
$spl = new ilObjSurveyQuestionPool($a_id, false);
$spl->loadFromDb();
include_once "./Modules/SurveyQuestionPool/classes/class.ilSurveyQuestionpoolExport.php";
$spl_exp = new ilSurveyQuestionpoolExport($spl, 'xml');
$zip = $spl_exp->buildExportFile();
$GLOBALS['ilLog']->write(__METHOD__ . ': Created zip file ' . $zip);
}
示例15: _isAccessible
/**
* Check if target is accessible and not deleted
* @param int $a_ref_id ref_id
* @return bool
* @static
*/
public static function _isAccessible($a_ref_id)
{
global $ilDB, $tree;
$obj_id = ilObject::_lookupObjId($a_ref_id);
$query = "SELECT target_obj_id FROM container_reference " . "WHERE obj_id = " . $ilDB->quote($obj_id, 'integer') . " ";
$res = $ilDB->query($query);
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
$target_id = $row->target_obj_id;
}
$target_ref_ids = ilObject::_getAllReferences($target_id);
$target_ref_id = current($target_ref_ids);
return !$tree->isDeleted($target_ref_id);
}