本文整理汇总了PHP中ilUtil::_getObjectsByOperations方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::_getObjectsByOperations方法的具体用法?PHP ilUtil::_getObjectsByOperations怎么用?PHP ilUtil::_getObjectsByOperations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilUtil
的用法示例。
在下文中一共展示了ilUtil::_getObjectsByOperations方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
protected function getItems($a_content_obj, $a_group_obj)
{
global $ilUser, $tree;
$counter = 0;
$items = ilUtil::_getObjectsByOperations($this->type, 'write', $ilUser->getId(), -1);
$items_obj_id = array();
$items_ids = array();
foreach ($items as $ref_id) {
$obj_id = ilObject::_lookupObjId($ref_id);
$items_ids[$obj_id] = $ref_id;
$items_obj_id[] = $obj_id;
}
$items_obj_id = ilUtil::_sortIds($items_obj_id, 'object_data', 'title', 'obj_id');
$assigned_ids = array();
$assigned = $a_group_obj->getAssignedItems();
if ($assigned) {
foreach ($assigned as $item) {
$assigned_ids[] = $item['target_ref_id'];
}
}
$data = array();
foreach ($items_obj_id as $obj_id) {
$item_id = $items_ids[$obj_id];
if ($tree->checkForParentType($item_id, 'adm')) {
continue;
}
$obj_id = ilObject::_lookupObjId($item_id);
$data[] = array('id' => $item_id, 'title' => ilObject::_lookupTitle($obj_id), 'description' => ilObject::_lookupDescription($obj_id), 'path' => $this->__formatPath($tree->getPathFull($item_id)), 'assigned' => in_array($item_id, $assigned_ids));
}
$this->setData($data);
}
示例2: testRbacUA
/**
* test rbac_ua
*/
public function testRbacUA()
{
global $rbacreview, $rbacadmin;
$obj = ilUtil::_getObjectsByOperations('crs', 'join');
$rbacreview->assignedUsers(4);
$rbacreview->assignedRoles(6);
}
示例3: check
function check()
{
global $ilObjDataCache, $ilUser;
include_once './Services/LinkChecker/classes/class.ilLinkChecker.php';
foreach (ilUtil::_getObjectsByOperations('webr', 'write', $ilUser->getId(), -1) as $node) {
if (!is_object($tmp_webr =& ilObjectFactory::getInstanceByRefId($node, false))) {
continue;
}
$tmp_webr->initLinkResourceItemsObject();
// Set all link to valid. After check invalid links will be set to invalid
$link_checker =& new ilLinkChecker($this->db);
$link_checker->setMailStatus(true);
$link_checker->setCheckPeriod($this->__getCheckPeriod());
$link_checker->setObjId($tmp_webr->getId());
$tmp_webr->items_obj->updateValidByCheck($this->__getCheckPeriod());
foreach ($link_checker->checkWebResourceLinks() as $invalid) {
$tmp_webr->items_obj->readItem($invalid['page_id']);
$tmp_webr->items_obj->setActiveStatus(false);
$tmp_webr->items_obj->setValidStatus(false);
$tmp_webr->items_obj->setDisableCheckStatus(true);
$tmp_webr->items_obj->setLastCheckDate(time());
$tmp_webr->items_obj->update(false);
}
$tmp_webr->items_obj->updateLastCheck($this->__getCheckPeriod());
foreach ($link_checker->getLogMessages() as $message) {
$this->log->write($message);
}
}
return true;
}
示例4: run
public function run()
{
global $ilLog, $ilUser, $ilDB;
$status = ilCronJobResult::STATUS_NO_ACTION;
include_once './Services/LinkChecker/classes/class.ilLinkChecker.php';
$counter = 0;
foreach (ilUtil::_getObjectsByOperations('webr', 'write', $ilUser->getId(), -1) as $node) {
if (!is_object($tmp_webr = ilObjectFactory::getInstanceByRefId($node, false))) {
continue;
}
$tmp_webr->initLinkResourceItemsObject();
// Set all link to valid. After check invalid links will be set to invalid
$link_checker =& new ilLinkChecker($ilDB);
$link_checker->setMailStatus(true);
$link_checker->setCheckPeriod($this->__getCheckPeriod());
$link_checker->setObjId($tmp_webr->getId());
$tmp_webr->items_obj->updateValidByCheck($this->__getCheckPeriod());
foreach ($link_checker->checkWebResourceLinks() as $invalid) {
$tmp_webr->items_obj->readItem($invalid['page_id']);
$tmp_webr->items_obj->setActiveStatus(false);
$tmp_webr->items_obj->setValidStatus(false);
$tmp_webr->items_obj->setDisableCheckStatus(true);
$tmp_webr->items_obj->setLastCheckDate(time());
$tmp_webr->items_obj->update(false);
}
$tmp_webr->items_obj->updateLastCheck($this->__getCheckPeriod());
foreach ($link_checker->getLogMessages() as $message) {
$ilLog->write($message);
$counter++;
}
}
if ($counter) {
$status = ilCronJobResult::STATUS_OK;
}
$result = new ilCronJobResult();
$result->setStatus($status);
return $result;
}
示例5: _getAvailableQuestionpools
/**
* Returns the available question pools for the active user
*
* @return array The available question pools
* @access public
*/
function _getAvailableQuestionpools($use_object_id = FALSE, $could_be_offline = FALSE, $showPath = FALSE, $permission = "read")
{
global $ilUser;
global $ilDB;
$result_array = array();
$qpls = ilUtil::_getObjectsByOperations("spl", $permission, $ilUser->getId(), -1);
$titles = ilObject::_prepareCloneSelection($qpls, "spl", $showPath);
$allqpls = array();
$result = $ilDB->query("SELECT obj_fi, isonline FROM svy_qpl");
while ($row = $ilDB->fetchAssoc($result)) {
$allqpls[$row['obj_fi']] = $row['isonline'];
}
foreach ($qpls as $ref_id) {
$obj_id = ilObject::_lookupObjectId($ref_id);
if ($could_be_offline || $allqpls[$obj_id] == 1) {
if ($use_object_id) {
$result_array[$obj_id] = $titles[$ref_id];
} else {
$result_array[$ref_id] = $titles[$ref_id];
}
}
}
return $result_array;
}
示例6: array
/**
* Returns the available question pools for the active user
*
* @return array The available question pools
* @access public
*/
function &_getAvailableQuestionpools($use_object_id = FALSE, $equal_points = FALSE, $could_be_offline = FALSE, $showPath = FALSE, $with_questioncount = FALSE, $permission = "read", $usr_id = "")
{
global $ilUser;
global $ilDB;
$result_array = array();
$permission = strlen($permission) == 0 ? "read" : $permission;
$qpls = ilUtil::_getObjectsByOperations("qpl", $permission, strlen($usr_id) ? $usr_id : $ilUser->getId(), -1);
$obj_ids = array();
foreach ($qpls as $ref_id) {
$obj_id = ilObject::_lookupObjId($ref_id);
$obj_ids[$ref_id] = $obj_id;
}
$titles = ilObject::_prepareCloneSelection($qpls, "qpl");
if (count($obj_ids)) {
$in = $ilDB->in('object_data.obj_id', $obj_ids, false, 'integer');
if ($could_be_offline) {
$result = $ilDB->query("SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE " . "qpl_questionpool.obj_fi = object_data.obj_id AND {$in} ORDER BY object_data.title");
} else {
$result = $ilDB->queryF("SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE " . "qpl_questionpool.obj_fi = object_data.obj_id AND {$in} AND qpl_questionpool.isonline = %s " . "ORDER BY object_data.title", array('text'), array(1));
}
while ($row = $ilDB->fetchAssoc($result)) {
$add = TRUE;
if ($equal_points) {
if (!ilObjQuestionPool::_hasEqualPoints($row["obj_fi"])) {
$add = FALSE;
}
}
if ($add) {
$ref_id = array_search($row["obj_fi"], $obj_ids);
$title = $showPath ? $titles[$ref_id] : $row["title"];
if ($with_questioncount) {
$title .= " [" . $row["questioncount"] . " " . ($row["questioncount"] == 1 ? $this->lng->txt("ass_question") : $this->lng->txt("assQuestions")) . "]";
}
if ($use_object_id) {
$result_array[$row["obj_fi"]] = array('qpl_id' => $row['obj_fi'], 'qpl_title' => $row['title'], "title" => $title, "count" => $row["questioncount"]);
} else {
$result_array[$ref_id] = array('qpl_id' => $row['obj_fi'], 'qpl_title' => $row['title'], "title" => $title, "count" => $row["questioncount"]);
}
}
}
}
return $result_array;
}
示例7: array
/**
* Returns the available tests for the active user
*
* @return array The available tests
* @access public
*/
function &_getAvailableTests($use_object_id = FALSE)
{
global $ilUser;
global $ilDB;
$result_array = array();
$tests = ilUtil::_getObjectsByOperations("tst", "write", $ilUser->getId(), -1);
if (count($tests)) {
$titles = ilObject::_prepareCloneSelection($tests, "tst");
foreach ($tests as $ref_id) {
if ($use_object_id) {
$obj_id = ilObject::_lookupObjId($ref_id);
$result_array[$obj_id] = $titles[$ref_id];
} else {
$result_array[$ref_id] = $titles[$ref_id];
}
}
}
return $result_array;
}
示例8: exportImported
/**
* csv export of imported remote courses
*
* @access protected
* @return
*/
protected function exportImported()
{
global $ilObjDataCache, $ilUser;
// :TODO: mind resource type and move to ilRemoteObjectBase...
$rcourses = ilUtil::_getObjectsByOperations('rcrs', 'visible', $ilUser->getId(), -1);
// Read participants
include_once './Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php';
include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
try {
$reader = ilECSCommunityReader::_getInstance();
} catch (ilECSConnectorException $e) {
$reader = null;
}
// read obj_ids
$ilObjDataCache->preloadReferenceCache($rcourses);
$obj_ids = array();
foreach ($rcourses as $rcrs_ref_id) {
$obj_id = $ilObjDataCache->lookupObjId($rcrs_ref_id);
$obj_ids[$obj_id] = $obj_id;
}
include_once 'Services/Utilities/classes/class.ilCSVWriter.php';
$writer = new ilCSVWriter();
$writer->addColumn($this->lng->txt('title'));
$writer->addColumn($this->lng->txt('description'));
$writer->addColumn($this->lng->txt('ecs_imported_from'));
$writer->addColumn($this->lng->txt('ecs_field_courseID'));
$writer->addColumn($this->lng->txt('ecs_field_term'));
$writer->addColumn($this->lng->txt('ecs_field_lecturer'));
$writer->addColumn($this->lng->txt('ecs_field_courseType'));
$writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
$writer->addColumn($this->lng->txt('ecs_field_credits'));
$writer->addColumn($this->lng->txt('ecs_field_room'));
$writer->addColumn($this->lng->txt('ecs_field_cycle'));
$writer->addColumn($this->lng->txt('ecs_field_begin'));
$writer->addColumn($this->lng->txt('ecs_field_end'));
$writer->addColumn($this->lng->txt('last_update'));
include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php';
$settings = ilECSDataMappingSettings::_getInstance();
foreach ($obj_ids as $obj_id) {
include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php';
$values = ilAdvancedMDValues::_getValuesByObjId($obj_id);
$writer->addRow();
$writer->addColumn(ilObject::_lookupTitle($obj_id));
$writer->addColumn(ilObject::_lookupDescription($obj_id));
$mid = ilObjRemoteCourse::_lookupMID($obj_id);
if ($reader and $participant = $reader->getParticipantByMID($mid)) {
$writer->addColumn($participant->getParticipantName());
}
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'courseID');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'term');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'lecturer');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'courseType');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'semester_hours');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'credits');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'room');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'cycle');
$writer->addColumn(isset($values[$field]) ? $values[$field] : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'begin');
$writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field], true) : '');
$field = $settings->getMappingByECSName(ilECSDataMappingSetting::MAPPING_IMPORT_RCRS, 'end');
$writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field], true) : '');
$writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
}
ilUtil::deliverData($writer->getCSVString(), date("Y_m_d") . "_ecs_import.csv", "text/csv");
}
示例9: getQuestionblocksTable
/**
* Calculates the data for the output of the questionblock browser
*
* @access public
*/
function getQuestionblocksTable($arrFilter)
{
global $ilUser, $ilDB;
$where = "";
if (is_array($arrFilter)) {
if (array_key_exists('title', $arrFilter) && strlen($arrFilter['title'])) {
$where .= " AND " . $ilDB->like('svy_qblk.title', 'text', "%%" . $arrFilter['title'] . "%%");
}
}
$query_result = $ilDB->query("SELECT svy_qblk.*, svy_svy.obj_fi FROM svy_qblk , svy_qblk_qst, svy_svy WHERE " . "svy_qblk.questionblock_id = svy_qblk_qst.questionblock_fi AND svy_svy.survey_id = svy_qblk_qst.survey_fi " . "{$where} GROUP BY svy_qblk.questionblock_id, svy_qblk.title, svy_qblk.show_questiontext, svy_qblk.show_blocktitle, " . "svy_qblk.owner_fi, svy_qblk.tstamp, svy_svy.obj_fi");
$rows = array();
if ($query_result->numRows()) {
$survey_ref_ids = ilUtil::_getObjectsByOperations("svy", "write");
$surveytitles = array();
foreach ($survey_ref_ids as $survey_ref_id) {
$survey_id = ilObject::_lookupObjId($survey_ref_id);
$surveytitles[$survey_id] = ilObject::_lookupTitle($survey_id);
}
while ($row = $ilDB->fetchAssoc($query_result)) {
$questions_array =& $this->getQuestionblockQuestions($row["questionblock_id"]);
$counter = 1;
foreach ($questions_array as $key => $value) {
$questions_array[$key] = "{$counter}. {$value}";
$counter++;
}
if (strlen($surveytitles[$row["obj_fi"]])) {
$rows[$row["questionblock_id"]] = array("questionblock_id" => $row["questionblock_id"], "title" => $row["title"], "svy" => $surveytitles[$row["obj_fi"]], "contains" => join($questions_array, ", "), "owner" => $row["owner_fi"]);
}
}
}
return $rows;
}
示例10: assignUsersAsCourseMembers
/**
* Assign users as course members
*
*/
function assignUsersAsCourseMembers($a_user_login_base = "learner", $a_start = 1, $a_end = 100)
{
global $ilDB;
$this->log("Assigning Course Members");
$set = $ilDB->query("SELECT usr_id, login FROM usr_data WHERE " . " login LIKE " . $ilDB->quote($a_user_login_base . "%", "text"));
$user_ids = array();
while ($rec = $ilDB->fetchAssoc($set)) {
$rest = substr($rec["login"], strlen($a_user_login_base));
if (is_numeric($rest) && ((int) $rest >= $a_start && (int) $rest <= $a_end)) {
$user_ids[] = $rec["usr_id"];
}
}
$cnt = 1;
$crs_ref_ids = ilUtil::_getObjectsByOperations("crs", "read", 0, $limit = 1000000);
include_once "./Modules/Course/classes/class.ilCourseParticipants.php";
foreach ($crs_ref_ids as $r) {
$crs_id = ilObject::_lookupObjId($r);
$mem_obj = ilCourseParticipants::_getInstanceByObjId($crs_id);
foreach ($user_ids as $u) {
$this->log("{$cnt}: add user {$u} as member to course " . $crs_id);
$mem_obj->add($u, 1);
$cnt++;
}
}
}
示例11: 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);
}
示例12: sourceExists
/**
* Check if there is any source object
* @return bool
*/
protected function sourceExists()
{
global $ilUser;
return (bool) ilUtil::_getObjectsByOperations($this->getType(), 'copy', $ilUser->getId(), 1);
}