Beispiel #1
0
 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();
 }
Beispiel #2
0
 public function kill()
 {
     $theme_var = $this->getThemeVar();
     $theme = $this->getTheme();
     $db = new PHPWS_DB('layout_box');
     $db->addWhere('id', $this->getId());
     $result = $db->delete();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     Layout_Box::reorderBoxes($theme, $theme_var);
 }
 /**
  * Receives the post results of the box change form.
  */
 public static function moveBox()
 {
     PHPWS_Core::initModClass('layout', 'Box.php');
     $box = new Layout_Box($_GET['box_source']);
     $result = $box->move($_GET['box_dest']);
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         Layout::add('An unexpected error occurred when trying to save the new box position.');
         return;
     }
     Layout::resetBoxes();
     return true;
 }