示例#1
0
 /**
  * Get or set the layout view that should be used in the response
  * @method layoutView
  * @static
  * @param {string} $new_view optionally set the new view, or unset it by passing false
  * @return {string}
  */
 static function layoutView($new_view = null)
 {
     if (isset($new_view)) {
         return Q_Response::$layout_view = $new_view;
     }
     if (Q_Response::$layout_view) {
         return Q_Response::$layout_view;
     }
     $app = Q_Config::expect('Q', 'app');
     $layout_view = Q_Config::get('Q', 'response', 'layout', 'html', "{$app}/layout/html.php");
     $desktop_layout_view = Q_Config::get('Q', 'response', 'layout', 'desktop', false);
     if ($desktop_layout_view) {
         $layout_view = $desktop_layout_view;
     }
     if (Q_Request::isTablet()) {
         $tablet_layout_view = Q_Config::get('Q', 'response', 'layout', 'tablet', false);
         if ($tablet_layout_view) {
             $layout_view = $tablet_layout_view;
         }
     } else {
         if (Q_Request::isMobile()) {
             $mobile_layout_view = Q_Config::get('Q', 'response', 'layout', 'mobile', false);
             if ($mobile_layout_view) {
                 $layout_view = $mobile_layout_view;
             }
         }
     }
     return $layout_view;
 }