本文整理汇总了PHP中ilObject::getLongDescriptions方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObject::getLongDescriptions方法的具体用法?PHP ilObject::getLongDescriptions怎么用?PHP ilObject::getLongDescriptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObject
的用法示例。
在下文中一共展示了ilObject::getLongDescriptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSubItems
/**
* Get subitems of container
*
* @param bool administration panel enabled
* @param bool side blocks enabled
*
* @return array
*/
function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false, $a_get_single = 0)
{
global $objDefinition, $ilBench, $tree, $ilObjDataCache, $ilUser, $rbacsystem, $ilSetting;
// Caching
if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]) && !$a_get_single) {
return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
}
$type_grps = $this->getGroupedObjTypes();
$objects = $tree->getChilds($this->getRefId(), "title");
// using long descriptions?
$short_desc = $ilSetting->get("rep_shorten_description");
$short_desc_max_length = $ilSetting->get("rep_shorten_description_length");
if (!$short_desc || $short_desc_max_length != ilObject::TITLE_LENGTH) {
// using (part of) shortened description
if ($short_desc && $short_desc_max_length && $short_desc_max_length < ilObject::TITLE_LENGTH) {
foreach ($objects as $key => $object) {
$objects[$key]["description"] = ilUtil::shortenText($object["description"], $short_desc_max_length, true);
}
} else {
$obj_ids = array();
foreach ($objects as $key => $object) {
$obj_ids[] = $object["obj_id"];
}
if (sizeof($obj_ids)) {
$long_desc = ilObject::getLongDescriptions($obj_ids);
foreach ($objects as $key => $object) {
if ($short_desc && $short_desc_max_length) {
$long_desc[$object["obj_id"]] = ilUtil::shortenText($long_desc[$object["obj_id"]], $short_desc_max_length, true);
}
$objects[$key]["description"] = $long_desc[$object["obj_id"]];
}
}
}
}
$found = false;
$all_obj_types = array();
$all_ref_ids = array();
$all_obj_ids = array();
include_once 'Services/Container/classes/class.ilContainerSorting.php';
$sort = ilContainerSorting::_getInstance($this->getId());
// TODO: check this
// get items attached to a session
include_once './Modules/Session/classes/class.ilEventItems.php';
$event_items = ilEventItems::_getItemsOfContainer($this->getRefId());
foreach ($objects as $key => $object) {
if ($a_get_single > 0 && $object["child"] != $a_get_single) {
continue;
}
// hide object types in devmode
if ($objDefinition->getDevMode($object["type"]) || $object["type"] == "adm" || $object["type"] == "rolf") {
continue;
}
// remove inactive plugins
if ($objDefinition->isInactivePlugin($object["type"])) {
continue;
}
// BEGIN WebDAV: Don't display hidden Files, Folders and Categories
if (in_array($object['type'], array('file', 'fold', 'cat'))) {
include_once 'Modules/File/classes/class.ilObjFileAccess.php';
if (ilObjFileAccess::_isFileHidden($object['title'])) {
$this->setHiddenFilesFound(true);
if (!$a_admin_panel_enabled) {
continue;
}
}
}
// END WebDAV: Don't display hidden Files, Folders and Categories
// filter out items that are attached to an event
if (in_array($object['ref_id'], $event_items)) {
continue;
}
// filter side block items
if (!$a_include_side_block && $objDefinition->isSideBlock($object['type'])) {
continue;
}
$all_obj_types[$object["type"]] = $object["type"];
$obj_ids_of_type[$object["type"]][] = $object["obj_id"];
$ref_ids_of_type[$object["type"]][] = $object["child"];
$all_ref_ids[] = $object["child"];
$all_obj_ids[] = $object["obj_id"];
}
// data preloader
if (!self::$data_preloaded && sizeof($all_ref_ids)) {
// type specific preloads
foreach ($all_obj_types as $t) {
// condition handler: preload conditions
include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
ilConditionHandler::preloadConditionsForTargetRecords($t, $obj_ids_of_type[$t]);
$class = $objDefinition->getClassName($t);
$location = $objDefinition->getLocation($t);
$full_class = "ilObj" . $class . "Access";
include_once $location . "/class." . $full_class . ".php";
//.........这里部分代码省略.........
示例2: getSubItems
/**
* Get subitems of container
*
* @param bool administration panel enabled
* @param bool side blocks enabled
*
* @return array
*/
function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false, $a_get_single = 0)
{
global $objDefinition, $ilBench, $tree, $ilObjDataCache, $ilUser, $rbacsystem, $ilSetting;
// Caching
if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]) && !$a_get_single) {
return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block];
}
$type_grps = $this->getGroupedObjTypes();
$objects = $tree->getChilds($this->getRefId(), "title");
// using long descriptions?
$short_desc = $ilSetting->get("rep_shorten_description");
$short_desc_max_length = $ilSetting->get("rep_shorten_description_length");
if (!$short_desc || $short_desc_max_length != ilObject::TITLE_LENGTH) {
// using (part of) shortened description
if ($short_desc && $short_desc_max_length && $short_desc_max_length < ilObject::TITLE_LENGTH) {
foreach ($objects as $key => $object) {
$objects[$key]["description"] = ilUtil::shortenText($object["description"], $short_desc_max_length, true);
}
} else {
$obj_ids = array();
foreach ($objects as $key => $object) {
$obj_ids[] = $object["obj_id"];
}
if (sizeof($obj_ids)) {
$long_desc = ilObject::getLongDescriptions($obj_ids);
foreach ($objects as $key => $object) {
// #12166 - keep translation, ignore long description
if ($ilObjDataCache->isTranslatedDescription($object["obj_id"])) {
$long_desc[$object["obj_id"]] = $object["description"];
}
if ($short_desc && $short_desc_max_length) {
$long_desc[$object["obj_id"]] = ilUtil::shortenText($long_desc[$object["obj_id"]], $short_desc_max_length, true);
}
$objects[$key]["description"] = $long_desc[$object["obj_id"]];
}
}
}
}
$found = false;
$all_ref_ids = array();
if (!self::$data_preloaded) {
include_once "./Services/Object/classes/class.ilObjectListGUIPreloader.php";
$preloader = new ilObjectListGUIPreloader(ilObjectListGUI::CONTEXT_REPOSITORY);
}
include_once 'Services/Container/classes/class.ilContainerSorting.php';
$sort = ilContainerSorting::_getInstance($this->getId());
// TODO: check this
// get items attached to a session
include_once './Modules/Session/classes/class.ilEventItems.php';
$event_items = ilEventItems::_getItemsOfContainer($this->getRefId());
foreach ($objects as $key => $object) {
if ($a_get_single > 0 && $object["child"] != $a_get_single) {
continue;
}
// hide object types in devmode
if ($objDefinition->getDevMode($object["type"]) || $object["type"] == "adm" || $object["type"] == "rolf") {
continue;
}
// remove inactive plugins
if ($objDefinition->isInactivePlugin($object["type"])) {
continue;
}
// BEGIN WebDAV: Don't display hidden Files, Folders and Categories
if (in_array($object['type'], array('file', 'fold', 'cat'))) {
include_once 'Modules/File/classes/class.ilObjFileAccess.php';
if (ilObjFileAccess::_isFileHidden($object['title'])) {
$this->setHiddenFilesFound(true);
if (!$a_admin_panel_enabled) {
continue;
}
}
}
// END WebDAV: Don't display hidden Files, Folders and Categories
// including event items!
if (!self::$data_preloaded) {
$preloader->addItem($object["obj_id"], $object["type"], $object["child"]);
}
// filter out items that are attached to an event
if (in_array($object['ref_id'], $event_items)) {
continue;
}
// filter side block items
if (!$a_include_side_block && $objDefinition->isSideBlock($object['type'])) {
continue;
}
$all_ref_ids[] = $object["child"];
}
// data preloader
if (!self::$data_preloaded) {
$preloader->preload();
unset($preloader);
self::$data_preloaded = true;
//.........这里部分代码省略.........
示例3: getCompleteDescriptions
/**
* overwrites description fields to long or short description in an assoc array
* keys needed (obj_id and description)
*
* @param array $objects
* @return array
*/
public static function getCompleteDescriptions(array $objects)
{
global $ilSetting, $ilObjDataCache;
// using long descriptions?
$short_desc = $ilSetting->get("rep_shorten_description");
$short_desc_max_length = $ilSetting->get("rep_shorten_description_length");
if (!$short_desc || $short_desc_max_length != ilObject::DESC_LENGTH) {
// using (part of) shortened description
if ($short_desc && $short_desc_max_length && $short_desc_max_length < ilObject::DESC_LENGTH) {
foreach ($objects as $key => $object) {
$objects[$key]["description"] = ilUtil::shortenText($object["description"], $short_desc_max_length, true);
}
} else {
$obj_ids = array();
foreach ($objects as $key => $object) {
$obj_ids[] = $object["obj_id"];
}
if (sizeof($obj_ids)) {
$long_desc = ilObject::getLongDescriptions($obj_ids);
foreach ($objects as $key => $object) {
// #12166 - keep translation, ignore long description
if ($ilObjDataCache->isTranslatedDescription($object["obj_id"])) {
$long_desc[$object["obj_id"]] = $object["description"];
}
if ($short_desc && $short_desc_max_length) {
$long_desc[$object["obj_id"]] = ilUtil::shortenText($long_desc[$object["obj_id"]], $short_desc_max_length, true);
}
$objects[$key]["description"] = $long_desc[$object["obj_id"]];
}
}
}
}
return $objects;
}