/** * Load Function */ function data_toc($pData, $pParams) { include_once LIBERTY_PKG_PATH . 'LibertyStructure.php'; global $gStructure, $gContent, $gBitSmarty; if (is_object($gStructure) && $gStructure->isValid()) { $struct =& $gStructure; } elseif (@BitBase::verifyId($pParams['structure_id'])) { $struct = new LibertyStructure($pParams['structure_id']); $struct->load(); } elseif (is_object($gContent)) { $structures = $gContent->getStructures(); // We take the first structure. not good, but works for now - spiderr if (!empty($structures[0])) { require_once LIBERTY_PKG_PATH . 'LibertyStructure.php'; $struct = new LibertyStructure($structures[0]['structure_id']); $struct->load(); } } $repl = ' '; if (!empty($struct) && is_object($struct) && $struct->isValid()) { if (@BitBase::verifyId($structure_id)) { $get_structure = $structure_id; } else { $get_structure = $struct->mStructureId; } $tree = $struct->getSubTree($get_structure, !empty($pParams['display']) && $pParams['display'] == 'full_toc'); $gBitSmarty->assign("subtree", $tree); $repl = $gBitSmarty->fetch("bitpackage:liberty/plugins/data_toc.tpl"); } return $repl; }
* All Rights Reserved. See below for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details * * @package kernel * @subpackage modules */ extract($moduleParams); if (!empty($module_params)) { $gBitSmarty->assign('modParams', $module_params); } global $gStructure, $gContent; if (!$gStructure and $gContent) { $structs = $gContent->getStructures(); if (count($structs) > 1) { $gStructure = new LibertyStructure($structs[0]['structure_id']); if ($gStructure->load()) { $gStructure->loadNavigation(); $gStructure->loadPath(); $gBitSmarty->assign('structureInfo', $gStructure->mInfo); } } } if ($gStructure and !empty($gStructure->mInfo['structure_path'])) { $secondbox = 0; $tree = 1; $gStructure->mInfo['structure_path'][0]['structure_id']; if ($gStructure->mInfo['parent']['structure_id'] == 4) { $sidebox = $gStructure->mInfo['content_id'] - 3; } elseif ($gStructure->mInfo['parent']['content_id'] > 4) { $sidebox = $gStructure->mInfo['parent']['content_id'] - 3; } else {
include_once LIBERTY_PKG_PATH . 'LibertyStructure.php'; if (!@BitBase::verifyId($_REQUEST["structure_id"])) { $gBitSystem->fatalError(tra("No structure indicated")); } else { global $gStructure; $gStructure = new LibertyStructure($_REQUEST["structure_id"]); $gStructure->load(); // order matters for these conditionals if (empty($gStructure) || !$gStructure->isValid()) { $gBitSystem->fatalError(tra('Invalid structure')); } if ($gStructure->mInfo['root_structure_id'] == $gStructure->mInfo['structure_id']) { $rootStructure =& $gStructure; } else { $rootStructure = new LibertyStructure($gStructure->mInfo['root_structure_id']); $rootStructure->load(); $rootStructure->loadNavigation(); $rootStructure->loadPath(); } if (empty($gContent)) { $gContent = LibertyContent::getLibertyObject($gStructure->getField('content_id')); $gContent->verifyUpdatePermission(); } $gBitSmarty->assign_by_ref('gStructure', $gStructure); $gBitSmarty->assign('editingStructure', TRUE); $gBitSmarty->assign('structureInfo', $gStructure->mInfo); // Store the actively stored structure name $gBitUser->storePreference('edit_structure_name', $rootStructure->mInfo['title']); $gBitUser->storePreference('edit_structure_id', $rootStructure->mStructureId); if (isset($_REQUEST["action"]) && $_REQUEST["action"] == 'remove' || !empty($_REQUEST["confirm"])) { $gBitUser->verifyTicket();
} } // used to display the newly updated version of an image if (!empty($_REQUEST['refresh'])) { $gBitSmarty->assign('refresh', '?refresh=' . time()); } // services $displayHash = array('perm_name' => 'p_treasury_view_gallery'); $gContent->invokeServices('content_display_function', $displayHash); // set up structure related stuff global $gStructure; if (empty($gContent->mInfo['root_structure_id']) || !@BitBase::verifyId($gContent->mInfo['root_structure_id'])) { bit_redirect(TREASURY_PKG_URL . "index.php"); } $gStructure = new LibertyStructure($gContent->mInfo['root_structure_id']); $gStructure->load(); // confirm that structure is valid if (empty($gStructure) || !$gStructure->isValid()) { $gBitSystem->fatalError(tra('Invalid structure')); } $gBitSmarty->assignByRef('gStructure', $gStructure); $gBitSmarty->assign('structureInfo', $gStructure->mInfo); $gBitSmarty->assign('subtree', $gStructure->getSubTree($gStructure->mStructureId)); $listHash = $_REQUEST; $listHash['root_structure_id'] = $gContent->mInfo['root_structure_id']; $listHash['structure_id'] = $gContent->mInfo['structure_id']; $listHash['sort_mode'] = !empty($_REQUEST['sort_mode']) ? $_REQUEST['sort_mode'] : 'created_desc'; $gContent->loadItems($listHash); // pagination related settings $listHash['listInfo']['parameters']['structure_id'] = $gContent->mStructureId; $gBitSmarty->assign('listInfo', $listHash['listInfo']);
/** * Imports a structure from liberty_structures to nexus including hierarchy * @return number of errors encountered */ function importStructure($pStructureId = NULL) { if ($pStructureId || !is_numeric($pStructureId)) { include_once LIBERTY_PKG_PATH . 'LibertyStructure.php'; $structure = new LibertyStructure($pStructureId); $structure->load(); // order matters for these conditionals if (empty($structure) || !$structure->isValid()) { $this->mErrors['structure'] = tra('Invalid structure'); } if ($structure->mInfo['root_structure_id'] == $structure->mInfo['structure_id']) { $rootStructure =& $structure; } else { $rootStructure = new LibertyStructure($structure->mInfo['root_structure_id']); $rootStructure->load(); } $structureList = $rootStructure->getSubTree($rootStructure->mInfo['structure_id']); $menuHash['title'] = $rootStructure->mInfo['title']; if ($menu_id = $this->storeMenu($menuHash)) { // we need to insert the structure title manually, as this is not part of the structure $itemHash = array('menu_id' => $menu_id, 'title' => $rootStructure->mInfo['title'], 'pos' => 1, 'parent_id' => 0, 'rsrc' => $rootStructure->mInfo['structure_id'], 'rsrc_type' => 'structure_id'); $storedItem = $this->storeItem($itemHash); // insert all nodes in structure as menu items foreach ($structureList as $structureItem) { if ($structureItem['first']) { // get id of the current item $query = "SELECT MAX(`item_id`) FROM `" . BIT_DB_PREFIX . "nexus_menu_items`"; $parentPath[] = $this->mDb->getOne($query, array()); $parent_id = end($parentPath); } if ($structureItem['last']) { // move up one step in the structure parentPath array_pop($parentPath); $parent_id = end($parentPath); } else { // save the item in the menu $tmpItem = $rootStructure->getNode($structureItem['structure_id']); $itemHash = array('menu_id' => $menu_id, 'title' => $structureItem['title'], 'pos' => $tmpItem['pos'], 'parent_id' => $parent_id, 'rsrc' => isset($structureItem['structure_id']) ? $structureItem['structure_id'] : NULL, 'rsrc_type' => 'structure_id'); $storedItem = $this->storeItem($itemHash); } } } else { $this->mErrors['store_menu'] = tra('The menu could not be stored.'); } } else { $this->mErrors['structure_id'] = tra('No valid structure id was given.'); } return count($this->mErrors) == 0; }
* @version $Header$ * * @package liberty * @subpackage modules */ /** * Initial Setup */ global $gStructure, $gContent, $moduleParams, $gBitSmarty; require_once LIBERTY_PKG_PATH . 'LibertyStructure.php'; extract($moduleParams); $struct = NULL; if (is_object($gStructure) && $gStructure->isValid() && $gStructure->hasViewPermission()) { $struct =& $gStructure; } elseif (@BitBase::verifyId($module_params['structure_id'])) { $struct = new LibertyStructure($module_params['structure_id']); $struct->load(); } elseif (is_object($gContent) && $gContent->hasViewPermission(FALSE)) { $structures = $gContent->getStructures(); // We take the first structure. not good, but works for now - spiderr if (!empty($structures[0])) { require_once LIBERTY_PKG_PATH . 'LibertyStructure.php'; $struct = new LibertyStructure($structures[0]['structure_id']); $struct->load(); } } if (is_object($struct) && count($struct->isValid())) { $_template->tpl_vars['moduleTitle'] = new Smarty_variable($moduleParams['title']); $toc = $struct->getToc($struct->mInfo['root_structure_id'], 'asc', FALSE, 2); $_template->tpl_vars['modStructureTOC'] = new Smarty_variable($struct->getToc($struct->mInfo['root_structure_id'], 'asc', FALSE, 2)); }