本文整理汇总了PHP中ilTree::setTableNames方法的典型用法代码示例。如果您正苦于以下问题:PHP ilTree::setTableNames方法的具体用法?PHP ilTree::setTableNames怎么用?PHP ilTree::setTableNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilTree
的用法示例。
在下文中一共展示了ilTree::setTableNames方法的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: prepareHTML
/**
* Call this before using getHTML()
* @access public
* @return ilMailFolderTableGUI
* @final
*
*/
public final function prepareHTML()
{
global $ilUser;
$this->addColumn('', '', '1px', true);
$this->addColumn($this->lng->txt('personal_picture'), '', '10%');
if ($this->isDraftFolder() || $this->isSentFolder()) {
$this->addColumn($this->lng->txt('recipient'), 'rcp_to', '25%');
} else {
$this->addColumn($this->lng->txt('sender'), 'from', '25%');
}
$this->addColumn($this->lng->txt('subject'), 'm_subject', '40%');
$this->addColumn($this->lng->txt('date'), 'send_time', '20%');
// init folder data
$mtree = new ilTree($ilUser->getId());
$mtree->setTableNames('mail_tree', 'mail_obj_data');
$this->_folderNode = $mtree->getNodeData($this->_currentFolderId);
// command buttons
$this->initCommandButtons();
// mail actions
$this->initMultiCommands($this->_parentObject->mbox->getActions($this->_currentFolderId));
// fetch table data
$this->fetchTableData();
return $this;
}
示例5: confirmedMove
function confirmedMove()
{
global $ilUser;
$tgt = (int) $_REQUEST["bmfmv_id"];
$bm_ids = explode(";", $_REQUEST['bm_id_tgt']);
if (!$bm_ids || !$tgt) {
ilUtil::sendFailure($this->lng->txt("no_checkbox"));
return $this->view();
}
$tree = new ilTree($ilUser->getId());
$tree->setTableNames('bookmark_tree', 'bookmark_data');
$tgt_node = $tree->getNodeData($tgt);
// sanity check
foreach ($bm_ids as $node_id) {
if ($tree->isGrandChild($node_id, $tgt)) {
ilUtil::sendFailure($this->lng->txt("error"), true);
$this->ctrl->redirect($this, "view");
}
$node = $tree->getNodeData($node_id);
// already at correct position
if ($node["parent"] == $tgt) {
continue;
}
$tree->moveTree($node_id, $tgt);
}
ilUtil::sendSuccess($this->lng->txt("bookmark_moved_ok"), true);
$this->ctrl->setParameter($this, "bmf_id", $tgt);
$this->ctrl->redirect($this, "view");
}
示例6: getTree
/**
* Get scorm module editing tree
*
* @param int scorm module object id
*
* @return object tree object
*/
static function getTree($a_slm_obj_id)
{
$tree = new ilTree($a_slm_obj_id);
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
$tree->readRootId();
return $tree;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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");
}
}
示例10: exportXMLPageObjects
function exportXMLPageObjects($a_target_dir, &$a_xml_writer, $a_inst, &$expLog)
{
global $ilBench;
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
$tree = new ilTree($this->slm_id);
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
$pages = $tree->getSubTree($tree->getNodeData($this->getId()), true, 'page');
foreach ($pages as $page) {
$expLog->write(date("[y-m-d H:i:s] ") . "Page Object " . $page["obj_id"]);
// export xml to writer object
$page_obj = new ilSCORM2004Page($page["obj_id"]);
$page_obj->exportXML($a_xml_writer, "normal", $a_inst);
//collect media objects
$mob_ids = $page_obj->getMediaObjectIds();
foreach ($mob_ids as $mob_id) {
$this->mob_ids[$mob_id] = $mob_id;
}
// collect all file items
$file_ids = $page_obj->getFileItemIds();
foreach ($file_ids as $file_id) {
$this->file_ids[$file_id] = $file_id;
}
include_once "./Services/COPage/classes/class.ilPCQuestion.php";
$q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
if (count($q_ids) > 0) {
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
foreach ($q_ids as $q_id) {
$q_obj =& assQuestion::_instanciateQuestion($q_id);
$qti_file = fopen($a_target_dir . "/qti_" . $q_id . ".xml", "w");
fwrite($qti_file, $q_obj->toXML());
fclose($qti_file);
}
}
unset($page_obj);
}
}
示例11: VALUES
$ilDB->manipulate("INSERT INTO rbac_ta " . "(typ_id, ops_id) VALUES (" . $ilDB->quote($typ_id, "integer") . "," . $ilDB->quote(2, "integer") . ")");
$ilDB->manipulate("INSERT INTO rbac_ta " . "(typ_id, ops_id) VALUES (" . $ilDB->quote($typ_id, "integer") . "," . $ilDB->quote(3, "integer") . ")");
$ilDB->manipulate("INSERT INTO rbac_ta " . "(typ_id, ops_id) VALUES (" . $ilDB->quote($typ_id, "integer") . "," . $ilDB->quote(4, "integer") . ")");
}
?>
<#3379>
<?php
$setting = new ilSetting();
$sk_step = (int) $setting->get('sk_db');
if ($sk_step <= 4) {
// add skill tree and root node
$nid = $ilDB->nextId("skl_tree_node");
$ilDB->manipulate("INSERT INTO skl_tree_node " . "(obj_id, type, title, create_date) VALUES (" . $ilDB->quote($nid, "integer") . "," . $ilDB->quote("skrt", "text") . "," . $ilDB->quote("Skill Tree Root Node", "text") . "," . $ilDB->now() . ")");
$skill_tree = new ilTree(1);
$skill_tree->setTreeTablePK("skl_tree_id");
$skill_tree->setTableNames('skl_tree', 'skl_tree_node');
$skill_tree->addTree(1, $nid);
}
?>
<#3380>
<?php
$setting = new ilSetting();
$sk_step = (int) $setting->get('sk_db');
if ($sk_step <= 6) {
$fields = array('id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 'skill_id' => array('type' => 'integer', 'length' => 4, 'notnull' => true), 'nr' => array('type' => 'integer', 'length' => 2, 'notnull' => true), 'title' => array('type' => 'text', 'length' => 200, 'notnull' => false), 'description' => array('type' => 'clob'));
$ilDB->createTable('skl_level', $fields);
$ilDB->createSequence('skl_level');
$ilDB->addPrimaryKey("skl_level", array("id"));
}
?>
<#3381>
示例12: setLocator
/**
* Set Locator Items
*/
function setLocator()
{
global $ilLocator, $tpl, $ilCtrl;
$ilLocator->addRepositoryItems($_GET["ref_id"]);
$this->getParentGUI()->addLocatorItems();
if ($_GET["obj_id"] > 0) {
$tree = new ilTree($this->slm_object->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
$path = $tree->getPathFull($_GET["obj_id"]);
for ($i = 1; $i < count($path); $i++) {
//var_dump($path[$i]);
switch ($path[$i]["type"]) {
case "chap":
$ilCtrl->setParameterByClass("ilscorm2004chaptergui", "obj_id", $path[$i]["child"]);
$ilLocator->addItem($path[$i]["title"], $ilCtrl->getLinkTargetByClass("ilscorm2004chaptergui", "showOrganization"), "", 0, $path[$i]["type"], ilUtil::getImagePath("icon_chap_s.png"));
break;
case "seqc":
$ilCtrl->setParameterByClass("ilscorm2004seqchaptergui", "obj_id", $path[$i]["child"]);
$ilLocator->addItem($path[$i]["title"], $ilCtrl->getLinkTargetByClass("ilscorm2004seqchaptergui", "showOrganization"), "", 0, $path[$i]["type"], ilUtil::getImagePath("icon_chap_s.png"));
break;
case "sco":
$ilCtrl->setParameterByClass("ilscorm2004scogui", "obj_id", $path[$i]["child"]);
$ilLocator->addItem($path[$i]["title"], $ilCtrl->getLinkTargetByClass("ilscorm2004scogui", "showOrganization"), "", 0, $path[$i]["type"], ilUtil::getImagePath("icon_sco_s.png"));
break;
case "ass":
$ilCtrl->setParameterByClass("ilscorm2004assetgui", "obj_id", $path[$i]["child"]);
$ilLocator->addItem($path[$i]["title"], $ilCtrl->getLinkTargetByClass("ilscorm2004assetgui", "showOrganization"), "", 0, $path[$i]["type"], ilUtil::getImagePath("icon_sca_s.png"));
break;
case "page":
$ilCtrl->setParameterByClass("ilscorm2004pagegui", "obj_id", $path[$i]["child"]);
$ilLocator->addItem($path[$i]["title"], $ilCtrl->getLinkTargetByClass("ilscorm2004pagegui", "edit"), "", 0, $path[$i]["type"], ilUtil::getImagePath("icon_pg_s.png"));
break;
}
}
}
$ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
$tpl->setLocator();
}
示例13: 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);
}
}
示例14: mapCurrentPageId
function mapCurrentPageId($current_page_id)
{
$subtree = $this->lm_tree->getSubTree($this->lm_tree->getNodeData(1));
$node = $this->lm_tree->getNodeData($current_page_id);
$pos = array_search($node, $subtree);
$this->tr_obj =& $this->ilias->obj_factory->getInstanceByRefId($_SESSION["tr_id"]);
$lmtree = new ilTree($this->tr_obj->getId());
$lmtree->setTableNames('lm_tree', 'lm_data');
$lmtree->setTreeTablePK("lm_id");
$subtree = $lmtree->getSubTree($lmtree->getNodeData(1));
return $subtree[$pos]["child"];
}
示例15: 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");
}