1<?php 2/** 3 * @package tikiwiki 4 */ 5// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 6// 7// All Rights Reserved. See copyright.txt for details and a complete list of authors. 8// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 9// $Id$ 10 11if (basename($_SERVER['SCRIPT_NAME']) === basename(__FILE__)) { 12 die('This script may only be included.'); 13} 14require_once('tiki-setup.php'); 15 16$modlib = TikiLib::lib('mod'); 17$usermoduleslib = TikiLib::lib('usermodules'); 18$userlib = TikiLib::lib('user'); 19$smarty = TikiLib::lib('smarty'); 20$tikilib = TikiLib::lib('tiki'); 21 22include_once('tiki-module_controls.php'); 23global $prefs, $user; 24 25clearstatcache(); 26$modules = $modlib->get_modules_for_user($user); 27 28if (Perms::get()->admin) { 29 $smarty->assign('module_pref_errors', $modlib->pref_errors); 30} 31 32$show_columns = array_fill_keys(array_keys($modules), 'n'); 33 34$modnames = []; 35foreach ($modules as $zone => & $moduleList) { 36 if ($prefs['feature_fullscreen'] != 'y' || empty($_SESSION['fullscreen']) || $_SESSION['fullscreen'] != 'y' || 37 strpos($zone, 'page') === 0) { // pagetop and pagebottom zones appear in fullscreen 38 foreach ($moduleList as & $mod_reference) { 39 $show_columns[$zone] = 'y'; 40 41 $ref = (array) $mod_reference; 42 $mod_reference['data'] = new Tiki_Render_Lazy( 43 function () use ($ref) { 44 $modlib = TikiLib::lib('mod'); 45 return $modlib->execute_module($ref); 46 } 47 ); 48 $modnames[$ref['name']] = ''; 49 } 50 51 $smarty->assign($zone, $moduleList); 52 } 53} 54 55//add necessary css files to header as required for specific modules 56//TODO only add css when module will actually be showing 57$cssadd = array_intersect_key($modlib->cssfiles, $modnames); 58if (count($cssadd)) { 59 $headerlib = TikiLib::lib('header'); 60 foreach ($cssadd as $add) { 61 $headerlib->add_cssfile($add['csspath'], $add['rank']); 62 } 63} 64 65$smarty->assign('show_columns', $show_columns); 66$smarty->assign('module_zones', $modules); 67 68$module_nodecorations = ['decorations' => 'n']; 69$module_isflippable = ['flip' => 'y']; 70$smarty->assign('module_nodecorations', $module_nodecorations); 71$smarty->assign('module_isflippable', $module_isflippable); 72