本文整理汇总了PHP中ilTree::setTreeTablePK方法的典型用法代码示例。如果您正苦于以下问题:PHP ilTree::setTreeTablePK方法的具体用法?PHP ilTree::setTreeTablePK怎么用?PHP ilTree::setTreeTablePK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilTree
的用法示例。
在下文中一共展示了ilTree::setTreeTablePK方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*/
public function __construct($a_parent_obj, $a_parent_cmd, $a_slm)
{
global $ilUser;
$this->slm = $a_slm;
$tree = new ilTree($this->slm->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
parent::__construct("scorm_ed_exp", $a_parent_obj, $a_parent_cmd, $tree);
//$this->setTypeWhiteList(array("du", "chap", "page"));
$this->setSkipRootNode(false);
$this->setAjax(false);
}
示例2: parentHasSeqTemplate
public function parentHasSeqTemplate($a_slm_id)
{
require_once "./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004SeqTemplate.php";
global $ilDB, $ilLog;
$has_template = false;
$mtree = new ilTree($a_slm_id);
$mtree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$mtree->setTreeTablePK("slm_id");
//get all parents for current node
$parents = $this->getParentsForNode($a_parents = array(), $this->id);
for ($i = 0; $i < count($parents); $i++) {
$template = ilSCORM2004SeqTemplate::templateForChapter($parents[$i]);
if ($template) {
$has_template = true;
break;
}
}
return $has_template;
}
示例3: getPossibleItems
public function getPossibleItems($a_ref_id)
{
if (!isset(self::$possible_items[$a_ref_id])) {
$obj_id = ilObject::_lookupObjectId($a_ref_id);
$items = array();
// only top-level chapters
include_once "Services/MetaData/classes/class.ilMDEducational.php";
$tree = new ilTree($obj_id);
$tree->setTableNames('lm_tree', 'lm_data');
$tree->setTreeTablePK("lm_id");
foreach ($tree->getChilds($tree->readRootId()) as $child) {
if ($child["type"] == "st") {
$child["tlt"] = ilMDEducational::_getTypicalLearningTimeSeconds($obj_id, $child["obj_id"]);
$items[$child["obj_id"]] = $child;
}
}
self::$possible_items[$a_ref_id] = $items;
}
return self::$possible_items[$a_ref_id];
}
示例4: putInTree
/**
* put chapter into tree
*/
function putInTree()
{
//echo "st:putInTree";
// chapters should be behind pages in the tree
// so if target is first node, the target is substituted with
// the last child of type pg
if ($_GET["target"] == IL_FIRST_NODE) {
$tree = new ilTree($this->content_object->getId());
$tree->setTableNames('lm_tree', 'lm_data');
$tree->setTreeTablePK("lm_id");
// determine parent node id
$parent_id = !empty($_GET["obj_id"]) ? $_GET["obj_id"] : $tree->getRootId();
// determine last child of type pg
$childs =& $tree->getChildsByType($parent_id, "pg");
if (count($childs) != 0) {
$_GET["target"] = $childs[count($childs) - 1]["obj_id"];
}
}
if (empty($_GET["target"])) {
$_GET["target"] = IL_LAST_NODE;
}
parent::putInTree();
}
示例5: getChapterList
/**
* export (sub)structure objects of structure object (see ilias_co.dtd)
*
* @param object $a_xml_writer ilXmlWriter object that receives the
* xml data
*/
static function getChapterList($a_lm_id)
{
$tree = new ilTree($a_lm_id);
$tree->setTableNames('lm_tree', 'lm_data');
$tree->setTreeTablePK("lm_id");
$chapters = array();
$ndata = $tree->getNodeData($tree->readRootId());
$childs = $tree->getSubtree($ndata);
foreach ($childs as $child) {
if ($child["type"] == "st") {
$chapters[] = $child;
}
}
return $chapters;
}
示例6: switch
/**
* split page to next page at hierarchical id
*
* the main reason for this method being static is that a lm page
* object is not available within ilPageContentGUI where this method
* is called
*/
function _splitPageNext($a_page_id, $a_pg_parent_type, $a_hier_id)
{
// get content object (learning module / digilib book)
$lm_id = ilLMObject::_lookupContObjID($a_page_id);
$type = ilObject::_lookupType($lm_id, false);
switch ($type) {
case "lm":
include_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
$cont_obj = new ilObjLearningModule($lm_id, false);
break;
case "dbk":
include_once "./Modules/LearningModule/classes/class.ilObjDlBook.php";
$cont_obj = new ilObjDlBook($lm_id, false);
break;
}
$tree = new ilTree($cont_obj->getId());
$tree->setTableNames('lm_tree', 'lm_data');
$tree->setTreeTablePK("lm_id");
$source_lm_page =& new ilLMPageObject($cont_obj, $a_page_id);
$source_page =& $source_lm_page->getPageObject();
// get next page
$succ = $tree->fetchSuccessorNode($a_page_id, "pg");
if ($succ["child"] > 0) {
$target_lm_page =& new ilLMPageObject($cont_obj, $succ["child"]);
$target_page =& $target_lm_page->getPageObject();
$target_page->buildDom();
$target_page->addHierIds();
// move nodes to target page
$source_page->buildDom();
$source_page->addHierIds();
ilLMPage::_moveContentAfterHierId($source_page, $target_page, $a_hier_id);
//$source_page->deleteContentFromHierId($a_hier_id);
return $succ["child"];
}
}
示例7: confirmedDelete
/**
* Delete chapters/scos/pages
*/
function confirmedDelete($a_redirect = true)
{
global $ilCtrl;
$tree = new ilTree($this->object->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
// delete all selected objects
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php";
foreach ($_POST["id"] as $id) {
if ($id != IL_FIRST_NODE) {
$obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
$node_data = $tree->getNodeData($id);
if (is_object($obj)) {
$obj->setSLMId($this->object->getId());
/*include_once("./Services/History/classes/class.ilHistory.php");
ilHistory::_createEntry($this->object->getId(), "delete_".$obj->getType(),
array(ilLMObject::_lookupTitle($id), $id),
$this->object->getType());*/
$obj->delete();
}
if ($tree->isInTree($id)) {
$tree->deleteTree($node_data);
}
}
}
// check the tree
// $this->object->checkTree();
// feedback
ilUtil::sendInfo($this->lng->txt("info_deleted"), true);
if ($a_redirect) {
$ilCtrl->redirect($this, "showOrganization");
}
}
示例8: ilTree
/**
* presentation title doesn't have to be page title, it may be
* chapter title + page title or chapter title only, depending on settings
*
* @param string $a_mode IL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER
*/
function _getPresentationTitle($a_pg_id, $a_mode = IL_CHAPTER_TITLE, $a_include_numbers = false, $a_time_scheduled_activation = false, $a_force_content = false)
{
global $ilDB;
// select
$query = "SELECT * FROM lm_data WHERE obj_id = " . $ilDB->quote($a_pg_id, "integer");
$pg_set = $ilDB->query($query);
$pg_rec = $ilDB->fetchAssoc($pg_set);
if ($a_mode == IL_NO_HEADER && !$a_force_content) {
return "";
}
$tree = new ilTree($pg_rec["lm_id"]);
$tree->setTableNames('lm_tree', 'lm_data');
$tree->setTreeTablePK("lm_id");
if ($a_mode == IL_PAGE_TITLE) {
$nr = "";
return $nr . $pg_rec["title"];
}
if ($tree->isInTree($pg_rec["obj_id"])) {
$pred_node = $tree->fetchPredecessorNode($pg_rec["obj_id"], "st");
$childs = $tree->getChildsByType($pred_node["obj_id"], "pg");
$cnt_str = "";
if (count($childs) > 1) {
$cnt = 0;
foreach ($childs as $child) {
include_once "./Services/COPage/classes/class.ilPageObject.php";
$active = ilPageObject::_lookupActive($child["obj_id"], ilObject::_lookupType($pg_rec["lm_id"]), $a_time_scheduled_activation);
if (!$active) {
$act_data = ilPageObject::_lookupActivationData((int) $child["obj_id"], ilObject::_lookupType($pg_rec["lm_id"]));
if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) {
$active = true;
}
}
if ($child["type"] != "pg" || $active) {
$cnt++;
}
if ($child["obj_id"] == $pg_rec["obj_id"]) {
$cur_cnt = $cnt;
}
}
if ($cnt > 1) {
$cnt_str = " (" . $cur_cnt . "/" . $cnt . ")";
}
}
require_once "./Modules/LearningModule/classes/class.ilStructureObject.php";
//$struct_obj =& new ilStructureObject($pred_node["obj_id"]);
//return $struct_obj->getTitle();
return ilStructureObject::_getPresentationTitle($pred_node["obj_id"], $a_include_numbers) . $cnt_str;
//return $pred_node["title"].$cnt_str;
} else {
return $pg_rec["title"];
}
}
示例9: pastePage
/**
* paste page
*/
function pastePage()
{
global $ilUser;
if (!$ilUser->clipboardHasObjectsOfType("pg")) {
$this->ilias->raiseError($this->lng->txt("no_page_in_clipboard"), $this->ilias->error_obj->MESSAGE);
}
return $this->insertPageClip();
return;
$tree = new ilTree($this->content_object->getId());
$tree->setTableNames('lm_tree', 'lm_data');
$tree->setTreeTablePK("lm_id");
// paste selected object
$id = ilEditClipboard::getContentObjectId();
// copy page, if action is copy
if (ilEditClipboard::getAction() == "copy") {
// check wether page belongs to lm
if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId()) == $this->content_object->getID()) {
$lm_page = new ilLMPageObject($this->content_object, $id);
$new_page =& $lm_page->copy();
$id = $new_page->getId();
} else {
// get page from other content object into current content object
$lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
$lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
$lm_page = new ilLMPageObject($lm_obj, $id);
$copied_nodes = array();
$new_page =& $lm_page->copyToOtherContObject($this->content_object, $copied_nodes);
$id = $new_page->getId();
ilLMObject::updateInternalLinks($copied_nodes);
}
}
if (ilEditClipboard::getAction() == "cut") {
// check wether page belongs not to lm
if (ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId()) != $this->content_object->getID()) {
$lm_id = ilLMObject::_lookupContObjID(ilEditClipboard::getContentObjectId());
$lm_obj =& $this->ilias->obj_factory->getInstanceByObjId($lm_id);
$lm_page = new ilLMPageObject($lm_obj, $id);
$lm_page->setLMId($this->content_object->getID());
$lm_page->update();
$page =& $lm_page->getPageObject();
$page->buildDom();
$page->setParentId($this->content_object->getID());
$page->update();
}
}
if (!$tree->isInTree($id)) {
if (!isset($_POST["id"])) {
$target = IL_FIRST_NODE;
} else {
$target = $_POST["id"][0];
}
$tree->insertNode($id, $this->obj->getId(), $target);
ilEditClipboard::clear();
}
// write history comments
include_once "./Services/History/classes/class.ilHistory.php";
$parent_id = $tree->getParentId($id);
ilHistory::_createEntry($id, "paste", array(ilLMObject::_lookupTitle($this->obj->getId()), $this->obj->getId()), $this->content_object->getType() . ":pg");
ilHistory::_createEntry($parent_id, "paste_page", array(ilLMObject::_lookupTitle($id), $id), $this->content_object->getType() . ":st");
// check the tree
$this->checkTree();
$this->ctrl->redirect($this, "view");
}
示例10: putInTree
/**
* put this object into content object tree
*/
function putInTree()
{
$tree = new ilTree($this->content_object->getId());
$tree->setTableNames('lm_tree', 'lm_data');
$tree->setTreeTablePK("lm_id");
$parent_id = !empty($_GET["obj_id"]) ? $_GET["obj_id"] : $tree->getRootId();
if (!empty($_GET["target"])) {
$target = $_GET["target"];
} else {
// determine last child of current type
$childs =& $tree->getChildsByType($parent_id, $this->obj->getType());
if (count($childs) == 0) {
$target = IL_FIRST_NODE;
} else {
$target = $childs[count($childs) - 1]["obj_id"];
}
}
if (!$tree->isInTree($this->obj->getId())) {
$tree->insertNode($this->obj->getId(), $parent_id, $target);
}
}
示例11: ilTree
/**
* get last accessed page
*
* @param int $a_obj_id content object id
* @param int $a_user_id user object id
*/
function _getLastAccessedPage($a_ref_id, $a_user_id = "")
{
global $ilDB, $ilUser;
if ($a_user_id == "") {
$a_user_id = $ilUser->getId();
}
if (isset(self::$lo_access[$a_ref_id])) {
$acc_rec["obj_id"] = self::$lo_access[$a_ref_id];
} else {
$q = "SELECT * FROM lo_access WHERE " . "usr_id = " . $ilDB->quote($a_user_id, "integer") . " AND " . "lm_id = " . $ilDB->quote($a_ref_id, "integer");
$acc_set = $ilDB->query($q);
$acc_rec = $ilDB->fetchAssoc($acc_set);
}
if ($acc_rec["obj_id"] > 0) {
$lm_id = ilObject::_lookupObjId($a_ref_id);
$mtree = new ilTree($lm_id);
$mtree->setTableNames('lm_tree', 'lm_data');
$mtree->setTreeTablePK("lm_id");
if ($mtree->isInTree($acc_rec["obj_id"])) {
return $acc_rec["obj_id"];
}
}
return 0;
}
示例12: getExportResources
function getExportResources()
{
$export_files = array();
require_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
include_once "./Modules/File/classes/class.ilObjFile.php";
$tree = new ilTree($this->slm_object->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
foreach ($tree->getSubTree($tree->getNodeData($this->node_object->getId()), true, 'page') as $page) {
$page_obj = new ilSCORM2004Page($page["obj_id"]);
$page_obj->buildDom();
$mob_ids = $page_obj->collectMediaObjects(false);
foreach ($mob_ids as $mob_id) {
if ($mob_id > 0 && ilObject::_exists($mob_id)) {
$path = ilObjMediaObject::_lookupStandardItemPath($mob_id, false, false);
$media_obj = new ilObjMediaObject($mob_id);
$export_files[$i]["date"] = $media_obj->getCreateDate();
$export_files[$i]["size"] = @filesize($path);
// could be remote, e.g. youtube video
$export_files[$i]["file"] = $media_obj->getTitle();
$export_files[$i]["type"] = $media_obj->getDescription();
$export_files[$i]["path"] = $path;
$this->ctrl->setParameter($this, "resource", rawurlencode(ilObjMediaObject::_lookupStandardItemPath($mob_id, false, false)));
$export_files[$i]["link"] = $this->ctrl->getLinkTarget($this, "downloadResource");
$i++;
}
}
include_once "./Services/COPage/classes/class.ilPCFileList.php";
$file_ids = ilPCFileList::collectFileItems($page_obj, $page_obj->getDomDoc());
foreach ($file_ids as $file_id) {
$file_obj = new ilObjFile($file_id, false);
$export_files[$i]["date"] = $file_obj->getCreateDate();
$export_files[$i]["size"] = $file_obj->getFileSize();
$export_files[$i]["file"] = $file_obj->getFileName();
$export_files[$i]["type"] = $file_obj->getFileType();
$export_files[$i]["file_id"] = $file_id;
$this->ctrl->setParameter($this, "file_id", $file_id);
$export_files[$i]["link"] = $this->ctrl->getLinkTarget($this, "downloadFile", "");
$i++;
}
unset($page_obj);
}
return $export_files;
}
示例13: getPoolTree
/**
* Get Pool Tree
*
* @param int Media pool ID
*
* @return object Tree object of media pool
*/
static function getPoolTree($a_obj_id)
{
$tree = new ilTree($a_obj_id);
$tree->setTreeTablePK("mep_id");
$tree->setTableNames("mep_tree", "mep_item");
return $tree;
}
示例14: exportHTMLScoObjects
function exportHTMLScoObjects($a_inst, $a_target_dir, &$expLog, $a_one_file = "")
{
global $ilBench;
$tree = new ilTree($this->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
// copy all necessary files now
if ($a_one_file != "") {
$this->prepareHTMLExporter($a_target_dir);
// put header into file
$sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
$sco_tpl = ilCOPageHTMLExport::getPreparedMainTemplate($sco_tpl);
$sco_tpl->setCurrentBlock("js_file");
$sco_tpl->setVariable("JS_FILE", "./js/pure.js");
$sco_tpl->parseCurrentBlock();
$sco_tpl->setCurrentBlock("js_file");
$sco_tpl->setVariable("JS_FILE", "./js/question_handling.js");
$sco_tpl->parseCurrentBlock();
$sco_tpl->setCurrentBlock("head");
$sco_tpl->parseCurrentBlock();
fputs($a_one_file, $sco_tpl->get("head"));
// toc
include_once "./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php";
$manifestBuilder = new ilContObjectManifestBuilder($this);
$manifestBuilder->buildManifest('12');
$xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
$xml = simplexml_load_string($manifestBuilder->writer->xmlDumpMem());
$args = array('/_xml' => $xml->organizations->organization->asXml(), '/_xsl' => $xsl);
$xh = xslt_create();
$params = array("one_page" => "y");
$output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
xslt_free($xh);
fputs($a_one_file, $output);
}
foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php";
$sco_folder = $a_target_dir . "/" . $sco['obj_id'];
ilUtil::makeDir($sco_folder);
$node = new ilSCORM2004Sco($this, $sco['obj_id']);
if ($a_one_file == "") {
$node->exportHTML($a_inst, $sco_folder, $expLog, $a_one_file);
} else {
$node->exportHTMLPageObjects($a_inst, $a_target_dir, $expLog, 'full', "sco", $a_one_file, $sco_tpl);
}
if ($this->getAssignedGlossary() != 0) {
include_once "./Modules/Glossary/classes/class.ilObjGlossary.php";
$glos = new ilObjGlossary($this->getAssignedGlossary(), false);
//$glos->exportHTML($sco_folder."/glossary", $expLog);
}
}
// copy all necessary files now
if ($a_one_file != "") {
// put tail into file
fputs($a_one_file, $sco_tpl->get("tail"));
}
}
示例15: ilTree
function updateQuickEdit_scorm_propagate($request, $type)
{
$module_id = $this->md_obj->obj_id;
if ($this->md_obj->obj_type == 'sco') {
$module_id = $this->md_obj->rbac_id;
}
$tree = new ilTree($module_id);
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) {
$sco_md = new ilMD($module_id, $sco['obj_id'], 'sco');
if ($_POST[$request] != "") {
$sco_md_section;
if (!is_object($sco_md_section = $sco_md->getLifecycle())) {
$sco_md_section = $sco_md->addLifecycle();
$sco_md_section->save();
}
// determine all entered authors
$auth_arr = explode(",", $_POST[$request]);
for ($i = 0; $i < count($auth_arr); $i++) {
$auth_arr[$i] = trim($auth_arr[$i]);
}
$md_con_author = "";
// update existing author entries (delete if not entered)
foreach ($ids = $sco_md_section->getContributeIds() as $con_id) {
$md_con = $sco_md_section->getContribute($con_id);
if ($md_con->getRole() == $type) {
foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
$md_ent = $md_con->getEntity($ent_id);
// entered author already exists
if (in_array($md_ent->getEntity(), $auth_arr)) {
unset($auth_arr[array_search($md_ent->getEntity(), $auth_arr)]);
} else {
$md_ent->delete();
}
}
$md_con_author = $md_con;
}
}
// insert enterd, but not existing authors
if (count($auth_arr) > 0) {
if (!is_object($md_con_author)) {
$md_con_author = $sco_md_section->addContribute();
$md_con_author->setRole($type);
$md_con_author->save();
}
foreach ($auth_arr as $auth) {
$md_ent = $md_con_author->addEntity();
$md_ent->setEntity(ilUtil::stripSlashes($auth));
$md_ent->save();
}
}
} else {
if (is_object($sco_md_section = $sco_md->getLifecycle())) {
foreach ($ids = $sco_md_section->getContributeIds() as $con_id) {
$md_con = $sco_md_section->getContribute($con_id);
if ($md_con->getRole() == $type) {
$md_con->delete();
}
}
}
}
$sco_md->update();
}
$this->updateQuickEdit_scorm();
}