Esempio n. 1
0
/**
 * When the list function is called and the template, a filter option will appear based on categories
 * 
 * @param array $pObject Current object
 * @param array $pParamHash Parameter hash - only works if $pParamHash[pigeonholes][filter] is passed back to the list sql funciton
 * @access public
 * @return void
 */
function pigeonholes_content_list(&$pObject, $pParamHash = NULL)
{
    global $gBitSystem, $gBitSmarty;
    if ($gBitSystem->isFeatureActive('pigeonholes_list_filter')) {
        $pigeonholes = new Pigeonholes();
        $listHash = array('sort_mode' => array('root_structure_id_asc', 'title_asc'), 'insertable' => TRUE);
        $pigeonList = $pigeonholes->getList($listHash);
        $list = array();
        foreach ($pigeonList as $pigeon) {
            $list[$pigeon['content_id']] = $pigeon['display_link'];
        }
        $gBitSmarty->assign('pigeonList', $list);
    }
}
$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) {
            $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();
                    }
                    if (!isset($pos_var['children'][$pos_v - 1])) {
                        $pos_var['children'][$pos_v - 1] = array();