function test_block_with_vars() { // Reads from test/templates/block-test.php $block = new Block('test'); $block->set_vars(array('foo' => 'bar', 'janf' => 'quux')); $this->assertEqual("test block\nfoo=bar\njanf=quux\n", $block->render()); }
function recursive_unset(&$array, $unwanted_key) { unset($array[$unwanted_key]); foreach ($array as &$value) { if (is_array($value)) { recursive_unset($value, $unwanted_key); } } } $tmp_record = $RECORD; recursive_unset($tmp_record, 'module'); print_r($tmp_record); ?> </pre> </div> <? endif /* Debug view*/ ?> <?php /*### TEMP: add sidebar blocks TODO: make this configurable ###*/ // Added in reverse order // Citation $block = new Block('citation'); $block->set_vars(array('CONF' => $CONF, 'RECORD' => $RECORD, 'MODULE' => $MODULE)); array_unshift($SIDEBAR, $block); // Mark record $block = new Block('mark_record'); $block->set_vars(array('CONF' => $CONF, 'RECORD' => $RECORD, 'MODULE' => $MODULE, 'MARKED_RECORDS' => $MARKED_RECORDS, 'USER' => $USER)); array_unshift($SIDEBAR, $block); ?> <?php require_once $CONF['path_templates'] . 'inc-footer.php';
<?php // $Id$ // Footer for database applications // James Fryer, 30 Aug 08 // BUFVC Potnia copyright 2011, BUFVC et al. See LICENSE for licensing information (GPL3). See http://potnia.org, http://bufvc.ac.uk // Include logo when on module default page if (@$SIDEBAR == '') { $logo = new Block('logo'); $logo->set_vars(compact('MODULE', 'CONF')); $SIDEBAR = array($logo); } ?> </div> <div class="sidebar-wrapper column_5 last_column"> <?if (@$SIDEBAR):?> <div class="sidebar" id="sidebar"> <ul> <?php /*---- Blocks -----*/ ?> <? foreach ($SIDEBAR as $block): ?> <li><?php echo $block->render(); ?> </li> <? endforeach ?> </ul> </div> <!-- sidebar --> <? endif /* Sidebar */ ?> </div> <!-- sidebar-wrapper -->