本文整理汇总了PHP中ilObject::_lookupType方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObject::_lookupType方法的具体用法?PHP ilObject::_lookupType怎么用?PHP ilObject::_lookupType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObject
的用法示例。
在下文中一共展示了ilObject::_lookupType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getCharacteristics
/**
* Get characteristics
*/
static function _getCharacteristics($a_style_id)
{
$st_chars = ilPCParagraphGUI::_getStandardCharacteristics();
$chars = ilPCParagraphGUI::_getStandardCharacteristics();
if ($a_style_id > 0 && ilObject::_lookupType($a_style_id) == "sty") {
include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
$style = new ilObjStyleSheet($a_style_id);
$types = array("text_block", "heading1", "heading2", "heading3");
$chars = array();
foreach ($types as $t) {
$chars = array_merge($chars, $style->getCharacteristics($t));
}
$new_chars = array();
foreach ($chars as $char) {
if ($st_chars[$char] != "") {
$new_chars[$char] = $st_chars[$char];
} else {
$new_chars[$char] = $char;
}
asort($new_chars);
}
$chars = $new_chars;
}
return $chars;
}
示例2: fillRow
/**
* Fill table row
*/
protected function fillRow($a_set)
{
global $lng, $ilCtrl, $ilUser;
include_once "./Services/Skill/classes/class.ilPersonalSkill.php";
$mat = ilPersonalSkill::getAssignedMaterial($ilUser->getId(), $this->tref_id, $a_set["id"]);
$ilCtrl->setParameter($this->parent_obj, "level_id", $a_set["id"]);
foreach ($mat as $m) {
$this->tpl->setCurrentBlock("mat");
$obj_id = $this->ws_tree->lookupObjectId($m["wsp_id"]);
$this->tpl->setVariable("MAT_TITLE", ilObject::_lookupTitle($obj_id));
$this->tpl->setVariable("MAT_IMG", ilUtil::img(ilUtil::getImagePath("icon_" . ilObject::_lookupType($obj_id) . ".svg")));
$this->tpl->setVariable("TXT_REMOVE", $lng->txt("remove"));
$ilCtrl->setParameter($this->parent_obj, "wsp_id", $m["wsp_id"]);
$this->tpl->setVariable("HREF_REMOVE", $ilCtrl->getLinkTarget($this->parent_obj, "removeMaterial"));
$obj_id = $this->ws_tree->lookupObjectId($m["wsp_id"]);
$url = $this->ws_access->getGotoLink($m["wsp_id"], $obj_id);
$this->tpl->setVariable("HREF_MAT", $url);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("cmd");
$this->tpl->setVariable("HREF_CMD", $ilCtrl->getLinkTarget($this->parent_obj, "assignMaterial"));
$this->tpl->setVariable("TXT_CMD", $lng->txt("skmg_assign_materials"));
$this->tpl->parseCurrentBlock();
$ilCtrl->setParameter($this->parent_obj, "level_id", "");
$this->tpl->setVariable("LEVEL_ID", $a_set["id"]);
$this->tpl->setVariable("SKILL_ID", $this->basic_skill_id);
$this->tpl->setVariable("TXT_SKILL", $a_set["title"]);
$this->tpl->setVariable("TXT_SKILL_DESC", $a_set["description"]);
}
示例3: 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());
}
示例4: 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();
}
示例5: 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);
}
示例6: 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);
}
}
示例7: 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"]);
}
示例8: showMemberViewSwitch
/**
* Show member view switch
* @return
* @param int $a_ref_id
*/
public static function showMemberViewSwitch($a_ref_id)
{
global $ilAccess, $ilCtrl;
$settings = ilMemberViewSettings::getInstance();
if (!$settings->isEnabled()) {
return false;
}
global $tpl, $tree, $lng, $ilTabs;
// No course or group in path => aborting
if (!$tree->checkForParentType($a_ref_id, 'crs') and !$tree->checkForParentType($a_ref_id, 'grp')) {
return false;
}
// TODO: check edit_permission
$active = $settings->isActive();
$type = ilObject::_lookupType(ilObject::_lookupObjId($a_ref_id));
if (($type == 'crs' or $type == 'grp') and $ilAccess->checkAccess('write', '', $a_ref_id)) {
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $a_ref_id);
$ilCtrl->setParameterByClass("ilrepositorygui", "mv", "1");
$ilCtrl->setParameterByClass("ilrepositorygui", "set_mode", "flat");
$ilTabs->addNonTabbedLink("members_view", $lng->txt('mem_view_activate'), $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset"));
$ilCtrl->clearParametersByClass("ilrepositorygui");
return true;
}
return true;
}
示例9: importSimpleXml
/**
* Import using simplexml
* @param SimpleXMLElement $role
*/
public function importSimpleXml(SimpleXMLElement $role)
{
global $rbacadmin, $rbacreview, $lng;
$import_id = (string) $role['id'];
$GLOBALS['ilLog']->write(__METHOD__ . ' Importing role with import id ' . $import_id);
if (!$this->initRole($import_id)) {
return 0;
}
$this->getRole()->setTitle(trim((string) $role->title));
$this->getRole()->setDescription(trim((string) $role->description));
$type = ilObject::_lookupType($this->getRoleFolderId(), true);
$exp = explode("_", $this->getRole()->getTitle());
if (count($exp) > 0 && $exp[0] === "il") {
if (count($exp) > 1 && $exp[1] !== $type) {
throw new ilRoleImporterException(sprintf($lng->txt("rbac_cant_import_role_wrong_type"), $lng->txt('obj_' . $exp[1]), $lng->txt('obj_' . $type)));
}
$exp[3] = $this->getRoleFolderId();
$id = ilObjRole::_getIdsForTitle(implode("_", $exp));
if ($id[0]) {
$GLOBALS['ilLog']->write(__METHOD__ . ': Overwrite role ' . implode("_", $exp));
$this->getRole()->setId($id[0]);
$this->getRole()->read();
}
}
// Create or update
if ($this->getRole()->getId()) {
$rbacadmin->deleteRolePermission($this->getRole()->getId(), $this->getRoleFolderId());
$this->getRole()->update();
} else {
$this->getRole()->create();
}
$this->assignToRoleFolder();
$protected = (string) $role['protected'];
if ($protected) {
$rbacadmin->setProtected(0, $this->getRole()->getId(), 'y');
}
// Add operations
$ops = $rbacreview->getOperations();
$operations = array();
foreach ($ops as $ope) {
$operations[$ope['operation']] = $ope['ops_id'];
}
foreach ($role->operations as $sxml_operations) {
foreach ($sxml_operations as $sxml_op) {
$ops_group = (string) $sxml_op['group'];
$ops_id = (int) $operations[trim((string) $sxml_op)];
$ops = trim((string) $sxml_op);
if ($ops_group and $ops_id) {
$rbacadmin->setRolePermission($this->getRole()->getId(), $ops_group, array($ops_id), $this->getRoleFolderId());
} else {
$GLOBALS['ilLog']->write(__METHOD__ . ': Cannot create operation for...');
$GLOBALS['ilLog']->write(__METHOD__ . ': New operation for group ' . $ops_group);
$GLOBALS['ilLog']->write(__METHOD__ . ': New operation ' . $ops);
$GLOBALS['ilLog']->write(__METHOD__ . ': New operation ' . $ops_id);
}
}
}
return $this->getRole()->getId();
}
示例10: 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" => ...)
*/
static function handleEvent($a_component, $a_event, $a_parameter)
{
global $ilUser;
if ($a_component == "Services/Tracking" && $a_event == "updateStatus") {
// #13905
include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
if (!ilObjUserTracking::_enabledLearningProgress()) {
return;
}
$obj_id = $a_parameter["obj_id"];
$user_id = $a_parameter["usr_id"];
$status = $a_parameter["status"];
if ($obj_id && $user_id) {
if (ilObject::_lookupType($obj_id) != "crs") {
return;
}
// determine couse setting only once
if (!isset(self::$course_mode[$obj_id])) {
include_once "./Modules/Course/classes/class.ilObjCourse.php";
$crs = new ilObjCourse($obj_id, false);
if ($crs->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
include_once './Services/Object/classes/class.ilObjectLP.php';
$olp = ilObjectLP::getInstance($obj_id);
$mode = $olp->getCurrentMode();
} else {
$mode = false;
}
self::$course_mode[$obj_id] = $mode;
}
$is_completed = $status == ilLPStatus::LP_STATUS_COMPLETED_NUM;
// we are NOT using the members object because of performance issues
switch (self::$course_mode[$obj_id]) {
case ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR:
// #11600
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed, true);
break;
case ilLPObjSettings::LP_MODE_COLLECTION:
case ilLPObjSettings::LP_MODE_OBJECTIVES:
// overwrites course passed status if it was set automatically (full sync)
// or toggle manually set passed status to completed (1-way-sync)
$do_update = $is_completed;
include_once "Modules/Course/classes/class.ilCourseParticipants.php";
if (!$do_update) {
$part = new ilCourseParticipants($obj_id);
$passed = $part->getPassedInfo($user_id);
if (!is_array($passed) || $passed["user_id"] == -1) {
$do_update = true;
}
}
if ($do_update) {
ilCourseParticipants::_updatePassed($obj_id, $user_id, $is_completed);
}
break;
}
}
}
}
示例11: isEditable
/**
* Check in the certificate type if this setting is editable in the current context (crs, tst...)
*
* @return bool
*/
public function isEditable()
{
/** @var srCertificateDefinition $definition */
$definition = srCertificateDefinition::find($this->getDefinitionId());
$type = $definition->getType();
$setting = $type->getCustomSettingByIdentifier($this->getIdentifier());
$ref_id = $definition->getRefId();
$object_type = $this->pl->isCourseTemplate($ref_id) ? 'crs-tpl' : ilObject::_lookupType($ref_id, true);
return in_array($object_type, $setting->getEditableIn());
}
示例12: setRefId
/**
* set ref id of target object
*
* @param $a_ref_id
*/
function setRefId($a_ref_id)
{
global $tree;
$this->ref_id = $a_ref_id;
//can target object be highlighted?
$target_type = ilObject::_lookupType($a_ref_id, true);
if (!in_array($target_type, $this->getTypeWhiteList())) {
$this->highlighted_parent = $tree->getParentId($a_ref_id);
}
}
示例13: __construct
public function __construct()
{
global $lng;
parent::__construct();
$this->parent_ref_id = (int) $_GET["ref_id"];
$this->parent_obj_id = ilObject::_lookupObjId($this->parent_ref_id);
$this->parent_obj_type = ilObject::_lookupType($this->parent_obj_id);
$lng->loadLanguageModule("classification");
$this->setTitle($lng->txt("clsfct_block_title"));
$this->setFooterInfo($lng->txt("clsfct_block_info"));
}
示例14: __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();
}
示例15: isValidPath
public function isValidPath(array $a_path)
{
if (parent::isValidPath($a_path)) {
// portfolio (not in repository)?
if (ilObject::_lookupType($this->object_id) == "prtf") {
$this->prtf_id = $this->object_id;
$this->object_id = null;
// force custom check
}
return true;
}
}