[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare SiteMgr - Web Content Management * 4 * http://www.egroupware.org * 5 * -------------------------------------------- * 6 * This program is free software; you can redistribute it and/or modify it * 7 * under the terms of the GNU General Public License as published by the * 8 * Free Software Foundation; either version 2 of the License, or (at your * 9 * option) any later version. * 10 \**************************************************************************/ 11 12 /* $Id: class.Common_BO.inc.php 20295 2006-02-15 12:31:25Z $ */ 13 14 class Common_BO 15 { 16 var $sites,$acl,$theme,$pages,$cats,$content,$modules; 17 var $state,$visiblestates; 18 var $sitemenu,$othermenu; 19 function Common_BO() 20 { 21 $this->sites =& CreateObject('sitemgr.Sites_BO',True); 22 $this->acl =& CreateObject('sitemgr.ACL_BO',True); 23 $this->theme =& CreateObject('sitemgr.Theme_BO',True); 24 $this->pages =& CreateObject('sitemgr.Pages_BO',True); 25 $this->cats =& CreateObject('sitemgr.Categories_BO',True); 26 $this->content =& CreateObject('sitemgr.Content_BO',True); 27 $this->modules =& CreateObject('sitemgr.Modules_BO',True); 28 $this->state = array( 29 SITEMGR_STATE_DRAFT => lang('draft'), 30 SITEMGR_STATE_PREPUBLISH => lang('prepublished'), 31 SITEMGR_STATE_PUBLISH => lang('published'), 32 SITEMGR_STATE_PREUNPUBLISH => lang('preunpublished'), 33 SITEMGR_STATE_ARCHIVE => lang('archived'), 34 ); 35 $this->viewable = array( 36 SITEMGR_VIEWABLE_EVERBODY => lang('everybody'), 37 SITEMGR_VIEWABLE_USER => lang('egw users'), 38 SITEMGR_VIEWABLE_ADMIN => lang('administrators'), 39 SITEMGR_VIEWABLE_ANONYMOUS => lang('anonymous') 40 ); 41 } 42 43 function setvisiblestates($mode) 44 { 45 $this->visiblestates = $this->getstates($mode); 46 } 47 48 function getstates($mode) 49 { 50 switch ($mode) 51 { 52 case 'Administration' : 53 return array(SITEMGR_STATE_DRAFT,SITEMGR_STATE_PREPUBLISH,SITEMGR_STATE_PUBLISH,SITEMGR_STATE_PREUNPUBLISH); 54 case 'Draft' : 55 return array(SITEMGR_STATE_PREPUBLISH,SITEMGR_STATE_PUBLISH); 56 case 'Edit' : 57 return array(SITEMGR_STATE_DRAFT,SITEMGR_STATE_PREPUBLISH,SITEMGR_STATE_PUBLISH,SITEMGR_STATE_PREUNPUBLISH); 58 case 'Commit' : 59 return array(SITEMGR_STATE_PREPUBLISH,SITEMGR_STATE_PREUNPUBLISH); 60 case 'Archive' : 61 return array(SITEMGR_STATE_ARCHIVE); 62 case 'Production' : 63 default: 64 return array(SITEMGR_STATE_PUBLISH,SITEMGR_STATE_PREUNPUBLISH); 65 } 66 } 67 68 function globalize($varname) 69 { 70 if (is_array($varname)) 71 { 72 foreach($varname as $var) 73 { 74 $GLOBALS[$var] = $_POST[$var]; 75 } 76 } 77 else 78 { 79 $GLOBALS[$varname] = $_POST[$varname]; 80 } 81 } 82 83 function getlangname($lang) 84 { 85 return $GLOBALS['egw']->translation->lang2language($lang); 86 } 87 88 function inputstateselect($default) 89 { 90 $returnValue = ''; 91 foreach($this->state as $value => $display) 92 { 93 $selected = ($default == $value) ? $selected = 'selected="selected" ' : ''; 94 $returnValue.='<option '.$selected.'value="'.$value.'">'. 95 $display.'</option>'."\n"; 96 } 97 return $returnValue; 98 } 99 100 function set_menus() 101 { 102 $this->sitemenu = $this->get_sitemenu(); 103 $this->othermenu = $this->get_othermenu(); 104 } 105 106 function get_sitemenu() 107 { 108 if ($GLOBALS['Common_BO']->acl->is_admin()) 109 { 110 $file['Configure Website'] = $GLOBALS['egw']->link('/index.php','menuaction=sitemgr.Common_UI.DisplayPrefs'); 111 $link_data['cat_id'] = CURRENT_SITE_ID; 112 $link_data['menuaction'] = "sitemgr.Modules_UI.manage"; 113 $file['Manage site-wide module properties'] = $GLOBALS['egw']->link('/index.php',$link_data); 114 /* not longer show, as it can be done via Edit-mode now 115 $link_data['page_id'] = 0; 116 $link_data['menuaction'] = "sitemgr.Content_UI.manage"; 117 $file['Manage site-wide content'] = $GLOBALS['egw']->link('/index.php',$link_data); 118 */ 119 $file['Manage Notifications'] = $GLOBALS['egw']->link('/index.php', 'menuaction=sitemgr.Notifications_UI.list_all&site_id='.CURRENT_SITE_ID); 120 } 121 // $file['Manage Categories and pages'] = $GLOBALS['egw']->link('/index.php', 'menuaction=sitemgr.Outline_UI.manage'); 122 $file['Manage Translations'] = $GLOBALS['egw']->link('/index.php', 'menuaction=sitemgr.Translations_UI.manage'); 123 $file['Commit Changes'] = $GLOBALS['egw']->link('/index.php', 'menuaction=sitemgr.Content_UI.commit'); 124 $file['Manage archived content'] = $GLOBALS['egw']->link('/index.php', 'menuaction=sitemgr.Content_UI.archive'); 125 126 $file['Manage Notification Messages'] = $GLOBALS['egw']->link('/index.php', 'menuaction=sitemgr.NtfMessages_UI.list_all&site_id='.CURRENT_SITE_ID); 127 if (($site = $this->sites->read(CURRENT_SITE_ID)) && $site['site_url']) 128 { 129 $file[] = '_NewLine_'; 130 $file['View generated Site'] = $site['site_url'].'?mode=Production'. 131 '&sessionid='.@$GLOBALS['egw_info']['user']['sessionid'] . 132 '&kp3=' . @$GLOBALS['egw_info']['user']['kp3'] . 133 '&domain=' . @$GLOBALS['egw_info']['user']['domain']; 134 135 $file['Edit Site'] = $GLOBALS['egw']->link('/sitemgr/'); 136 } 137 return $file; 138 } 139 140 function get_othermenu() 141 { 142 $numberofsites = $this->sites->getnumberofsites(); 143 $isadmin = $GLOBALS['egw']->acl->check('run',1,'admin'); 144 if ($numberofsites < 2 && !$isadmin) 145 { 146 return false; 147 } 148 $menu_title = lang('Other websites'); 149 if ($numberofsites > 1) 150 { 151 $link_data['menuaction'] = 'sitemgr.Common_UI.DisplayIFrame'; 152 $sites = $GLOBALS['Common_BO']->sites->list_sites(False); 153 while(list($site_id,$site) = @each($sites)) 154 { 155 if ($site_id != CURRENT_SITE_ID) 156 { 157 $link_data['siteswitch'] = $site_id; 158 $file[] = array( 159 'text' => $site['site_name'], 160 'no_lang' => True, 161 'link' => $GLOBALS['egw']->link('/index.php',$link_data) 162 ); 163 } 164 } 165 } 166 if ($numberofsites > 1 && $isadmin) 167 { 168 $file['_NewLine_'] =''; 169 } 170 if ($isadmin) 171 { 172 $file['Define websites'] = $GLOBALS['egw']->link('/index.php','menuaction=sitemgr.Sites_UI.list_sites'); 173 } 174 return $file; 175 } 176 } 177 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |