Overview

Packages

  • Actions
  • Codegen
  • Controls
    • Base
  • DatabaseAdapters
  • Events
  • None
  • Sessions
  • Tests

Classes

  • AbstractControl_CodeGenerator
  • AjaxTimingForm
  • BasicForm
  • BasicOrmTests
  • BBCodeParser
  • CacheTests
  • CalculatorForm
  • CalculatorWidget
  • ComplexColumn
  • DataRepeaterExample
  • Event
  • ExampleCheckColumn1
  • ExampleCheckColumn2
  • ExampleForm
  • Examples
  • ExampleService
  • ExamplesForm
  • ExampleSingleForm
  • ExpandAsArrayTests
  • HtmlJqDoc
  • InjectForm
  • JavaScriptHelper
  • JqAttributes
  • JqControlGen
  • JqDoc
  • JqIcon
  • Method
  • ModelConnectorTests
  • MyControl
  • MyQSlider_ChangeEvent
  • NavPanel
  • NestedTabForm
  • Option
  • Order
  • PaginatorForm
  • ParamsForm
  • PersistentExampleForm
  • PersonEditPanel
  • PluginEditForm
  • PluginManagerForm
  • Project
  • ProjectEditPanel
  • ProjectListForm
  • ProjectPickerListBox
  • ProjectViewPanel
  • QAbstractCacheProvider
  • QAbstractHtmlTableColumn
  • QAbstractHtmlTableDataColumn
  • QAccordion
  • QAccordion_ActivateEvent
  • QAccordion_BeforeActivateEvent
  • QAccordion_CreateEvent
  • QAccordionBase
  • QAccordionGen
  • QAction
  • QActionControl
  • QAjaxAction
  • QAjaxControlAction
  • QAjaxResponse
  • QAlertAction
  • QApplication
  • QApplicationBase
  • QArchive
  • QAutocomplete
  • QAutocomplete_ChangeEvent
  • QAutocomplete_CloseEvent
  • QAutocomplete_CodeGenerator
  • QAutocomplete_CreateEvent
  • QAutocomplete_FocusEvent
  • QAutocomplete_OpenEvent
  • QAutocomplete_ResponseEvent
  • QAutocomplete_SearchEvent
  • QAutocomplete_SelectEvent
  • QAutocomplete_SourceEvent
  • QAutocompleteBase
  • QAutocompleteBase_CodeGenerator
  • QAutocompleteGen
  • QAutocompleteListItem
  • QBackspaceKeyEvent
  • QBaseClass
  • QBlockControl
  • QBlurControlAction
  • QBlurEvent
  • QBorderCollapse
  • QBorderStyle
  • QBrowserType
  • QButton
  • QButtonBase
  • QCache
  • QCacheDeleteAction
  • QCacheDeleteAllAction
  • QCacheProviderAPC
  • QCacheProviderLocalMemory
  • QCacheProviderLocalMemoryTest
  • QCacheProviderMemcache
  • QCacheProviderNoCache
  • QCacheProviderProxy
  • QCacheSetAction
  • QCalendar
  • QCalendarType
  • QCallType
  • QCausesValidation
  • QCellClickEvent
  • QChangeEvent
  • QCheckBox
  • QCheckBox_CodeGenerator
  • QCheckBoxBase_CodeGenerator
  • QCheckBoxLegacyColumn
  • QCheckBoxList
  • QCheckBoxList_CodeGenerator
  • QCheckBoxListBase_CodeGenerator
  • QClickEvent
  • QCodeGen
  • QCodeGenBase
  • QConfirmAction
  • QContextMenuEvent
  • QControl
  • QControl_CodeGenerator
  • QControlBase
  • QControlBase_CodeGenerator
  • QControlBaseTests
  • QControlCategoryType
  • QControlGrouping
  • QControlLabel
  • QControlProxy
  • QConvertNotation
  • QConvertNotationBase
  • QCrossScripting
  • QCryptography
  • QCss
  • QCssAction
  • QCssClassAction
  • QCssTests
  • QCsvTextBox
  • QCursor
  • QDatabaseBase
  • QDatabaseCodeGen
  • QDatabaseFieldBase
  • QDatabaseFieldType
  • QDatabaseForeignKey
  • QDatabaseIndex
  • QDatabaseResultBase
  • QDatabaseRowBase
  • QDatabaseTests
  • QDataGrid
  • QDataGrid_CheckBoxColumn
  • QDataGrid_CodeGenerator
  • QDataGrid_SortEvent
  • QDataGridBase
  • QDataGridBase_CodeGenerator
  • QDataGridLegacy
  • QDataGridLegacyBase
  • QDataGridLegacyColumn
  • QDataGridLegacyRow
  • QDataGridLegacyRowStyle
  • QDataRepeater
  • QDatepicker
  • QDatepicker_BeforeShowDayEvent
  • QDatepicker_BeforeShowEvent
  • QDatepicker_CalculateWeekEvent
  • QDatepicker_ChangeMonthYearEvent
  • QDatepicker_CloseEvent
  • QDatepicker_SelectEvent
  • QDatepicker_SelectEvent2
  • QDatepickerBase
  • QDatepickerBox
  • QDatepickerBox_BeforeShowDayEvent
  • QDatepickerBox_BeforeShowEvent
  • QDatepickerBox_CalculateWeekEvent
  • QDatepickerBox_ChangeMonthYearEvent
  • QDatepickerBox_CloseEvent
  • QDatepickerBox_CodeGenerator
  • QDatepickerBox_SelectEvent
  • QDatepickerBoxBase
  • QDatepickerBoxBase_CodeGenerator
  • QDatepickerBoxGen
  • QDatepickerGen
  • QDateTime
  • QDateTimePicker
  • QDateTimePicker_CodeGenerator
  • QDateTimePickerBase_CodeGenerator
  • QDateTimePickerFormat
  • QDateTimePickerType
  • QDateTimeSpan
  • QDateTimeTests
  • QDateTimeTextBox
  • QDbBackedFormStateHandler
  • QDbBackedSessionHandler
  • QDialog
  • QDialog_BeforeCloseEvent
  • QDialog_ButtonEvent
  • QDialog_CloseEvent
  • QDialog_CreateEvent
  • QDialog_DragEvent
  • QDialog_DragStartEvent
  • QDialog_DragStopEvent
  • QDialog_FocusEvent
  • QDialog_OpenEvent
  • QDialog_ResizeEvent
  • QDialog_ResizeStartEvent
  • QDialog_ResizeStopEvent
  • QDialogBase
  • QDialogBox
  • QDialogGen
  • QDisplayStyle
  • QDoubleClickEvent
  • QDownArrowKeyEvent
  • QDragDropEvent
  • QDraggable
  • QDraggable_CreateEvent
  • QDraggable_DragEvent
  • QDraggable_StartEvent
  • QDraggable_StopEvent
  • QDraggableBase
  • QDraggableGen
  • QDroppable
  • QDroppable_ActivateEvent
  • QDroppable_CreateEvent
  • QDroppable_DeactivateEvent
  • QDroppable_DropEvent
  • QDroppable_OutEvent
  • QDroppable_OverEvent
  • QDroppableBase
  • QDroppableGen
  • QDropZoneGrouping
  • QEmailAttachment
  • QEmailMessage
  • QEmailServer
  • QEmailStringAttachment
  • QEmailTextBox
  • QEnterKeyEvent
  • QErrorAttribute
  • QEscapeKeyEvent
  • QEvent
  • QFieldset
  • QFile
  • QFileAsset
  • QFileAssetBase
  • QFileAssetDialog
  • QFileAssetType
  • QFileControl
  • QFileFormStateHandler
  • QFilterType
  • QFloatTextBox
  • QFloatTextBox_CodeGenerator
  • QFloatTextBoxBase_CodeGenerator
  • QFocusControlAction
  • QFocusEvent
  • QFocusInEvent
  • QFocusOutEvent
  • QFolder
  • QFontFamily
  • QForm
  • QFormBase
  • QFormGen
  • QFormStateHandler
  • QGridLines
  • QHideCalendarAction
  • QHideDialog
  • QHideDialogBox
  • QHListControl
  • QHListItem
  • QHorizontalAlign
  • QHtml
  • QHtmlAttributeManager
  • QHtmlAttributeManagerBase
  • QHtmlReporter
  • QHtmlTable
  • QHtmlTable_CodeGenerator
  • QHtmlTableBase
  • QHtmlTableCallableColumn
  • QHtmlTableCheckBoxColumn
  • QHtmlTableCheckBoxColumn_ClickEvent
  • QHtmlTableIndexedColumn
  • QHtmlTableLinkColumn
  • QHtmlTableNodeColumn
  • QHtmlTablePropertyColumn
  • QI18n
  • QI18nTests
  • QImageBase
  • QImageBrowser
  • QImageBrowserBase
  • QImageBrowserNav
  • QImageBrowserThumbnails
  • QImageButton
  • QImageControl
  • QImageControlBase
  • QImageFileAsset
  • QImageLabel
  • QImageLabelBase
  • QImageRollover
  • QImageType
  • QIndex
  • QInformixPdoDatabase
  • QInformixPdoDatabaseField
  • QInformixPdoDatabaseResult
  • QInformixPdoDatabaseRow
  • QInputEvent
  • QInstallationValidationResult
  • QInstallationValidator
  • QIntegerTextBox
  • QIntegerTextBox_CodeGenerator
  • QIntegerTextBoxBase_CodeGenerator
  • QJavaScriptAction
  • QJQAction
  • QJQBounceAction
  • QJqButton
  • QJqButton_CreateEvent
  • QJqButtonBase
  • QJqButtonGen
  • QJqCheckBox
  • QJqCheckBox_CreateEvent
  • QJqCheckBoxBase
  • QJqCheckBoxGen
  • QJQHideAction
  • QJQHideEffectAction
  • QJQHighlightAction
  • QJQPulsateAction
  • QJqRadioButton
  • QJqRadioButton_CreateEvent
  • QJqRadioButtonBase
  • QJqRadioButtonGen
  • QJQShakeAction
  • QJQShowAction
  • QJQShowEffectAction
  • QJQSizeAction
  • QJQToggleAction
  • QJQToggleEffectAction
  • QJQTransferAction
  • QJqUiEvent
  • QJqUiPropertyEvent
  • QJsClosure
  • QJsFunction
  • QJsNoQuoteKey
  • QJsParameterList
  • QJsPriority
  • QJsTimer
  • QJsTimerBase
  • QJsVarName
  • QKeyDownEvent
  • QKeyPressEvent
  • QKeyUpEvent
  • QLabel
  • QLabel_CodeGenerator
  • QLabelBase_CodeGenerator
  • QLexer
  • QLinkButton
  • QListBox
  • QListBox_CodeGenerator
  • QListBoxBase
  • QListBoxBase_CodeGenerator
  • QListControl
  • QListControl_CodeGenerator
  • QListControlBase_CodeGenerator
  • QListItem
  • QListItemBase
  • QListItemStyle
  • QManyToManyReference
  • QMenu
  • QMenu_BlurEvent
  • QMenu_CreateEvent
  • QMenu_FocusEvent
  • QMenu_SelectEvent
  • QMenuBase
  • QMenuGen
  • QMimeType
  • QModelConnectorArgumentType
  • QModelConnectorCreateType
  • QModelConnectorEditDlg
  • QModelConnectorOptions
  • QModelConnectorParam
  • QMouseDownEvent
  • QMouseEnterEvent
  • QMouseLeaveEvent
  • QMouseMoveEvent
  • QMouseOutEvent
  • QMouseOverEvent
  • QMouseUpEvent
  • QMultiLevelCacheProvider
  • QMySqlDatabase
  • QMySqlDatabaseField
  • QMySqlDatabaseResult
  • QMySqli5ClusterDatabase
  • QMySqli5Database
  • QMySqli5DatabaseField
  • QMySqli5DatabaseResult
  • QMySqliDatabase
  • QMySqliDatabaseField
  • QMySqliDatabaseResult
  • QMySqliDatabaseRow
  • QNoScriptAjaxAction
  • QNumericTextBox
  • QOnEvent
  • QOracleDatabase
  • QOracleDatabaseField
  • QOracleDatabaseResult
  • QOracleDatabaseRow
  • QOrderedListType
  • QOverflow
  • QPaginatedControl
  • QPaginator
  • QPaginatorBase
  • QPanel
  • QPartialQueryBuilder
  • QPdoDatabase
  • QPdoDatabaseResult
  • QPgConditionILike
  • QPgConditionJsonContains
  • QPgQ
  • QPosition
  • QPostgreSqlDatabase
  • QPostgreSqlDatabaseField
  • QPostgreSqlDatabaseResult
  • QPostgreSqlDatabaseRow
  • QPostgreSqlPdoDatabase
  • QPostgreSqlPdoDatabaseField
  • QPostgreSqlPdoDatabaseResult
  • QPostgreSqlPdoDatabaseRow
  • QProgressbar
  • QProgressbar_ChangeEvent
  • QProgressbar_CompleteEvent
  • QProgressbar_CreateEvent
  • QProgressbarBase
  • QProgressbarGen
  • QQ
  • QQAggregationClause
  • QQAliasTests
  • QQAssociationNode
  • QQAverage
  • QQClause
  • QQColumnNode
  • QQCondition
  • QQConditionAll
  • QQConditionAnd
  • QQConditionBetween
  • QQConditionComparison
  • QQConditionEqual
  • QQConditionExists
  • QQConditionGreaterOrEqual
  • QQConditionGreaterThan
  • QQConditionIn
  • QQConditionIsNotNull
  • QQConditionIsNull
  • QQConditionLessOrEqual
  • QQConditionLessThan
  • QQConditionLike
  • QQConditionLogical
  • QQConditionNone
  • QQConditionNot
  • QQConditionNotBetween
  • QQConditionNotEqual
  • QQConditionNotExists
  • QQConditionNotIn
  • QQConditionNotLike
  • QQConditionOr
  • QQCount
  • QQDistinct
  • QQExpand
  • QQExpandAsArray
  • QQExpandVirtualNode
  • QQFuncTests
  • QQFunctionNode
  • QQGroupBy
  • QQHavingClause
  • QQLimitInfo
  • QQMathNode
  • QQMathOpTests
  • QQMaximum
  • QQMinimum
  • QQNamedValue
  • QQNode
  • QQNoParentNode
  • QQOrderBy
  • QQReverseReferenceNode
  • QQSelect
  • QQSubQueryCountNode
  • QQSubQueryNode
  • QQSubQuerySqlNode
  • QQSum
  • QQTableNode
  • QQuery
  • QQueryBuilder
  • QQueryExpansion
  • QQVirtualNode
  • QRadioButton
  • QRadioButtonList
  • QRadioButtonList_CodeGenerator
  • QRadioButtonListBase_CodeGenerator
  • QRedirectAction
  • QReference
  • QRegex
  • QRegisterClickPositionAction
  • QRepeatDirection
  • QRequestMode
  • QResetTimerAction
  • QResizable
  • QResizable_CreateEvent
  • QResizable_ResizeEvent
  • QResizable_StartEvent
  • QResizable_StopEvent
  • QResizableBase
  • QResizableGen
  • QResizeHandleDirection
  • QRestServiceCodeGen
  • QReverseReference
  • QRssCategory
  • QRssFeed
  • QRssImage
  • QRssItem
  • QSampleControl
  • QSampleTranslation
  • QSelectable
  • QSelectable_CreateEvent
  • QSelectable_SelectedEvent
  • QSelectable_SelectingEvent
  • QSelectable_StartEvent
  • QSelectable_StopEvent
  • QSelectable_UnselectedEvent
  • QSelectable_UnselectingEvent
  • QSelectableBase
  • QSelectableGen
  • QSelectControlAction
  • QSelectEvent
  • QSelectionMode
  • QSelectMenu
  • QSelectMenu_ChangeEvent
  • QSelectMenu_CloseEvent
  • QSelectMenu_CreateEvent
  • QSelectMenu_FocusEvent
  • QSelectMenu_OpenEvent
  • QSelectMenu_SelectEvent
  • QSelectMenuBase
  • QSelectMenuGen
  • QServerAction
  • QServerControlAction
  • QSessionFormStateHandler
  • QSetValueAction
  • QShowCalendarAction
  • QShowDialog
  • QShowDialogBox
  • QSlider
  • QSlider_ChangeEvent
  • QSlider_CodeGenerator
  • QSlider_CreateEvent
  • QSlider_SlideEvent
  • QSlider_StartEvent
  • QSlider_StopEvent
  • QSliderBase
  • QSliderBase_CodeGenerator
  • QSliderGen
  • QSoapMethod
  • QSoapParameter
  • QSoapService
  • QSortable
  • QSortable_ActivateEvent
  • QSortable_BeforeStopEvent
  • QSortable_ChangeEvent
  • QSortable_CreateEvent
  • QSortable_DeactivateEvent
  • QSortable_OutEvent
  • QSortable_OverEvent
  • QSortable_ReceiveEvent
  • QSortable_RemoveEvent
  • QSortable_SortEvent
  • QSortable_StartEvent
  • QSortable_StopEvent
  • QSortable_UpdateEvent
  • QSortableBase
  • QSortableGen
  • QSpinner
  • QSpinner_ChangeEvent
  • QSpinner_CreateEvent
  • QSpinner_SpinEvent
  • QSpinner_StartEvent
  • QSpinner_StopEvent
  • QSpinnerBase
  • QSpinnerGen
  • QSqlColumn
  • QSqLite3PdoDatabase
  • QSqLite3PdoDatabaseField
  • QSqLite3PdoDatabaseResult
  • QSqLite3PdoDatabaseRow
  • QSqlServer2005Database
  • QSqlServer2005DatabaseField
  • QSqlServer2005DatabaseResult
  • QSqlServer2005DatabaseRow
  • QSqlServerDatabase
  • QSqlServerDatabaseField
  • QSqlServerDatabaseResult
  • QSqlServerDatabaseRow
  • QSqlTable
  • QStack
  • QStopPropagationAction
  • QString
  • QStringTest
  • QTabKeyEvent
  • QTabs
  • QTabs_ActivateEvent
  • QTabs_BeforeActivateEvent
  • QTabs_BeforeLoadEvent
  • QTabs_CreateEvent
  • QTabs_LoadEvent
  • QTabsBase
  • QTabsGen
  • QTag
  • QTagStyler
  • QTerminateAction
  • QTestControl
  • QTestForm
  • QTextAlign
  • QTextBox
  • QTextBox_CodeGenerator
  • QTextBoxBase
  • QTextBoxBase_CodeGenerator
  • QTextMode
  • QTimer
  • QTimerExpiredEvent
  • QTimerTests
  • QToggleCssClassAction
  • QToggleDisplayAction
  • QToggleEnableAction
  • QTranslationPoParser
  • QTreeNav
  • QTreeNavItem
  • QType
  • QTypeTable
  • QTypeTests
  • QUnitTestCaseBase
  • QUnorderedListStyle
  • QUpArrowKeyEvent
  • QUrlTextBox
  • QVerticalAlign
  • QVirtualAttributeColumn
  • QWaitIcon
  • QWatcher
  • QWatcherBase
  • QWatcherCache
  • QWatcherDB
  • QWatcherNone
  • QWriteBox
  • RecordsSummary
  • RefreshForm
  • SampleComposite
  • SampleForm
  • SelectableLabel
  • SelectForm
  • SpeedForm
  • TestImageBrowser
  • UrlForm

Interfaces

  • ICacheAction
  • QDataList_CodeGenerator_Interface
  • QTranslationBase

Traits

  • QDataBinder
  • QListItemManager
  • QModelTrait

Exceptions

  • QCallerException
  • QCrossScriptingException
  • QCryptographyException
  • QDatabaseExceptionBase
  • QDataBindException
  • QDateTimeNullException
  • QEmailException
  • QIndexOutOfRangeException
  • QInformixPdoDatabaseException
  • QInvalidCastException
  • QInvalidFormStateException
  • QMySqliDatabaseException
  • QOptimisticLockingException
  • QOracleDatabaseException
  • QPdoDatabaseException
  • QPoParserException
  • QPostgreSqlDatabaseException
  • QPostgreSqlPdoDatabaseException
  • QRemoteAdminDeniedException
  • QSqLite3PdoDatabaseException
  • QSqlServer2005DatabaseException
  • QSqlServerDatabaseException
  • QUndefinedMethodException
  • QUndefinedPrimaryKeyException
  • QUndefinedPropertyException

Functions

  • __database_check_error
  • __QForm_EvaluateTemplate_ObHandler
  • _b
  • _indent
  • _nl
  • _p
  • _r
  • _t
  • _tp
  • _tr
  • array_trim
  • beginsWith
  • CamelCaseFromDash
  • CastToInt
  • DataGridEvalHandleError
  • DisplayMonospacedText
  • endsWith
  • GO_BACK
  • jq_anytime_gen
  • jq_control_gen
  • jq_inc_gen
  • jq_indent
  • PrintExplainStatement
  • PrintInstructions
  • QcubedHandleCodeGenParseError
  • QcubedHandleError
  • QcubedHandleException
  • QCubedShutdown
  • QDateTimeErrorHandler
  • trimOffEnd
  • trimOffFront
  • Overview
  • Package
  • Class
  1: <?php
  2: /**
  3:  * This file contains the QImageBrowser class and supporting classes.
  4:  *
  5:  * @package Controls
  6:  */
  7: 
  8: /**
  9:  * Control for a simple image browser.
 10:  *
 11:  * The browser can have one or two navigation bars (with 4 buttons allowing to go back and forward,
 12:  * and to the first and last images). It can also have a caption textbox, which can be editable.
 13:  * A thumbnails panel is also provided with the browser. The layout is fully controlled by css.
 14:  *
 15:  * It is designed to allow almost every aspect of the browser to be customized. However typical defaults
 16:  * are provided so in a simple case it can be used "out-of-the-box" (see the example).
 17:  *
 18:  * QImageBrowserBase is the abstract class that you may want to subclass if you need to customize
 19:  * some functionality (such us the source of the images or how to load/save the captions). See the comments in
 20:  * this class for details about how it can be customized. A concrete implementation called QImageBrowser is also
 21:  * provided, which loads the images from a directory.
 22:  *
 23:  * QImageBrowserNav represents the simple 4 button navigation panel, it has getters and setters for all the
 24:  * buttons, so you can replace the default buttons by anything you'd like (such as image buttons).
 25:  *
 26:  * QImageBrowserThumbnails represents the tumbnails navigation panel.
 27:  *
 28:  * @package Controls
 29:  * @property QButton FirstButton the button to go to the first image
 30:  * @property QButton PrevButton the button to go to the previous image
 31:  * @property QButton NextButton the button to go to the next image
 32:  * @property QButton LastButton the button to go to the last image
 33:  *
 34:  */
 35:     class QImageBrowserNav extends QPanel {
 36:         protected $btnFirst;
 37:         protected $btnPrev;
 38:         protected $btnNext;
 39:         protected $btnLast;
 40:         
 41:         public function __construct($objParentObject, $strControlId = null) {
 42:             // Call the Parent
 43:             try {
 44:                 parent::__construct($objParentObject, $strControlId);
 45:             } catch (QCallerException $objExc) {
 46:                 $objExc->IncrementOffset();
 47:                 throw $objExc;
 48:             }
 49:             $this->AutoRenderChildren = true;
 50:             
 51:             $this->btnFirst = new QButton($this);
 52:             $this->btnFirst->Text = QApplication::Translate('First');
 53:             $this->btnFirst->Enabled = false;
 54:             $this->btnFirst->CssClass = 'button ib_nav_button ib_nav_button_first';
 55: 
 56:             $this->btnPrev = new QButton($this);
 57:             $this->btnPrev->Text = QApplication::Translate('Previous');
 58:             $this->btnPrev->Enabled = false;
 59:             $this->btnPrev->CssClass = 'button ib_nav_button ib_nav_button_prev';
 60: 
 61:             $this->btnNext = new QButton($this);
 62:             $this->btnNext->Text = QApplication::Translate('Next');
 63:             $this->btnNext->Enabled = false;
 64:             $this->btnNext->CssClass = 'button ib_nav_button ib_nav_button_next';
 65: 
 66:             $this->btnLast = new QButton($this);
 67:             $this->btnLast->Text = QApplication::Translate('Last');
 68:             $this->btnLast->Enabled = false;
 69:             $this->btnLast->CssClass = 'button ib_nav_button ib_nav_button_last';
 70: 
 71:             $this->setButtonActions();
 72:         }
 73:         
 74:         protected function setButtonActions(array $arrButtons = null) {
 75:             // get the QImageBrowser control
 76:             $objImageBrowser = $this->ParentControl;
 77:             while ( !($objImageBrowser instanceof QImageBrowserBase) ) {
 78:                 $objImageBrowser = $objImageBrowser->ParentControl;
 79:                 if (is_null($objImageBrowser) || $objImageBrowser instanceof QForm) {
 80:                     throw new QCallerException("QImageBrowserNav must be inside a QImageBrowser");
 81:                 }
 82:             }
 83:             if (!$arrButtons) {
 84:                 $arrButtons = array(
 85:                     "btnFirst_Click"    => $this->btnFirst, 
 86:                     "btnPrev_Click"     => $this->btnPrev, 
 87:                     "btnNext_Click"     => $this->btnNext, 
 88:                     "btnLast_Click"     => $this->btnLast);
 89:             }
 90:             
 91:             foreach ($arrButtons as $strActionCalback => $objButton) {
 92:                 $objButton->RemoveAllActions(QClickEvent::EventName);
 93:                 $objButton->AddAction(new QClickEvent(), new QAjaxControlAction($objImageBrowser, $strActionCalback));
 94:             }
 95:         }
 96:         
 97:         public function BackButtonsEnabled($blnEnable) {
 98:             $this->btnFirst->Enabled = $blnEnable;
 99:             $this->btnPrev->Enabled = $blnEnable;
100:         }
101:         
102:         public function ForwardButtonsEnabled($blnEnable) {
103:             $this->btnNext->Enabled = $blnEnable;
104:             $this->btnLast->Enabled = $blnEnable;
105:         }
106: 
107:         public function __get($strName) {
108:             switch ($strName) {
109:                 case "FirstButton": return $this->btnFirst;
110:                 case "PrevButton":  return $this->btnPrev;
111:                 case "NextButton":  return $this->btnNext;
112:                 case "LastButton":  return $this->btnLast;
113:                 default:
114:                     try {
115:                         return parent::__get($strName);
116:                     } catch (QCallerException $objExc) {
117:                         $objExc->IncrementOffset();
118:                         throw $objExc;
119:                     }
120:             }
121:         }
122: 
123:         public function __set($strName, $mixValue) {
124:             $this->blnModified = true;
125: 
126:             switch ($strName) {
127:                 case "FirstButton":
128:                     try {
129:                         $this->RemoveChildControl($this->btnFirst->ControlId, true);
130:                         $this->btnFirst = QType::Cast($mixValue, 'QControl');
131:                         $this->setButtonActions(array("btnFirst_Click" => $this->btnFirst));
132:                         break;
133:                     } catch (QInvalidCastException $objExc) {
134:                         $objExc->IncrementOffset();
135:                         throw $objExc;
136:                     }
137: 
138:                 case "PrevButton":
139:                     try {
140:                         $this->RemoveChildControl($this->btnPrev->ControlId, true);
141:                         $this->btnPrev = QType::Cast($mixValue, 'QControl');
142:                         $this->setButtonActions(array("btnPrev_Click" => $this->btnPrev));
143:                         break;
144:                     } catch (QInvalidCastException $objExc) {
145:                         $objExc->IncrementOffset();
146:                         throw $objExc;
147:                     }
148: 
149:                 case "NextButton":
150:                     try {
151:                         $this->RemoveChildControl($this->btnNext->ControlId, true);
152:                         $this->btnNext = QType::Cast($mixValue, 'QControl');
153:                         $this->setButtonActions(array("btnNext_Click" => $this->btnNext));
154:                         break;
155:                     } catch (QInvalidCastException $objExc) {
156:                         $objExc->IncrementOffset();
157:                         throw $objExc;
158:                     }
159: 
160:                 case "LastButton":
161:                     try {
162:                         $this->RemoveChildControl($this->btnLast->ControlId, true);
163:                         $this->btnLast = QType::Cast($mixValue, 'QControl');
164:                         $this->setButtonActions(array("btnLast_Click" => $this->btnLast));
165:                         break;
166:                     } catch (QInvalidCastException $objExc) {
167:                         $objExc->IncrementOffset();
168:                         throw $objExc;
169:                     }
170: 
171:                 default:
172:                     try {
173:                         parent::__set($strName, $mixValue);
174:                     } catch (QCallerException $objExc) {
175:                         $objExc->IncrementOffset();
176:                         throw $objExc;
177:                     }
178:                     break;
179:             }
180:         }
181:     }
182:     
183:     /**
184:      * @package Controls
185:      */
186:     class QImageBrowserThumbnails extends QPanel {
187:         public function __construct($objParentObject, $strControlId = null) {
188:             // Call the Parent
189:             try {
190:                 parent::__construct($objParentObject, $strControlId);
191:             } catch (QCallerException $objExc) {
192:                 $objExc->IncrementOffset();
193:                 throw $objExc;
194:             }
195:             $this->AutoRenderChildren = true;
196:         }
197: 
198:         public function reload() {
199:             $this->RemoveChildControls(true);
200:             $img = null;
201:             // get the QImageBrowser control
202:             $objImageBrowser = $this->ParentControl;
203:             while ( !($objImageBrowser instanceof QImageBrowserBase) ) {
204:                 $objImageBrowser = $objImageBrowser->ParentControl;
205:                 if (is_null($objImageBrowser) || $objImageBrowser instanceof QForm) {
206:                     throw new QCallerException("QImageBrowserThumbnails must be inside a QImageBrowser");
207:                 }
208:             }
209:             $iEnd = $objImageBrowser->ImageCount();
210:             for ($i = 0; $i < $iEnd; ++$i) {
211:                 $strImagePath = $objImageBrowser->ThumbnailImagePath($i);
212:                 $img = new QImageControl($this);
213:                 $img->CssClass = 'ib_thm_image';
214:                 $img->ImagePath = $strImagePath;
215:                 $img->AlternateText = $strImagePath;
216:                 $img->ActionParameter = $i;
217:             
218:                 // And finally, let's specify a CacheFolder so that the images are cached
219:                 // Notice that this CacheFolder path is a complete web-accessible relative-to-docroot path
220:                 $img->CacheFolder = __IMAGE_CACHE_ASSETS__;
221:                 
222:                 $img->AddAction(new QClickEvent(), new QAjaxControlAction($objImageBrowser, "imgThm_Click"));
223:             }
224:             if ($img) {
225:                 $img->CssClass = 'ib_thm_image ib_thm_image_last';
226:                 $this->Text = '';
227:             } else {
228:                 $this->Text = QApplication::Translate('No thumbnails');
229:             }
230:         }
231:     }
232: 
233: /**
234:  *
235:  * @property-read QImageControl MainImage the main image control
236:  * @property QTextBox Caption the caption control
237:  * @property QButton SaveButton the save button control
238:  * @property QImageBrowserNav Navigation1 the first navigation panel
239:  * @property QImageBrowserNav Navigation2 the second navigation panel
240:  * @property QImageBrowserThumbnails Thumbnails the thumbnails panel
241:  */
242:     abstract class QImageBrowserBase extends QPanel {
243:         protected $intCurrentImage;
244:         protected $imgMainImage;
245:         protected $txtCaption;
246:         protected $btnSave;
247:         protected $ibnNavigation1;
248:         protected $ibnNavigation2;
249:         protected $ibtThumbnails;
250:         
251:         /**
252:          * @param $objParentObject
253:          * @param bool $blnReadOnlyCaption if true (default) don't allow captions to be edited (and don't show the save button)
254:          * @param bool $blnTwoNavBars if true (default false),will show two navigation bars (which can layout with template/css)
255:          * @param bool $blnThumbnails if true (default), will show two thumbnails panel (which you can layout with template/css)
256:          * @param null $strControlId
257:          */
258:         public function __construct($objParentObject, $blnReadOnlyCaption = true, $blnTwoNavBars = false, $blnThumbnails = true, $strControlId = null) {
259:             // Call the Parent
260:             try {
261:                 parent::__construct($objParentObject, $strControlId);
262:             } catch (QCallerException $objExc) {
263:                 $objExc->IncrementOffset();
264:                 throw $objExc;
265:             }
266:             $this->intCurrentImage = null;
267:             
268:             // main image
269:             $this->imgMainImage = new QImageControl($this);
270:             $this->imgMainImage->CssClass = 'ib_main_image';
271:             $this->imgMainImage->ImagePath = $this->invalidImagePath();
272:             
273:             // And finally, let's specify a CacheFolder so that the images are cached
274:             // Notice that this CacheFolder path is a complete web-accessible relative-to-docroot path
275:             $this->imgMainImage->CacheFolder = __IMAGE_CACHE_ASSETS__;
276:             
277:             // caption
278:             $this->txtCaption = new QTextBox($this);
279:             $this->txtCaption->Name = 'Caption';
280:             $this->txtCaption->TextMode = QTextMode::MultiLine;
281:             $this->txtCaption->Rows = 2;
282:             $this->txtCaption->Enabled = false;
283:             if ($blnReadOnlyCaption) {
284:                 $this->txtCaption->CssClass = 'textbox ib_caption ib_caption_readonly';
285:                 $this->txtCaption->ReadOnly = true;
286:             } else {
287:                 $this->txtCaption->CssClass = 'textbox ib_caption';
288:                 $this->txtCaption->AddAction(new QChangeEvent(), new QAjaxControlAction($this, "txtCaption_Change"));
289: 
290:                 $this->btnSave = new QButton($this);
291:                 $this->btnSave->Text = QApplication::Translate('Save');
292:                 $this->btnSave->Enabled = false;
293:                 $this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, "btnSave_Click"));
294:             }
295:             
296:             // nav bars
297:             $this->ibnNavigation1 = new QImageBrowserNav($this);
298:             $this->ibnNavigation1->CssClass = 'ib_nav ib_nav1';
299:             if ($blnTwoNavBars) {
300:                 $this->ibnNavigation2 = new QImageBrowserNav($this);
301:                 $this->ibnNavigation2->CssClass = 'ib_nav ib_nav2';
302:             }
303:             
304:             // thumbnails
305:             if ($blnThumbnails) {
306:                 $this->ibtThumbnails = new QImageBrowserThumbnails($this);
307:                 $this->ibtThumbnails->CssClass = 'ib_thm';
308:             }
309:         }
310:         
311:         protected function reload() {
312:             $this->ibtThumbnails->reload();
313:             $this->intCurrentImage = 0;
314:             $this->setMainImage($this->intCurrentImage);
315:         }
316: 
317:         protected function setMainImage($intIdx) {
318:             $intCount = $this->ImageCount();
319:             $blnBackButtonsEnabled = $intCount > 1 && $intIdx > 0;
320:             $blnForwardButtonsEnabled = $intCount > 1 && $intIdx+1 < $intCount;
321:             $this->ibnNavigation1->BackButtonsEnabled($blnBackButtonsEnabled);
322:             if ($this->ibnNavigation2) {
323:                 $this->ibnNavigation2->BackButtonsEnabled($blnBackButtonsEnabled);
324:             }
325:             $this->ibnNavigation1->ForwardButtonsEnabled($blnForwardButtonsEnabled);
326:             if ($this->ibnNavigation2) {
327:                 $this->ibnNavigation2->ForwardButtonsEnabled($blnForwardButtonsEnabled);
328:             }
329:             if ($this->btnSave) {
330:                 $this->btnSave->Enabled = false;
331:             }
332:             if ($intIdx < 0 || $intIdx >= $intCount) {
333:                 $this->intCurrentImage = null;
334:                 $this->imgMainImage->ImagePath = $this->invalidImagePath();
335:                 $this->txtCaption->Enabled = false;
336:                 $this->txtCaption->Text = '';
337:                 return;
338:             }
339:             $this->txtCaption->Enabled = true;
340:             $strImagePath = $this->ImagePath($intIdx);
341:             $this->imgMainImage->ImagePath = $strImagePath;
342:             if ($this->ibtThumbnails) {
343:                 foreach ($this->ibtThumbnails->GetChildControls() as $ctrl) {
344:                     if ($ctrl instanceof QImageControl) {
345:                         if ($ctrl->ImagePath == $strImagePath) {
346:                             $ctrl->AddCssClass($this->selectThumbnailCssClass());
347:                         } else {
348:                             $ctrl->RemoveCssClass($this->selectThumbnailCssClass());
349:                         }
350:                     }
351:                 }
352:             }
353:             $this->intCurrentImage = $intIdx;
354:             $this->txtCaption->Text = $this->loadCaption($intIdx);
355:         }
356:         
357:         public function btnFirst_Click($strFormId, $strControlId, $strParameter) {
358:             $this->setMainImage(0);
359:         }
360:         
361:         public function btnNext_Click($strFormId, $strControlId, $strParameter) {
362:             if (!is_null($this->intCurrentImage)) {
363:                 $this->setMainImage($this->intCurrentImage + 1);
364:             }
365:         }
366:         
367:         public function btnPrev_Click($strFormId, $strControlId, $strParameter) {
368:             if (!is_null($this->intCurrentImage)) {
369:                 $this->setMainImage($this->intCurrentImage - 1);
370:             }
371:         }
372:         
373:         public function btnLast_Click($strFormId, $strControlId, $strParameter) {
374:             $this->setMainImage($this->ImageCount()-1);
375:         }
376:         
377:         public function imgThm_Click($strFormId, $strControlId, $strParameter) {
378:             $this->setMainImage($strParameter);
379:         }
380:         
381:         public function btnSave_Click($strFormId, $strControlId, $strParameter) {
382:             $this->saveCaption($this->intCurrentImage, $this->txtCaption->Text);
383:             if ($this->btnSave) {
384:                 $this->btnSave->Enabled = false;
385:             }
386:         }
387:         
388:         public function txtCaption_Change($strFormId, $strControlId, $strParameter) {
389:             if ($this->btnSave) {
390:                 $this->btnSave->Enabled = !is_null($this->intCurrentImage);
391:             }
392:         }
393:         
394:         /////////////////////////////////////////////////////////////////////////////////
395:         // Methods that need to be implemented or customized
396:         /////////////////////////////////////////////////////////////////////////////////
397: 
398:         /**
399:          * Return the total number of the images in this image browser
400:          *
401:          * @abstract
402:          */
403:         abstract public function ImageCount();
404: 
405:         /**
406:          * Return the absolute path of the corresponding image.
407:          *
408:          * @abstract
409:          * @param $intIdx index of the image (between 0 and ImageCount()-1)
410:          */
411:         abstract public function ImagePath($intIdx);    
412: 
413:         /**
414:          * Return the absolute path of the corresponding thumbnail image.
415:          * This could be the same as the image, and the browser will scale it to the size of the thumbnail.
416:          *
417:          * @abstract
418:          * @param $intIdx index of the image (between 0 and ImageCount()-1)
419:          */
420:         abstract public function ThumbnailImagePath($intIdx);
421: 
422:         /**
423:          * Return the corresponding image caption
424:          *
425:          * @abstract
426:          * @param $intIdx index of the image (between 0 and ImageCount()-1)
427:          */
428:         abstract protected function loadCaption($intIdx);
429:         
430:         // Saves the caption for an image.
431:         /**
432:          * @abstract
433:          * @param $intIdx index of the image (between 0 and ImageCount()-1)
434:          * @param $strCaption caption to save
435:          */
436:         abstract protected function saveCaption($intIdx, $strCaption);
437:         
438: 
439:         /**
440:          * Return the added CSS class for the selected thumbnail image.
441:          * Overwrite this method if you'd like a different CSS class.
442:          *
443:          * @return string
444:          */
445:         protected function selectThumbnailCssClass() {
446:             return 'ib_thm_selected';
447:         }
448: 
449:         /**
450:          * The absolute path of an image that indicates that the current image path is invalid.
451:          * This is needed since we cannot render the QImageControl without a valid ImagePath.
452:          *
453:          * @return string
454:          */
455:         protected function invalidImagePath() {
456:             return __DOCROOT__ . __IMAGE_ASSETS__ . '/file_asset_blank.png';
457:         }
458:         
459:         public function __get($strName) {
460:             switch ($strName) {
461:                 case "MainImage": return $this->imgMainImage;
462:                 case "Caption": return $this->txtCaption;
463:                 case "SaveButton": return $this->btnSave;
464:                 case "Navigation1": return $this->ibnNavigation1;
465:                 case "Navigation2": return $this->ibnNavigation2;
466:                 case "Thumbnails": return $this->ibtThumbnails;
467:                 default:
468:                     try {
469:                         return parent::__get($strName);
470:                     } catch (QCallerException $objExc) {
471:                         $objExc->IncrementOffset();
472:                         throw $objExc;
473:                     }
474:             }
475:         }
476: 
477:         public function __set($strName, $mixValue) {
478:             $this->blnModified = true;
479: 
480:             switch ($strName) {
481:                 case "Navigation1":
482:                     try {
483:                         if ($this->ibnNavigation1)
484:                             $this->RemoveChildControl($this->ibnNavigation1->ControlId, true);
485:                         $this->ibnNavigation1 = QType::Cast($mixValue, 'QImageBrowserNav');
486:                         break;
487:                     } catch (QInvalidCastException $objExc) {
488:                         $objExc->IncrementOffset();
489:                         throw $objExc;
490:                     }
491: 
492:                 case "Navigation2":
493:                     try {
494:                         if ($this->ibnNavigation2)
495:                             $this->RemoveChildControl($this->ibnNavigation2->ControlId, true);
496:                         $this->ibnNavigation2 = QType::Cast($mixValue, 'QImageBrowserNav');
497:                         break;
498:                     } catch (QInvalidCastException $objExc) {
499:                         $objExc->IncrementOffset();
500:                         throw $objExc;
501:                     }
502: 
503:                 case "Thumbnails":
504:                     try {
505:                         if ($this->ibtThumbnails)
506:                             $this->RemoveChildControl($this->ibtThumbnails->ControlId, true);
507:                         $this->ibtThumbnails = QType::Cast($mixValue, 'QImageBrowserThumbnails');
508:                         break;
509:                     } catch (QInvalidCastException $objExc) {
510:                         $objExc->IncrementOffset();
511:                         throw $objExc;
512:                     }
513: 
514:                 case "Caption":
515:                     try {
516:                         if ($this->txtCaption)
517:                             $this->RemoveChildControl($this->txtCaption->ControlId, true);
518:                         $this->txtCaption = QType::Cast($mixValue, 'QControl');
519:                         break;
520:                     } catch (QInvalidCastException $objExc) {
521:                         $objExc->IncrementOffset();
522:                         throw $objExc;
523:                     }
524: 
525:                 case "SaveButton":
526:                     try {
527:                         if ($this->btnSave) {
528:                             $this->btnSave->RemoveAllActions(QClickEvent::EventName);
529:                             $this->RemoveChildControl($this->btnSave->ControlId, true);
530:                         }
531:                         $this->btnSave = QType::Cast($mixValue, 'QControl');
532:                         $this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, "btnSave_Click"));
533:                         break;
534:                     } catch (QInvalidCastException $objExc) {
535:                         $objExc->IncrementOffset();
536:                         throw $objExc;
537:                     }
538: 
539:                 default:
540:                     try {
541:                         parent::__set($strName, $mixValue);
542:                     } catch (QCallerException $objExc) {
543:                         $objExc->IncrementOffset();
544:                         throw $objExc;
545:                     }
546:                     break;
547:             }
548:         }
549:     }
550:     
551:     /**
552:      * A simple implementation of the QImageBrowserBase, which takes the images from a provided
553:      * array of image paths (must be absolute paths). It has a method that you can use to load
554:      * all the images from a directory. By default it aassumes that the captions are saved in the same
555:      * directory in files with an additional ".txt" extension.
556:      *
557:      * @package Controls
558:      * @property array ImagePaths the array of absolute paths for the images
559:      *
560:      */
561:     class QImageBrowser extends QImageBrowserBase {
562:         protected $arrImagePaths;
563: 
564:         public function LoadImagesFromDirectory($strDir, $strPattern) {
565:             if (!is_dir($strDir)) {
566:                 throw new QCallerException("$strDir is not a directory"); 
567:             }
568: 
569:             $dh = opendir($strDir);
570:             if ($dh === false) {
571:                 throw new QCallerException("Could not open directory $strDir");
572:             }
573:             $this->arrImagePaths = array();
574:             while ($strFile = readdir($dh)) {
575:                 if ("." == $strFile || ".." == $strFile) {
576:                     continue;
577:                 }
578:                 if (preg_match($strPattern, $strFile) > 0) {
579:                     $this->arrImagePaths[] = $strDir.'/'.$strFile;
580:                 }
581:             }
582:             closedir($dh);
583:             $this->reload();
584:         }
585:         
586:         public function ImageCount() {
587:             if (!$this->arrImagePaths) return 0;
588:             return count($this->arrImagePaths);
589:         }
590: 
591:         public function ImagePath($intIdx) {
592:             return $this->arrImagePaths[$intIdx];
593:         }
594: 
595:         public function ThumbnailImagePath($intIdx) {
596:             return $this->ImagePath($intIdx);
597:         }
598: 
599:         protected function captionFileName($intIdx) {
600:             $strImagePath = $this->ImagePath($intIdx);
601:             return $strImagePath.'.txt';
602:         }
603:         
604:         protected function loadCaption($intIdx) {
605:             $strCaptionFile = $this->captionFileName($intIdx);
606:             if (!file_exists($strCaptionFile)) {
607:                 //return $strCaptionFile;
608:                 return '';
609:             }
610:             if (false === ($strCaption = file_get_contents($strCaptionFile))) {
611:                 //return $strCaptionFile;
612:                 return '';
613:             }
614:             return $strCaption;
615:         }
616:         
617:         protected function saveCaption($intIdx, $strCaption) {
618:             $strCaptionFile = $this->captionFileName($intIdx);
619:             file_put_contents($strCaptionFile, $strCaption, LOCK_EX);
620:         }
621:         
622:         public function __get($strName) {
623:             switch ($strName) {
624:                 case "ImagePaths": return $this->arrImagePaths;
625:                 default:
626:                     try {
627:                         return parent::__get($strName);
628:                     } catch (QCallerException $objExc) {
629:                         $objExc->IncrementOffset();
630:                         throw $objExc;
631:                     }
632:             }
633:         }
634:         public function __set($strName, $mixValue) {
635:             $this->blnModified = true;
636: 
637:             switch ($strName) {
638:                 case "ImagePaths":
639:                     try {
640:                         $this->arrImagePaths = QType::Cast($mixValue, QType::ArrayType);
641:                         $this->reload();
642:                         break;
643:                     } catch (QInvalidCastException $objExc) {
644:                         $objExc->IncrementOffset();
645:                         throw $objExc;
646:                     }
647: 
648:                 default:
649:                     try {
650:                         parent::__set($strName, $mixValue);
651:                     } catch (QCallerException $objExc) {
652:                         $objExc->IncrementOffset();
653:                         throw $objExc;
654:                     }
655:                     break;
656:             }
657:         }
658:     }
API documentation generated by ApiGen