Esempio n. 1
0
 /**
  * Returns HTML link to display a pigeonhole
  * @param $pTitle is the pigeonhole we want to see
  * @param $pContentId content id of the pigeonhole in question
  * @return the link to display the page.
  */
 function getDisplayLink($pLinkText = NULL, $pMixed = NULL, $pAnchor = NULL)
 {
     global $gBitSystem;
     if (empty($pLinkText) && !empty($this)) {
         $ppLinkText = $this->getTitle();
     }
     if (empty($pMixed) && !empty($this)) {
         $pMixed = $this->mInfo;
     }
     $ret = $pLinkText;
     if (!empty($pLinkText) && !empty($pMixed)) {
         if ($gBitSystem->isPackageActive('pigeonholes')) {
             $ret = '<a title="' . htmlspecialchars($pLinkText) . '" href="' . Pigeonholes::getDisplayUrlFromHash($pMixed) . '">' . htmlspecialchars($pLinkText) . '</a>';
         }
     }
     return $ret;
 }
 *
 * $Id$
 * @package pigeonholes
 * @subpackage modules
 */
/**
 * Initial Setup
 */
global $gBitSmarty, $gQueryUserId, $gBitThemes, $module_rows, $moduleParams, $gBitSystem, $module_params;
$module_rows = $moduleParams['module_rows'];
$module_params = $moduleParams['module_params'];
$_template->tpl_vars['moduleTitle'] = new Smarty_variable(isset($moduleParams['title']));
$ns = array();
if ($gBitSystem->isPackageActive('pigeonholes')) {
    require_once PIGEONHOLES_PKG_PATH . 'Pigeonholes.php';
    $p = new Pigeonholes();
    $s = new LibertyStructure();
    // Prep get list screws with us.
    $listHash = array('load_only_root' => TRUE, 'sort_mode' => 'lc.title_asc', 'offset' => 0, 'max_records' => '999999', 'find' => '');
    if (!empty($module_params['root_structure_id'])) {
        $listHash['root_structure_id'] = $module_params['root_structure_id'];
    }
    if (!empty($module_params['structure_id'])) {
        $l = array(array('structure_id' => $module_params['structure_id']));
    } else {
        $l = $p->getList($listHash);
    }
    foreach ($l as $e) {
        $d = $s->getSubTree($e['structure_id']);
        $d_o = array();
        foreach ($d as $c) {
<?php

/**
 * Provide a list of pigenoholes
 *
 * @package pigeonholes
 * @subpackage functions
 * @version $Header$
 *
 * Copyright ( c ) 2005 bitweaver.org
 * 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
 */
/**
 * Required Files
 */
$gContent = new Pigeonholes(!empty($_REQUEST['structure_id']) ? $_REQUEST['structure_id'] : NULL, !empty($_REQUEST['content_id']) ? $_REQUEST['content_id'] : NULL);
$gContent->load(TRUE);
$gBitSmarty->assign_by_ref('gContent', $gContent);
Esempio n. 4
0
    // get all the nodes in this structure
    foreach ($rootTree as $node) {
        $pigeonStructure[$node['structure_id']] = str_repeat('-', $node['level']) . ' ' . $node['title'];
    }
    $gBitSmarty->assign('pigeonStructure', $pigeonStructure);
}
global $gStructure;
// store the form if we need to
if (!empty($_REQUEST['pigeonhole_store'])) {
    if (empty($_REQUEST['pigeonhole']['title'])) {
        $gBitSystem->fatalError(tra("You must specify a title."));
    }
    // we need to get the root structure id
    $_REQUEST['pigeonhole']['root_structure_id'] = !empty($rootStructure->mStructureId) ? $rootStructure->mStructureId : NULL;
    // store the pigeonhole
    $pigeonStore = new Pigeonholes(NULL, !empty($_REQUEST['pigeonhole_content_id']) ? $_REQUEST['pigeonhole_content_id'] : NULL);
    $pigeonStore->load();
    if ($pigeonStore->store($_REQUEST['pigeonhole'])) {
        header("Location: " . $_SERVER['SCRIPT_NAME'] . '?structure_id=' . $pigeonStore->mStructureId . (!empty($_REQUEST['action']) ? '&action=' . $_REQUEST['action'] : '') . "&success=" . urlencode(tra("The category was successfully stored")));
    } else {
        $feedback['error'] = $gContent->mErrors;
    }
}
if (!empty($_REQUEST['action']) || isset($_REQUEST["confirm"])) {
    // if we need to edit, show the information
    if ($_REQUEST['action'] == 'edit') {
        $pigeonInfo = $gContent->mInfo;
        $gContent->loadPreferences();
    }
    if ($_REQUEST['action'] == 'edit' || $_REQUEST['action'] == 'create') {
        $gBitSmarty->assign('pigeonInfo', !empty($pigeonInfo) ? $pigeonInfo : NULL);
Esempio n. 5
0
function boards_content_store($pContent, $pParamHash)
{
    global $gBitDb, $gBitSmarty, $gBitSystem;
    require_once BOARDS_PKG_PATH . 'BitBoardTopic.php';
    // do not allow unassigning topics. the UI should prevent this, but just to make sure...
    if ($pContent->isValid() && !$pContent->isContentType(BITBOARDTOPIC_CONTENT_TYPE_GUID) && !$pContent->isContentType(BITBOARD_CONTENT_TYPE_GUID)) {
        // wipe out all previous assignments for good measure. Not the sanest thing to do, but edits are infrequent - at least for now
        if ($gBitSystem->isFeatureActive('boards_link_by_pigeonholes') && $gBitSystem->isPackageActive('pigeonholes')) {
            // Delete all old mappings
            $pContent->mDb->query("DELETE FROM `" . BIT_DB_PREFIX . "boards_map` WHERE `topic_content_id`=?", array($pContent->mContentId));
            // Get the pigeonholes this content is in
            $p = null;
            if (!empty($pParamHash['pigoneholes'])) {
                foreach ($pParamHash['pigeonholes']['pigeonhole'] as $p_id) {
                    require_once PIGEONHOLES_PKG_PATH . 'Pigeonholes.php';
                    if (empty($p)) {
                        $p = new Pigeonholes();
                    }
                    // What boards are in the same pigeonhole?
                    $params = array('content_type_guid' => BITBOARD_CONTENT_TYPE_GUID, 'content_id' => $p_id);
                    $boards = $p->getMemberList($params);
                    // Insert into these boards
                    foreach ($boards as $board) {
                        if (@BitBase::verifyId($board['content_id'])) {
                            $pContent->mDb->query("INSERT INTO `" . BIT_DB_PREFIX . "boards_map` (`board_content_id`,`topic_content_id`) VALUES (?,?)", array($board['content_id'], $pContent->mContentId));
                        }
                    }
                }
            }
        } else {
            $pContent->mDb->query("DELETE FROM `" . BIT_DB_PREFIX . "boards_map` WHERE `topic_content_id`=?", array($pContent->mContentId));
            if (@BitBase::verifyId($pParamHash['linked_board_cid'])) {
                $pContent->mDb->query("INSERT INTO `" . BIT_DB_PREFIX . "boards_map` (`board_content_id`,`topic_content_id`) VALUES (?,?)", array($pParamHash['linked_board_cid'], $pContent->mContentId));
            }
        }
        $gBitSmarty->assign('boardInfo', BitBoard::getLinkedBoard($pContent->mContentId));
    } else {
        if (@BitBase::verifyId($pParamHash['content_id']) && @BitBase::verifyId($pParamHash['linked_board_cid'])) {
            $pContent->mDb->query("INSERT INTO `" . BIT_DB_PREFIX . "boards_map` (`board_content_id`,`topic_content_id`) VALUES (?,?)", array($pParamHash['linked_board_cid'], $pParamHash['content_id']));
        }
    }
}
Esempio n. 6
0
 */
require_once "../kernel/setup_inc.php";
require_once BOARDS_PKG_PATH . 'BitBoardTopic.php';
require_once BOARDS_PKG_PATH . 'BitBoardPost.php';
require_once BOARDS_PKG_PATH . 'BitBoard.php';
// Is package installed and enabled
$gBitSystem->verifyPackage('boards');
// Now check permissions to access this page
$gBitSystem->verifyPermission('p_boards_read');
// Get a list of boards
$ns = array();
$board_all_cids = array();
// @TODO move pigeonholes to its own file library or something
if ($gBitSystem->isPackageActive('pigeonholes')) {
    require_once PIGEONHOLES_PKG_PATH . 'Pigeonholes.php';
    $p = new Pigeonholes();
    $s = new LibertyStructure();
    $listHash = array('load_only_root' => TRUE);
    $l = $p->getList($listHash);
    foreach ($l as $e) {
        $d = $s->getSubTree($e['structure_id']);
        $d_o = array();
        foreach ($d as $c) {
            $pos_var =& $d_o;
            if ($c['level'] != 0) {
                $pos = explode(".", $c['pos']);
                $pos_var =& $d_o;
                foreach ($pos as $pos_v) {
                    if (!isset($pos_var['children'])) {
                        $pos_var['children'] = array();
                    }