当前位置: 首页>>代码示例>>PHP>>正文


PHP Layout::resetBoxes方法代码示例

本文整理汇总了PHP中Layout::resetBoxes方法的典型用法代码示例。如果您正苦于以下问题:PHP Layout::resetBoxes方法的具体用法?PHP Layout::resetBoxes怎么用?PHP Layout::resetBoxes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Layout的用法示例。


在下文中一共展示了Layout::resetBoxes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addBox

 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();
 }
开发者ID:sysulsj,项目名称:phpwebsite,代码行数:26,代码来源:Layout.php

示例2: move

 /**
  * Moves a box to a new location
  */
 public function move($dest)
 {
     if ($dest != 'move_box_up' && $dest != 'move_box_down' && $dest != 'move_box_top' && $dest != 'move_box_bottom' && $dest != 'restore') {
         $themeVars = $_SESSION['Layout_Settings']->getAllowedVariables();
         if (!in_array($dest, $themeVars)) {
             return PHPWS_Error::get(LAYOUT_BAD_THEME_VAR, 'layout', 'Layout_Box::move', $dest);
         }
         $themeVar = $this->theme_var;
         $this->setThemeVar($dest);
         $this->setBoxOrder(NULL);
         $this->save();
         $this->reorderBoxes($this->theme, $themeVar);
         return;
     }
     $db = new PHPWS_DB('layout_box');
     $db->addWhere('id', $this->id, '!=');
     $db->addWhere('theme', $this->theme);
     $db->addWhere('theme_var', $this->theme_var);
     $db->addOrder('box_order');
     $db->setIndexBy('box_order');
     $boxes = $db->getObjects('Layout_Box');
     if (empty($boxes)) {
         return NULL;
     }
     if (PHPWS_Error::isError($boxes)) {
         PHPWS_Error::log($boxes);
         return NULL;
     }
     switch ($dest) {
         case 'restore':
             $this->kill();
             $this->reorderBoxes($this->theme, $this->theme_var);
             Layout::resetBoxes();
             return;
             break;
         case 'move_box_up':
             if ($this->box_order == 1) {
                 $this->move('move_box_bottom');
                 return;
             } else {
                 $old_box =& $boxes[$this->box_order - 1];
                 $old_box->box_order++;
                 $this->box_order--;
                 if (!PHPWS_Error::logIfError($old_box->save())) {
                     PHPWS_Error::logIfError($this->save());
                 }
                 return;
             }
             break;
         case 'move_box_down':
             if ($this->box_order == count($boxes) + 1) {
                 $this->move('move_box_top');
                 return;
             } else {
                 $old_box =& $boxes[$this->box_order + 1];
                 $old_box->box_order--;
                 $this->box_order++;
                 if (!PHPWS_Error::logIfError($old_box->save())) {
                     PHPWS_Error::logIfError($this->save());
                 }
                 return;
             }
             break;
         case 'move_box_top':
             $this->box_order = 1;
             $this->save();
             $count = 2;
             break;
         case 'move_box_bottom':
             $this->box_order = count($boxes) + 1;
             $this->save();
             $count = 1;
             break;
     }
     foreach ($boxes as $box) {
         $box->box_order = $count;
         $box->save();
         $count++;
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:83,代码来源:Box.php

示例3: moveBox

 /**
  * 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;
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:16,代码来源:LayoutAdmin.php


注:本文中的Layout::resetBoxes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。