コード例 #1
0
ファイル: Layout.php プロジェクト: sysulsj/phpwebsite
 public static function addBox($content_var, $module, $theme_var = NULL, $theme = NULL)
 {
     PHPWS_Core::initModClass('layout', 'Box.php');
     if (!isset($theme)) {
         $theme = $_SESSION['Layout_Settings']->current_theme;
     }
     if (!isset($theme_var)) {
         $mod_theme_var = strtoupper(sprintf('%s_%s', $module, $content_var));
         if (!empty($_SESSION['Layout_Settings']->_theme_variables) && in_array($mod_theme_var, $_SESSION['Layout_Settings']->_theme_variables)) {
             $theme_var = $mod_theme_var;
         } else {
             $theme_var = DEFAULT_BOX_VAR;
         }
     }
     $box = new Layout_Box();
     $box->setTheme($theme);
     $box->setContentVar($content_var);
     $box->setModule($module);
     $box->setThemeVar($theme_var);
     $result = $box->save();
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         PHPWS_Core::errorPage();
     }
     Layout::resetBoxes();
 }