phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: sitemgr/sitemgr-site/inc class.Template2.inc.php


From: Patrick Walsh <address@hidden>
Subject: [Phpgroupware-cvs] CVS: sitemgr/sitemgr-site/inc class.Template2.inc.php,NONE,1.1 class.bo.inc.php,1.3,1.4 class.ui.inc.php,1.4,1.5 phpnuke.compat.inc.php,1.4,1.5
Date: Mon, 02 Sep 2002 19:08:15 -0400

Update of /cvsroot/phpgroupware/sitemgr/sitemgr-site/inc
In directory subversions:/tmp/cvs-serv14966/inc

Modified Files:
        class.bo.inc.php class.ui.inc.php phpnuke.compat.inc.php 
Added Files:
        class.Template2.inc.php 
Log Message:
Made templates work... ooh, got to add the templates dir....


***** Error reading new file: [Errno 2] No such file or directory: 
'class.Template2.inc.php'
Index: class.bo.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/sitemgr-site/inc/class.bo.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.bo.inc.php    30 Aug 2002 08:44:42 -0000      1.3
--- class.bo.inc.php    2 Sep 2002 23:08:13 -0000       1.4
***************
*** 18,21 ****
--- 18,22 ----
                var $page;
                var $catbo;
+               var $acl;
  
                function bo()
***************
*** 26,29 ****
--- 27,31 ----
                        $this->headerfooter_bo = 
CreateObject('sitemgr.headerFooter_BO');
                        $this->page = CreateObject('sitemgr.Page_SO');
+                       $this->acl = CreateObject('sitemgr.ACL_BO');
                }
  
***************
*** 248,251 ****
--- 250,271 ----
                {
                        return $this->headerfooter_bo->getsitefooter();
+               }
+ 
+               function is_user()
+               {
+                       global $sitemgr_info,$phpgw_info;
+                       if ($phpgw_info['user']['account_lid'] != 
$sitemgr_info['login'])
+                       {
+                               return true;
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+ 
+               function is_admin()
+               {
+                       return $this->acl->is_admin();
                }
  

Index: class.ui.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/sitemgr-site/inc/class.ui.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.ui.inc.php    1 Sep 2002 04:22:46 -0000       1.4
--- class.ui.inc.php    2 Sep 2002 23:08:13 -0000       1.5
***************
*** 14,21 ****
--- 14,23 ----
        {
                var $bo;
+               var $t;
  
                function ui()
                {
                        $this->bo = new bo;
+                       $this->t = new Template2;
                }
  
***************
*** 67,74 ****
                function generatePage()
                {
                        /* Note: much of this func was taken from phpNuke -- it
!                          is there template system so don't blame me for the 
mess */
                        global $header,$foot1,$user,$sitename,$index;
  
                        $index = 1;
  
--- 69,89 ----
                function generatePage()
                {
+                       if ($GLOBALS['sitemgr_info']['interface'] == 
'templates')
+                       {
+                               $this->generatePageTemplate();
+                       }
+                       else
+                       {
+                               $this->generatePageTheme();
+                       }
+               }
+ 
+               function generatePageTheme()
+               {
                        /* Note: much of this func was taken from phpNuke -- it
!                          is their template system so don't blame me for the 
mess */
                        global $header,$foot1,$user,$sitename,$index;
  
+                       require_once('./inc/phpnuke.compat.inc.php');
                        $index = 1;
  
***************
*** 103,106 ****
--- 118,223 ----
                        themefooter();
                        echo "</body></html>";
+               }
+ 
+               function generatePageTemplate()
+               {
+                       $themesel = $GLOBALS['sitemgr_info']['themesel'];
+                       $templatedir = 
$GLOBALS['sitemgr_info']['sitemgr-site_path'].'/templates/';
+                       if (!file_exists($templatedir.$themesel.'/main.tpl'))
+                       {
+                               die("Selected template '$themesel' does not 
exist.");
+                       }
+                       $this->t->set_root($templatedir);
+                       $this->t->set_unknowns('keep');
+ 
+                       $this->t->set_file('header','header.tpl');
+                       $this->t->set_var('themesel',$themesel);
+                       
$this->t->set_var('site_name',$this->bo->get_siteName());
+                       $this->t->pfp('out','header');
+                       $this->t->set_file('body',$themesel.'/main.tpl');
+ 
+                       $this->t->set_var('user', 
$GLOBALS['phpgw_info']['user']['account_lid']);
+                       $this->t->set_var('site_header', 
$this->bo->get_header());
+                       $this->t->set_var('site_footer', 
$this->bo->get_footer());
+                       $this->t->set_var('page_title', $this->bo->get_title());
+                       $this->t->set_var('page_subtitle', 
$this->bo->get_subtitle());
+                       $this->t->set_var('page_content', 
$this->bo->get_content());
+ 
+                       
$this->t->set_file('sideblocks',$themesel.'/sideblock.tpl');
+                       $this->t->set_block('sideblocks','SideBlock','SBlock');
+                       $this->blocks('l');
+                       
$this->t->set_var('left_blocks',$this->t->get_var('SBlock'));
+                       $this->t->set_var('SBlock','');
+                       $this->blocks('r');
+                       
$this->t->set_var('right_blocks',$this->t->get_var('SBlock'));
+                       $this->t->set_var('SBlock','');
+ 
+ 
+                       $this->t->pfp('out','body');
+               }
+ 
+               function block_allowed($block)
+               {
+                       switch($block['view'])
+                       {
+                               case 0:
+                                       return true;
+                               case 1:
+                                       return $this->bo->is_user();
+                               case 2:
+                                       return $this->bo->is_admin();
+                               case 3:
+                                       return (! $this->bo->is_user());
+                       }
+                       return false;
+               }
+ 
+               function get_blocktitle($block)
+               {
+                       return $block['title'];
+               }
+ 
+               function get_blockcontent($block)
+               {
+                       $content='';
+                       if (file_exists('blocks/'.$block['blockfile']) && 
trim($block['blockfile']))
+                       {
+                               include('blocks/'.$block['blockfile']);
+                               if (!$content)
+                               {
+                                       $content = 'No content found';
+                               }
+                       }
+                       elseif ($block['content'])
+                       {
+                               $content = $block['content'];
+                       }
+                       else
+                       {
+                               $content = 'Block not found';
+                       }
+                       return $content;
+               }
+ 
+               function blocks($side)
+               {
+                       global $blocks;
+                       //echo "<pre>";
+                       //print_r($blocks);
+                       //echo "</pre>";
+                       foreach($blocks as $block)
+                       {
+                               if($block['position']==$side)
+                               {
+                                       if ($this->block_allowed($block))
+                                       {
+                                               $title = 
$this->get_blocktitle($block);
+                                               $content = 
$this->get_blockcontent($block);
+                                               
$this->t->set_var('block_title',$title);
+                                               
$this->t->set_var('block_content',$content);
+                                               
$this->t->parse('SBlock','SideBlock',true);
+                                       }
+                               }
+                       }
                }
        }

Index: phpnuke.compat.inc.php
===================================================================
RCS file: 
/cvsroot/phpgroupware/sitemgr/sitemgr-site/inc/phpnuke.compat.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** phpnuke.compat.inc.php      1 Sep 2002 08:35:12 -0000       1.4
--- phpnuke.compat.inc.php      2 Sep 2002 23:08:13 -0000       1.5
***************
*** 100,104 ****
                                $content = 'Contact the administrator.';
                        }
!                       $val = themecenterbox($title, $content);
                }
                else
--- 100,115 ----
                                $content = 'Contact the administrator.';
                        }
! 
!                       add_theme_var('block_title',$title);
!                       add_theme_var('block_content',$content);
! 
!                       if(function_exists('themecenterbox'))
!                       {
!                               $val = themecenterbox($title, $content);
!                       }
!                       else
!                       {
!                               $val = 
parse_theme_vars(implode("",file('templates/'.$GLOBALS['sitemgr_info']['themesel'].'/centerblock.tpl')));
!                       }
                }
                else





reply via email to

[Prev in Thread] Current Thread [Next in Thread]