本文整理汇总了PHP中ilObject::_hasUntrashedReference方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObject::_hasUntrashedReference方法的具体用法?PHP ilObject::_hasUntrashedReference怎么用?PHP ilObject::_hasUntrashedReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObject
的用法示例。
在下文中一共展示了ilObject::_hasUntrashedReference方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: _getIdForImportId
/**
* get current term id for import id (static)
*
* @param int $a_import_id import id
*
* @return int id
*/
function _getIdForImportId($a_import_id)
{
global $ilDB;
if ($a_import_id == "") {
return 0;
}
$q = "SELECT * FROM glossary_term WHERE import_id = " . $ilDB->quote($a_import_id, "text") . " ORDER BY create_date DESC";
$term_set = $ilDB->query($q);
while ($term_rec = $ilDB->fetchAssoc($term_set)) {
$glo_id = ilGlossaryTerm::_lookGlossaryID($term_rec["id"]);
if (ilObject::_hasUntrashedReference($glo_id)) {
return $term_rec["id"];
}
}
return 0;
}
示例3: 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)
{
include_once "./Services/Tagging/classes/class.ilTagging.php";
switch ($a_component) {
case "Services/Object":
switch ($a_event) {
case "toTrash":
if (!ilObject::_hasUntrashedReference($a_parameter["obj_id"])) {
ilTagging::setTagsOfObjectOffline($a_parameter["obj_id"], ilObject::_lookupType($a_parameter["obj_id"]), 0, "");
}
break;
case "undelete":
ilTagging::setTagsOfObjectOffline($a_parameter["obj_id"], ilObject::_lookupType($a_parameter["obj_id"]), 0, "", false);
break;
case "delete":
$ref_ids = ilObject::_getAllReferences($a_parameter["obj_id"]);
if (count($ref_ids) == 0) {
ilTagging::deleteTagsOfObject($a_parameter["obj_id"], $a_parameter["type"], 0, "");
}
break;
}
break;
}
}
示例4: updateSkillLevelsByTriggerRef
/**
* Look for all skill level that have a trigger and update
* the user skill level information, if it has changed
*/
public static function updateSkillLevelsByTriggerRef($a_user_id, $a_ref_id)
{
global $ilDB;
die("ilBasicSkill::updateSkillLevelsByTriggerRef is deprecated.");
$set = $ilDB->query("SELECT id, trigger_obj_id FROM skl_level WHERE " . " trigger_ref_id = " . $ilDB->quote($a_ref_id, "integer"));
while ($rec = $ilDB->fetchAssoc($set)) {
$skill_level_id = $rec["id"];
$tr_obj_id = $rec["trigger_obj_id"];
if (ilObject::_hasUntrashedReference($tr_obj_id)) {
include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
$completed = ilLPStatusWrapper::_lookupCompletedForObject($tr_obj_id);
foreach ($completed as $user_id) {
if ($a_user_id == $user_id) {
ilBasicSkill::writeUserSkillLevelStatus($skill_level_id, $user_id, ilBasicSkill::ACHIEVED);
}
}
}
}
}
示例5: getScormModulesForGlossary
/**
* Get SCORM modules that assign a certain glossary
*
* @param
* @return
*/
static function getScormModulesForGlossary($a_glo_id)
{
global $ilDB;
$set = $ilDB->query("SELECT DISTINCT id FROM sahs_lm WHERE " . " glossary = " . $ilDB->quote($a_glo_id, "integer"));
$sms = array();
while ($rec = $ilDB->fetchAssoc($set)) {
if (ilObject::_hasUntrashedReference($rec["id"])) {
$sms[] = $rec["id"];
}
}
return $sms;
}
示例6: getMeetingsInRange
/**
* Returns a List of Meetings that takes place in the time between $startDate and $endDate.
* A Meeting is in range if $startDate > start_date < $endDate or $startDate > end_date < $endDate.
* @param integer $startDate unixtimestamp
* @param integer $endDate unixtimestamp
*/
public static function getMeetingsInRange($startDate, $endDate)
{
/**
* @var $ilDB ilDB
*/
global $ilDB;
$query = 'SELECT * FROM rep_robj_xavc_data WHERE (start_date > %s AND start_date < %s) OR (end_date > %s AND end_date < %s) ORDER BY start_date';
$types = array('integer', 'integer', 'integer', 'integer');
$values = array($startDate, $endDate, $startDate, $endDate);
$res = $ilDB->queryF($query, $types, $values);
$objects = array();
while ($row = $ilDB->fetchObject($res)) {
if (ilObject::_hasUntrashedReference($row->id)) {
$objects[] = $row;
}
}
return $objects;
}
示例7: checkConcurrentMeetingDates
public function checkConcurrentMeetingDates(ilDateTime $endDate, ilDateTime $startDate = null, $ignoreId = null)
{
/**
* @var $ilDB ilDB
*/
global $ilDB;
if ($startDate == null) {
$startDate = new ilDateTime(time(), IL_CAL_UNIX);
}
$sim = array();
$srv = ilAdobeConnectServer::_getInstance();
$new_start_date = $startDate->getUnixTime() - $srv->getBufferBefore();
$new_end_date = $endDate->getUnixTime() + $srv->getBufferAfter();
$query = array('SELECT * FROM rep_robj_xavc_data', 'WHERE (', '(%s > start_date AND %s < end_date) OR', '(%s > start_date AND %s < end_date) OR', '(%s < start_date AND %s > end_date)', ')');
$types = array('integer', 'integer', 'integer', 'integer', 'integer', 'integer');
$values = array($new_start_date, $new_start_date, $new_end_date, $new_end_date, $new_start_date, $new_end_date);
if ($ignoreId !== null) {
$query[] = 'AND id <> %s';
$types[] = 'integer';
$values[] = $ignoreId;
}
$res = $ilDB->queryF(join(' ', $query), $types, $values);
while ($row = $ilDB->fetchObject($res)) {
if (ilObject::_hasUntrashedReference($row->id)) {
$sim[] = $row;
}
}
return $sim;
}
示例8: _getIdForImportId
/**
* Get Node ID for import ID (static)
*
* import ids can exist multiple times (if the same learning module
* has been imported multiple times). we get the object id of
* the last imported object, that is not in trash
*
* @param int $a_import_id import id
*
* @return int id
*/
function _getIdForImportId($a_import_id)
{
global $ilDB;
$ilDB->setLimit(1);
$q = "SELECT * FROM sahs_sc13_tree_node WHERE import_id = " . $ilDB->quote($a_import_id, "text") . " " . " ORDER BY create_date DESC";
$obj_set = $ilDB->query($q);
while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
$slm_id = ilSCORM2004Node::_lookupSLMID($obj_rec["obj_id"]);
// link only in learning module, that is not trashed
if (ilObject::_hasUntrashedReference($slm_id)) {
return $obj_rec["obj_id"];
}
}
return 0;
}
示例9: _isWriteable
/**
* Returns true, if the question pool is writeable by a given user
*
* @param integer $object_id The object id of the question pool
* @param integer $user_id The database id of the user
* @access public
*/
function _isWriteable($object_id, $user_id)
{
global $rbacsystem;
global $ilDB;
$refs = ilObject::_getAllReferences($object_id);
$result = false;
foreach ($refs as $ref) {
if ($rbacsystem->checkAccess("write", $ref) && ilObject::_hasUntrashedReference($object_id)) {
$result = true;
}
}
return $result;
}
示例10: simpleImportElement
public function simpleImportElement(SimpleXMLElement $o)
{
global $tree, $tpl, $ilUser;
$title = $o->title;
$description = $o->description;
$external_id = $o->external_id;
$create_mode = true;
$attributes = $o->attributes();
$action = (string) $attributes->action;
$ou_id = (string) $attributes->ou_id;
$ou_id_type = (string) $attributes->ou_id_type;
$ou_parent_id = (string) $attributes->ou_parent_id;
$ou_parent_id_type = (string) $attributes->ou_parent_id_type;
if ($ou_id == ilObjOrgUnit::getRootOrgRefId()) {
$this->addWarning("cannot_change_root_node", $ou_id ? $ou_id : $external_id, $action);
return;
}
if ($ou_parent_id == "__ILIAS") {
$ou_parent_id = ilObjOrgUnit::getRootOrgRefId();
$ou_parent_id_type = "reference_id";
}
$ref_id = $this->buildRef($ou_id, $ou_id_type);
$parent_ref_id = $this->buildRef($ou_parent_id, $ou_parent_id_type);
if ($action == "delete") {
if (!$parent_ref_id) {
$this->addError("ou_parent_id_not_valid", $ou_id ? $ou_id : $external_id, $action);
return;
}
if (!$ref_id) {
$this->addError("ou_id_not_valid", $ou_id ? $ou_id : $external_id, $action);
return;
}
include_once "./Services/Repository/classes/class.ilRepUtil.php";
$ru = new ilRepUtil($this);
try {
$ru->deleteObjects($parent_ref_id, array($ref_id)) !== false;
$this->stats["deleted"]++;
} catch (Excpetion $e) {
$this->addWarning("orgu_already_deleted", $ou_id ? $ou_id : $external_id, $action);
}
return;
} elseif ($action == "update") {
if (!$parent_ref_id) {
$this->addError("ou_parent_id_not_valid", $ou_id ? $ou_id : $external_id, $action);
return;
}
if (!$ref_id) {
$this->addError("ou_id_not_valid", $ou_id ? $ou_id : $external_id, $action);
return;
}
$object = new ilObjOrgUnit($ref_id);
$object->setTitle($title);
$arrTranslations = $object->getTranslations();
$object->updateTranslation($title, $description, $ilUser->getLanguage(), "");
$object->setDescription($description);
$object->update();
$object->setImportId($external_id);
if ($parent_ref_id != $tree->getParentId($ref_id)) {
try {
$tree->moveTree($ref_id, $parent_ref_id);
} catch (Exception $e) {
global $ilLog;
$this->addWarning("not_movable", $ou_id ? $ou_id : $external_id, $action);
$ilLog->write($e->getMessage() . "\\n" . $e->getTraceAsString());
}
}
$this->stats["updated"]++;
} elseif ($action == "create") {
if (!$parent_ref_id) {
$this->addError("ou_parent_id_not_valid", $ou_id ? $ou_id : $external_id, $action);
return;
}
if ($external_id) {
$obj_id = ilObject::_lookupObjIdByImportId($external_id);
if (ilObject::_hasUntrashedReference($obj_id)) {
$this->addError("ou_external_id_exists", $ou_id ? $ou_id : $external_id, $action);
return;
}
}
$object = new ilObjOrgUnit();
$object->setTitle($title);
$object->setDescription($description);
$object->setImportId($external_id);
$object->create();
$object->createReference();
$object->putInTree($parent_ref_id);
$object->setPermissions($ou_parent_id);
$this->stats["created"]++;
} else {
$this->addError("no_valid_action_given", $ou_id, $action);
}
}
示例11: forcePublicRoom
/**
*
*/
public function forcePublicRoom()
{
$ref_id = ilObjChatroom::_getPublicRefId();
if (!$ref_id) {
$this->createPublicRoom();
return;
}
$instance = ilObjectFactory::getInstanceByRefId($ref_id, false);
if (!$instance) {
$this->createPublicRoom();
return;
}
$obj_id = ilObject::_lookupObjId($ref_id);
if (!$obj_id) {
$this->createPublicRoom();
return;
}
if (!ilObject::_hasUntrashedReference($obj_id)) {
$this->createPublicRoom();
return;
}
require_once 'Modules/Chatroom/classes/class.ilChatroomInstaller.php';
ilChatroomInstaller::ensureCorrectPublicChatroomTreeLocation($ref_id);
}
示例12: testTreeTrash
public function testTreeTrash()
{
global $tree;
$obj = new ilObject();
$obj->setType("xxx");
$obj->setTitle("TestObject");
$obj->setDescription("TestDescription");
$obj->setImportId("imp_44");
$obj->create();
$obj->createReference();
$id = $obj->getId();
$ref_id = $obj->getRefId();
$obj = new ilObject($ref_id);
$obj->putInTree(ROOT_FOLDER_ID);
$obj->createRoleFolder();
$obj->setPermissions(ROOT_FOLDER_ID);
if ($tree->isInTree($ref_id)) {
$value .= "tree1-";
}
if (ilObject::_hasUntrashedReference($id)) {
$value .= "tree2-";
}
// isSaved() uses internal cache!
$tree->useCache(false);
$tree->saveSubTree($ref_id, true);
if ($tree->isDeleted($ref_id)) {
$value .= "tree3-";
}
if ($tree->isSaved($ref_id)) {
$value .= "tree4-";
}
if (ilObject::_isInTrash($ref_id)) {
$value .= "tree5-";
}
if (!ilObject::_hasUntrashedReference($id)) {
$value .= "tree6-";
}
$saved_tree = new ilTree(-(int) $ref_id);
$node_data = $saved_tree->getNodeData($ref_id);
$saved_tree->deleteTree($node_data);
if (!ilObject::_isInTrash($ref_id)) {
$value .= "tree7-";
}
$obs = ilUtil::_getObjectsByOperations("cat", "read");
foreach ($obs as $ob) {
if (ilObject::_lookupType(ilObject::_lookupObjId($ob)) != "cat") {
$value .= "nocat-";
}
}
$obj->delete();
$this->assertEquals("tree1-tree2-tree3-tree4-tree5-tree6-tree7-", $value);
}
示例13: forcePublicRoom
public function forcePublicRoom()
{
$ref_id = ilObjChatroom::_getPublicRefId();
if (!$ref_id) {
$this->createPublicRoom();
return;
}
$instance = ilObjectFactory::getInstanceByRefId($ref_id, false);
if (!$instance) {
$this->createPublicRoom();
return;
}
$obj_id = ilObject::_lookupObjId($ref_id);
if (!$obj_id) {
$this->createPublicRoom();
return;
}
if (!ilObject::_hasUntrashedReference($obj_id)) {
$this->createPublicRoom();
return;
}
}
示例14: showMyCourses
/**
* Show user's courses
*/
public function showMyCourses()
{
global $lng, $ilUser, $ilObjDataCache, $tree, $tpl, $rbacsystem;
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$this->tpl->setTitle($this->lng->txt('mail_addressbook'));
$searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
$_GET['view'] = 'mycourses';
$lng->loadLanguageModule('crs');
include_once 'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php';
$table = new ilMailSearchCoursesTableGUI($this, "crs", $_GET["ref"]);
$table->setId('search_crs_tbl');
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$crs_ids = ilCourseParticipants::_getMembershipByType($ilUser->getId(), 'crs');
$counter = 0;
$tableData = array();
if (is_array($crs_ids) && count($crs_ids) > 0) {
$num_courses_hidden_members = 0;
include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
foreach ($crs_ids as $crs_id) {
/**
* @var $oTmpCrs ilObjCourse
*/
$oTmpCrs = ilObjectFactory::getInstanceByObjId($crs_id);
$isOffline = !$oTmpCrs->isActivated();
$hasUntrashedReferences = ilObject::_hasUntrashedReference($crs_id);
$showMemberListEnabled = (bool) $oTmpCrs->getShowMembers();
$ref_ids = array_keys(ilObject::_getAllReferences($crs_id));
$isPrivilegedUser = $rbacsystem->checkAccess('write', $ref_ids[0]);
if ($hasUntrashedReferences && (!$isOffline && $showMemberListEnabled || $isPrivilegedUser)) {
$oCrsParticipants = ilCourseParticipants::_getInstanceByObjId($crs_id);
$crs_members = $oCrsParticipants->getParticipants();
foreach ($crs_members as $key => $member) {
$tmp_usr = new ilObjUser($member);
if ($tmp_usr->checkTimeLimit() == false || $tmp_usr->getActive() == false) {
unset($crs_members[$key]);
}
}
unset($tmp_usr);
$hiddenMembers = false;
if ((int) $oTmpCrs->getShowMembers() == $oTmpCrs->SHOW_MEMBERS_DISABLED) {
++$num_courses_hidden_members;
$hiddenMembers = true;
}
unset($oTmpCrs);
$ref_ids = ilObject::_getAllReferences($crs_id);
$ref_id = current($ref_ids);
$path_arr = $tree->getPathFull($ref_id, $tree->getRootId());
$path_counter = 0;
$path = '';
foreach ($path_arr as $data) {
if ($path_counter++) {
$path .= " -> ";
}
$path .= $data['title'];
}
$path = $this->lng->txt('path') . ': ' . $path;
$current_selection_list = new ilAdvancedSelectionListGUI();
$current_selection_list->setListTitle($this->lng->txt("actions"));
$current_selection_list->setId("act_" . $counter);
$this->ctrl->setParameter($this, 'search_crs', $crs_id);
$this->ctrl->setParameter($this, 'view', 'mycourses');
if ($_GET["ref"] == "mail") {
if ($this->mailing_allowed) {
$current_selection_list->addItem($this->lng->txt("mail_members"), '', $this->ctrl->getLinkTarget($this, "mail"));
}
} else {
if ($_GET["ref"] == "wsp") {
$current_selection_list->addItem($this->lng->txt("wsp_share_with_members"), '', $this->ctrl->getLinkTarget($this, "share"));
}
}
$current_selection_list->addItem($this->lng->txt("mail_list_members"), '', $this->ctrl->getLinkTarget($this, "showMembers"));
$this->ctrl->clearParameters($this);
$rowData = array("CRS_ID" => $crs_id, "CRS_NAME" => $ilObjDataCache->lookupTitle($crs_id), "CRS_NO_MEMBERS" => count($crs_members), "CRS_PATH" => $path, 'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML(), "hidden_members" => $hiddenMembers);
$counter++;
$tableData[] = $rowData;
}
}
//if((int)$counter)
//{
// $table->addCommandButton('mail',$lng->txt('mail_members'));
// $table->addCommandButton('showMembers',$lng->txt('mail_list_members'));
//}
if ($num_courses_hidden_members > 0) {
$searchTpl->setCurrentBlock('caption_block');
$searchTpl->setVariable('TXT_LIST_MEMBERS_NOT_AVAILABLE', $this->lng->txt('mail_crs_list_members_not_available'));
$searchTpl->parseCurrentBlock();
}
}
$searchTpl->setVariable('TXT_MARKED_ENTRIES', $lng->txt('marked_entries'));
$table->setData($tableData);
if ($_GET['ref'] == 'mail') {
$this->tpl->setVariable('BUTTON_CANCEL', $lng->txt('cancel'));
}
$searchTpl->setVariable('TABLE', $table->getHtml());
$tpl->setContent($searchTpl->get());
if ($_GET["ref"] != "wsp") {
$tpl->show();
//.........这里部分代码省略.........
示例15:
final function _hasUntrashedReference($a_obj_id)
{
return parent::_hasUntrashedReference($a_obj_id);
}