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

Class CWidget

CWidget is the base class for widgets.

A widget is a self-contained component that may generate presentation based on model data. It can be viewed as a micro-controller that embeds into the controller-managed views.

Compared with CController controller, a widget has neither actions nor filters.

Usage is described at CBaseController and CBaseController::widget().

CComponent
Extended by CBaseController
Extended by CWidget

Direct known subclasses

CActiveForm, CBaseListView, CJuiWidget, CMenu, CPortlet, CTabView, CTreeView, DateRangeInputsWidget, ProfileDashboardManager, ProfileLayoutEditor, X2Widget, CBasePager, CBreadcrumbs, CCaptcha, CClipWidget, CDetailView, CFilterWidget, CFlexWidget, CInputWidget

Indirect known subclasses

AccountsGridViewProfileWidget, ActionActiveForm, CallsWidget, PublisherWidget, QuickContact, QuotesGridViewProfileWidget, QuotesWidget, RecentItems, RecordAliasesWidget, RecordIndexListView, RecordView, RecordViewLayoutManager, RecordViewWidgetManager, CContentDecorator, Reminders, ServicesGridViewProfileWidget, ServiceWebFormDesigner, SmallCalendar, SocialForm, SortableWidget, SortableWidgetManager, SortableWidgets, TagCloud, TemplatesGridViewProfileWidget, CGridView, TimeActiveForm, TimeZone, TopContacts, TopicsListView, TopSites, TransactionalViewWidget, TwitterFeed, TwitterFeedWidget, TwoColumnSortableWidgetManager, UsersChartProfileWidget, ChartWidget, WebActivityWidget, WebFormDesigner, WebLeadFormDesigner, WorkflowStageDetailsWidget, X2ActiveForm, X2ActiveGridView, X2ActiveGridViewForSortableWidgets, X2ConditionList, X2GridView, X2GridViewBase, ChatBox, X2GridViewForSortableWidgets, X2GridViewGeneric, X2LeadsGridViewProfileWidget, X2ListView, X2ModelConversionWidget, X2PillBox, X2ProgressBar, X2StarRating, X2WidgetList, CHtmlPurifier, CJuiAccordion, CJuiAutoComplete, CJuiButton, CJuiDatePicker, ActionActiveFormBase, CJuiDialog, CJuiDraggable, CJuiDroppable, CJuiInputWidget, CJuiProgressBar, CJuiResizable, CJuiSelectable, CJuiSlider, CJuiSliderInput, CJuiSortable, ActionMenu, CJuiTabs, CLinkPager, CListPager, CListView, CMarkdown, CMaskedTextField, CMultiFileUpload, CommentsWidget, ContactMapInlineTags, ContactsGridViewProfileWidget, ActionsGridViewProfileWidget, COutputCache, COutputProcessor, CronForm, CStarRating, CTextHighlighter, DetailView, DocsGridViewProfileWidget, DocViewer, DocViewerProfileWidget, EmailProgressControl, ActionsWidget, EmailsWidget, EventActiveForm, EventsChartProfileWidget, EventsWidget, FileUploader, FormView, GridViewWidget, History, IframeWidget, InlineActionForm, ActiveDateRangeInput, InlineEmailForm, InlineQuotes, InlineRelationshipsGridView, InlineRelationshipsWidget, InlineTagsWidget, LeftWidget, LoggedTimeWidget, MarketingGridViewProfileWidget, MediaBox, MediaSelector, Attachments, MenuList, MessageBox, MobileActiveForm, MobileActivityFeedListView, MobileCaptcha, MobileFormLayoutRenderer, MobileLayoutRenderer, MobileRecordIndexPager, MobileTopicsPager, MobileViewLayoutRenderer, CalendarEventActiveForm, ModelFileUploader, MultiTypeAutocomplete, NewWebLeadsGridViewProfileWidget, NoteActiveForm, NoteBox, OnlineUsers, OpportunitiesGridViewProfileWidget, Panel, ProfileGridViewWidget, ProfileInfo, CallActiveForm, ProfilesGridViewProfileWidget, Publisher, PublisherActionTab, PublisherCalendarEventTab, PublisherCallTab, PublisherCommentTab, PublisherEventTab, PublisherSmallCalendarEventTab, PublisherTab, PublisherTimeTab
Package: system\web\widgets
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/widgets/CWidget.php
Methods summary
public static array
# actions( )

Returns a list of actions that are used by this widget. The structure of this method's return value is similar to that returned by CController::actions().

Returns a list of actions that are used by this widget. The structure of this method's return value is similar to that returned by CController::actions().

When a widget uses several actions, you can declare these actions using this method. The widget will then become an action provider, and the actions can be easily imported into a controller.

Note, when creating URLs referring to the actions listed in this method, make sure the action IDs are prefixed with CWidget::$actionPrefix.

Returns

array

See

CWidget::$actionPrefix
CController::actions()
public
# __construct( CBaseController $owner = null )

Constructor.

Constructor.

Parameters

$owner
CBaseController
$owner owner/creator of this widget. It could be either a widget or a controller.
public CBaseController
# getOwner( )

Returns the owner/creator of this widget.

Returns the owner/creator of this widget.

Returns

CBaseController
owner/creator of this widget. It could be either a widget or a controller.
public string
# getId( boolean $autoGenerate = true )

Returns the ID of the widget or generates a new one if requested.

Returns the ID of the widget or generates a new one if requested.

Parameters

$autoGenerate
boolean
$autoGenerate whether to generate an ID if it is not set previously

Returns

string
id of the widget.
public
# setId( string $value )

Sets the ID of the widget.

Sets the ID of the widget.

Parameters

$value
string
$value id of the widget.
public CController
# getController( )

Returns the controller that this widget belongs to.

Returns the controller that this widget belongs to.

Returns

CController
the controller that this widget belongs to.
public
# init( )

Initializes the widget. This method is called by CBaseController::createWidget() and CBaseController::beginWidget() after the widget's properties have been initialized.

Initializes the widget. This method is called by CBaseController::createWidget() and CBaseController::beginWidget() after the widget's properties have been initialized.

public
# run( )

Executes the widget. This method is called by CBaseController::endWidget().

Executes the widget. This method is called by CBaseController::endWidget().

public string
# getViewPath( boolean $checkTheme = false )

Returns the directory containing the view files for this widget. The default implementation returns the 'views' subdirectory of the directory containing the widget class file. If $checkTheme is set true, the directory "ThemeID/views/ClassName" will be returned when it exists.

Returns the directory containing the view files for this widget. The default implementation returns the 'views' subdirectory of the directory containing the widget class file. If $checkTheme is set true, the directory "ThemeID/views/ClassName" will be returned when it exists.

Parameters

$checkTheme
boolean
$checkTheme whether to check if the theme contains a view path for the widget.

Returns

string
the directory containing the view files for this widget.
public string
# getViewFile( string $viewName )

Looks for the view script file according to the view name. This method will look for the view under the widget's getViewPath viewPath. The view script file is named as "ViewName.php". A localized view file may be returned if internationalization is needed. See CApplication::findLocalizedFile() for more details. The view name can also refer to a path alias if it contains dot characters.

Looks for the view script file according to the view name. This method will look for the view under the widget's getViewPath viewPath. The view script file is named as "ViewName.php". A localized view file may be returned if internationalization is needed. See CApplication::findLocalizedFile() for more details. The view name can also refer to a path alias if it contains dot characters.

Parameters

$viewName
string
$viewName name of the view (without file extension)

Returns

string
the view file path. False if the view file does not exist

See

CApplication::findLocalizedFile()
public string
# render( string $view, array $data = null, boolean $return = false )

Renders a view.

Renders a view.

The named view refers to a PHP script (resolved via CWidget::getViewFile()) that is included by this method. If $data is an associative array, it will be extracted as PHP variables and made available to the script.

Parameters

$view
string
$view name of the view to be rendered. See CWidget::getViewFile() for details about how the view script is resolved.
$data
array
$data data to be extracted into PHP variables and made available to the view script
$return
boolean
$return whether the rendering result should be returned instead of being displayed to end users

Returns

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

Throws

CException
if the view does not exist

See

CWidget::getViewFile()
Methods inherited from CBaseController
beginCache(), beginClip(), beginContent(), beginWidget(), createWidget(), endCache(), endClip(), endContent(), endWidget(), renderFile(), renderInternal(), widget()
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()
Properties summary
public string $actionPrefix
#

the prefix to the IDs of the CWidget::actions(). When a widget is declared an action provider in CController::actions(), a prefix can be specified to differentiate its action IDs from others. The same prefix should then also be used to configure this property when the widget is used in a view of the controller.

the prefix to the IDs of the CWidget::actions(). When a widget is declared an action provider in CController::actions(), a prefix can be specified to differentiate its action IDs from others. The same prefix should then also be used to configure this property when the widget is used in a view of the controller.

public mixed $skin 'default'
#

the name of the skin to be used by this widget. Defaults to 'default'. If this is set as false, no skin will be applied to this widget.

the name of the skin to be used by this widget. Defaults to 'default'. If this is set as false, no skin will be applied to this widget.

Since

1.1

See

CWidgetFactory
Magic properties summary
public CBaseController $owner
#

Owner/creator of this widget. It could be either a widget or a controller.

Owner/creator of this widget. It could be either a widget or a controller.

public string $id
#

Id of the widget.

Id of the widget.

public CController $controller
#

The controller that this widget belongs to.

The controller that this widget belongs to.

public string $viewPath
#

The directory containing the view files for this widget.

The directory containing the view files for this widget.

API documentation generated by ApiGen 2.8.0