Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • ActionActiveForm
  • ActionActiveFormBase
  • CActiveForm
  • CalendarEventActiveForm
  • CallActiveForm
  • CClipWidget
  • CContentDecorator
  • CFilterWidget
  • CFlexWidget
  • CHtmlPurifier
  • CInputWidget
  • CMarkdown
  • CMaskedTextField
  • CMultiFileUpload
  • COutputCache
  • COutputProcessor
  • CStarRating
  • CTabView
  • CTextHighlighter
  • CTreeView
  • CWidget
  • EventActiveForm
  • MobileActiveForm
  • NoteActiveForm
  • TimeActiveForm
  • X2ActiveForm
  • X2StarRating
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * CContentDecorator class file.
 4:  *
 5:  * @author Qiang Xue <qiang.xue@gmail.com>
 6:  * @link http://www.yiiframework.com/
 7:  * @copyright 2008-2013 Yii Software LLC
 8:  * @license http://www.yiiframework.com/license/
 9:  */
10: 
11: /**
12:  * CContentDecorator decorates the content it encloses with the specified view.
13:  *
14:  * CContentDecorator is mostly used to implement nested layouts, i.e., a layout
15:  * is embedded within another layout. {@link CBaseController} defines a pair of
16:  * convenient methods to use CContentDecorator:
17:  * <pre>
18:  * $this->beginContent('path/to/view');
19:  * // ... content to be decorated
20:  * $this->endContent();
21:  * </pre>
22:  *
23:  * The property {@link view} specifies the name of the view that is used to
24:  * decorate the content. In the view, the content being decorated may be
25:  * accessed with variable <code>$content</code>.
26:  *
27:  * @author Qiang Xue <qiang.xue@gmail.com>
28:  * @package system.web.widgets
29:  * @since 1.0
30:  */
31: class CContentDecorator extends COutputProcessor
32: {
33:     /**
34:      * @var mixed the name of the view that will be used to decorate the captured content.
35:      * If this property is null (default value), the default layout will be used as
36:      * the decorative view. Note that if the current controller does not belong to
37:      * any module, the default layout refers to the application's {@link CWebApplication::layout default layout};
38:      * If the controller belongs to a module, the default layout refers to the module's
39:      * {@link CWebModule::layout default layout}.
40:      */
41:     public $view;
42:     /**
43:      * @var array the variables (name=>value) to be extracted and made available in the decorative view.
44:      */
45:     public $data=array();
46: 
47:     /**
48:      * Processes the captured output.
49:      * This method decorates the output with the specified {@link view}.
50:      * @param string $output the captured output to be processed
51:      */
52:     public function processOutput($output)
53:     {
54:         $output=$this->decorate($output);
55:         parent::processOutput($output);
56:     }
57: 
58:     /**
59:      * Decorates the content by rendering a view and embedding the content in it.
60:      * The content being embedded can be accessed in the view using variable <code>$content</code>
61:      * The decorated content will be displayed directly.
62:      * @param string $content the content to be decorated
63:      * @return string the decorated content
64:      */
65:     protected function decorate($content)
66:     {
67:         $owner=$this->getOwner();
68:         if($this->view===null)
69:             $viewFile=Yii::app()->getController()->getLayoutFile(null);
70:         else
71:             $viewFile=$owner->getViewFile($this->view);
72:         if($viewFile!==false)
73:         {
74:             $data=$this->data;
75:             $data['content']=$content;
76:             return $owner->renderFile($viewFile,$data,true);
77:         }
78:         else
79:             return $content;
80:     }
81: }
82: 
API documentation generated by ApiGen 2.8.0