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

  • ActionFormModelBase
  • CActiveDataProvider
  • CalendarEventFormModel
  • CallFormModel
  • CArrayDataProvider
  • CAssetManager
  • CBaseController
  • CBaseUrlRule
  • CCacheHttpSession
  • CClientScript
  • CController
  • CCookieCollection
  • CDataProvider
  • CDataProviderIterator
  • CDbHttpSession
  • CExtController
  • CFormModel
  • CHttpCookie
  • CHttpRequest
  • CHttpSession
  • CHttpSessionIterator
  • COutputEvent
  • CPagination
  • CreatePageFormModel
  • CSort
  • CSqlDataProvider
  • CTheme
  • CThemeManager
  • CUploadedFile
  • CUrlManager
  • CUrlRule
  • CWebApplication
  • CWebModule
  • CWidgetFactory
  • EditMobileFormsFormModel
  • EventCommentPublisherFormModel
  • EventFormModel
  • EventPublisherFormModel
  • FileSystemObjectDataProvider
  • MassActionFormModel
  • MobilePagination
  • NoteFormModel
  • NotificationsController
  • TimeFormModel
  • UploadLogoFormModel
  • X2FormModel
  • X2HttpRequest

Interfaces

  • IDataProvider
  • IWidgetFactory
  • Overview
  • Package
  • Class
  • Tree

Class CBaseController

CBaseController is the base class for CController and CWidget.

It provides the common functionalities shared by controllers who need to render views.

CBaseController also implements the support for the following features:
  • CClipWidget Clips : a clip is a piece of captured output that can be inserted elsewhere.
  • CWidget Widgets : a widget is a self-contained sub-controller with its own view and model.
  • COutputCache Fragment cache : fragment cache selectively caches a portion of the output.

To use a widget in a view, use the following in the view:

$this->widget('path.to.widgetClass',array('property1'=>'value1',...));

or

$this->beginWidget('path.to.widgetClass',array('property1'=>'value1',...));
// ... display other contents here
$this->endWidget();

To create a clip, use the following:

$this->beginClip('clipID');
// ... display the clip contents
$this->endClip();

Then, in a different view or place, the captured clip can be inserted as:

echo $this->clips['clipID'];

Note that $this in the code above refers to current controller so, for example, if you need to access clip from a widget where $this refers to widget itself you need to do it the following way:

echo $this->getController()->clips['clipID'];

To use fragment cache, do as follows,

if($this->beginCache('cacheID',array('property1'=>'value1',...))
{
    // ... display the content to be cached here
   $this->endCache();
}
CComponent
Extended by CBaseController

Direct known subclasses

CController, CWidget

Indirect known subclasses

AccountsController, AccountsGridViewProfileWidget, Api2Controller, MessageBox, MobileActiveForm, MobileActivityFeedListView, MobileCaptcha, MobileController, MobileFormLayoutRenderer, MobileLayoutRenderer, MobileRecordIndexPager, MobileTopicsPager, MobileViewLayoutRenderer, ApiController, ModelFileUploader, MultiTypeAutocomplete, NewWebLeadsGridViewProfileWidget, NoteActiveForm, NoteBox, NotificationsController, OnlineUsers, OpportunitiesController, OpportunitiesGridViewProfileWidget, Panel, Attachments, ProductsController, ProfileController, ProfileDashboardManager, ProfileGridViewWidget, ProfileInfo, ProfileLayoutEditor, ProfilesGridViewProfileWidget, Publisher, PublisherActionTab, PublisherCalendarEventTab, BugReportsController, PublisherCallTab, PublisherCommentTab, PublisherEventTab, PublisherSmallCalendarEventTab, PublisherTab, PublisherTimeTab, PublisherWidget, QuickContact, QuotesController, QuotesGridViewProfileWidget, CActiveForm, QuotesWidget, RecentItems, RecordAliasesWidget, RecordIndexListView, RecordView, RecordViewLayoutManager, RecordViewWidgetManager, RelationshipsController, Reminders, SearchController, CalendarController, ServicesController, ServicesGridViewProfileWidget, ServiceWebFormDesigner, SiteController, SmallCalendar, SocialForm, SortableWidget, SortableWidgetManager, SortableWidgets, StudioController, CalendarEventActiveForm, TagCloud, TemplatesController, TemplatesGridViewProfileWidget, TimeActiveForm, TimeZone, TopContacts, TopicsController, TopicsListView, TopSites, TransactionalViewWidget, CallActiveForm, TwitterFeed, TwitterFeedWidget, TwoColumnSortableWidgetManager, UsersChartProfileWidget, UsersController, WebActivityWidget, WebFormDesigner, WebLeadFormDesigner, WorkflowController, WorkflowStageDetailsWidget, CallsWidget, X2ActiveForm, X2ActiveGridView, X2ActiveGridViewForSortableWidgets, x2base, X2ConditionList, X2Controller, X2GridView, X2GridViewBase, X2GridViewForSortableWidgets, X2GridViewGeneric, CBaseListView, X2LeadsController, X2LeadsGridViewProfileWidget, X2ListView, X2ModelConversionWidget, X2PillBox, X2ProgressBar, X2StarRating, X2Widget, X2WidgetList, ActionActiveForm, CBasePager, CBreadcrumbs, CCaptcha, CClipWidget, CContentDecorator, CDetailView, CExtController, CFilterWidget, CFlexWidget, CGridView, ActionActiveFormBase, ChartWidget, ChatBox, CHtmlPurifier, CInputWidget, CJuiAccordion, CJuiAutoComplete, CJuiButton, CJuiDatePicker, CJuiDialog, CJuiDraggable, ActionMenu, CJuiDroppable, CJuiInputWidget, CJuiProgressBar, CJuiResizable, CJuiSelectable, CJuiSlider, CJuiSliderInput, CJuiSortable, CJuiTabs, CJuiWidget, ActionsController, CLinkPager, CListPager, CListView, CMarkdown, CMaskedTextField, CMenu, CMultiFileUpload, CommentsWidget, ContactMapInlineTags, ContactsController, ActionsGridViewProfileWidget, ContactsGridViewProfileWidget, COutputCache, COutputProcessor, CPortlet, CronForm, CStarRating, CTabView, CTextHighlighter, CTreeView, DateRangeInputsWidget, ActionsWidget, DetailView, DocsController, DocsGridViewProfileWidget, DocViewer, DocViewerProfileWidget, EmailProgressControl, EmailsWidget, EventActiveForm, EventsChartProfileWidget, EventsWidget, ActiveDateRangeInput, FileUploader, FormView, GridViewWidget, GroupsController, History, IframeWidget, InlineActionForm, InlineEmailForm, InlineQuotes, InlineRelationshipsGridView, AdminController, InlineRelationshipsWidget, InlineTagsWidget, LeftWidget, LoggedTimeWidget, MarketingController, MarketingGridViewProfileWidget, MediaBox, MediaController, MediaSelector, MenuList
Abstract
Package: system\web
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/web/CBaseController.php
Methods summary
abstract public string
# getViewFile( string $viewName )

Returns the view script file according to the specified view name. This method must be implemented by child classes.

Returns the view script file according to the specified view name. This method must be implemented by child classes.

Parameters

$viewName
string
$viewName view name

Returns

string
the file path for the named view. False if the view cannot be found.
public string
# renderFile( string $viewFile, array $data = null, boolean $return = false )

Renders a view file.

Renders a view file.

Parameters

$viewFile
string
$viewFile view file path
$data
array
$data data to be extracted and made available to the view
$return
boolean
$return whether the rendering result should be returned instead of being echoed

Returns

string
the rendering result. Null if the rendering result is not required.

Throws

CException
if the view file does not exist
public string
# renderInternal( string $_viewFile_, array $_data_ = null, boolean $_return_ = false )

Renders a view file. This method includes the view file as a PHP script and captures the display result if required.

Renders a view file. This method includes the view file as a PHP script and captures the display result if required.

Parameters

$_viewFile_
string
$_viewFile_ view file
$_data_
array
$_data_ data to be extracted and made available to the view file
$_return_
boolean
$_return_ whether the rendering result should be returned as a string

Returns

string
the rendering result. Null if the rendering result is not required.
public CWidget
# createWidget( string $className, array $properties = array() )

Creates a widget and initializes it. This method first creates the specified widget instance. It then configures the widget's properties with the given initial values. At the end it calls CWidget::init() to initialize the widget. Starting from version 1.1, if a CWidgetFactory widget factory is enabled, this method will use the factory to create the widget, instead.

Creates a widget and initializes it. This method first creates the specified widget instance. It then configures the widget's properties with the given initial values. At the end it calls CWidget::init() to initialize the widget. Starting from version 1.1, if a CWidgetFactory widget factory is enabled, this method will use the factory to create the widget, instead.

Parameters

$className
string
$className class name (can be in path alias format)
$properties
array
$properties initial property values

Returns

CWidget
the fully initialized widget instance.
public mixed
# widget( string $className, array $properties = array(), boolean $captureOutput = false )

Creates a widget and executes it.

Creates a widget and executes it.

Parameters

$className
string
$className the widget class name or class in dot syntax (e.g. application.widgets.MyWidget)
$properties
array
$properties list of initial property values for the widget (Property Name => Property Value)
$captureOutput
boolean
$captureOutput whether to capture the output of the widget. If true, the method will capture and return the output generated by the widget. If false, the output will be directly sent for display and the widget object will be returned. This parameter is available since version 1.1.2.

Returns

mixed
the widget instance when $captureOutput is false, or the widget output when $captureOutput is true.
public CWidget
# beginWidget( string $className, array $properties = array() )

Creates a widget and executes it. This method is similar to CBaseController::widget() except that it is expecting a CBaseController::endWidget() call to end the execution.

Creates a widget and executes it. This method is similar to CBaseController::widget() except that it is expecting a CBaseController::endWidget() call to end the execution.

Parameters

$className
string
$className the widget class name or class in dot syntax (e.g. application.widgets.MyWidget)
$properties
array
$properties list of initial property values for the widget (Property Name => Property Value)

Returns

CWidget
the widget created to run

See

CBaseController::endWidget()
public CWidget
# endWidget( string $id = '' )

Ends the execution of the named widget. This method is used together with CBaseController::beginWidget().

Ends the execution of the named widget. This method is used together with CBaseController::beginWidget().

Parameters

$id
string
$id optional tag identifying the method call for debugging purpose.

Returns

CWidget
the widget just ended running

Throws

CException
if an extra endWidget call is made

See

CBaseController::beginWidget()
public
# beginClip( string $id, array $properties = array() )

Begins recording a clip. This method is a shortcut to beginning CClipWidget.

Begins recording a clip. This method is a shortcut to beginning CClipWidget.

Parameters

$id
string
$id the clip ID.
$properties
array
$properties initial property values for CClipWidget.
public
# endClip( )

Ends recording a clip. This method is an alias to CBaseController::endWidget().

Ends recording a clip. This method is an alias to CBaseController::endWidget().

public boolean
# beginCache( string $id, array $properties = array() )

Begins fragment caching. This method will display cached content if it is availabe. If not, it will start caching and would expect a CBaseController::endCache() call to end the cache and save the content into cache. A typical usage of fragment caching is as follows,

if($this->beginCache($id))
{
    // ...generate content here
    $this->endCache();
}

Begins fragment caching. This method will display cached content if it is availabe. If not, it will start caching and would expect a CBaseController::endCache() call to end the cache and save the content into cache. A typical usage of fragment caching is as follows,

if($this->beginCache($id))
{
    // ...generate content here
    $this->endCache();
}

Parameters

$id
string
$id a unique ID identifying the fragment to be cached.
$properties
array
$properties initial property values for COutputCache.

Returns

boolean
whether we need to generate content for caching. False if cached version is available.

See

CBaseController::endCache()
public
# endCache( )

Ends fragment caching. This is an alias to CBaseController::endWidget().

Ends fragment caching. This is an alias to CBaseController::endWidget().

See

CBaseController::beginCache()
public
# beginContent( mixed $view = null, array $data = array() )

Begins the rendering of content that is to be decorated by the specified view.

Begins the rendering of content that is to be decorated by the specified view.

Parameters

$view
mixed
$view the name of the view that will be used to decorate the content. The actual view script is resolved via CBaseController::getViewFile(). If this parameter is null (default), the default layout will be used as the decorative view. Note that if the current controller does not belong to any module, the default layout refers to the application's CWebApplication::layout default layout; If the controller belongs to a module, the default layout refers to the module's CWebModule::layout default layout.
$data
array
$data the variables (name=>value) to be extracted and made available in the decorative view.

See

CBaseController::endContent()
CContentDecorator
public
# endContent( )

Ends the rendering of content.

Ends the rendering of content.

See

CBaseController::beginContent()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
API documentation generated by ApiGen 2.8.0