summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected
diff options
context:
space:
mode:
Diffstat (limited to 'demos/quickstart/protected')
-rw-r--r--demos/quickstart/protected/QuickStartGlobalization.php60
-rw-r--r--demos/quickstart/protected/controls/Comments/CommentBlock.php212
-rw-r--r--demos/quickstart/protected/controls/Comments/comments.js412
-rw-r--r--demos/quickstart/protected/controls/DocLink.php60
-rw-r--r--demos/quickstart/protected/controls/Layout.php94
-rw-r--r--demos/quickstart/protected/controls/RequiresVersion.php30
-rw-r--r--demos/quickstart/protected/controls/RunBar.php44
-rw-r--r--demos/quickstart/protected/controls/SampleLayout.php24
-rw-r--r--demos/quickstart/protected/controls/SearchBox.php80
-rw-r--r--demos/quickstart/protected/controls/SinceVersion.php30
-rw-r--r--demos/quickstart/protected/controls/TopicList.php14
-rw-r--r--demos/quickstart/protected/index/ZendSearch.php108
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.php38
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.php30
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBoxList/Home.php50
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.php20
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php72
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php170
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php378
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php40
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php156
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php262
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDropDownList/Home.php118
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveFileUpload/Home.php40
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php50
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImage/Home.php32
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImageButton/Home.php34
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveLinkButton/Home.php26
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.php128
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveMultiView/Home.php28
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActivePanel/Home.php40
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButton/Home.php52
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButtonList/Home.php50
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php156
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveTableRow/Home.php42
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php68
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php56
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.php22
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.php22
-rw-r--r--demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.php88
-rw-r--r--demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.php36
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.php24
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.php34
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.php24
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php64
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.php14
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TAccordion/Home.php32
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php22
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TButton/Home.php26
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TCaptcha/Home.php52
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TCheckBox/Home.php20
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php138
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.php32
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TCompareValidator/Home.php14
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.php12
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TCustomValidator/Home.php34
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php80
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php170
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php378
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php40
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php134
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample6.php110
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php80
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.php262
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataTypeValidator/Home.php14
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php136
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.php14
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php40
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.php40
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TImageButton/Home.php34
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TImageMap/Home.php20
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TKeyboard/Home.php20
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TLinkButton/Home.php26
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php156
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TMultiView/Home.php28
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.php162
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.php20
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TPlaceHolder/Home.php30
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRadioButton/Home.php52
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php136
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRangeValidator/Home.php14
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRegularExpressionValidator/Home.php14
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRepeater/RegionDisplay.php54
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample1.php80
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php156
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.php156
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample4.php72
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample5.php102
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TRequiredFieldValidator/Home.php14
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.php8
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TTabPanel/Home.php12
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TTable/Home.php64
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TTextBox/Home.php42
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TValidationSummary/Home.php14
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample1.php20
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.php20
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample3.php48
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample4.php20
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample5.php22
-rw-r--r--demos/quickstart/protected/pages/Database/Samples/Scaffold/Home.php64
-rw-r--r--demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php240
-rw-r--r--demos/quickstart/protected/pages/Search.php110
-rw-r--r--demos/quickstart/protected/pages/ViewSource.php222
103 files changed, 3882 insertions, 3882 deletions
diff --git a/demos/quickstart/protected/QuickStartGlobalization.php b/demos/quickstart/protected/QuickStartGlobalization.php
index 6a0b0fb2..8fc42e8d 100644
--- a/demos/quickstart/protected/QuickStartGlobalization.php
+++ b/demos/quickstart/protected/QuickStartGlobalization.php
@@ -1,31 +1,31 @@
-<?php
-
-class QuickStartGlobalization extends TGlobalizationAutoDetect
-{
- public function init($xml)
- {
- parent::init($xml);
- $this->Application->OnBeginRequest[] = array($this, 'beginRequest');
- }
-
- public function beginRequest($sender, $param)
- {
- if(null == ($culture=$this->Request['lang']))
- {
- if(null !== ($cookie=$this->Request->Cookies['lang']))
- $culture = $cookie->getValue();
- }
-
- if(is_string($culture))
- {
- $info = new CultureInfo();
- if($info->validCulture($culture))
- {
- $this->setCulture($culture);
- $this->Response->Cookies[] = new THttpCookie('lang',$culture);
- }
- }
- }
-}
-
+<?php
+
+class QuickStartGlobalization extends TGlobalizationAutoDetect
+{
+ public function init($xml)
+ {
+ parent::init($xml);
+ $this->Application->OnBeginRequest[] = array($this, 'beginRequest');
+ }
+
+ public function beginRequest($sender, $param)
+ {
+ if(null == ($culture=$this->Request['lang']))
+ {
+ if(null !== ($cookie=$this->Request->Cookies['lang']))
+ $culture = $cookie->getValue();
+ }
+
+ if(is_string($culture))
+ {
+ $info = new CultureInfo();
+ if($info->validCulture($culture))
+ {
+ $this->setCulture($culture);
+ $this->Response->Cookies[] = new THttpCookie('lang',$culture);
+ }
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/controls/Comments/CommentBlock.php b/demos/quickstart/protected/controls/Comments/CommentBlock.php
index 9c008491..ebb82a0f 100644
--- a/demos/quickstart/protected/controls/Comments/CommentBlock.php
+++ b/demos/quickstart/protected/controls/Comments/CommentBlock.php
@@ -1,107 +1,107 @@
-<?php
-
-Prado::using('System.Data.*');
-Prado::using('System.Web.UI.ActiveControls.*');
-Prado::using('System.Data.ActiveRecord.TActiveRecordManager');
-
-$db = new TDbConnection('mysql:host=localhost;dbname=xxxx', 'yyyy', 'zzzz');
-$manager = TActiveRecordManager::getInstance();
-$manager->setDbConnection($db);
-
-class CommentRecord extends TActiveRecord
-{
- const TABLE='qs_comments';
-
- public $id;
- public $username;
- public $date_added;
- public $page;
- public $block_id;
- public $content;
-
- public static function finder($className=__CLASS__)
- {
- return parent::finder($className);
- }
-}
-
-class CommentBlock extends TTemplateControl
-{
- private $_page;
-
- function onLoad($param)
- {
- if(!$this->Page->IsCallBack)
- {
- $count = array();
- $data = $this->getCommentData();
- foreach($data as $r)
- {
- if(!isset($count[$r->block_id]))
- $count[$r->block_id]=0;
- $count[$r->block_id]++;
- }
- $js = "var comment_count = ".TJavascript::encode($count).";\n";
- $this->Page->ClientScript->registerBeginScript('count',$js);
- $this->comments->dataSource = $data;
- $this->comments->dataBind();
- }
- }
-
- function getCommentData()
- {
- return CommentRecord::finder()->findAllByPage($this->getCurrentPagePath());
- }
-
- function add_comment($sender, $param)
- {
- if(!$this->Page->IsValid)
- return;
- $record = new CommentRecord;
- $record->username = $this->username->Text;
- $record->date_added = date('Y-m-d h:i:s');
- $record->page = $this->getCurrentPagePath();
- $record->block_id = $this->block_id->Value;
- $record->content = $this->content->Text;
- $record->save();
-
- $this->content->Text = '';
- $this->password->Text = '';
- $cc = $this->Page->CallbackClient;
- $cc->appendContent('comment-list', $this->format_message($record));
- $cc->callClientFunction('hide_add_comment');
- $cc->callClientFunction('increment_count_tag', $record->block_id);
- if(!$this->Page->IsCallBack)
- {
- $this->comments->dataSource = $this->getCommentData();
- $this->comments->dataBind();
- }
- }
-
- protected function getCurrentPagePath()
- {
- if(is_null($this->_page))
- {
- $page = str_replace($this->Service->BasePath, '', $this->Page->Template->TemplateFile);
- $this->_page = str_replace('\\', '/', $page);
- }
- return $this->_page;
- }
-
- function validate_credential($sender, $param)
- {
- $param->IsValid = $this->password->Text == 'Prado';
- }
-
- protected function format_message($record)
- {
- $username=htmlspecialchars($record->username);
- $content=nl2br(htmlspecialchars($record->content));
- return <<<EOD
- <div class="comment c-{$record->block_id}">
- <span><strong>{$username}</strong> on {$record->date_added}.</span>
- <div>{$content}</div>
- </div>
-EOD;
- }
+<?php
+
+Prado::using('System.Data.*');
+Prado::using('System.Web.UI.ActiveControls.*');
+Prado::using('System.Data.ActiveRecord.TActiveRecordManager');
+
+$db = new TDbConnection('mysql:host=localhost;dbname=xxxx', 'yyyy', 'zzzz');
+$manager = TActiveRecordManager::getInstance();
+$manager->setDbConnection($db);
+
+class CommentRecord extends TActiveRecord
+{
+ const TABLE='qs_comments';
+
+ public $id;
+ public $username;
+ public $date_added;
+ public $page;
+ public $block_id;
+ public $content;
+
+ public static function finder($className=__CLASS__)
+ {
+ return parent::finder($className);
+ }
+}
+
+class CommentBlock extends TTemplateControl
+{
+ private $_page;
+
+ function onLoad($param)
+ {
+ if(!$this->Page->IsCallBack)
+ {
+ $count = array();
+ $data = $this->getCommentData();
+ foreach($data as $r)
+ {
+ if(!isset($count[$r->block_id]))
+ $count[$r->block_id]=0;
+ $count[$r->block_id]++;
+ }
+ $js = "var comment_count = ".TJavascript::encode($count).";\n";
+ $this->Page->ClientScript->registerBeginScript('count',$js);
+ $this->comments->dataSource = $data;
+ $this->comments->dataBind();
+ }
+ }
+
+ function getCommentData()
+ {
+ return CommentRecord::finder()->findAllByPage($this->getCurrentPagePath());
+ }
+
+ function add_comment($sender, $param)
+ {
+ if(!$this->Page->IsValid)
+ return;
+ $record = new CommentRecord;
+ $record->username = $this->username->Text;
+ $record->date_added = date('Y-m-d h:i:s');
+ $record->page = $this->getCurrentPagePath();
+ $record->block_id = $this->block_id->Value;
+ $record->content = $this->content->Text;
+ $record->save();
+
+ $this->content->Text = '';
+ $this->password->Text = '';
+ $cc = $this->Page->CallbackClient;
+ $cc->appendContent('comment-list', $this->format_message($record));
+ $cc->callClientFunction('hide_add_comment');
+ $cc->callClientFunction('increment_count_tag', $record->block_id);
+ if(!$this->Page->IsCallBack)
+ {
+ $this->comments->dataSource = $this->getCommentData();
+ $this->comments->dataBind();
+ }
+ }
+
+ protected function getCurrentPagePath()
+ {
+ if(is_null($this->_page))
+ {
+ $page = str_replace($this->Service->BasePath, '', $this->Page->Template->TemplateFile);
+ $this->_page = str_replace('\\', '/', $page);
+ }
+ return $this->_page;
+ }
+
+ function validate_credential($sender, $param)
+ {
+ $param->IsValid = $this->password->Text == 'Prado';
+ }
+
+ protected function format_message($record)
+ {
+ $username=htmlspecialchars($record->username);
+ $content=nl2br(htmlspecialchars($record->content));
+ return <<<EOD
+ <div class="comment c-{$record->block_id}">
+ <span><strong>{$username}</strong> on {$record->date_added}.</span>
+ <div>{$content}</div>
+ </div>
+EOD;
+ }
} \ No newline at end of file
diff --git a/demos/quickstart/protected/controls/Comments/comments.js b/demos/quickstart/protected/controls/Comments/comments.js
index ca3f54fb..44464689 100644
--- a/demos/quickstart/protected/controls/Comments/comments.js
+++ b/demos/quickstart/protected/controls/Comments/comments.js
@@ -1,207 +1,207 @@
-var currentCommentID;
-
-function show_comment_list()
-{
- $('comment-list').show();
- $('add-comment').hide();
- $('show-comment-link').addClassName("active");
- $('add-comment-link').removeClassName("active");
- $('all-comments-link').removeClassName("active");
- show_comments_in_list(currentCommentID);
-}
-
-function show_all_comments()
-{
- $('comment-list').show();
- $('add-comment').hide();
- $('show-comment-link').removeClassName("active");
- $('add-comment-link').removeClassName("active");
- $('all-comments-link').addClassName("active");
- show_comments_in_list();
-}
-
-
-function show_add_comment()
-{
- $('comment-list').hide();
- $('add-comment').show();
- $('show-comment-link').removeClassName("active");
- $('add-comment-link').addClassName("active");
- $('all-comments-link').removeClassName("active");
-}
-
-function hide_add_comment()
-{
- $('user-comments').hide();
- $('modal-background').hide();
- $(content_textare_id).value = '';
- $(currentCommentID).style.zIndex = 0;
-}
-
-function show_comments_in_list(id)
-{
- var list = $('comment-list');
- var count=0;
- for(var i=0, k=list.childNodes.length; i < k; i++)
- {
- var node = list.childNodes[i];
- if(node.nodeType == 1) //an element node
- {
- if(typeof(id) == "undefined" || node.className.indexOf(id) >= 0)
- {
- node.style.display="block"
- count++;
- }
- else
- node.style.display="none";
- }
- }
- return count;
-}
-
-function show_comments(block)
-{
- var id = block.id
- currentCommentID = id;
- $(hidden_block_id).value = id;
- var commentBlock = $('user-comments');
- var pos = Position.cumulativeOffset(block);
- var top = pos[1] + block.offsetHeight;
- commentBlock.style.top = top+"px";
- commentBlock.style.width = (block.offsetWidth-22)+"px";
-
- commentBlock.show();
-
- var count = show_comments_in_list(id);
-
- $('comment-list').show();
- if(count > 0)
- show_comment_list();
- else
- show_add_comment();
-
- var background = $('modal-background');
- background.style.top="0px";
- background.style.left="0px";
- background.style.opacity="0.5";
- background.style.width = document.body.offsetWidth+"px";
- background.style.height = document.body.offsetHeight+"px";
- background.show();
- block.style.zIndex = 100;
- block.style.paddingRight="9px";
- block.style.marginRight="-9px";
-
-}
-
-function show_block(block)
-{
- while(block && (!block.className || block.className.indexOf("block-content") < 0))
- block = block.parentNode;
- if(block && block.className.indexOf("block-content") >= 0)
- {
- block.addClassName('block-hover');
- var tag = $('tag-'+block.id);
-// if(tag.className.indexOf("tag-shown")<=0)
- tag.firstChild.style.visibility="visible"
- }
-}
-
-function hide_block(block)
-{
- while(block && (!block.className || block.className.indexOf("block-content") < 0))
- block = block.parentNode;
- if(block && block.className.indexOf("block-hover") >= 0)
- {
- block.removeClassName('block-hover');
- var tag = $('tag-'+block.id);
- if(tag.className.indexOf("tag-shown")<=0)
- tag.firstChild.style.visibility="hidden"
- }
-}
-
-function add_comment_tag(el)
-{
- var dim = Element.getDimensions(el);
- var comments = get_comment_count(el.id);
- var style = "height:"+(dim.height > 35 ? dim.height : 35)+"px;";
- var cssClass = dim.height ? "block-comment-tag" : "block-comment-tag-ie";
- var title = "View "+comments+" comments"
- var innerStyle="";
- if(comments <= 0)
- {
- innerStyle = " visibility:hidden;";
- comments = "add";
- title = "Add new comment";
- }
- else
- cssClass += " tag-shown";
- var id = "tag-"+el.id;
- var tag = "<div id='"+id+"' class='"+cssClass+"' style='"+style+"'><div style='"+innerStyle+"' title='"+title+"'>"+comments+"</div>&nbsp;</div>";
- new Insertion.Before(el, tag);
- var tag_div = $(id);
- Event.observe(tag_div, "mouseover", function(e){ if(typeof(show_block)!="undefined") show_block(el); });
- Event.observe(tag_div, "mouseout", function(e){ if(typeof(hide_block) !="undefined") hide_block(el); });
- Event.observe(tag_div, "click", function(e) { if(typeof(show_comments) !="undefined") show_comments(el); Event.stop(e); });
-}
-
-function increment_count_tag(id)
-{
- var tag = $('tag-'+id);
- if(tag && tag.firstChild)
- {
- if(tag.className.indexOf("tag-shown") >= 0)
- {
- var count = Number(tag.firstChild.innerHTML);
- tag.firstChild.innerHTML = (++count)+"";
- tag.firstChild.style.visibility="visible";
- }
- else
- {
- tag.firstChild.innerHTML = "1";
- tag.addClassName("tag-shown");
- tag.firstChild.style.visibility="visible";
- }
- }
-}
-
-function get_comment_count(id)
-{
- return comment_count[id] ? comment_count[id] : 0;
-}
-
-//initialize the comment js
-
-if(!Prado.Browser.ie) //not IE 4,5,6
-{
- (function()
- {
- var userComments = $('user-comments');
- userComments.style.position="absolute";
- userComments.style.marginRight="80px";
- var commentList = $('comment-list');
- commentList.style.height="320px";
- $('add-comment').style.height="320px";
- commentList.style.overflow="auto";
- $('show-comment-link').style.display="";
- $('to-top').hide();
- $('close-comments').show();
- $('all-comments-link').show();
- userComments.hide();
- $('comments-header').hide();
-
- $$('#comment-list .source-link').each(function(el){ el.hide(); });
-
- $$('#content .block-content').each(function(el)
- {
- Event.observe(el, 'mouseover', function(e){ if(typeof(show_block)!="undefined") show_block(Event.element(e)); });
- Event.observe(el, 'mouseout', function(e){ if(typeof(hide_block)!="undefined") hide_block(Event.element(e)); });
- add_comment_tag(el);
- });
-
- Event.observe($('show-comment-link'), "click", function(e) { show_comment_list(); Event.stop(e); });
- Event.observe($('add-comment-link'), "click", function(e) { show_add_comment(); Event.stop(e); });
- Event.observe($('all-comments-link'), "click", function(e) { show_all_comments(); Event.stop(e); });
- Event.observe($('close-comments'), "click", function(e) { hide_add_comment(); Event.stop(e); });
-
- })();
+var currentCommentID;
+
+function show_comment_list()
+{
+ $('comment-list').show();
+ $('add-comment').hide();
+ $('show-comment-link').addClassName("active");
+ $('add-comment-link').removeClassName("active");
+ $('all-comments-link').removeClassName("active");
+ show_comments_in_list(currentCommentID);
+}
+
+function show_all_comments()
+{
+ $('comment-list').show();
+ $('add-comment').hide();
+ $('show-comment-link').removeClassName("active");
+ $('add-comment-link').removeClassName("active");
+ $('all-comments-link').addClassName("active");
+ show_comments_in_list();
+}
+
+
+function show_add_comment()
+{
+ $('comment-list').hide();
+ $('add-comment').show();
+ $('show-comment-link').removeClassName("active");
+ $('add-comment-link').addClassName("active");
+ $('all-comments-link').removeClassName("active");
+}
+
+function hide_add_comment()
+{
+ $('user-comments').hide();
+ $('modal-background').hide();
+ $(content_textare_id).value = '';
+ $(currentCommentID).style.zIndex = 0;
+}
+
+function show_comments_in_list(id)
+{
+ var list = $('comment-list');
+ var count=0;
+ for(var i=0, k=list.childNodes.length; i < k; i++)
+ {
+ var node = list.childNodes[i];
+ if(node.nodeType == 1) //an element node
+ {
+ if(typeof(id) == "undefined" || node.className.indexOf(id) >= 0)
+ {
+ node.style.display="block"
+ count++;
+ }
+ else
+ node.style.display="none";
+ }
+ }
+ return count;
+}
+
+function show_comments(block)
+{
+ var id = block.id
+ currentCommentID = id;
+ $(hidden_block_id).value = id;
+ var commentBlock = $('user-comments');
+ var pos = Position.cumulativeOffset(block);
+ var top = pos[1] + block.offsetHeight;
+ commentBlock.style.top = top+"px";
+ commentBlock.style.width = (block.offsetWidth-22)+"px";
+
+ commentBlock.show();
+
+ var count = show_comments_in_list(id);
+
+ $('comment-list').show();
+ if(count > 0)
+ show_comment_list();
+ else
+ show_add_comment();
+
+ var background = $('modal-background');
+ background.style.top="0px";
+ background.style.left="0px";
+ background.style.opacity="0.5";
+ background.style.width = document.body.offsetWidth+"px";
+ background.style.height = document.body.offsetHeight+"px";
+ background.show();
+ block.style.zIndex = 100;
+ block.style.paddingRight="9px";
+ block.style.marginRight="-9px";
+
+}
+
+function show_block(block)
+{
+ while(block && (!block.className || block.className.indexOf("block-content") < 0))
+ block = block.parentNode;
+ if(block && block.className.indexOf("block-content") >= 0)
+ {
+ block.addClassName('block-hover');
+ var tag = $('tag-'+block.id);
+// if(tag.className.indexOf("tag-shown")<=0)
+ tag.firstChild.style.visibility="visible"
+ }
+}
+
+function hide_block(block)
+{
+ while(block && (!block.className || block.className.indexOf("block-content") < 0))
+ block = block.parentNode;
+ if(block && block.className.indexOf("block-hover") >= 0)
+ {
+ block.removeClassName('block-hover');
+ var tag = $('tag-'+block.id);
+ if(tag.className.indexOf("tag-shown")<=0)
+ tag.firstChild.style.visibility="hidden"
+ }
+}
+
+function add_comment_tag(el)
+{
+ var dim = Element.getDimensions(el);
+ var comments = get_comment_count(el.id);
+ var style = "height:"+(dim.height > 35 ? dim.height : 35)+"px;";
+ var cssClass = dim.height ? "block-comment-tag" : "block-comment-tag-ie";
+ var title = "View "+comments+" comments"
+ var innerStyle="";
+ if(comments <= 0)
+ {
+ innerStyle = " visibility:hidden;";
+ comments = "add";
+ title = "Add new comment";
+ }
+ else
+ cssClass += " tag-shown";
+ var id = "tag-"+el.id;
+ var tag = "<div id='"+id+"' class='"+cssClass+"' style='"+style+"'><div style='"+innerStyle+"' title='"+title+"'>"+comments+"</div>&nbsp;</div>";
+ new Insertion.Before(el, tag);
+ var tag_div = $(id);
+ Event.observe(tag_div, "mouseover", function(e){ if(typeof(show_block)!="undefined") show_block(el); });
+ Event.observe(tag_div, "mouseout", function(e){ if(typeof(hide_block) !="undefined") hide_block(el); });
+ Event.observe(tag_div, "click", function(e) { if(typeof(show_comments) !="undefined") show_comments(el); Event.stop(e); });
+}
+
+function increment_count_tag(id)
+{
+ var tag = $('tag-'+id);
+ if(tag && tag.firstChild)
+ {
+ if(tag.className.indexOf("tag-shown") >= 0)
+ {
+ var count = Number(tag.firstChild.innerHTML);
+ tag.firstChild.innerHTML = (++count)+"";
+ tag.firstChild.style.visibility="visible";
+ }
+ else
+ {
+ tag.firstChild.innerHTML = "1";
+ tag.addClassName("tag-shown");
+ tag.firstChild.style.visibility="visible";
+ }
+ }
+}
+
+function get_comment_count(id)
+{
+ return comment_count[id] ? comment_count[id] : 0;
+}
+
+//initialize the comment js
+
+if(!Prado.Browser.ie) //not IE 4,5,6
+{
+ (function()
+ {
+ var userComments = $('user-comments');
+ userComments.style.position="absolute";
+ userComments.style.marginRight="80px";
+ var commentList = $('comment-list');
+ commentList.style.height="320px";
+ $('add-comment').style.height="320px";
+ commentList.style.overflow="auto";
+ $('show-comment-link').style.display="";
+ $('to-top').hide();
+ $('close-comments').show();
+ $('all-comments-link').show();
+ userComments.hide();
+ $('comments-header').hide();
+
+ $$('#comment-list .source-link').each(function(el){ el.hide(); });
+
+ $$('#content .block-content').each(function(el)
+ {
+ Event.observe(el, 'mouseover', function(e){ if(typeof(show_block)!="undefined") show_block(Event.element(e)); });
+ Event.observe(el, 'mouseout', function(e){ if(typeof(hide_block)!="undefined") hide_block(Event.element(e)); });
+ add_comment_tag(el);
+ });
+
+ Event.observe($('show-comment-link'), "click", function(e) { show_comment_list(); Event.stop(e); });
+ Event.observe($('add-comment-link'), "click", function(e) { show_add_comment(); Event.stop(e); });
+ Event.observe($('all-comments-link'), "click", function(e) { show_all_comments(); Event.stop(e); });
+ Event.observe($('close-comments'), "click", function(e) { hide_add_comment(); Event.stop(e); });
+
+ })();
} \ No newline at end of file
diff --git a/demos/quickstart/protected/controls/DocLink.php b/demos/quickstart/protected/controls/DocLink.php
index e8ca7dfa..12b8e898 100644
--- a/demos/quickstart/protected/controls/DocLink.php
+++ b/demos/quickstart/protected/controls/DocLink.php
@@ -1,31 +1,31 @@
-<?php
-
-class DocLink extends THyperLink
-{
- const BASE_URL='http://www.pradosoft.com/docs/manual';
-
- public function getClassPath()
- {
- return $this->getViewState('ClassPath','');
- }
-
- public function setClassPath($value)
- {
- $this->setViewState('ClassPath',$value,'');
- }
-
- public function onPreRender($param)
- {
- parent::onPreRender($param);
- $paths=explode('.',$this->getClassPath());
- if(count($paths)>1)
- {
- $classFile=array_pop($paths).'.html';
- $this->setNavigateUrl(self::BASE_URL . '/' . implode('.',$paths) . '/' . $classFile);
- if($this->getText() === '')
- $this->setText('API Manual');
- }
- }
-}
-
+<?php
+
+class DocLink extends THyperLink
+{
+ const BASE_URL='http://www.pradosoft.com/docs/manual';
+
+ public function getClassPath()
+ {
+ return $this->getViewState('ClassPath','');
+ }
+
+ public function setClassPath($value)
+ {
+ $this->setViewState('ClassPath',$value,'');
+ }
+
+ public function onPreRender($param)
+ {
+ parent::onPreRender($param);
+ $paths=explode('.',$this->getClassPath());
+ if(count($paths)>1)
+ {
+ $classFile=array_pop($paths).'.html';
+ $this->setNavigateUrl(self::BASE_URL . '/' . implode('.',$paths) . '/' . $classFile);
+ if($this->getText() === '')
+ $this->setText('API Manual');
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/controls/Layout.php b/demos/quickstart/protected/controls/Layout.php
index 3973db8f..5106a72b 100644
--- a/demos/quickstart/protected/controls/Layout.php
+++ b/demos/quickstart/protected/controls/Layout.php
@@ -1,48 +1,48 @@
-<?php
-
-class Layout extends TTemplateControl
-{
- public function __construct()
- {
- if(isset($this->Request['notheme']))
- $this->Service->RequestedPage->EnableTheming=false;
- parent::__construct();
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- $url=$this->Request->RequestUri;
- if(strpos($url,'?')===false)
- $url.='?notheme=true';
- else
- $url.='&amp;notheme=true';
- $this->PrinterLink->NavigateUrl=$url;
-
- if(isset($this->Request['notheme']))
- {
- $this->MainMenu->Visible=false;
- $this->TopicPanel->Visible=false;
- }
-
- $this->languages->DataSource = TPropertyValue::ensureArray($this->Application->Parameters['languages']);
- $this->languages->dataBind();
- }
-
- public function languageLinkCreated($sender, $param)
- {
- $item = $param->Item;
- if($item->ItemType == TListItemType::Item || $item->ItemType == TListItemType::AlternatingItem)
- {
- $params = $this->Request->toArray();
- $params['lang'] = $sender->DataKeys[$item->ItemIndex];
- unset($params[$this->Request->ServiceID]);
- $url = $this->Service->ConstructUrl($this->Service->RequestedPagePath, $params);
- $item->link->NavigateUrl = $url;
- if($this->Application->Globalization->Culture == $params['lang'])
- $item->link->CssClass="active";
- }
- }
-}
-
+<?php
+
+class Layout extends TTemplateControl
+{
+ public function __construct()
+ {
+ if(isset($this->Request['notheme']))
+ $this->Service->RequestedPage->EnableTheming=false;
+ parent::__construct();
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ $url=$this->Request->RequestUri;
+ if(strpos($url,'?')===false)
+ $url.='?notheme=true';
+ else
+ $url.='&amp;notheme=true';
+ $this->PrinterLink->NavigateUrl=$url;
+
+ if(isset($this->Request['notheme']))
+ {
+ $this->MainMenu->Visible=false;
+ $this->TopicPanel->Visible=false;
+ }
+
+ $this->languages->DataSource = TPropertyValue::ensureArray($this->Application->Parameters['languages']);
+ $this->languages->dataBind();
+ }
+
+ public function languageLinkCreated($sender, $param)
+ {
+ $item = $param->Item;
+ if($item->ItemType == TListItemType::Item || $item->ItemType == TListItemType::AlternatingItem)
+ {
+ $params = $this->Request->toArray();
+ $params['lang'] = $sender->DataKeys[$item->ItemIndex];
+ unset($params[$this->Request->ServiceID]);
+ $url = $this->Service->ConstructUrl($this->Service->RequestedPagePath, $params);
+ $item->link->NavigateUrl = $url;
+ if($this->Application->Globalization->Culture == $params['lang'])
+ $item->link->CssClass="active";
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/controls/RequiresVersion.php b/demos/quickstart/protected/controls/RequiresVersion.php
index 9e598d3a..c5dc37ec 100644
--- a/demos/quickstart/protected/controls/RequiresVersion.php
+++ b/demos/quickstart/protected/controls/RequiresVersion.php
@@ -1,16 +1,16 @@
-<?php
-
-class RequiresVersion extends TTemplateControl
-{
- public function setVersion($value)
- {
- $this->setViewState('Version',$value);
- }
-
- public function getVersion()
- {
- return $this->getViewState('Version');
- }
-}
-
+<?php
+
+class RequiresVersion extends TTemplateControl
+{
+ public function setVersion($value)
+ {
+ $this->setViewState('Version',$value);
+ }
+
+ public function getVersion()
+ {
+ return $this->getViewState('Version');
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/controls/RunBar.php b/demos/quickstart/protected/controls/RunBar.php
index 8990c4c3..4db016be 100644
--- a/demos/quickstart/protected/controls/RunBar.php
+++ b/demos/quickstart/protected/controls/RunBar.php
@@ -1,23 +1,23 @@
-<?php
-
-class RunBar extends TTemplateControl
-{
- public function getPagePath()
- {
- return $this->getViewState('PagePath','');
- }
-
- public function setPagePath($value)
- {
- $this->setViewState('PagePath',$value,'');
- }
-
- public function onPreRender($param)
- {
- $pagePath=$this->getPagePath();
- $this->RunButton->NavigateUrl="?page=$pagePath";
- $this->ViewSourceButton->NavigateUrl="?page=ViewSource&path=/".strtr($pagePath,'.','/').'.page';
- }
-}
-
+<?php
+
+class RunBar extends TTemplateControl
+{
+ public function getPagePath()
+ {
+ return $this->getViewState('PagePath','');
+ }
+
+ public function setPagePath($value)
+ {
+ $this->setViewState('PagePath',$value,'');
+ }
+
+ public function onPreRender($param)
+ {
+ $pagePath=$this->getPagePath();
+ $this->RunButton->NavigateUrl="?page=$pagePath";
+ $this->ViewSourceButton->NavigateUrl="?page=ViewSource&path=/".strtr($pagePath,'.','/').'.page';
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/controls/SampleLayout.php b/demos/quickstart/protected/controls/SampleLayout.php
index a89b905d..a2d6f658 100644
--- a/demos/quickstart/protected/controls/SampleLayout.php
+++ b/demos/quickstart/protected/controls/SampleLayout.php
@@ -1,13 +1,13 @@
-<?php
-
-class SampleLayout extends TTemplateControl
-{
- public function __construct()
- {
- if(isset($this->Request['notheme']))
- $this->Service->RequestedPage->EnableTheming=false;
- parent::__construct();
- }
-}
-
+<?php
+
+class SampleLayout extends TTemplateControl
+{
+ public function __construct()
+ {
+ if(isset($this->Request['notheme']))
+ $this->Service->RequestedPage->EnableTheming=false;
+ parent::__construct();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/controls/SearchBox.php b/demos/quickstart/protected/controls/SearchBox.php
index 2e74ae31..e13d5e46 100644
--- a/demos/quickstart/protected/controls/SearchBox.php
+++ b/demos/quickstart/protected/controls/SearchBox.php
@@ -1,41 +1,41 @@
-<?php
-
-class SearchBox extends TTemplateControl
-{
- public function getText()
- {
- $this->ensureChildControls();
- return $this->getRegisteredObject('search')->getText();
- }
-
- public function getTextBox()
- {
- $this->ensureChildControls();
- return $this->getRegisteredObject('search');
- }
-
- public function getButton()
- {
- $this->ensureChildControls();
- return $this->getRegisteredObject('find');
- }
-
- public function onInit($param)
- {
- parent::onInit($param);
- if(strlen($q = $this->Page->Request['q']) > 0)
- $this->search->setText($q);
- }
-
- public function doSearch($sender, $param)
- {
- if(strlen($query = $this->search->getText()) >0)
- {
- $ps = $this->getApplication()->getService();
- $page = $ps->constructUrl('Search', array('q' => $query), false);
- $this->getApplication()->getResponse()->redirect($page);
- }
- }
-}
-
+<?php
+
+class SearchBox extends TTemplateControl
+{
+ public function getText()
+ {
+ $this->ensureChildControls();
+ return $this->getRegisteredObject('search')->getText();
+ }
+
+ public function getTextBox()
+ {
+ $this->ensureChildControls();
+ return $this->getRegisteredObject('search');
+ }
+
+ public function getButton()
+ {
+ $this->ensureChildControls();
+ return $this->getRegisteredObject('find');
+ }
+
+ public function onInit($param)
+ {
+ parent::onInit($param);
+ if(strlen($q = $this->Page->Request['q']) > 0)
+ $this->search->setText($q);
+ }
+
+ public function doSearch($sender, $param)
+ {
+ if(strlen($query = $this->search->getText()) >0)
+ {
+ $ps = $this->getApplication()->getService();
+ $page = $ps->constructUrl('Search', array('q' => $query), false);
+ $this->getApplication()->getResponse()->redirect($page);
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/controls/SinceVersion.php b/demos/quickstart/protected/controls/SinceVersion.php
index cfeeffbb..db73275b 100644
--- a/demos/quickstart/protected/controls/SinceVersion.php
+++ b/demos/quickstart/protected/controls/SinceVersion.php
@@ -1,16 +1,16 @@
-<?php
-
-class SinceVersion extends TTemplateControl
-{
- public function setVersion($value)
- {
- $this->setViewState('Version',$value);
- }
-
- public function getVersion()
- {
- return $this->getViewState('Version');
- }
-}
-
+<?php
+
+class SinceVersion extends TTemplateControl
+{
+ public function setVersion($value)
+ {
+ $this->setViewState('Version',$value);
+ }
+
+ public function getVersion()
+ {
+ return $this->getViewState('Version');
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/controls/TopicList.php b/demos/quickstart/protected/controls/TopicList.php
index ce827cc0..eb5976a9 100644
--- a/demos/quickstart/protected/controls/TopicList.php
+++ b/demos/quickstart/protected/controls/TopicList.php
@@ -1,8 +1,8 @@
-<?php
-
-class TopicList extends TTemplateControl
-{
-
-}
-
+<?php
+
+class TopicList extends TTemplateControl
+{
+
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/index/ZendSearch.php b/demos/quickstart/protected/index/ZendSearch.php
index ec15729c..70aef414 100644
--- a/demos/quickstart/protected/index/ZendSearch.php
+++ b/demos/quickstart/protected/index/ZendSearch.php
@@ -1,55 +1,55 @@
-<?php
-/*
- * Created on 7/05/2006
- */
-
-class ZendSearch extends TModule
-{
- private $_data;
- private $_ZF;
- private $_search;
-
- public function setIndexDataDirectory($path)
- {
- $this->_data = Prado::getPathOfNamespace($path);
- }
-
- public function getIndexDataDirectory()
- {
- return $this->_data;
- }
-
- public function setZendFramework($path)
- {
- $this->_ZF = Prado::getPathOfNamespace($path);
- }
-
- protected function importZendNamespace()
- {
- if(is_null(Prado::getPathOfAlias('Zend')))
- {
- $zendBase = !is_null($this->_ZF) ? $this->_ZF.'.*' : 'Application.index.*';
- $path = !is_null($this->_ZF) ? $this->_ZF.'.Zend.*' : 'Application.index.Zend.*';
- Prado::using($zendBase);
- Prado::setPathOfAlias('Zend', Prado::getPathOfNamespace($path));
- }
- }
-
- protected function getZendSearch()
- {
- if(is_null($this->_search))
- {
- $this->importZendNamespace();
- Prado::using('Zend.Search.Lucene');
- $this->_search = new Zend_Search_Lucene($this->_data);
- }
- return $this->_search;
- }
-
- public function find($query)
- {
- return $this->getZendSearch()->find(strtolower($query));
- }
-}
-
+<?php
+/*
+ * Created on 7/05/2006
+ */
+
+class ZendSearch extends TModule
+{
+ private $_data;
+ private $_ZF;
+ private $_search;
+
+ public function setIndexDataDirectory($path)
+ {
+ $this->_data = Prado::getPathOfNamespace($path);
+ }
+
+ public function getIndexDataDirectory()
+ {
+ return $this->_data;
+ }
+
+ public function setZendFramework($path)
+ {
+ $this->_ZF = Prado::getPathOfNamespace($path);
+ }
+
+ protected function importZendNamespace()
+ {
+ if(is_null(Prado::getPathOfAlias('Zend')))
+ {
+ $zendBase = !is_null($this->_ZF) ? $this->_ZF.'.*' : 'Application.index.*';
+ $path = !is_null($this->_ZF) ? $this->_ZF.'.Zend.*' : 'Application.index.Zend.*';
+ Prado::using($zendBase);
+ Prado::setPathOfAlias('Zend', Prado::getPathOfNamespace($path));
+ }
+ }
+
+ protected function getZendSearch()
+ {
+ if(is_null($this->_search))
+ {
+ $this->importZendNamespace();
+ Prado::using('Zend.Search.Lucene');
+ $this->_search = new Zend_Search_Lucene($this->_data);
+ }
+ return $this->_search;
+ }
+
+ public function find($query)
+ {
+ return $this->getZendSearch()->find(strtolower($query));
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.php
index 4a4e23ca..e3afdaae 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.php
@@ -1,20 +1,20 @@
-<?php
-
-// $Id$
-class Home extends TPage
-{
- public function buttonClicked($sender, $param)
- {
- if($param instanceof TCommandEventParameter)
- $sender->Text="Name: {$param->CommandName}, Param: {$param->CommandParameter}";
- else
- $sender->Text="I'm clicked";
- }
-
- public function buttonCallback($sender, $param)
- {
- $sender->Text .= ' using callback';
- }
-}
-
+<?php
+
+// $Id$
+class Home extends TPage
+{
+ public function buttonClicked($sender, $param)
+ {
+ if($param instanceof TCommandEventParameter)
+ $sender->Text="Name: {$param->CommandName}, Param: {$param->CommandParameter}";
+ else
+ $sender->Text="I'm clicked";
+ }
+
+ public function buttonCallback($sender, $param)
+ {
+ $sender->Text .= ' using callback';
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.php
index f0543695..5a73a6f4 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.php
@@ -1,16 +1,16 @@
-<?php
-// $Id$
-class Home extends TPage
-{
- public function checkboxClicked($sender,$param)
- {
- $sender->Text= $sender->ClientID . " clicked";
- }
-
- public function checkboxCallback($sender, $param)
- {
- $sender->Text .= ' using callback';
- }
-}
-
+<?php
+// $Id$
+class Home extends TPage
+{
+ public function checkboxClicked($sender,$param)
+ {
+ $sender->Text= $sender->ClientID . " clicked";
+ }
+
+ public function checkboxCallback($sender, $param)
+ {
+ $sender->Text .= ' using callback';
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBoxList/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBoxList/Home.php
index 3644721e..b9060163 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBoxList/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBoxList/Home.php
@@ -1,26 +1,26 @@
-<?php
-
-class Home extends TPage
-{
- protected function collectSelectionResult($input,$output)
- {
- $indices=$input->SelectedIndices;
- $result='';
- foreach($indices as $index)
- {
- $item=$input->Items[$index];
- $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
- }
- if($result==='')
- $output->Text='Your selection is empty.';
- else
- $output->Text='Your selection is: '.$result;
- }
-
- public function selectionChanged($sender,$param)
- {
- $this->collectSelectionResult($this->CheckBoxList,$this->SelectionResult);
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ protected function collectSelectionResult($input,$output)
+ {
+ $indices=$input->SelectedIndices;
+ $result='';
+ foreach($indices as $index)
+ {
+ $item=$input->Items[$index];
+ $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
+ }
+ if($result==='')
+ $output->Text='Your selection is empty.';
+ else
+ $output->Text='Your selection is: '.$result;
+ }
+
+ public function selectionChanged($sender,$param)
+ {
+ $this->collectSelectionResult($this->CheckBoxList,$this->SelectionResult);
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.php
index 102afcb0..c668c86d 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.php
@@ -1,11 +1,11 @@
-<?php
-
-class Home extends TPage
-{
- public function validator1_onvalidate($sender, $param)
- {
- $param->IsValid = $this->textbox1->Text == 'Prado';
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function validator1_onvalidate($sender, $param)
+ {
+ $param->IsValid = $this->textbox1->Text == 'Prado';
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php
index ada1ee6e..43d645ab 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample1.php
@@ -1,37 +1,37 @@
-<?php
-
-class Sample1 extends TPage
-{
- protected function getData()
- {
- return array(
- array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
- array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
- array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
- array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
- array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
- array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
- array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
- array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
- array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
- array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
- array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
- array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
- array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
- array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
- array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
- );
- }
-
- public function buttonClicked($sender, $param)
- {
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+class Sample1 extends TPage
+{
+ protected function getData()
+ {
+ return array(
+ array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
+ array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
+ array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
+ array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
+ array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
+ array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
+ array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
+ array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
+ array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
+ array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
+ array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
+ array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
+ array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
+ array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
+ array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
+ );
+ }
+
+ public function buttonClicked($sender, $param)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php
index 3831582d..10a37e0a 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample2.php
@@ -1,86 +1,86 @@
-<?php
-
-class Sample2 extends TPage
-{
- protected function getData()
- {
- return array(
- array(
- 'ISBN'=>'0596007124',
- 'title'=>'Head First Design Patterns',
- 'publisher'=>'O\'Reilly Media, Inc.',
- 'price'=>29.67,
- 'instock'=>true,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0201633612',
- 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>47.04,
- 'instock'=>true,
- 'rating'=>5,
- ),
- array(
- 'ISBN'=>'0321247140',
- 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>37.49,
- 'instock'=>true,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0201485672',
- 'title'=>'Refactoring: Improving the Design of Existing Code',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>47.14,
- 'instock'=>true,
- 'rating'=>3,
- ),
- array(
- 'ISBN'=>'0321213351',
- 'title'=>'Refactoring to Patterns',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>38.49,
- 'instock'=>true,
- 'rating'=>2,
- ),
- array(
- 'ISBN'=>'0735619670',
- 'title'=>'Code Complete',
- 'publisher'=>'Microsoft Press',
- 'price'=>32.99,
- 'instock'=>false,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0321278658',
- 'title'=>'Extreme Programming Explained : Embrace Change',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>34.99,
- 'instock'=>true,
- 'rating'=>3,
- ),
- );
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack && !$this->IsCallBack)
- {
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
- }
-
- public function toggleColumnVisibility($sender,$param)
- {
- foreach($this->DataGrid->Columns as $index=>$column)
- $column->Visible=$sender->Items[$index]->Selected;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+class Sample2 extends TPage
+{
+ protected function getData()
+ {
+ return array(
+ array(
+ 'ISBN'=>'0596007124',
+ 'title'=>'Head First Design Patterns',
+ 'publisher'=>'O\'Reilly Media, Inc.',
+ 'price'=>29.67,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201633612',
+ 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.04,
+ 'instock'=>true,
+ 'rating'=>5,
+ ),
+ array(
+ 'ISBN'=>'0321247140',
+ 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>37.49,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201485672',
+ 'title'=>'Refactoring: Improving the Design of Existing Code',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.14,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ array(
+ 'ISBN'=>'0321213351',
+ 'title'=>'Refactoring to Patterns',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>38.49,
+ 'instock'=>true,
+ 'rating'=>2,
+ ),
+ array(
+ 'ISBN'=>'0735619670',
+ 'title'=>'Code Complete',
+ 'publisher'=>'Microsoft Press',
+ 'price'=>32.99,
+ 'instock'=>false,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0321278658',
+ 'title'=>'Extreme Programming Explained : Embrace Change',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>34.99,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ );
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack && !$this->IsCallBack)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
+ public function toggleColumnVisibility($sender,$param)
+ {
+ foreach($this->DataGrid->Columns as $index=>$column)
+ $column->Visible=$sender->Items[$index]->Selected;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php
index 9768ca31..5e2fb355 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample3.php
@@ -1,190 +1,190 @@
-<?php
-
-class Sample3 extends TPage
-{
- private $_data=null;
-
- protected function getData()
- {
- if($this->_data===null)
- $this->loadData();
- return $this->_data;
- }
-
- protected function loadData()
- {
- // We use viewstate keep track of data.
- // In real applications, data should come from database using an SQL SELECT statement.
- // In the following tabular data, field 'ISBN' is the primary key.
- // All update and delete operations should come with an 'id' value in order to go through.
- if(($this->_data=$this->getViewState('Data',null))===null)
- {
- $this->_data=array(
- array(
- 'ISBN'=>'0596007124',
- 'title'=>'Head First Design Patterns',
- 'publisher'=>'O\'Reilly Media, Inc.',
- 'price'=>29.67,
- 'instock'=>true,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0201633612',
- 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>47.04,
- 'instock'=>true,
- 'rating'=>5,
- ),
- array(
- 'ISBN'=>'0321247140',
- 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>37.49,
- 'instock'=>true,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0201485672',
- 'title'=>'Refactoring: Improving the Design of Existing Code',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>47.14,
- 'instock'=>true,
- 'rating'=>3,
- ),
- array(
- 'ISBN'=>'0321213351',
- 'title'=>'Refactoring to Patterns',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>38.49,
- 'instock'=>true,
- 'rating'=>2,
- ),
- array(
- 'ISBN'=>'0735619670',
- 'title'=>'Code Complete',
- 'publisher'=>'Microsoft Press',
- 'price'=>32.99,
- 'instock'=>false,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0321278658 ',
- 'title'=>'Extreme Programming Explained : Embrace Change',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>34.99,
- 'instock'=>true,
- 'rating'=>3,
- ),
- );
- $this->saveData();
- }
- }
-
- protected function saveData()
- {
- $this->setViewState('Data',$this->_data);
- }
-
- protected function updateBook($isbn,$title,$publisher,$price,$instock,$rating)
- {
- // In real applications, data should be saved to database using an SQL UPDATE statement
- if($this->_data===null)
- $this->loadData();
- $updateRow=null;
- foreach($this->_data as $index=>$row)
- if($row['ISBN']===$isbn)
- $updateRow=&$this->_data[$index];
- if($updateRow!==null)
- {
- $updateRow['title']=$title;
- $updateRow['publisher']=$publisher;
- $updateRow['price']=TPropertyValue::ensureFloat(ltrim($price,'$'));
- $updateRow['instock']=TPropertyValue::ensureBoolean($instock);
- $updateRow['rating']=TPropertyValue::ensureInteger($rating);
- $this->saveData();
- }
- }
-
- protected function deleteBook($isbn)
- {
- // In real applications, data should be saved to database using an SQL DELETE statement
- if($this->_data===null)
- $this->loadData();
- $deleteIndex=-1;
- foreach($this->_data as $index=>$row)
- if($row['ISBN']===$isbn)
- $deleteIndex=$index;
- if($deleteIndex>=0)
- {
- unset($this->_data[$deleteIndex]);
- $this->saveData();
- }
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack && !$this->IsCallBack)
- {
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
- }
-
- public function itemCreated($sender,$param)
- {
- $item=$param->Item;
- if($item->ItemType==='EditItem')
- {
- // set column width of textboxes
- $item->BookTitleColumn->TextBox->Columns=40;
- $item->PriceColumn->TextBox->Columns=5;
- }
- if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem' || $item->ItemType==='EditItem')
- {
- // add an aleart dialog to delete buttons
- $item->DeleteColumn->Button->Attributes->onclick='if(!confirm(\'Are you sure?\')) return false;';
- }
- }
-
- public function editItem($sender,$param)
- {
- $this->DataGrid->EditItemIndex=$param->Item->ItemIndex;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function saveItem($sender,$param)
- {
- $item=$param->Item;
- $this->updateBook(
- $this->DataGrid->DataKeys[$item->ItemIndex], // ISBN
- $item->BookTitleColumn->TextBox->Text, // title
- $item->PublisherColumn->TextBox->Text, // publisher
- $item->PriceColumn->TextBox->Text, // price
- $item->InStockColumn->CheckBox->Checked, // instock
- $item->RatingColumn->DropDownList->SelectedValue // rating
- );
- $this->DataGrid->EditItemIndex=-1;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function cancelItem($sender,$param)
- {
- $this->DataGrid->EditItemIndex=-1;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function deleteItem($sender,$param)
- {
- $this->deleteBook($this->DataGrid->DataKeys[$param->Item->ItemIndex]);
- $this->DataGrid->EditItemIndex=-1;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+class Sample3 extends TPage
+{
+ private $_data=null;
+
+ protected function getData()
+ {
+ if($this->_data===null)
+ $this->loadData();
+ return $this->_data;
+ }
+
+ protected function loadData()
+ {
+ // We use viewstate keep track of data.
+ // In real applications, data should come from database using an SQL SELECT statement.
+ // In the following tabular data, field 'ISBN' is the primary key.
+ // All update and delete operations should come with an 'id' value in order to go through.
+ if(($this->_data=$this->getViewState('Data',null))===null)
+ {
+ $this->_data=array(
+ array(
+ 'ISBN'=>'0596007124',
+ 'title'=>'Head First Design Patterns',
+ 'publisher'=>'O\'Reilly Media, Inc.',
+ 'price'=>29.67,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201633612',
+ 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.04,
+ 'instock'=>true,
+ 'rating'=>5,
+ ),
+ array(
+ 'ISBN'=>'0321247140',
+ 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>37.49,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201485672',
+ 'title'=>'Refactoring: Improving the Design of Existing Code',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.14,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ array(
+ 'ISBN'=>'0321213351',
+ 'title'=>'Refactoring to Patterns',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>38.49,
+ 'instock'=>true,
+ 'rating'=>2,
+ ),
+ array(
+ 'ISBN'=>'0735619670',
+ 'title'=>'Code Complete',
+ 'publisher'=>'Microsoft Press',
+ 'price'=>32.99,
+ 'instock'=>false,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0321278658 ',
+ 'title'=>'Extreme Programming Explained : Embrace Change',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>34.99,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ );
+ $this->saveData();
+ }
+ }
+
+ protected function saveData()
+ {
+ $this->setViewState('Data',$this->_data);
+ }
+
+ protected function updateBook($isbn,$title,$publisher,$price,$instock,$rating)
+ {
+ // In real applications, data should be saved to database using an SQL UPDATE statement
+ if($this->_data===null)
+ $this->loadData();
+ $updateRow=null;
+ foreach($this->_data as $index=>$row)
+ if($row['ISBN']===$isbn)
+ $updateRow=&$this->_data[$index];
+ if($updateRow!==null)
+ {
+ $updateRow['title']=$title;
+ $updateRow['publisher']=$publisher;
+ $updateRow['price']=TPropertyValue::ensureFloat(ltrim($price,'$'));
+ $updateRow['instock']=TPropertyValue::ensureBoolean($instock);
+ $updateRow['rating']=TPropertyValue::ensureInteger($rating);
+ $this->saveData();
+ }
+ }
+
+ protected function deleteBook($isbn)
+ {
+ // In real applications, data should be saved to database using an SQL DELETE statement
+ if($this->_data===null)
+ $this->loadData();
+ $deleteIndex=-1;
+ foreach($this->_data as $index=>$row)
+ if($row['ISBN']===$isbn)
+ $deleteIndex=$index;
+ if($deleteIndex>=0)
+ {
+ unset($this->_data[$deleteIndex]);
+ $this->saveData();
+ }
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack && !$this->IsCallBack)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
+ public function itemCreated($sender,$param)
+ {
+ $item=$param->Item;
+ if($item->ItemType==='EditItem')
+ {
+ // set column width of textboxes
+ $item->BookTitleColumn->TextBox->Columns=40;
+ $item->PriceColumn->TextBox->Columns=5;
+ }
+ if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem' || $item->ItemType==='EditItem')
+ {
+ // add an aleart dialog to delete buttons
+ $item->DeleteColumn->Button->Attributes->onclick='if(!confirm(\'Are you sure?\')) return false;';
+ }
+ }
+
+ public function editItem($sender,$param)
+ {
+ $this->DataGrid->EditItemIndex=$param->Item->ItemIndex;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function saveItem($sender,$param)
+ {
+ $item=$param->Item;
+ $this->updateBook(
+ $this->DataGrid->DataKeys[$item->ItemIndex], // ISBN
+ $item->BookTitleColumn->TextBox->Text, // title
+ $item->PublisherColumn->TextBox->Text, // publisher
+ $item->PriceColumn->TextBox->Text, // price
+ $item->InStockColumn->CheckBox->Checked, // instock
+ $item->RatingColumn->DropDownList->SelectedValue // rating
+ );
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function cancelItem($sender,$param)
+ {
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function deleteItem($sender,$param)
+ {
+ $this->deleteBook($this->DataGrid->DataKeys[$param->Item->ItemIndex]);
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php
index eb1a0e5b..46c7dc81 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php
@@ -1,21 +1,21 @@
-<?php
-
-Prado::using('Application.pages.ActiveControls.Samples.TActiveDataGrid.Sample2');
-
-class Sample4 extends Sample2
-{
- protected function sortData($data,$key)
- {
- $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}');
- usort($data,$compare) ;
- return $data ;
- }
-
- public function sortDataGrid($sender,$param)
- {
- $this->DataGrid->DataSource=$this->sortData($this->Data,$param->SortExpression);
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+Prado::using('Application.pages.ActiveControls.Samples.TActiveDataGrid.Sample2');
+
+class Sample4 extends Sample2
+{
+ protected function sortData($data,$key)
+ {
+ $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}');
+ usort($data,$compare) ;
+ return $data ;
+ }
+
+ public function sortDataGrid($sender,$param)
+ {
+ $this->DataGrid->DataSource=$this->sortData($this->Data,$param->SortExpression);
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php
index 95bf9a0e..dc4a4dd6 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample5.php
@@ -1,79 +1,79 @@
-<?php
-
-Prado::using('Application.pages.ActiveControls.Samples.TActiveDataGrid.Sample1');
-
-class Sample5 extends Sample1
-{
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostback && ! $this->IsCallback)
- {
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
- }
-
- public function changePage($sender,$param)
- {
- $this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function pagerCreated($sender,$param)
- {
- $param->Pager->Controls->insertAt(0,'Page: ');
- }
-
- public function changePagerPosition($sender,$param)
- {
- $top=$sender->Items[0]->Selected;
- $bottom=$sender->Items[1]->Selected;
- if($top && $bottom)
- $position='TopAndBottom';
- else if($top)
- $position='Top';
- else if($bottom)
- $position='Bottom';
- else
- $position='';
- if($position==='')
- $this->DataGrid->PagerStyle->Visible=false;
- else
- {
- $this->DataGrid->PagerStyle->Position=$position;
- $this->DataGrid->PagerStyle->Visible=true;
- }
- }
-
- public function useNumericPager($sender,$param)
- {
- $this->DataGrid->PagerStyle->Mode='Numeric';
- $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
- $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
- $this->DataGrid->PagerStyle->PageButtonCount=$this->PageButtonCount->Text;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function useNextPrevPager($sender,$param)
- {
- $this->DataGrid->PagerStyle->Mode='NextPrev';
- $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
- $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function changePageSize($sender,$param)
- {
- $this->DataGrid->PageSize=TPropertyValue::ensureInteger($this->PageSize->Text);
- $this->DataGrid->CurrentPageIndex=0;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+Prado::using('Application.pages.ActiveControls.Samples.TActiveDataGrid.Sample1');
+
+class Sample5 extends Sample1
+{
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostback && ! $this->IsCallback)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
+ public function changePage($sender,$param)
+ {
+ $this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function pagerCreated($sender,$param)
+ {
+ $param->Pager->Controls->insertAt(0,'Page: ');
+ }
+
+ public function changePagerPosition($sender,$param)
+ {
+ $top=$sender->Items[0]->Selected;
+ $bottom=$sender->Items[1]->Selected;
+ if($top && $bottom)
+ $position='TopAndBottom';
+ else if($top)
+ $position='Top';
+ else if($bottom)
+ $position='Bottom';
+ else
+ $position='';
+ if($position==='')
+ $this->DataGrid->PagerStyle->Visible=false;
+ else
+ {
+ $this->DataGrid->PagerStyle->Position=$position;
+ $this->DataGrid->PagerStyle->Visible=true;
+ }
+ }
+
+ public function useNumericPager($sender,$param)
+ {
+ $this->DataGrid->PagerStyle->Mode='Numeric';
+ $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
+ $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
+ $this->DataGrid->PagerStyle->PageButtonCount=$this->PageButtonCount->Text;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function useNextPrevPager($sender,$param)
+ {
+ $this->DataGrid->PagerStyle->Mode='NextPrev';
+ $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
+ $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function changePageSize($sender,$param)
+ {
+ $this->DataGrid->PageSize=TPropertyValue::ensureInteger($this->PageSize->Text);
+ $this->DataGrid->CurrentPageIndex=0;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php
index c62a239d..b77fe63c 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataList/Home.php
@@ -1,132 +1,132 @@
-<?php
-
-class Home extends TPage
-{
- private $_data=null;
-
- protected function getData()
- {
- if($this->_data===null)
- $this->loadData();
- return $this->_data;
- }
-
- protected function loadData()
- {
- // We use viewstate keep track of data.
- // In real applications, data should come from database using an SQL SELECT statement.
- // In the following tabular data, field 'id' is the primary key.
- // All update and delete operations should come with an 'id' value in order to go through.
- if(($this->_data=$this->getViewState('Data',null))===null)
- {
- $this->_data=array(
- array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
- array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>false),
- array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
- array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>true),
- array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>false),
- );
- $this->saveData();
- }
- }
-
- protected function saveData()
- {
- $this->setViewState('Data',$this->_data);
- }
-
- protected function updateProduct($id,$name,$quantity,$price,$imported)
- {
- // In real applications, data should be saved to database using an SQL UPDATE statement
- if($this->_data===null)
- $this->loadData();
- $updateRow=null;
- foreach($this->_data as $index=>$row)
- if($row['id']===$id)
- $updateRow=&$this->_data[$index];
- if($updateRow!==null)
- {
- $updateRow['name']=$name;
- $updateRow['quantity']=TPropertyValue::ensureInteger($quantity);
- $updateRow['price']=TPropertyValue::ensureFloat($price);
- $updateRow['imported']=TPropertyValue::ensureBoolean($imported);
- $this->saveData();
- }
- }
-
- protected function deleteProduct($id)
- {
- // In real applications, data should be saved to database using an SQL DELETE statement
- if($this->_data===null)
- $this->loadData();
- $deleteIndex=-1;
- foreach($this->_data as $index=>$row)
- if($row['id']===$id)
- $deleteIndex=$index;
- if($deleteIndex>=0)
- {
- unset($this->_data[$deleteIndex]);
- $this->saveData();
- }
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->DataList->DataSource=$this->Data;
- $this->DataList->dataBind();
- }
- }
-
- public function editItem($sender,$param)
- {
- $this->DataList->SelectedItemIndex=-1;
- $this->DataList->EditItemIndex=$param->Item->ItemIndex;
- $this->DataList->DataSource=$this->Data;
- $this->DataList->dataBind();
- }
-
- public function cancelItem($sender,$param)
- {
- $this->DataList->SelectedItemIndex=-1;
- $this->DataList->EditItemIndex=-1;
- $this->DataList->DataSource=$this->Data;
- $this->DataList->dataBind();
- }
-
- public function updateItem($sender,$param)
- {
- $item=$param->Item;
- $this->updateProduct(
- $this->DataList->DataKeys[$item->ItemIndex],
- $item->ProductName->Text,
- $item->ProductQuantity->Text,
- $item->ProductPrice->Text,
- $item->ProductImported->Checked);
- $this->DataList->EditItemIndex=-1;
- $this->DataList->DataSource=$this->Data;
- $this->DataList->dataBind();
- }
-
- public function deleteItem($sender,$param)
- {
- $this->deleteProduct($this->DataList->DataKeys[$param->Item->ItemIndex]);
- $this->DataList->SelectedItemIndex=-1;
- $this->DataList->EditItemIndex=-1;
- $this->DataList->DataSource=$this->Data;
- $this->DataList->dataBind();
- }
-
- public function selectItem($sender,$param)
- {
- $this->DataList->EditItemIndex=-1;
- $this->DataList->DataSource=$this->Data;
- $this->DataList->dataBind();
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ private $_data=null;
+
+ protected function getData()
+ {
+ if($this->_data===null)
+ $this->loadData();
+ return $this->_data;
+ }
+
+ protected function loadData()
+ {
+ // We use viewstate keep track of data.
+ // In real applications, data should come from database using an SQL SELECT statement.
+ // In the following tabular data, field 'id' is the primary key.
+ // All update and delete operations should come with an 'id' value in order to go through.
+ if(($this->_data=$this->getViewState('Data',null))===null)
+ {
+ $this->_data=array(
+ array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
+ array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>false),
+ array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
+ array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>true),
+ array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>false),
+ );
+ $this->saveData();
+ }
+ }
+
+ protected function saveData()
+ {
+ $this->setViewState('Data',$this->_data);
+ }
+
+ protected function updateProduct($id,$name,$quantity,$price,$imported)
+ {
+ // In real applications, data should be saved to database using an SQL UPDATE statement
+ if($this->_data===null)
+ $this->loadData();
+ $updateRow=null;
+ foreach($this->_data as $index=>$row)
+ if($row['id']===$id)
+ $updateRow=&$this->_data[$index];
+ if($updateRow!==null)
+ {
+ $updateRow['name']=$name;
+ $updateRow['quantity']=TPropertyValue::ensureInteger($quantity);
+ $updateRow['price']=TPropertyValue::ensureFloat($price);
+ $updateRow['imported']=TPropertyValue::ensureBoolean($imported);
+ $this->saveData();
+ }
+ }
+
+ protected function deleteProduct($id)
+ {
+ // In real applications, data should be saved to database using an SQL DELETE statement
+ if($this->_data===null)
+ $this->loadData();
+ $deleteIndex=-1;
+ foreach($this->_data as $index=>$row)
+ if($row['id']===$id)
+ $deleteIndex=$index;
+ if($deleteIndex>=0)
+ {
+ unset($this->_data[$deleteIndex]);
+ $this->saveData();
+ }
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+ }
+
+ public function editItem($sender,$param)
+ {
+ $this->DataList->SelectedItemIndex=-1;
+ $this->DataList->EditItemIndex=$param->Item->ItemIndex;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function cancelItem($sender,$param)
+ {
+ $this->DataList->SelectedItemIndex=-1;
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function updateItem($sender,$param)
+ {
+ $item=$param->Item;
+ $this->updateProduct(
+ $this->DataList->DataKeys[$item->ItemIndex],
+ $item->ProductName->Text,
+ $item->ProductQuantity->Text,
+ $item->ProductPrice->Text,
+ $item->ProductImported->Checked);
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function deleteItem($sender,$param)
+ {
+ $this->deleteProduct($this->DataList->DataKeys[$param->Item->ItemIndex]);
+ $this->DataList->SelectedItemIndex=-1;
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function selectItem($sender,$param)
+ {
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDropDownList/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDropDownList/Home.php
index 0ba728c6..5b16af2c 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDropDownList/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDropDownList/Home.php
@@ -1,60 +1,60 @@
-<?php
-
-class Home extends TPage
-{
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack && !$this->IsCallback)
- {
- $this->resetClicked(null,null);
- }
- }
-
- protected function collectSelectionResult($input,$output)
- {
- $indices=$input->SelectedIndices;
- $result='';
- foreach($indices as $index)
- {
- $item=$input->Items[$index];
- $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
- }
- if($result==='')
- $output->Text='Your selection is empty.';
- else
- $output->Text='Your selection is: '.$result;
- }
-
- public function selectionChanged($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->SelectionResult);
- }
-
- public function buttonClicked($sender, $param)
- {
- $data=array();
- for($i = 0; $i <= $this->ddl1->Items->Count; $i++)
- $data[$i]="Item number #".$i;
- $this->ddl1->DataSource=$data;
- $this->ddl1->dataBind();
- $this->label1->Text="Total ".count($data)." items";
- }
-
- public function resetClicked($sender, $param)
- {
- $data=array('item 1','item 2','item 3','item 4');
- $this->ddl2->DataSource=$data;
- $this->ddl2->dataBind();
- $this->label2->Text="DropDownList has been reset";
- }
-
- public function clearClicked($sender, $param)
- {
- $this->ddl2->DataSource=array();
- $this->ddl2->dataBind();
- $this->label2->Text="DropDownList cleared";
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack && !$this->IsCallback)
+ {
+ $this->resetClicked(null,null);
+ }
+ }
+
+ protected function collectSelectionResult($input,$output)
+ {
+ $indices=$input->SelectedIndices;
+ $result='';
+ foreach($indices as $index)
+ {
+ $item=$input->Items[$index];
+ $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
+ }
+ if($result==='')
+ $output->Text='Your selection is empty.';
+ else
+ $output->Text='Your selection is: '.$result;
+ }
+
+ public function selectionChanged($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->SelectionResult);
+ }
+
+ public function buttonClicked($sender, $param)
+ {
+ $data=array();
+ for($i = 0; $i <= $this->ddl1->Items->Count; $i++)
+ $data[$i]="Item number #".$i;
+ $this->ddl1->DataSource=$data;
+ $this->ddl1->dataBind();
+ $this->label1->Text="Total ".count($data)." items";
+ }
+
+ public function resetClicked($sender, $param)
+ {
+ $data=array('item 1','item 2','item 3','item 4');
+ $this->ddl2->DataSource=$data;
+ $this->ddl2->dataBind();
+ $this->label2->Text="DropDownList has been reset";
+ }
+
+ public function clearClicked($sender, $param)
+ {
+ $this->ddl2->DataSource=array();
+ $this->ddl2->dataBind();
+ $this->label2->Text="DropDownList cleared";
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveFileUpload/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveFileUpload/Home.php
index d5cf990a..29d05a1c 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveFileUpload/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveFileUpload/Home.php
@@ -1,21 +1,21 @@
-<?php
-
-class Home extends TPage
-{
- public function fileUploaded($sender,$param)
- {
- if($sender->HasFile)
- {
- $this->Result->Text="
- You just uploaded a file:
- <br/>
- Name: {$sender->FileName}
- <br/>
- Size: {$sender->FileSize}
- <br/>
- Type: {$sender->FileType}";
- }
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function fileUploaded($sender,$param)
+ {
+ if($sender->HasFile)
+ {
+ $this->Result->Text="
+ You just uploaded a file:
+ <br/>
+ Name: {$sender->FileName}
+ <br/>
+ Size: {$sender->FileSize}
+ <br/>
+ Type: {$sender->FileType}";
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php
index c125d902..45ea1584 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php
@@ -1,26 +1,26 @@
-<?php
-
-class Home extends TPage
-{
- function button1_clicked($sender, $param)
- {
- $this->link1->NavigateUrl = 'http://www.google.com';
- }
-
- function button2_clicked($sender, $param)
- {
- $this->link2->Target = '_self';
- }
-
- function button3_clicked($sender, $param)
- {
- $this->link3->Text = 'PradoSoft.com';
- }
-
- function button4_clicked($sender, $param)
- {
- $img = $this->publishFilePath(dirname(__FILE__).'/hello_world.gif');
- $this->link4->ImageUrl = $img;
- }
-}
+<?php
+
+class Home extends TPage
+{
+ function button1_clicked($sender, $param)
+ {
+ $this->link1->NavigateUrl = 'http://www.google.com';
+ }
+
+ function button2_clicked($sender, $param)
+ {
+ $this->link2->Target = '_self';
+ }
+
+ function button3_clicked($sender, $param)
+ {
+ $this->link3->Text = 'PradoSoft.com';
+ }
+
+ function button4_clicked($sender, $param)
+ {
+ $img = $this->publishFilePath(dirname(__FILE__).'/hello_world.gif');
+ $this->link4->ImageUrl = $img;
+ }
+}
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImage/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImage/Home.php
index 3628ad0a..6850fb40 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImage/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImage/Home.php
@@ -1,17 +1,17 @@
-<?php
-
-// $Id: Home.php 1405 2006-09-10 01:03:56Z wei $
-class Home extends TPage
-{
- public function buttonClicked($sender, $param)
- {
- $this->imageTest->ImageUrl=$this->publishAsset("hello_world.gif");
- }
-
- public function buttonClicked2($sender, $param)
- {
- $this->imageTest->ImageUrl=$this->publishAsset("hello_world2.gif");
- }
-}
-
+<?php
+
+// $Id: Home.php 1405 2006-09-10 01:03:56Z wei $
+class Home extends TPage
+{
+ public function buttonClicked($sender, $param)
+ {
+ $this->imageTest->ImageUrl=$this->publishAsset("hello_world.gif");
+ }
+
+ public function buttonClicked2($sender, $param)
+ {
+ $this->imageTest->ImageUrl=$this->publishAsset("hello_world2.gif");
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImageButton/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImageButton/Home.php
index b1f2c53b..28be10f9 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImageButton/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveImageButton/Home.php
@@ -1,18 +1,18 @@
-<?php
-
-class Home extends TPage
-{
- public function buttonClicked($sender,$param)
- {
- if($param instanceof TCallbackEventParameter)
- {
- $this->Result2->Text="Callback parameter: $param->CallbackParameter";
- }
- else
- {
- $this->Result->Text="You clicked at ($param->X,$param->Y)";
- }
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ if($param instanceof TCallbackEventParameter)
+ {
+ $this->Result2->Text="Callback parameter: $param->CallbackParameter";
+ }
+ else
+ {
+ $this->Result->Text="You clicked at ($param->X,$param->Y)";
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveLinkButton/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveLinkButton/Home.php
index 64e2dede..e929c07b 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveLinkButton/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveLinkButton/Home.php
@@ -1,14 +1,14 @@
-<?php
-
-class Home extends TPage
-{
- public function buttonClicked($sender,$param)
- {
- if($param instanceof TCallbackEventParameter)
- $sender->Text="Callback Parameter: {$param->CallbackParameter}";
- else
- $sender->Text="I'm clicked";
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ if($param instanceof TCallbackEventParameter)
+ $sender->Text="Callback Parameter: {$param->CallbackParameter}";
+ else
+ $sender->Text="I'm clicked";
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.php
index 795e3eca..509e32ab 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.php
@@ -1,65 +1,65 @@
-<?php
-
-class Home extends TPage
-{
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack && !$this->IsCallback)
- {
- $this->resetClicked(null,null);
- }
- }
-
- protected function collectSelectionResult($input,$output)
- {
- $indices=$input->SelectedIndices;
- $result='';
- foreach($indices as $index)
- {
- $item=$input->Items[$index];
- $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
- }
- if($result==='')
- $output->Text='Your selection is empty.';
- else
- $output->Text='Your selection is: '.$result;
- }
-
- public function selectionChanged($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->SelectionResult);
- }
-
- public function multiSelectionChanged($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->MSelectionResult);
- }
-
- public function buttonClicked($sender, $param)
- {
- $data=array();
- for($i = 0; $i <= $this->box1->Items->Count; $i++)
- $data[$i]="Item number #".$i;
- $this->box1->DataSource=$data;
- $this->box1->dataBind();
- $this->label1->Text="Total ".count($data)." items";
- }
-
- public function resetClicked($sender, $param)
- {
- $data=array('item 1','item 2','item 3','item 4');
- $this->box2->DataSource=$data;
- $this->box2->dataBind();
- $this->label2->Text="ListBox has been reset";
- }
-
- public function clearClicked($sender, $param)
- {
- $this->box2->DataSource=array();
- $this->box2->dataBind();
- $this->label2->Text="ListBox cleared";
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack && !$this->IsCallback)
+ {
+ $this->resetClicked(null,null);
+ }
+ }
+
+ protected function collectSelectionResult($input,$output)
+ {
+ $indices=$input->SelectedIndices;
+ $result='';
+ foreach($indices as $index)
+ {
+ $item=$input->Items[$index];
+ $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
+ }
+ if($result==='')
+ $output->Text='Your selection is empty.';
+ else
+ $output->Text='Your selection is: '.$result;
+ }
+
+ public function selectionChanged($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->SelectionResult);
+ }
+
+ public function multiSelectionChanged($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->MSelectionResult);
+ }
+
+ public function buttonClicked($sender, $param)
+ {
+ $data=array();
+ for($i = 0; $i <= $this->box1->Items->Count; $i++)
+ $data[$i]="Item number #".$i;
+ $this->box1->DataSource=$data;
+ $this->box1->dataBind();
+ $this->label1->Text="Total ".count($data)." items";
+ }
+
+ public function resetClicked($sender, $param)
+ {
+ $data=array('item 1','item 2','item 3','item 4');
+ $this->box2->DataSource=$data;
+ $this->box2->dataBind();
+ $this->label2->Text="ListBox has been reset";
+ }
+
+ public function clearClicked($sender, $param)
+ {
+ $this->box2->DataSource=array();
+ $this->box2->dataBind();
+ $this->label2->Text="ListBox cleared";
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveMultiView/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveMultiView/Home.php
index 1a5dbed3..24a240ca 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveMultiView/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveMultiView/Home.php
@@ -1,15 +1,15 @@
-<?php
-
-class Home extends TPage
-{
- public function viewChanged($sender,$param)
- {
- if($this->MultiView->ActiveViewIndex===2)
- {
- $this->Result1->Text="Your text input is: ".$this->Memo->Text;
- $this->Result2->Text="Your color choice is: ".$this->DropDownList->SelectedValue;
- }
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function viewChanged($sender,$param)
+ {
+ if($this->MultiView->ActiveViewIndex===2)
+ {
+ $this->Result1->Text="Your text input is: ".$this->Memo->Text;
+ $this->Result2->Text="Your color choice is: ".$this->DropDownList->SelectedValue;
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePanel/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePanel/Home.php
index ae174f59..362fdebe 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePanel/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActivePanel/Home.php
@@ -1,21 +1,21 @@
-<?php
-
-class Home extends TPage
-{
- public function buttonClicked($sender,$param)
- {
- $this->check1->Checked = !$this->check1->Checked;
- if($this->txt1->Text=="")
- $this->txt1->Text="changes happens";
- else
- $this->txt1->Text="";
- if($this->label1->Text=="")
- $this->label1->Text="label has changed, too";
- else
- $this->label1->Text="";
-
- $this->panel1->render($param->NewWriter);
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ $this->check1->Checked = !$this->check1->Checked;
+ if($this->txt1->Text=="")
+ $this->txt1->Text="changes happens";
+ else
+ $this->txt1->Text="";
+ if($this->label1->Text=="")
+ $this->label1->Text="label has changed, too";
+ else
+ $this->label1->Text="";
+
+ $this->panel1->render($param->NewWriter);
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButton/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButton/Home.php
index 034d2fcc..a0c2af32 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButton/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButton/Home.php
@@ -1,27 +1,27 @@
-<?php
-
-class Home extends TPage
-{
- public function radiobuttonClicked($sender,$param)
- {
- $sender->Text="I'm clicked";
- }
-
- public function selectRadioButton($sender,$param)
- {
- $selection='';
- if($this->Radio1->Checked)
- $selection.='1';
- if($this->Radio2->Checked)
- $selection.='2';
- if($this->Radio3->Checked)
- $selection.='3';
- if($this->Radio4->Checked)
- $selection.='4';
- if($selection==='')
- $selection='empty';
- $this->Result->Text='Your selection is '.$selection;
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function radiobuttonClicked($sender,$param)
+ {
+ $sender->Text="I'm clicked";
+ }
+
+ public function selectRadioButton($sender,$param)
+ {
+ $selection='';
+ if($this->Radio1->Checked)
+ $selection.='1';
+ if($this->Radio2->Checked)
+ $selection.='2';
+ if($this->Radio3->Checked)
+ $selection.='3';
+ if($this->Radio4->Checked)
+ $selection.='4';
+ if($selection==='')
+ $selection='empty';
+ $this->Result->Text='Your selection is '.$selection;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButtonList/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButtonList/Home.php
index dfa52ce4..1033837c 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButtonList/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRadioButtonList/Home.php
@@ -1,26 +1,26 @@
-<?php
-
-class Home extends TPage
-{
- protected function collectSelectionResult($input,$output)
- {
- $indices=$input->SelectedIndices;
- $result='';
- foreach($indices as $index)
- {
- $item=$input->Items[$index];
- $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
- }
- if($result==='')
- $output->Text='Your selection is empty.';
- else
- $output->Text='Your selection is: '.$result;
- }
-
- public function selectionChanged($sender,$param)
- {
- $this->collectSelectionResult($this->RadioButtonList,$this->SelectionResult);
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ protected function collectSelectionResult($input,$output)
+ {
+ $indices=$input->SelectedIndices;
+ $result='';
+ foreach($indices as $index)
+ {
+ $item=$input->Items[$index];
+ $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
+ }
+ if($result==='')
+ $output->Text='Your selection is empty.';
+ else
+ $output->Text='Your selection is: '.$result;
+ }
+
+ public function selectionChanged($sender,$param)
+ {
+ $this->collectSelectionResult($this->RadioButtonList,$this->SelectionResult);
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php
index f7c8d61c..ae765ee1 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveRepeater/Home.php
@@ -1,79 +1,79 @@
-<?php
-
-class Home extends TPage
-{
- protected function getProducts()
- {
- return array(
- array('id'=>'ITN001','name'=>'Motherboard','category'=>'CAT004','price'=>100.00,'imported'=>true),
- array('id'=>'ITN002','name'=>'CPU','category'=>'CAT004','price'=>150.00,'imported'=>true),
- array('id'=>'ITN003','name'=>'Harddrive','category'=>'CAT003','price'=>80.00,'imported'=>true),
- array('id'=>'ITN006','name'=>'Keyboard','category'=>'CAT002','price'=>20.00,'imported'=>false),
- array('id'=>'ITN008','name'=>'CDRW drive','category'=>'CAT003','price'=>40.00,'imported'=>true),
- array('id'=>'ITN009','name'=>'Cooling fan','category'=>'CAT001','price'=>10.00,'imported'=>false),
- array('id'=>'ITN012','name'=>'Floppy drive','category'=>'CAT003','price'=>12.00,'imported'=>false),
- array('id'=>'ITN013','name'=>'CD drive','category'=>'CAT003','price'=>20.00,'imported'=>true),
- array('id'=>'ITN014','name'=>'DVD drive','category'=>'CAT003','price'=>80.00,'imported'=>true),
- array('id'=>'ITN015','name'=>'Mouse pad','category'=>'CAT001','price'=>5.00,'imported'=>false),
- );
- }
-
- protected function getCategories()
- {
- return array(
- array('id'=>'CAT001','name'=>'Accessories'),
- array('id'=>'CAT002','name'=>'Input Devices'),
- array('id'=>'CAT003','name'=>'Drives'),
- array('id'=>'CAT004','name'=>'Barebone'),
- );
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->Repeater->DataSource=$this->Products;
- $this->Repeater->dataBind();
- }
- }
-
- public function repeaterDataBound($sender,$param)
- {
- $item=$param->Item;
- if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
- {
- $item->ProductCategory->DataSource=$this->Categories;
- $item->ProductCategory->DataTextField='name';
- $item->ProductCategory->DataValueField='id';
- $item->ProductCategory->dataBind();
- $item->ProductCategory->SelectedValue=$item->DataItem['category'];
- }
- }
-
- public function saveInput($sender,$param)
- {
- if($this->IsValid)
- {
- $index=0;
- $products=$this->Products;
- $data=array();
- foreach($this->Repeater->Items as $item)
- {
- $item=array(
- 'id'=>$products[$index]['id'],
- 'name'=>$item->ProductName->Text,
- 'category'=>$item->ProductCategory->SelectedItem->Text,
- 'price'=>TPropertyValue::ensureFloat($item->ProductPrice->Text),
- 'imported'=>$item->ProductImported->Checked,
- );
- $data[]=$item;
- $index++;
- }
- $this->Repeater2->DataSource=$data;
- $this->Repeater2->dataBind();
- }
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ protected function getProducts()
+ {
+ return array(
+ array('id'=>'ITN001','name'=>'Motherboard','category'=>'CAT004','price'=>100.00,'imported'=>true),
+ array('id'=>'ITN002','name'=>'CPU','category'=>'CAT004','price'=>150.00,'imported'=>true),
+ array('id'=>'ITN003','name'=>'Harddrive','category'=>'CAT003','price'=>80.00,'imported'=>true),
+ array('id'=>'ITN006','name'=>'Keyboard','category'=>'CAT002','price'=>20.00,'imported'=>false),
+ array('id'=>'ITN008','name'=>'CDRW drive','category'=>'CAT003','price'=>40.00,'imported'=>true),
+ array('id'=>'ITN009','name'=>'Cooling fan','category'=>'CAT001','price'=>10.00,'imported'=>false),
+ array('id'=>'ITN012','name'=>'Floppy drive','category'=>'CAT003','price'=>12.00,'imported'=>false),
+ array('id'=>'ITN013','name'=>'CD drive','category'=>'CAT003','price'=>20.00,'imported'=>true),
+ array('id'=>'ITN014','name'=>'DVD drive','category'=>'CAT003','price'=>80.00,'imported'=>true),
+ array('id'=>'ITN015','name'=>'Mouse pad','category'=>'CAT001','price'=>5.00,'imported'=>false),
+ );
+ }
+
+ protected function getCategories()
+ {
+ return array(
+ array('id'=>'CAT001','name'=>'Accessories'),
+ array('id'=>'CAT002','name'=>'Input Devices'),
+ array('id'=>'CAT003','name'=>'Drives'),
+ array('id'=>'CAT004','name'=>'Barebone'),
+ );
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->Repeater->DataSource=$this->Products;
+ $this->Repeater->dataBind();
+ }
+ }
+
+ public function repeaterDataBound($sender,$param)
+ {
+ $item=$param->Item;
+ if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
+ {
+ $item->ProductCategory->DataSource=$this->Categories;
+ $item->ProductCategory->DataTextField='name';
+ $item->ProductCategory->DataValueField='id';
+ $item->ProductCategory->dataBind();
+ $item->ProductCategory->SelectedValue=$item->DataItem['category'];
+ }
+ }
+
+ public function saveInput($sender,$param)
+ {
+ if($this->IsValid)
+ {
+ $index=0;
+ $products=$this->Products;
+ $data=array();
+ foreach($this->Repeater->Items as $item)
+ {
+ $item=array(
+ 'id'=>$products[$index]['id'],
+ 'name'=>$item->ProductName->Text,
+ 'category'=>$item->ProductCategory->SelectedItem->Text,
+ 'price'=>TPropertyValue::ensureFloat($item->ProductPrice->Text),
+ 'imported'=>$item->ProductImported->Checked,
+ );
+ $data[]=$item;
+ $index++;
+ }
+ $this->Repeater2->DataSource=$data;
+ $this->Repeater2->dataBind();
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveTableRow/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveTableRow/Home.php
index b056eba8..d74160bb 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveTableRow/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveTableRow/Home.php
@@ -1,22 +1,22 @@
-<?php
-
-// $Id: Home.php 1405 2006-09-10 01:03:56Z wei $
-class Home extends TPage
-{
-
- public function clickCell ($sender, $param)
- {
- $sender->Text .= "<br/>Clicked";
- $this->lblResult->Text='You clicked on cell #'.$param->SelectedCellIndex.' with id='.$sender->id;
- $sender->render($param->NewWriter);
- }
-
- public function clickRow ($sender, $param)
- {
- $sender->BackColor="yellow";
- $this->lblResult->Text='You clicked on row #'.$param->SelectedRowIndex.' with id='.$sender->id;
- $sender->render($param->NewWriter);
- }
-}
-
+<?php
+
+// $Id: Home.php 1405 2006-09-10 01:03:56Z wei $
+class Home extends TPage
+{
+
+ public function clickCell ($sender, $param)
+ {
+ $sender->Text .= "<br/>Clicked";
+ $this->lblResult->Text='You clicked on cell #'.$param->SelectedCellIndex.' with id='.$sender->id;
+ $sender->render($param->NewWriter);
+ }
+
+ public function clickRow ($sender, $param)
+ {
+ $sender->BackColor="yellow";
+ $this->lblResult->Text='You clicked on row #'.$param->SelectedRowIndex.' with id='.$sender->id;
+ $sender->render($param->NewWriter);
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php
index ca8a9e59..290995c7 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TAutoComplete/Home.php
@@ -1,34 +1,34 @@
-<?php
-// $Id$
-class Home extends TPage
-{
- public function suggestNames($sender,$param) {
- // Get the token
- $token=$param->getToken();
- // Sender is the Suggestions repeater
- $sender->DataSource=$this->getDummyData($token);
- $sender->dataBind();
- }
-
- public function suggestionSelected1($sender,$param) {
- $id=$sender->Suggestions->DataKeys[ $param->selectedIndex ];
- $this->Selection1->Text='Selected ID: '.$id;
- }
-
- public function suggestionSelected2($sender,$param) {
- $id=$sender->Suggestions->DataKeys[ $param->selectedIndex ];
- $this->Selection2->Text='Selected ID: '.$id;
- }
-
- public function getDummyData($token) {
- // You would look for matches to the given token here
- return array(
- array('id'=>1, 'name'=>'John'),
- array('id'=>2, 'name'=>'Paul'),
- array('id'=>3, 'name'=>'George'),
- array('id'=>4, 'name'=>'Ringo')
- );
- }
-}
-
-?>
+<?php
+// $Id$
+class Home extends TPage
+{
+ public function suggestNames($sender,$param) {
+ // Get the token
+ $token=$param->getToken();
+ // Sender is the Suggestions repeater
+ $sender->DataSource=$this->getDummyData($token);
+ $sender->dataBind();
+ }
+
+ public function suggestionSelected1($sender,$param) {
+ $id=$sender->Suggestions->DataKeys[ $param->selectedIndex ];
+ $this->Selection1->Text='Selected ID: '.$id;
+ }
+
+ public function suggestionSelected2($sender,$param) {
+ $id=$sender->Suggestions->DataKeys[ $param->selectedIndex ];
+ $this->Selection2->Text='Selected ID: '.$id;
+ }
+
+ public function getDummyData($token) {
+ // You would look for matches to the given token here
+ return array(
+ array('id'=>1, 'name'=>'John'),
+ array('id'=>2, 'name'=>'Paul'),
+ array('id'=>3, 'name'=>'George'),
+ array('id'=>4, 'name'=>'Ringo')
+ );
+ }
+}
+
+?>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php
index 500d7987..a8cef26c 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php
@@ -1,29 +1,29 @@
-<?php
-
-// $Id: Home.php -1 $
-class Home extends TPage
-{
- public function buttonCallback ($sender, $param)
- {
- switch($this->radio1->SelectedValue)
- {
- case 1:
- $this->getCallbackClient()->evaluateScript("<script> alert('something'); </script>");
- break;
- case 2:
- $this->getCallbackClient()->check($this->check1, !$this->check1->Checked);
- break;
- case 3:
- $this->getCallbackClient()->hide($this->label1);
- break;
- case 4:
- $this->getCallbackClient()->show($this->label1);
- break;
- case 5:
- $this->getCallbackClient()->focus($this->txt1);
- break;
- }
- }
-}
-
+<?php
+
+// $Id: Home.php -1 $
+class Home extends TPage
+{
+ public function buttonCallback ($sender, $param)
+ {
+ switch($this->radio1->SelectedValue)
+ {
+ case 1:
+ $this->getCallbackClient()->evaluateScript("<script> alert('something'); </script>");
+ break;
+ case 2:
+ $this->getCallbackClient()->check($this->check1, !$this->check1->Checked);
+ break;
+ case 3:
+ $this->getCallbackClient()->hide($this->label1);
+ break;
+ case 4:
+ $this->getCallbackClient()->show($this->label1);
+ break;
+ case 5:
+ $this->getCallbackClient()->focus($this->txt1);
+ break;
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.php
index 8dd794fe..f642ccbb 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.php
@@ -1,12 +1,12 @@
-<?php
-
-// $Id: Home.php -1 $
-class Home extends TPage
-{
- public function buttonCallback ($sender, $param)
- {
- sleep(5);
- }
-}
-
+<?php
+
+// $Id: Home.php -1 $
+class Home extends TPage
+{
+ public function buttonCallback ($sender, $param)
+ {
+ sleep(5);
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.php
index 6f101107..caff7360 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.php
@@ -1,12 +1,12 @@
-<?php
-
-// $Id$
-class Home extends TPage
-{
- public function buttonCallback ($sender, $param)
- {
- sleep(5);
- }
-}
-
+<?php
+
+// $Id$
+class Home extends TPage
+{
+ public function buttonCallback ($sender, $param)
+ {
+ sleep(5);
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.php b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.php
index cce1ed4e..634c1773 100644
--- a/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.php
+++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.php
@@ -1,45 +1,45 @@
-<?php
-
-class Home extends TPage
-{
- /**
- * Change the globalization culture using value from request "lang" parameter.
- */
- public function __construct()
- {
- parent::__construct();
- $lang = $this->Request['lang'];
- $info = new CultureInfo();
- if($info->validCulture($lang)) //only valid lang is permitted
- $this->getApplication()->getGlobalization()->setCulture($lang);
- }
-
- /**
- * Initialize the page with some arbituary data.
- * @param TEventParameter event parameter.
- */
- public function onLoad($param)
- {
- parent::onLoad($param);
- $time1 = $this->Time1;
- $time1->Value = time();
-
- $number2 = $this->Number2;
- $number2->Value = 46412.416;
-
- $this->dataBind();
- }
-
- /**
- * Get the localized current culture name.
- * @return string localized curreny culture name.
- */
- public function getCurrentCulture()
- {
- $culture = $this->getApplication()->getGlobalization()->getCulture();
- $cultureInfo = new CultureInfo($culture);
- return $cultureInfo->getNativeName();
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ /**
+ * Change the globalization culture using value from request "lang" parameter.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $lang = $this->Request['lang'];
+ $info = new CultureInfo();
+ if($info->validCulture($lang)) //only valid lang is permitted
+ $this->getApplication()->getGlobalization()->setCulture($lang);
+ }
+
+ /**
+ * Initialize the page with some arbituary data.
+ * @param TEventParameter event parameter.
+ */
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ $time1 = $this->Time1;
+ $time1->Value = time();
+
+ $number2 = $this->Number2;
+ $number2->Value = 46412.416;
+
+ $this->dataBind();
+ }
+
+ /**
+ * Get the localized current culture name.
+ * @return string localized curreny culture name.
+ */
+ public function getCurrentCulture()
+ {
+ $culture = $this->getApplication()->getGlobalization()->getCulture();
+ $cultureInfo = new CultureInfo($culture);
+ return $cultureInfo->getNativeName();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.php b/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.php
index d3db187d..bdeb5039 100644
--- a/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.php
+++ b/demos/quickstart/protected/pages/Advanced/Samples/I18N/LanguageList.php
@@ -1,19 +1,19 @@
-<?php
-/**
- * Language List
- * @author $Author: weizhuo $
- * @version $Id$
- * @package prado.examples
- */
-
-/**
- *
- * @author $Author: weizhuo $
- * @version $Id$
- */
-class LanguageList extends TTemplateControl
-{
-
-}
-
+<?php
+/**
+ * Language List
+ * @author $Author: weizhuo $
+ * @version $Id$
+ * @package prado.examples
+ */
+
+/**
+ *
+ * @author $Author: weizhuo $
+ * @version $Id$
+ */
+class LanguageList extends TTemplateControl
+{
+
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.php b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.php
index 2309bd88..cfc01a31 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/Home.php
@@ -1,13 +1,13 @@
-<?php
-
-Prado::using('Application.pages.Controls.Samples.LabeledTextBox1.LabeledTextBox');
-
-class Home extends TPage
-{
- public function buttonClicked($sender,$param)
- {
- $sender->Text=$this->Input->TextBox->Text;
- }
-}
-
+<?php
+
+Prado::using('Application.pages.Controls.Samples.LabeledTextBox1.LabeledTextBox');
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ $sender->Text=$this->Input->TextBox->Text;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.php b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.php
index 999639d7..0c374b72 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox1/LabeledTextBox.php
@@ -1,18 +1,18 @@
-<?php
-
-class LabeledTextBox extends TTemplateControl
-{
- public function getLabel()
- {
- $this->ensureChildControls();
- return $this->getRegisteredObject('Label');
- }
-
- public function getTextBox()
- {
- $this->ensureChildControls();
- return $this->getRegisteredObject('TextBox');
- }
-}
-
+<?php
+
+class LabeledTextBox extends TTemplateControl
+{
+ public function getLabel()
+ {
+ $this->ensureChildControls();
+ return $this->getRegisteredObject('Label');
+ }
+
+ public function getTextBox()
+ {
+ $this->ensureChildControls();
+ return $this->getRegisteredObject('TextBox');
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.php b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.php
index 2b18972d..ae3f9e8b 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/Home.php
@@ -1,13 +1,13 @@
-<?php
-
-Prado::using('Application.pages.Controls.Samples.LabeledTextBox2.LabeledTextBox');
-
-class Home extends TPage
-{
- public function buttonClicked($sender,$param)
- {
- $sender->Text=$this->Input->TextBox->Text;
- }
-}
-
+<?php
+
+Prado::using('Application.pages.Controls.Samples.LabeledTextBox2.LabeledTextBox');
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ $sender->Text=$this->Input->TextBox->Text;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php
index fc912003..601cebc6 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/LabeledTextBox2/LabeledTextBox.php
@@ -1,33 +1,33 @@
-<?php
-
-class LabeledTextBox extends TCompositeControl
-{
- private $_label;
- private $_textbox;
-
- public function createChildControls()
- {
- $this->_label=new TLabel;
- $this->_label->setID('Label');
- $this->getControls()->add($this->_label);
- $this->getControls()->add('&nbsp;');
- $this->_textbox=new TTextBox;
- $this->_textbox->setID('TextBox');
- $this->_label->setForControl('TextBox');
- $this->getControls()->add($this->_textbox);
- }
-
- public function getLabel()
- {
- $this->ensureChildControls();
- return $this->_label;
- }
-
- public function getTextBox()
- {
- $this->ensureChildControls();
- return $this->_textbox;
- }
-}
-
+<?php
+
+class LabeledTextBox extends TCompositeControl
+{
+ private $_label;
+ private $_textbox;
+
+ public function createChildControls()
+ {
+ $this->_label=new TLabel;
+ $this->_label->setID('Label');
+ $this->getControls()->add($this->_label);
+ $this->getControls()->add('&nbsp;');
+ $this->_textbox=new TTextBox;
+ $this->_textbox->setID('TextBox');
+ $this->_label->setForControl('TextBox');
+ $this->getControls()->add($this->_textbox);
+ }
+
+ public function getLabel()
+ {
+ $this->ensureChildControls();
+ return $this->_label;
+ }
+
+ public function getTextBox()
+ {
+ $this->ensureChildControls();
+ return $this->_textbox;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.php b/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.php
index 88d2dbf2..1c5efbcf 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/ResetValidation/Home.php
@@ -1,8 +1,8 @@
-<?php
-
-class Home extends TPage
-{
-
-}
-
+<?php
+
+class Home extends TPage
+{
+
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TAccordion/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TAccordion/Home.php
index 3da69927..4faaef1c 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TAccordion/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TAccordion/Home.php
@@ -1,17 +1,17 @@
-<?php
-
-class Home extends TPage
-{
- public function onLoad($param)
- {
- parent::onLoad($param);
- $this->lab1->Text="";
- }
-
- public function executeTransaction($sender, $param)
- {
- $this->lab1->Text="executeTransaction ok";
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ $this->lab1->Text="";
+ }
+
+ public function executeTransaction($sender, $param)
+ {
+ $this->lab1->Text="executeTransaction ok";
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php
index d3e04787..93c947fe 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TBulletedList/Home.php
@@ -1,12 +1,12 @@
-<?php
-
-class Home extends TPage
-{
- public function buttonClicked($sender,$param)
- {
- $item=$sender->Items[$param->Index];
- $this->Result->Text="You clicked $item->Text : $item->Value.";
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ $item=$sender->Items[$param->Index];
+ $this->Result->Text="You clicked $item->Text : $item->Value.";
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TButton/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TButton/Home.php
index f18072f2..3711ca46 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TButton/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TButton/Home.php
@@ -1,14 +1,14 @@
-<?php
-
-class Home extends TPage
-{
- public function buttonClicked($sender,$param)
- {
- if($param instanceof TCommandEventParameter)
- $sender->Text="Name: {$param->CommandName}, Param: {$param->CommandParameter}";
- else
- $sender->Text="I'm clicked";
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ if($param instanceof TCommandEventParameter)
+ $sender->Text="Name: {$param->CommandName}, Param: {$param->CommandParameter}";
+ else
+ $sender->Text="I'm clicked";
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCaptcha/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TCaptcha/Home.php
index 6965bbbd..c88b9378 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TCaptcha/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TCaptcha/Home.php
@@ -1,27 +1,27 @@
-<?php
-
-class Home extends TPage
-{
- public function onInit($param)
- {
- if(!$this->IsPostBack)
- {
- $this->CaptchaList->DataSource=range(0,63);
- $this->CaptchaList->dataBind();
- }
- }
-
- public function regenerateToken($sender,$param)
- {
- $this->Captcha->regenerateToken();
- $this->SubmitButton->Text="Submit";
- }
-
- public function buttonClicked($sender,$param)
- {
- if($this->IsValid)
- $sender->Text="You passed!";
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function onInit($param)
+ {
+ if(!$this->IsPostBack)
+ {
+ $this->CaptchaList->DataSource=range(0,63);
+ $this->CaptchaList->dataBind();
+ }
+ }
+
+ public function regenerateToken($sender,$param)
+ {
+ $this->Captcha->regenerateToken();
+ $this->SubmitButton->Text="Submit";
+ }
+
+ public function buttonClicked($sender,$param)
+ {
+ if($this->IsValid)
+ $sender->Text="You passed!";
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCheckBox/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TCheckBox/Home.php
index 37eae19b..89fb6852 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TCheckBox/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TCheckBox/Home.php
@@ -1,11 +1,11 @@
-<?php
-
-class Home extends TPage
-{
- public function checkboxClicked($sender,$param)
- {
- $sender->Text="I'm clicked";
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function checkboxClicked($sender,$param)
+ {
+ $sender->Text="I'm clicked";
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php
index 08c6f3ca..ac7ca8bc 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TCheckBoxList/Home.php
@@ -1,70 +1,70 @@
-<?php
-
-class Home extends TPage
-{
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $data=array('item 1','item 2','item 3','item 4');
- $this->DBCheckBoxList1->DataSource=$data;
- $this->DBCheckBoxList1->dataBind();
-
- $data=array('key 1'=>'item 1','key 2'=>'item 2',
- 'key 3'=>'item 3','key 4'=>'item 4');
- $this->DBCheckBoxList2->DataSource=$data;
- $this->DBCheckBoxList2->dataBind();
-
- $data=array(
- array('id'=>'001','name'=>'John','age'=>31),
- array('id'=>'002','name'=>'Mary','age'=>30),
- array('id'=>'003','name'=>'Cary','age'=>20));
- $this->DBCheckBoxList3->DataSource=$data;
- $this->DBCheckBoxList3->dataBind();
- }
- }
-
- protected function collectSelectionResult($input,$output)
- {
- $indices=$input->SelectedIndices;
- $result='';
- foreach($indices as $index)
- {
- $item=$input->Items[$index];
- $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
- }
- if($result==='')
- $output->Text='Your selection is empty.';
- else
- $output->Text='Your selection is: '.$result;
- }
-
- public function buttonClicked($sender,$param)
- {
- $this->collectSelectionResult($this->CheckBoxList,$this->SelectionResult);
- }
-
- public function selectionChanged($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->SelectionResult2);
- }
-
- public function DBCheckBoxList1Changed($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->DBCheckBoxList1Result);
- }
-
- public function DBCheckBoxList2Changed($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->DBCheckBoxList2Result);
- }
-
- public function DBCheckBoxList3Changed($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->DBCheckBoxList3Result);
- }
-
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $data=array('item 1','item 2','item 3','item 4');
+ $this->DBCheckBoxList1->DataSource=$data;
+ $this->DBCheckBoxList1->dataBind();
+
+ $data=array('key 1'=>'item 1','key 2'=>'item 2',
+ 'key 3'=>'item 3','key 4'=>'item 4');
+ $this->DBCheckBoxList2->DataSource=$data;
+ $this->DBCheckBoxList2->dataBind();
+
+ $data=array(
+ array('id'=>'001','name'=>'John','age'=>31),
+ array('id'=>'002','name'=>'Mary','age'=>30),
+ array('id'=>'003','name'=>'Cary','age'=>20));
+ $this->DBCheckBoxList3->DataSource=$data;
+ $this->DBCheckBoxList3->dataBind();
+ }
+ }
+
+ protected function collectSelectionResult($input,$output)
+ {
+ $indices=$input->SelectedIndices;
+ $result='';
+ foreach($indices as $index)
+ {
+ $item=$input->Items[$index];
+ $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
+ }
+ if($result==='')
+ $output->Text='Your selection is empty.';
+ else
+ $output->Text='Your selection is: '.$result;
+ }
+
+ public function buttonClicked($sender,$param)
+ {
+ $this->collectSelectionResult($this->CheckBoxList,$this->SelectionResult);
+ }
+
+ public function selectionChanged($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->SelectionResult2);
+ }
+
+ public function DBCheckBoxList1Changed($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->DBCheckBoxList1Result);
+ }
+
+ public function DBCheckBoxList2Changed($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->DBCheckBoxList2Result);
+ }
+
+ public function DBCheckBoxList3Changed($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->DBCheckBoxList3Result);
+ }
+
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.php
index d6dded08..cccbf845 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TClientSideValidator/Home.php
@@ -1,17 +1,17 @@
-<?php
-
-class Home extends TPage
-{
- function check_validate($sender, $params)
- {
- $sender->enabled = $this->check1->checked;
- }
-
- function onPreRender($param)
- {
- //always re-enable the validator2 so as to display the client-side validator
- $this->validator2->enabled=true;
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ function check_validate($sender, $params)
+ {
+ $sender->enabled = $this->check1->checked;
+ }
+
+ function onPreRender($param)
+ {
+ //always re-enable the validator2 so as to display the client-side validator
+ $this->validator2->enabled=true;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCompareValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TCompareValidator/Home.php
index 88d2dbf2..1c5efbcf 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TCompareValidator/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TCompareValidator/Home.php
@@ -1,8 +1,8 @@
-<?php
-
-class Home extends TPage
-{
-
-}
-
+<?php
+
+class Home extends TPage
+{
+
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.php
index badbca73..b03361b8 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TConditional/Home.php
@@ -1,7 +1,7 @@
-<?php
-
-class Home extends TPage
-{
-}
-
+<?php
+
+class Home extends TPage
+{
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TCustomValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TCustomValidator/Home.php
index da0d15b2..a3b83ff5 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TCustomValidator/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TCustomValidator/Home.php
@@ -1,18 +1,18 @@
-<?php
-
-class Home extends TPage
-{
- public function serverValidate($sender,$param)
- {
- if($param->Value!=='test')
- $param->IsValid=false;
- }
-
- public function serverValidateNoControl($sender,$param)
- {
- if($this->TextBox4->Text!=='test')
- $param->IsValid=false;
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function serverValidate($sender,$param)
+ {
+ if($param->Value!=='test')
+ $param->IsValid=false;
+ }
+
+ public function serverValidateNoControl($sender,$param)
+ {
+ if($this->TextBox4->Text!=='test')
+ $param->IsValid=false;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php
index ec78006b..628d0740 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample1.php
@@ -1,41 +1,41 @@
-<?php
-
-class Sample1 extends TPage
-{
- protected function getData()
- {
- return array(
- array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
- array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
- array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
- array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
- array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
- array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
- array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
- array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
- array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
- array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
- array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
- array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
- array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
- array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
- array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
- );
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
- }
-}
-
+<?php
+
+class Sample1 extends TPage
+{
+ protected function getData()
+ {
+ return array(
+ array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
+ array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
+ array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
+ array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
+ array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
+ array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
+ array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
+ array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
+ array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
+ array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
+ array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
+ array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
+ array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
+ array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
+ array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
+ );
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php
index a49077b5..026d1a5a 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php
@@ -1,86 +1,86 @@
-<?php
-
-class Sample2 extends TPage
-{
- protected function getData()
- {
- return array(
- array(
- 'ISBN'=>'0596007124',
- 'title'=>'Head First Design Patterns',
- 'publisher'=>'O\'Reilly Media, Inc.',
- 'price'=>29.67,
- 'instock'=>true,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0201633612',
- 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>47.04,
- 'instock'=>true,
- 'rating'=>5,
- ),
- array(
- 'ISBN'=>'0321247140',
- 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>37.49,
- 'instock'=>true,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0201485672',
- 'title'=>'Refactoring: Improving the Design of Existing Code',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>47.14,
- 'instock'=>true,
- 'rating'=>3,
- ),
- array(
- 'ISBN'=>'0321213351',
- 'title'=>'Refactoring to Patterns',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>38.49,
- 'instock'=>true,
- 'rating'=>2,
- ),
- array(
- 'ISBN'=>'0735619670',
- 'title'=>'Code Complete',
- 'publisher'=>'Microsoft Press',
- 'price'=>32.99,
- 'instock'=>false,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0321278658',
- 'title'=>'Extreme Programming Explained : Embrace Change',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>34.99,
- 'instock'=>true,
- 'rating'=>3,
- ),
- );
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
- }
-
- public function toggleColumnVisibility($sender,$param)
- {
- foreach($this->DataGrid->Columns as $index=>$column)
- $column->Visible=$sender->Items[$index]->Selected;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+class Sample2 extends TPage
+{
+ protected function getData()
+ {
+ return array(
+ array(
+ 'ISBN'=>'0596007124',
+ 'title'=>'Head First Design Patterns',
+ 'publisher'=>'O\'Reilly Media, Inc.',
+ 'price'=>29.67,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201633612',
+ 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.04,
+ 'instock'=>true,
+ 'rating'=>5,
+ ),
+ array(
+ 'ISBN'=>'0321247140',
+ 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>37.49,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201485672',
+ 'title'=>'Refactoring: Improving the Design of Existing Code',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.14,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ array(
+ 'ISBN'=>'0321213351',
+ 'title'=>'Refactoring to Patterns',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>38.49,
+ 'instock'=>true,
+ 'rating'=>2,
+ ),
+ array(
+ 'ISBN'=>'0735619670',
+ 'title'=>'Code Complete',
+ 'publisher'=>'Microsoft Press',
+ 'price'=>32.99,
+ 'instock'=>false,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0321278658',
+ 'title'=>'Extreme Programming Explained : Embrace Change',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>34.99,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ );
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
+ public function toggleColumnVisibility($sender,$param)
+ {
+ foreach($this->DataGrid->Columns as $index=>$column)
+ $column->Visible=$sender->Items[$index]->Selected;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php
index bb18f36b..74085a0f 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample3.php
@@ -1,190 +1,190 @@
-<?php
-
-class Sample3 extends TPage
-{
- private $_data=null;
-
- protected function getData()
- {
- if($this->_data===null)
- $this->loadData();
- return $this->_data;
- }
-
- protected function loadData()
- {
- // We use viewstate keep track of data.
- // In real applications, data should come from database using an SQL SELECT statement.
- // In the following tabular data, field 'ISBN' is the primary key.
- // All update and delete operations should come with an 'id' value in order to go through.
- if(($this->_data=$this->getViewState('Data',null))===null)
- {
- $this->_data=array(
- array(
- 'ISBN'=>'0596007124',
- 'title'=>'Head First Design Patterns',
- 'publisher'=>'O\'Reilly Media, Inc.',
- 'price'=>29.67,
- 'instock'=>true,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0201633612',
- 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>47.04,
- 'instock'=>true,
- 'rating'=>5,
- ),
- array(
- 'ISBN'=>'0321247140',
- 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>37.49,
- 'instock'=>true,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0201485672',
- 'title'=>'Refactoring: Improving the Design of Existing Code',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>47.14,
- 'instock'=>true,
- 'rating'=>3,
- ),
- array(
- 'ISBN'=>'0321213351',
- 'title'=>'Refactoring to Patterns',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>38.49,
- 'instock'=>true,
- 'rating'=>2,
- ),
- array(
- 'ISBN'=>'0735619670',
- 'title'=>'Code Complete',
- 'publisher'=>'Microsoft Press',
- 'price'=>32.99,
- 'instock'=>false,
- 'rating'=>4,
- ),
- array(
- 'ISBN'=>'0321278658 ',
- 'title'=>'Extreme Programming Explained : Embrace Change',
- 'publisher'=>'Addison-Wesley Professional',
- 'price'=>34.99,
- 'instock'=>true,
- 'rating'=>3,
- ),
- );
- $this->saveData();
- }
- }
-
- protected function saveData()
- {
- $this->setViewState('Data',$this->_data);
- }
-
- protected function updateBook($isbn,$title,$publisher,$price,$instock,$rating)
- {
- // In real applications, data should be saved to database using an SQL UPDATE statement
- if($this->_data===null)
- $this->loadData();
- $updateRow=null;
- foreach($this->_data as $index=>$row)
- if($row['ISBN']===$isbn)
- $updateRow=&$this->_data[$index];
- if($updateRow!==null)
- {
- $updateRow['title']=$title;
- $updateRow['publisher']=$publisher;
- $updateRow['price']=TPropertyValue::ensureFloat(ltrim($price,'$'));
- $updateRow['instock']=TPropertyValue::ensureBoolean($instock);
- $updateRow['rating']=TPropertyValue::ensureInteger($rating);
- $this->saveData();
- }
- }
-
- protected function deleteBook($isbn)
- {
- // In real applications, data should be saved to database using an SQL DELETE statement
- if($this->_data===null)
- $this->loadData();
- $deleteIndex=-1;
- foreach($this->_data as $index=>$row)
- if($row['ISBN']===$isbn)
- $deleteIndex=$index;
- if($deleteIndex>=0)
- {
- unset($this->_data[$deleteIndex]);
- $this->saveData();
- }
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
- }
-
- public function itemCreated($sender,$param)
- {
- $item=$param->Item;
- if($item->ItemType==='EditItem')
- {
- // set column width of textboxes
- $item->BookTitleColumn->TextBox->Columns=40;
- $item->PriceColumn->TextBox->Columns=5;
- }
- if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem' || $item->ItemType==='EditItem')
- {
- // add an aleart dialog to delete buttons
- $item->DeleteColumn->Button->Attributes->onclick='if(!confirm(\'Are you sure?\')) return false;';
- }
- }
-
- public function editItem($sender,$param)
- {
- $this->DataGrid->EditItemIndex=$param->Item->ItemIndex;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function saveItem($sender,$param)
- {
- $item=$param->Item;
- $this->updateBook(
- $this->DataGrid->DataKeys[$item->ItemIndex], // ISBN
- $item->BookTitleColumn->TextBox->Text, // title
- $item->PublisherColumn->TextBox->Text, // publisher
- $item->PriceColumn->TextBox->Text, // price
- $item->InStockColumn->CheckBox->Checked, // instock
- $item->RatingColumn->DropDownList->SelectedValue // rating
- );
- $this->DataGrid->EditItemIndex=-1;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function cancelItem($sender,$param)
- {
- $this->DataGrid->EditItemIndex=-1;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function deleteItem($sender,$param)
- {
- $this->deleteBook($this->DataGrid->DataKeys[$param->Item->ItemIndex]);
- $this->DataGrid->EditItemIndex=-1;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+class Sample3 extends TPage
+{
+ private $_data=null;
+
+ protected function getData()
+ {
+ if($this->_data===null)
+ $this->loadData();
+ return $this->_data;
+ }
+
+ protected function loadData()
+ {
+ // We use viewstate keep track of data.
+ // In real applications, data should come from database using an SQL SELECT statement.
+ // In the following tabular data, field 'ISBN' is the primary key.
+ // All update and delete operations should come with an 'id' value in order to go through.
+ if(($this->_data=$this->getViewState('Data',null))===null)
+ {
+ $this->_data=array(
+ array(
+ 'ISBN'=>'0596007124',
+ 'title'=>'Head First Design Patterns',
+ 'publisher'=>'O\'Reilly Media, Inc.',
+ 'price'=>29.67,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201633612',
+ 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.04,
+ 'instock'=>true,
+ 'rating'=>5,
+ ),
+ array(
+ 'ISBN'=>'0321247140',
+ 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>37.49,
+ 'instock'=>true,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0201485672',
+ 'title'=>'Refactoring: Improving the Design of Existing Code',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>47.14,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ array(
+ 'ISBN'=>'0321213351',
+ 'title'=>'Refactoring to Patterns',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>38.49,
+ 'instock'=>true,
+ 'rating'=>2,
+ ),
+ array(
+ 'ISBN'=>'0735619670',
+ 'title'=>'Code Complete',
+ 'publisher'=>'Microsoft Press',
+ 'price'=>32.99,
+ 'instock'=>false,
+ 'rating'=>4,
+ ),
+ array(
+ 'ISBN'=>'0321278658 ',
+ 'title'=>'Extreme Programming Explained : Embrace Change',
+ 'publisher'=>'Addison-Wesley Professional',
+ 'price'=>34.99,
+ 'instock'=>true,
+ 'rating'=>3,
+ ),
+ );
+ $this->saveData();
+ }
+ }
+
+ protected function saveData()
+ {
+ $this->setViewState('Data',$this->_data);
+ }
+
+ protected function updateBook($isbn,$title,$publisher,$price,$instock,$rating)
+ {
+ // In real applications, data should be saved to database using an SQL UPDATE statement
+ if($this->_data===null)
+ $this->loadData();
+ $updateRow=null;
+ foreach($this->_data as $index=>$row)
+ if($row['ISBN']===$isbn)
+ $updateRow=&$this->_data[$index];
+ if($updateRow!==null)
+ {
+ $updateRow['title']=$title;
+ $updateRow['publisher']=$publisher;
+ $updateRow['price']=TPropertyValue::ensureFloat(ltrim($price,'$'));
+ $updateRow['instock']=TPropertyValue::ensureBoolean($instock);
+ $updateRow['rating']=TPropertyValue::ensureInteger($rating);
+ $this->saveData();
+ }
+ }
+
+ protected function deleteBook($isbn)
+ {
+ // In real applications, data should be saved to database using an SQL DELETE statement
+ if($this->_data===null)
+ $this->loadData();
+ $deleteIndex=-1;
+ foreach($this->_data as $index=>$row)
+ if($row['ISBN']===$isbn)
+ $deleteIndex=$index;
+ if($deleteIndex>=0)
+ {
+ unset($this->_data[$deleteIndex]);
+ $this->saveData();
+ }
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+ }
+
+ public function itemCreated($sender,$param)
+ {
+ $item=$param->Item;
+ if($item->ItemType==='EditItem')
+ {
+ // set column width of textboxes
+ $item->BookTitleColumn->TextBox->Columns=40;
+ $item->PriceColumn->TextBox->Columns=5;
+ }
+ if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem' || $item->ItemType==='EditItem')
+ {
+ // add an aleart dialog to delete buttons
+ $item->DeleteColumn->Button->Attributes->onclick='if(!confirm(\'Are you sure?\')) return false;';
+ }
+ }
+
+ public function editItem($sender,$param)
+ {
+ $this->DataGrid->EditItemIndex=$param->Item->ItemIndex;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function saveItem($sender,$param)
+ {
+ $item=$param->Item;
+ $this->updateBook(
+ $this->DataGrid->DataKeys[$item->ItemIndex], // ISBN
+ $item->BookTitleColumn->TextBox->Text, // title
+ $item->PublisherColumn->TextBox->Text, // publisher
+ $item->PriceColumn->TextBox->Text, // price
+ $item->InStockColumn->CheckBox->Checked, // instock
+ $item->RatingColumn->DropDownList->SelectedValue // rating
+ );
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function cancelItem($sender,$param)
+ {
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function deleteItem($sender,$param)
+ {
+ $this->deleteBook($this->DataGrid->DataKeys[$param->Item->ItemIndex]);
+ $this->DataGrid->EditItemIndex=-1;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php
index f9c0804d..ba7cba11 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php
@@ -1,21 +1,21 @@
-<?php
-
-Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample2');
-
-class Sample4 extends Sample2
-{
- protected function sortData($data,$key)
- {
- $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}');
- usort($data,$compare) ;
- return $data ;
- }
-
- public function sortDataGrid($sender,$param)
- {
- $this->DataGrid->DataSource=$this->sortData($this->Data,$param->SortExpression);
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample2');
+
+class Sample4 extends Sample2
+{
+ protected function sortData($data,$key)
+ {
+ $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}');
+ usort($data,$compare) ;
+ return $data ;
+ }
+
+ public function sortDataGrid($sender,$param)
+ {
+ $this->DataGrid->DataSource=$this->sortData($this->Data,$param->SortExpression);
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php
index bdca2ca8..fcf075ea 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample5.php
@@ -1,68 +1,68 @@
-<?php
-
-Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample1');
-
-class Sample5 extends Sample1
-{
- public function changePage($sender,$param)
- {
- $this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function pagerCreated($sender,$param)
- {
- $param->Pager->Controls->insertAt(0,'Page: ');
- }
-
- public function changePagerPosition($sender,$param)
- {
- $top=$sender->Items[0]->Selected;
- $bottom=$sender->Items[1]->Selected;
- if($top && $bottom)
- $position='TopAndBottom';
- else if($top)
- $position='Top';
- else if($bottom)
- $position='Bottom';
- else
- $position='';
- if($position==='')
- $this->DataGrid->PagerStyle->Visible=false;
- else
- {
- $this->DataGrid->PagerStyle->Position=$position;
- $this->DataGrid->PagerStyle->Visible=true;
- }
- }
-
- public function useNumericPager($sender,$param)
- {
- $this->DataGrid->PagerStyle->Mode='Numeric';
- $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
- $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
- $this->DataGrid->PagerStyle->PageButtonCount=$this->PageButtonCount->Text;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function useNextPrevPager($sender,$param)
- {
- $this->DataGrid->PagerStyle->Mode='NextPrev';
- $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
- $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-
- public function changePageSize($sender,$param)
- {
- $this->DataGrid->PageSize=TPropertyValue::ensureInteger($this->PageSize->Text);
- $this->DataGrid->CurrentPageIndex=0;
- $this->DataGrid->DataSource=$this->Data;
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample1');
+
+class Sample5 extends Sample1
+{
+ public function changePage($sender,$param)
+ {
+ $this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function pagerCreated($sender,$param)
+ {
+ $param->Pager->Controls->insertAt(0,'Page: ');
+ }
+
+ public function changePagerPosition($sender,$param)
+ {
+ $top=$sender->Items[0]->Selected;
+ $bottom=$sender->Items[1]->Selected;
+ if($top && $bottom)
+ $position='TopAndBottom';
+ else if($top)
+ $position='Top';
+ else if($bottom)
+ $position='Bottom';
+ else
+ $position='';
+ if($position==='')
+ $this->DataGrid->PagerStyle->Visible=false;
+ else
+ {
+ $this->DataGrid->PagerStyle->Position=$position;
+ $this->DataGrid->PagerStyle->Visible=true;
+ }
+ }
+
+ public function useNumericPager($sender,$param)
+ {
+ $this->DataGrid->PagerStyle->Mode='Numeric';
+ $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
+ $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
+ $this->DataGrid->PagerStyle->PageButtonCount=$this->PageButtonCount->Text;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function useNextPrevPager($sender,$param)
+ {
+ $this->DataGrid->PagerStyle->Mode='NextPrev';
+ $this->DataGrid->PagerStyle->NextPageText=$this->NextPageText->Text;
+ $this->DataGrid->PagerStyle->PrevPageText=$this->PrevPageText->Text;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+
+ public function changePageSize($sender,$param)
+ {
+ $this->DataGrid->PageSize=TPropertyValue::ensureInteger($this->PageSize->Text);
+ $this->DataGrid->CurrentPageIndex=0;
+ $this->DataGrid->DataSource=$this->Data;
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample6.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample6.php
index 90e3f7fe..3f24c9ac 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample6.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample6.php
@@ -1,56 +1,56 @@
-<?php
-
-Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample1');
-
-class Sample6 extends Sample1
-{
- /**
- * Returns a subset of data.
- * In MySQL database, this can be replaced by LIMIT clause
- * in an SQL select statement.
- * @param integer the starting index of the row
- * @param integer number of rows to be returned
- * @return array subset of data
- */
- protected function getDataRows($offset,$rows)
- {
- $data=$this->getData();
- $page=array();
- for($i=0;$i<$rows;++$i)
- {
- if($offset+$i<$this->getRowCount())
- $page[$i]=$data[$offset+$i];
- }
- return $page;
- }
-
- /**
- * Returns total number of data rows.
- * In real DB applications, this may be replaced by an SQL select
- * query with count().
- * @return integer total number of data rows
- */
- protected function getRowCount()
- {
- return 19;
- }
-
- public function onLoad($param)
- {
- if(!$this->IsPostBack)
- {
- $this->DataGrid->DataSource=$this->getDataRows(0,$this->DataGrid->PageSize);
- $this->DataGrid->dataBind();
- }
- }
-
- public function changePage($sender,$param)
- {
- $this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
- $offset=$param->NewPageIndex*$this->DataGrid->PageSize;
- $this->DataGrid->DataSource=$this->getDataRows($offset,$this->DataGrid->PageSize);
- $this->DataGrid->dataBind();
- }
-}
-
+<?php
+
+Prado::using('Application.pages.Controls.Samples.TDataGrid.Sample1');
+
+class Sample6 extends Sample1
+{
+ /**
+ * Returns a subset of data.
+ * In MySQL database, this can be replaced by LIMIT clause
+ * in an SQL select statement.
+ * @param integer the starting index of the row
+ * @param integer number of rows to be returned
+ * @return array subset of data
+ */
+ protected function getDataRows($offset,$rows)
+ {
+ $data=$this->getData();
+ $page=array();
+ for($i=0;$i<$rows;++$i)
+ {
+ if($offset+$i<$this->getRowCount())
+ $page[$i]=$data[$offset+$i];
+ }
+ return $page;
+ }
+
+ /**
+ * Returns total number of data rows.
+ * In real DB applications, this may be replaced by an SQL select
+ * query with count().
+ * @return integer total number of data rows
+ */
+ protected function getRowCount()
+ {
+ return 19;
+ }
+
+ public function onLoad($param)
+ {
+ if(!$this->IsPostBack)
+ {
+ $this->DataGrid->DataSource=$this->getDataRows(0,$this->DataGrid->PageSize);
+ $this->DataGrid->dataBind();
+ }
+ }
+
+ public function changePage($sender,$param)
+ {
+ $this->DataGrid->CurrentPageIndex=$param->NewPageIndex;
+ $offset=$param->NewPageIndex*$this->DataGrid->PageSize;
+ $this->DataGrid->DataSource=$this->getDataRows($offset,$this->DataGrid->PageSize);
+ $this->DataGrid->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php
index 7b8a2ae4..037036f5 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample1.php
@@ -1,41 +1,41 @@
-<?php
-
-class Sample1 extends TPage
-{
- protected function getData()
- {
- return array(
- array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
- array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
- array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
- array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
- array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
- array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
- array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
- array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
- array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
- array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
- array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
- array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
- array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
- array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
- array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
- );
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->DataList->DataSource=$this->Data;
- $this->DataList->dataBind();
- }
- }
-}
-
+<?php
+
+class Sample1 extends TPage
+{
+ protected function getData()
+ {
+ return array(
+ array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
+ array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
+ array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
+ array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
+ array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
+ array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
+ array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
+ array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
+ array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
+ array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
+ array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
+ array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
+ array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
+ array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
+ array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
+ );
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.php b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.php
index 9715f5ba..7273dd39 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataList/Sample2.php
@@ -1,132 +1,132 @@
-<?php
-
-class Sample2 extends TPage
-{
- private $_data=null;
-
- protected function getData()
- {
- if($this->_data===null)
- $this->loadData();
- return $this->_data;
- }
-
- protected function loadData()
- {
- // We use viewstate keep track of data.
- // In real applications, data should come from database using an SQL SELECT statement.
- // In the following tabular data, field 'id' is the primary key.
- // All update and delete operations should come with an 'id' value in order to go through.
- if(($this->_data=$this->getViewState('Data',null))===null)
- {
- $this->_data=array(
- array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
- array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>false),
- array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
- array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>true),
- array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>false),
- );
- $this->saveData();
- }
- }
-
- protected function saveData()
- {
- $this->setViewState('Data',$this->_data);
- }
-
- protected function updateProduct($id,$name,$quantity,$price,$imported)
- {
- // In real applications, data should be saved to database using an SQL UPDATE statement
- if($this->_data===null)
- $this->loadData();
- $updateRow=null;
- foreach($this->_data as $index=>$row)
- if($row['id']===$id)
- $updateRow=&$this->_data[$index];
- if($updateRow!==null)
- {
- $updateRow['name']=$name;
- $updateRow['quantity']=TPropertyValue::ensureInteger($quantity);
- $updateRow['price']=TPropertyValue::ensureFloat($price);
- $updateRow['imported']=TPropertyValue::ensureBoolean($imported);
- $this->saveData();
- }
- }
-
- protected function deleteProduct($id)
- {
- // In real applications, data should be saved to database using an SQL DELETE statement
- if($this->_data===null)
- $this->loadData();
- $deleteIndex=-1;
- foreach($this->_data as $index=>$row)
- if($row['id']===$id)
- $deleteIndex=$index;
- if($deleteIndex>=0)
- {
- unset($this->_data[$deleteIndex]);
- $this->saveData();
- }
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->DataList->DataSource=$this->Data;
- $this->DataList->dataBind();
- }
- }
-
- public function editItem($sender,$param)
- {
- $this->DataList->SelectedItemIndex=-1;
- $this->DataList->EditItemIndex=$param->Item->ItemIndex;
- $this->DataList->DataSource=$this->Data;
- $this->DataList->dataBind();
- }
-
- public function cancelItem($sender,$param)
- {
- $this->DataList->SelectedItemIndex=-1;
- $this->DataList->EditItemIndex=-1;
- $this->DataList->DataSource=$this->Data;
- $this->DataList->dataBind();
- }
-
- public function updateItem($sender,$param)
- {
- $item=$param->Item;
- $this->updateProduct(
- $this->DataList->DataKeys[$item->ItemIndex],
- $item->ProductName->Text,
- $item->ProductQuantity->Text,
- $item->ProductPrice->Text,
- $item->ProductImported->Checked);
- $this->DataList->EditItemIndex=-1;
- $this->DataList->DataSource=$this->Data;
- $this->DataList->dataBind();
- }
-
- public function deleteItem($sender,$param)
- {
- $this->deleteProduct($this->DataList->DataKeys[$param->Item->ItemIndex]);
- $this->DataList->SelectedItemIndex=-1;
- $this->DataList->EditItemIndex=-1;
- $this->DataList->DataSource=$this->Data;
- $this->DataList->dataBind();
- }
-
- public function selectItem($sender,$param)
- {
- $this->DataList->EditItemIndex=-1;
- $this->DataList->DataSource=$this->Data;
- $this->DataList->dataBind();
- }
-}
-
+<?php
+
+class Sample2 extends TPage
+{
+ private $_data=null;
+
+ protected function getData()
+ {
+ if($this->_data===null)
+ $this->loadData();
+ return $this->_data;
+ }
+
+ protected function loadData()
+ {
+ // We use viewstate keep track of data.
+ // In real applications, data should come from database using an SQL SELECT statement.
+ // In the following tabular data, field 'id' is the primary key.
+ // All update and delete operations should come with an 'id' value in order to go through.
+ if(($this->_data=$this->getViewState('Data',null))===null)
+ {
+ $this->_data=array(
+ array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
+ array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>false),
+ array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
+ array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>true),
+ array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>false),
+ );
+ $this->saveData();
+ }
+ }
+
+ protected function saveData()
+ {
+ $this->setViewState('Data',$this->_data);
+ }
+
+ protected function updateProduct($id,$name,$quantity,$price,$imported)
+ {
+ // In real applications, data should be saved to database using an SQL UPDATE statement
+ if($this->_data===null)
+ $this->loadData();
+ $updateRow=null;
+ foreach($this->_data as $index=>$row)
+ if($row['id']===$id)
+ $updateRow=&$this->_data[$index];
+ if($updateRow!==null)
+ {
+ $updateRow['name']=$name;
+ $updateRow['quantity']=TPropertyValue::ensureInteger($quantity);
+ $updateRow['price']=TPropertyValue::ensureFloat($price);
+ $updateRow['imported']=TPropertyValue::ensureBoolean($imported);
+ $this->saveData();
+ }
+ }
+
+ protected function deleteProduct($id)
+ {
+ // In real applications, data should be saved to database using an SQL DELETE statement
+ if($this->_data===null)
+ $this->loadData();
+ $deleteIndex=-1;
+ foreach($this->_data as $index=>$row)
+ if($row['id']===$id)
+ $deleteIndex=$index;
+ if($deleteIndex>=0)
+ {
+ unset($this->_data[$deleteIndex]);
+ $this->saveData();
+ }
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+ }
+
+ public function editItem($sender,$param)
+ {
+ $this->DataList->SelectedItemIndex=-1;
+ $this->DataList->EditItemIndex=$param->Item->ItemIndex;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function cancelItem($sender,$param)
+ {
+ $this->DataList->SelectedItemIndex=-1;
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function updateItem($sender,$param)
+ {
+ $item=$param->Item;
+ $this->updateProduct(
+ $this->DataList->DataKeys[$item->ItemIndex],
+ $item->ProductName->Text,
+ $item->ProductQuantity->Text,
+ $item->ProductPrice->Text,
+ $item->ProductImported->Checked);
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function deleteItem($sender,$param)
+ {
+ $this->deleteProduct($this->DataList->DataKeys[$param->Item->ItemIndex]);
+ $this->DataList->SelectedItemIndex=-1;
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+
+ public function selectItem($sender,$param)
+ {
+ $this->DataList->EditItemIndex=-1;
+ $this->DataList->DataSource=$this->Data;
+ $this->DataList->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataTypeValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TDataTypeValidator/Home.php
index 88d2dbf2..1c5efbcf 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataTypeValidator/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataTypeValidator/Home.php
@@ -1,8 +1,8 @@
-<?php
-
-class Home extends TPage
-{
-
-}
-
+<?php
+
+class Home extends TPage
+{
+
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php
index 133a797a..74e47b6c 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDropDownList/Home.php
@@ -1,69 +1,69 @@
-<?php
-
-class Home extends TPage
-{
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $data=array('item 1','item 2','item 3','item 4');
- $this->DBDropDownList1->DataSource=$data;
- $this->DBDropDownList1->dataBind();
-
- $data=array('key 1'=>'item 1','key 2'=>'item 2',
- 'key 3'=>'item 3','key 4'=>'item 4');
- $this->DBDropDownList2->DataSource=$data;
- $this->DBDropDownList2->dataBind();
-
- $data=array(
- array('id'=>'001','name'=>'John','age'=>31),
- array('id'=>'002','name'=>'Mary','age'=>30),
- array('id'=>'003','name'=>'Cary','age'=>20));
- $this->DBDropDownList3->DataSource=$data;
- $this->DBDropDownList3->dataBind();
- }
- }
-
- protected function collectSelectionResult($input,$output)
- {
- $indices=$input->SelectedIndices;
- $result='';
- foreach($indices as $index)
- {
- $item=$input->Items[$index];
- $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
- }
- if($result==='')
- $output->Text='Your selection is empty.';
- else
- $output->Text='Your selection is: '.$result;
- }
-
- public function DBDropDownList1Changed($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->DBDropDownList1Result);
- }
-
- public function DBDropDownList2Changed($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->DBDropDownList2Result);
- }
-
- public function DBDropDownList3Changed($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->DBDropDownList3Result);
- }
-
- public function selectionChanged($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->SelectionResult);
- }
-
- public function buttonClicked($sender,$param)
- {
- $this->collectSelectionResult($this->DropDownList1,$this->SelectionResult2);
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $data=array('item 1','item 2','item 3','item 4');
+ $this->DBDropDownList1->DataSource=$data;
+ $this->DBDropDownList1->dataBind();
+
+ $data=array('key 1'=>'item 1','key 2'=>'item 2',
+ 'key 3'=>'item 3','key 4'=>'item 4');
+ $this->DBDropDownList2->DataSource=$data;
+ $this->DBDropDownList2->dataBind();
+
+ $data=array(
+ array('id'=>'001','name'=>'John','age'=>31),
+ array('id'=>'002','name'=>'Mary','age'=>30),
+ array('id'=>'003','name'=>'Cary','age'=>20));
+ $this->DBDropDownList3->DataSource=$data;
+ $this->DBDropDownList3->dataBind();
+ }
+ }
+
+ protected function collectSelectionResult($input,$output)
+ {
+ $indices=$input->SelectedIndices;
+ $result='';
+ foreach($indices as $index)
+ {
+ $item=$input->Items[$index];
+ $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
+ }
+ if($result==='')
+ $output->Text='Your selection is empty.';
+ else
+ $output->Text='Your selection is: '.$result;
+ }
+
+ public function DBDropDownList1Changed($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->DBDropDownList1Result);
+ }
+
+ public function DBDropDownList2Changed($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->DBDropDownList2Result);
+ }
+
+ public function DBDropDownList3Changed($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->DBDropDownList3Result);
+ }
+
+ public function selectionChanged($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->SelectionResult);
+ }
+
+ public function buttonClicked($sender,$param)
+ {
+ $this->collectSelectionResult($this->DropDownList1,$this->SelectionResult2);
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.php
index 88d2dbf2..1c5efbcf 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TEmailAddressValidator/Home.php
@@ -1,8 +1,8 @@
-<?php
-
-class Home extends TPage
-{
-
-}
-
+<?php
+
+class Home extends TPage
+{
+
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php
index d5cf990a..29d05a1c 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TFileUpload/Home.php
@@ -1,21 +1,21 @@
-<?php
-
-class Home extends TPage
-{
- public function fileUploaded($sender,$param)
- {
- if($sender->HasFile)
- {
- $this->Result->Text="
- You just uploaded a file:
- <br/>
- Name: {$sender->FileName}
- <br/>
- Size: {$sender->FileSize}
- <br/>
- Type: {$sender->FileType}";
- }
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function fileUploaded($sender,$param)
+ {
+ if($sender->HasFile)
+ {
+ $this->Result->Text="
+ You just uploaded a file:
+ <br/>
+ Name: {$sender->FileName}
+ <br/>
+ Size: {$sender->FileSize}
+ <br/>
+ Type: {$sender->FileType}";
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.php b/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.php
index c56b5229..255a2bf3 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/THtmlArea/Home.php
@@ -1,21 +1,21 @@
-<?php
-
-class Home extends TPage
-{
- public function button1Clicked($sender,$param)
- {
- $this->Result1->Text="You have entered: ".$this->HtmlArea1->Text;
- }
-
- public function button2Clicked($sender,$param)
- {
- $this->Result2->Text="You have entered: ".$this->HtmlArea2->Text;
- }
-
- public function button3Clicked($sender,$param)
- {
- $this->Result3->Text="You have entered: ".$this->HtmlArea3->Text;
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function button1Clicked($sender,$param)
+ {
+ $this->Result1->Text="You have entered: ".$this->HtmlArea1->Text;
+ }
+
+ public function button2Clicked($sender,$param)
+ {
+ $this->Result2->Text="You have entered: ".$this->HtmlArea2->Text;
+ }
+
+ public function button3Clicked($sender,$param)
+ {
+ $this->Result3->Text="You have entered: ".$this->HtmlArea3->Text;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TImageButton/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TImageButton/Home.php
index df61ed82..e30aab2b 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TImageButton/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TImageButton/Home.php
@@ -1,18 +1,18 @@
-<?php
-
-class Home extends TPage
-{
- public function buttonClicked($sender,$param)
- {
- if($param instanceof TCommandEventParameter)
- {
- $this->Result2->Text="Command name: $param->CommandName, Command parameter: $param->CommandParameter";
- }
- else
- {
- $this->Result->Text="You clicked at ($param->X,$param->Y)";
- }
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ if($param instanceof TCommandEventParameter)
+ {
+ $this->Result2->Text="Command name: $param->CommandName, Command parameter: $param->CommandParameter";
+ }
+ else
+ {
+ $this->Result->Text="You clicked at ($param->X,$param->Y)";
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TImageMap/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TImageMap/Home.php
index b8e17941..01294c60 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TImageMap/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TImageMap/Home.php
@@ -1,11 +1,11 @@
-<?php
-
-class Home extends TPage
-{
- public function buttonClicked($sender,$param)
- {
- $this->Result->Text="Your post value is : ".$param->PostBackValue;
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ $this->Result->Text="Your post value is : ".$param->PostBackValue;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TKeyboard/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TKeyboard/Home.php
index 689f45c8..d725dc06 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TKeyboard/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TKeyboard/Home.php
@@ -1,11 +1,11 @@
-<?php
-
-class Home extends TPage
-{
- public function buttonClicked($sender,$param)
- {
- $this->Result->Text='You have entered "'.$this->PasswordInput->Text.'".';
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ $this->Result->Text='You have entered "'.$this->PasswordInput->Text.'".';
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TLinkButton/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TLinkButton/Home.php
index f18072f2..3711ca46 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TLinkButton/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TLinkButton/Home.php
@@ -1,14 +1,14 @@
-<?php
-
-class Home extends TPage
-{
- public function buttonClicked($sender,$param)
- {
- if($param instanceof TCommandEventParameter)
- $sender->Text="Name: {$param->CommandName}, Param: {$param->CommandParameter}";
- else
- $sender->Text="I'm clicked";
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ if($param instanceof TCommandEventParameter)
+ $sender->Text="Name: {$param->CommandName}, Param: {$param->CommandParameter}";
+ else
+ $sender->Text="I'm clicked";
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php
index a570d38b..9e5add52 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TListBox/Home.php
@@ -1,79 +1,79 @@
-<?php
-
-class Home extends TPage
-{
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $data=array('item 1','item 2','item 3','item 4');
- $this->DBListBox1->DataSource=$data;
- $this->DBListBox1->dataBind();
-
- $data=array('key 1'=>'item 1','key 2'=>'item 2',
- 'key 3'=>'item 3','key 4'=>'item 4');
- $this->DBListBox2->DataSource=$data;
- $this->DBListBox2->dataBind();
-
- $data=array(
- array('id'=>'001','name'=>'John','age'=>31),
- array('id'=>'002','name'=>'Mary','age'=>30),
- array('id'=>'003','name'=>'Cary','age'=>20));
- $this->DBListBox3->DataSource=$data;
- $this->DBListBox3->dataBind();
- }
- }
-
- public function DBListBox1Changed($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->DBListBox1Result);
- }
-
- public function DBListBox2Changed($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->DBListBox2Result);
- }
-
- public function DBListBox3Changed($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->DBListBox3Result);
- }
-
- protected function collectSelectionResult($input,$output)
- {
- $indices=$input->SelectedIndices;
- $result='';
- foreach($indices as $index)
- {
- $item=$input->Items[$index];
- $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
- }
- if($result==='')
- $output->Text='Your selection is empty.';
- else
- $output->Text='Your selection is: '.$result;
- }
-
- public function selectionChanged($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->SelectionResult);
- }
-
- public function buttonClicked($sender,$param)
- {
- $this->collectSelectionResult($this->ListBox1,$this->SelectionResult2);
- }
-
- public function multiSelectionChanged($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->MultiSelectionResult);
- }
-
- public function buttonClicked2($sender,$param)
- {
- $this->collectSelectionResult($this->ListBox2,$this->MultiSelectionResult2);
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $data=array('item 1','item 2','item 3','item 4');
+ $this->DBListBox1->DataSource=$data;
+ $this->DBListBox1->dataBind();
+
+ $data=array('key 1'=>'item 1','key 2'=>'item 2',
+ 'key 3'=>'item 3','key 4'=>'item 4');
+ $this->DBListBox2->DataSource=$data;
+ $this->DBListBox2->dataBind();
+
+ $data=array(
+ array('id'=>'001','name'=>'John','age'=>31),
+ array('id'=>'002','name'=>'Mary','age'=>30),
+ array('id'=>'003','name'=>'Cary','age'=>20));
+ $this->DBListBox3->DataSource=$data;
+ $this->DBListBox3->dataBind();
+ }
+ }
+
+ public function DBListBox1Changed($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->DBListBox1Result);
+ }
+
+ public function DBListBox2Changed($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->DBListBox2Result);
+ }
+
+ public function DBListBox3Changed($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->DBListBox3Result);
+ }
+
+ protected function collectSelectionResult($input,$output)
+ {
+ $indices=$input->SelectedIndices;
+ $result='';
+ foreach($indices as $index)
+ {
+ $item=$input->Items[$index];
+ $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
+ }
+ if($result==='')
+ $output->Text='Your selection is empty.';
+ else
+ $output->Text='Your selection is: '.$result;
+ }
+
+ public function selectionChanged($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->SelectionResult);
+ }
+
+ public function buttonClicked($sender,$param)
+ {
+ $this->collectSelectionResult($this->ListBox1,$this->SelectionResult2);
+ }
+
+ public function multiSelectionChanged($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->MultiSelectionResult);
+ }
+
+ public function buttonClicked2($sender,$param)
+ {
+ $this->collectSelectionResult($this->ListBox2,$this->MultiSelectionResult2);
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TMultiView/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TMultiView/Home.php
index 1a5dbed3..24a240ca 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TMultiView/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TMultiView/Home.php
@@ -1,15 +1,15 @@
-<?php
-
-class Home extends TPage
-{
- public function viewChanged($sender,$param)
- {
- if($this->MultiView->ActiveViewIndex===2)
- {
- $this->Result1->Text="Your text input is: ".$this->Memo->Text;
- $this->Result2->Text="Your color choice is: ".$this->DropDownList->SelectedValue;
- }
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function viewChanged($sender,$param)
+ {
+ if($this->MultiView->ActiveViewIndex===2)
+ {
+ $this->Result1->Text="Your text input is: ".$this->Memo->Text;
+ $this->Result2->Text="Your color choice is: ".$this->DropDownList->SelectedValue;
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.php b/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.php
index e5446f60..86563cc1 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TPager/Sample1.php
@@ -1,82 +1,82 @@
-<?php
-
-class Sample1 extends TPage
-{
- /**
- * Returns total number of data items.
- * In DB-driven applications, this typically requires
- * execution of an SQL statement with COUNT function.
- * Here we simply return a constant number.
- */
- protected function getDataItemCount()
- {
- return 19;
- }
-
- /**
- * Fetches a page of data.
- * In DB-driven applications, this can be achieved by executing
- * an SQL query with LIMIT clause.
- */
- protected function getData($offset,$limit)
- {
- $data=array(
- array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
- array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
- array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
- array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
- array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
- array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
- array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
- array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
- array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
- array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
- array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
- array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
- array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
- array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
- array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
- );
- return array_slice($data,$offset,$limit);
- }
-
- /**
- * Determines which page of data to be displayed and
- * populates the datalist with the fetched data.
- */
- protected function populateData()
- {
- $offset=$this->DataList->CurrentPageIndex*$this->DataList->PageSize;
- $limit=$this->DataList->PageSize;
- if($offset+$limit>$this->DataList->VirtualItemCount)
- $limit=$this->DataList->VirtualItemCount-$offset;
- $data=$this->getData($offset,$limit);
- $this->DataList->DataSource=$data;
- $this->DataList->dataBind();
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->DataList->VirtualItemCount=$this->DataItemCount;
- $this->populateData();
- }
- }
-
- /**
- * Event handler to the OnPageIndexChanged event of pagers.
- */
- public function pageChanged($sender,$param)
- {
- $this->DataList->CurrentPageIndex=$param->NewPageIndex;
- $this->populateData();
- }
-}
-
+<?php
+
+class Sample1 extends TPage
+{
+ /**
+ * Returns total number of data items.
+ * In DB-driven applications, this typically requires
+ * execution of an SQL statement with COUNT function.
+ * Here we simply return a constant number.
+ */
+ protected function getDataItemCount()
+ {
+ return 19;
+ }
+
+ /**
+ * Fetches a page of data.
+ * In DB-driven applications, this can be achieved by executing
+ * an SQL query with LIMIT clause.
+ */
+ protected function getData($offset,$limit)
+ {
+ $data=array(
+ array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
+ array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
+ array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
+ array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
+ array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
+ array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
+ array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
+ array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
+ array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
+ array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
+ array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
+ array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
+ array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
+ array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
+ array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
+ );
+ return array_slice($data,$offset,$limit);
+ }
+
+ /**
+ * Determines which page of data to be displayed and
+ * populates the datalist with the fetched data.
+ */
+ protected function populateData()
+ {
+ $offset=$this->DataList->CurrentPageIndex*$this->DataList->PageSize;
+ $limit=$this->DataList->PageSize;
+ if($offset+$limit>$this->DataList->VirtualItemCount)
+ $limit=$this->DataList->VirtualItemCount-$offset;
+ $data=$this->getData($offset,$limit);
+ $this->DataList->DataSource=$data;
+ $this->DataList->dataBind();
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->DataList->VirtualItemCount=$this->DataItemCount;
+ $this->populateData();
+ }
+ }
+
+ /**
+ * Event handler to the OnPageIndexChanged event of pagers.
+ */
+ public function pageChanged($sender,$param)
+ {
+ $this->DataList->CurrentPageIndex=$param->NewPageIndex;
+ $this->populateData();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.php
index d6cf1bd5..1864f380 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TPanel/Home.php
@@ -1,11 +1,11 @@
-<?php
-
-class Home extends TPage
-{
- public function buttonClicked($sender,$param)
- {
- $this->Result->Text="You have clicked on '$sender->Text'.";
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function buttonClicked($sender,$param)
+ {
+ $this->Result->Text="You have clicked on '$sender->Text'.";
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TPlaceHolder/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TPlaceHolder/Home.php
index ecae7876..8987c230 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TPlaceHolder/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TPlaceHolder/Home.php
@@ -1,16 +1,16 @@
-<?php
-
-class Home extends TPage
-{
- public function onInit($param)
- {
- parent::onInit($param);
- $label=new TLabel;
- $label->Text='dynamic';
- $label->BackColor='silver';
- $this->PlaceHolder1->Controls[]=$label;
- $this->PlaceHolder1->Controls[]=' content';
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function onInit($param)
+ {
+ parent::onInit($param);
+ $label=new TLabel;
+ $label->Text='dynamic';
+ $label->BackColor='silver';
+ $this->PlaceHolder1->Controls[]=$label;
+ $this->PlaceHolder1->Controls[]=' content';
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRadioButton/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TRadioButton/Home.php
index 034d2fcc..a0c2af32 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRadioButton/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRadioButton/Home.php
@@ -1,27 +1,27 @@
-<?php
-
-class Home extends TPage
-{
- public function radiobuttonClicked($sender,$param)
- {
- $sender->Text="I'm clicked";
- }
-
- public function selectRadioButton($sender,$param)
- {
- $selection='';
- if($this->Radio1->Checked)
- $selection.='1';
- if($this->Radio2->Checked)
- $selection.='2';
- if($this->Radio3->Checked)
- $selection.='3';
- if($this->Radio4->Checked)
- $selection.='4';
- if($selection==='')
- $selection='empty';
- $this->Result->Text='Your selection is '.$selection;
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function radiobuttonClicked($sender,$param)
+ {
+ $sender->Text="I'm clicked";
+ }
+
+ public function selectRadioButton($sender,$param)
+ {
+ $selection='';
+ if($this->Radio1->Checked)
+ $selection.='1';
+ if($this->Radio2->Checked)
+ $selection.='2';
+ if($this->Radio3->Checked)
+ $selection.='3';
+ if($this->Radio4->Checked)
+ $selection.='4';
+ if($selection==='')
+ $selection='empty';
+ $this->Result->Text='Your selection is '.$selection;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php
index b45441f9..62b4d7e7 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/Home.php
@@ -1,69 +1,69 @@
-<?php
-
-class Home extends TPage
-{
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $data=array('item 1','item 2','item 3','item 4');
- $this->DBRadioButtonList1->DataSource=$data;
- $this->DBRadioButtonList1->dataBind();
-
- $data=array('key 1'=>'item 1','key 2'=>'item 2',
- 'key 3'=>'item 3','key 4'=>'item 4');
- $this->DBRadioButtonList2->DataSource=$data;
- $this->DBRadioButtonList2->dataBind();
-
- $data=array(
- array('id'=>'001','name'=>'John','age'=>31),
- array('id'=>'002','name'=>'Mary','age'=>30),
- array('id'=>'003','name'=>'Cary','age'=>20));
- $this->DBRadioButtonList3->DataSource=$data;
- $this->DBRadioButtonList3->dataBind();
- }
- }
-
- protected function collectSelectionResult($input,$output)
- {
- $indices=$input->SelectedIndices;
- $result='';
- foreach($indices as $index)
- {
- $item=$input->Items[$index];
- $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
- }
- if($result==='')
- $output->Text='Your selection is empty.';
- else
- $output->Text='Your selection is: '.$result;
- }
-
- public function buttonClicked($sender,$param)
- {
- $this->collectSelectionResult($this->RadioButtonList,$this->SelectionResult);
- }
-
- public function selectionChanged($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->SelectionResult2);
- }
-
- public function DBRadioButtonList1Changed($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->DBRadioButtonList1Result);
- }
-
- public function DBRadioButtonList2Changed($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->DBRadioButtonList2Result);
- }
-
- public function DBRadioButtonList3Changed($sender,$param)
- {
- $this->collectSelectionResult($sender,$this->DBRadioButtonList3Result);
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $data=array('item 1','item 2','item 3','item 4');
+ $this->DBRadioButtonList1->DataSource=$data;
+ $this->DBRadioButtonList1->dataBind();
+
+ $data=array('key 1'=>'item 1','key 2'=>'item 2',
+ 'key 3'=>'item 3','key 4'=>'item 4');
+ $this->DBRadioButtonList2->DataSource=$data;
+ $this->DBRadioButtonList2->dataBind();
+
+ $data=array(
+ array('id'=>'001','name'=>'John','age'=>31),
+ array('id'=>'002','name'=>'Mary','age'=>30),
+ array('id'=>'003','name'=>'Cary','age'=>20));
+ $this->DBRadioButtonList3->DataSource=$data;
+ $this->DBRadioButtonList3->dataBind();
+ }
+ }
+
+ protected function collectSelectionResult($input,$output)
+ {
+ $indices=$input->SelectedIndices;
+ $result='';
+ foreach($indices as $index)
+ {
+ $item=$input->Items[$index];
+ $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
+ }
+ if($result==='')
+ $output->Text='Your selection is empty.';
+ else
+ $output->Text='Your selection is: '.$result;
+ }
+
+ public function buttonClicked($sender,$param)
+ {
+ $this->collectSelectionResult($this->RadioButtonList,$this->SelectionResult);
+ }
+
+ public function selectionChanged($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->SelectionResult2);
+ }
+
+ public function DBRadioButtonList1Changed($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->DBRadioButtonList1Result);
+ }
+
+ public function DBRadioButtonList2Changed($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->DBRadioButtonList2Result);
+ }
+
+ public function DBRadioButtonList3Changed($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->DBRadioButtonList3Result);
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRangeValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TRangeValidator/Home.php
index 88d2dbf2..1c5efbcf 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRangeValidator/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRangeValidator/Home.php
@@ -1,8 +1,8 @@
-<?php
-
-class Home extends TPage
-{
-
-}
-
+<?php
+
+class Home extends TPage
+{
+
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRegularExpressionValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TRegularExpressionValidator/Home.php
index 88d2dbf2..1c5efbcf 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRegularExpressionValidator/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRegularExpressionValidator/Home.php
@@ -1,8 +1,8 @@
-<?php
-
-class Home extends TPage
-{
-
-}
-
+<?php
+
+class Home extends TPage
+{
+
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/RegionDisplay.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/RegionDisplay.php
index 40d1841e..4f7ab6c2 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/RegionDisplay.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/RegionDisplay.php
@@ -1,28 +1,28 @@
-<?php
-
-class RegionDisplay extends TRepeaterItemRenderer
-{
- /**
- * This method is invoked when the data is being bound
- * to the parent repeater.
- * At this time, the <b>Data</b> is available which
- * refers to the data row associated with the parent repeater item.
- */
- public function onDataBinding($param)
- {
- parent::onDataBinding($param);
- $this->Repeater->DataSource=$this->Data['detail'];
- $this->Repeater->dataBind();
- }
-
- public function itemCreated($sender,$param)
- {
- static $itemIndex=0;
- $item=$param->Item;
- if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
- $item->Row->BackColor=$itemIndex%2 ? "#BFCFFF" : "#E6ECFF";
- $itemIndex++;
- }
-}
-
+<?php
+
+class RegionDisplay extends TRepeaterItemRenderer
+{
+ /**
+ * This method is invoked when the data is being bound
+ * to the parent repeater.
+ * At this time, the <b>Data</b> is available which
+ * refers to the data row associated with the parent repeater item.
+ */
+ public function onDataBinding($param)
+ {
+ parent::onDataBinding($param);
+ $this->Repeater->DataSource=$this->Data['detail'];
+ $this->Repeater->dataBind();
+ }
+
+ public function itemCreated($sender,$param)
+ {
+ static $itemIndex=0;
+ $item=$param->Item;
+ if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
+ $item->Row->BackColor=$itemIndex%2 ? "#BFCFFF" : "#E6ECFF";
+ $itemIndex++;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample1.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample1.php
index 905a3b8d..c3cff79b 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample1.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample1.php
@@ -1,41 +1,41 @@
-<?php
-
-class Sample1 extends TPage
-{
- protected function getData()
- {
- return array(
- array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
- array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
- array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
- array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
- array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
- array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
- array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
- array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
- array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
- array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
- array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
- array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
- array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
- array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
- array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
- array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
- array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
- );
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->Repeater->DataSource=$this->getData();
- $this->Repeater->dataBind();
- }
- }
-}
-
+<?php
+
+class Sample1 extends TPage
+{
+ protected function getData()
+ {
+ return array(
+ array('id'=>'ITN001','name'=>'Motherboard','quantity'=>1,'price'=>100.00,'imported'=>true),
+ array('id'=>'ITN002','name'=>'CPU','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN003','name'=>'Harddrive','quantity'=>2,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN004','name'=>'Sound card','quantity'=>1,'price'=>40.00,'imported'=>false),
+ array('id'=>'ITN005','name'=>'Video card','quantity'=>1,'price'=>150.00,'imported'=>true),
+ array('id'=>'ITN006','name'=>'Keyboard','quantity'=>1,'price'=>20.00,'imported'=>false),
+ array('id'=>'ITN007','name'=>'Monitor','quantity'=>2,'price'=>300.00,'imported'=>true),
+ array('id'=>'ITN008','name'=>'CDRW drive','quantity'=>1,'price'=>40.00,'imported'=>true),
+ array('id'=>'ITN009','name'=>'Cooling fan','quantity'=>2,'price'=>10.00,'imported'=>false),
+ array('id'=>'ITN010','name'=>'Video camera','quantity'=>20,'price'=>30.00,'imported'=>true),
+ array('id'=>'ITN011','name'=>'Card reader','quantity'=>10,'price'=>24.00,'imported'=>true),
+ array('id'=>'ITN012','name'=>'Floppy drive','quantity'=>50,'price'=>12.00,'imported'=>false),
+ array('id'=>'ITN013','name'=>'CD drive','quantity'=>25,'price'=>20.00,'imported'=>true),
+ array('id'=>'ITN014','name'=>'DVD drive','quantity'=>15,'price'=>80.00,'imported'=>true),
+ array('id'=>'ITN015','name'=>'Mouse pad','quantity'=>50,'price'=>5.00,'imported'=>false),
+ array('id'=>'ITN016','name'=>'Network cable','quantity'=>40,'price'=>8.00,'imported'=>true),
+ array('id'=>'ITN017','name'=>'Case','quantity'=>8,'price'=>65.00,'imported'=>false),
+ array('id'=>'ITN018','name'=>'Surge protector','quantity'=>45,'price'=>15.00,'imported'=>false),
+ array('id'=>'ITN019','name'=>'Speaker','quantity'=>35,'price'=>65.00,'imported'=>false),
+ );
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->Repeater->DataSource=$this->getData();
+ $this->Repeater->dataBind();
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php
index e84580a2..803201e9 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample2.php
@@ -1,79 +1,79 @@
-<?php
-
-class Sample2 extends TPage
-{
- protected function getMasterData()
- {
- return array('North','West','East','South');
- }
-
- protected function getDetailData($region)
- {
- static $data=array(
- 'North'=>array(
- array('name'=>'John','age'=>30,'position'=>'Program Manager'),
- array('name'=>'Edward','age'=>35,'position'=>'Developer'),
- array('name'=>'Walter','age'=>28,'position'=>'Developer'),
- ),
- 'West'=>array(
- array('name'=>'Cary','age'=>31,'position'=>'Senior Manager'),
- array('name'=>'Ted','age'=>25,'position'=>'Developer'),
- array('name'=>'Kevin','age'=>28,'position'=>'Developer'),
- ),
- 'East'=>array(
- array('name'=>'Shawn','age'=>30,'position'=>'Sales Manager'),
- array('name'=>'Larry','age'=>28,'position'=>'Document Writer'),
- ),
- 'South'=>array(
- array('name'=>'King','age'=>30,'position'=>'Program Manager'),
- array('name'=>'Carter','age'=>22,'position'=>'Developer'),
- ),
- );
- return $data[$region];
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->Repeater->DataSource=$this->getMasterData();
- $this->Repeater->dataBind();
- }
- }
-
- public function dataBindRepeater2($sender,$param)
- {
- $item=$param->Item;
- if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
- {
- $item->Repeater2->DataSource=$this->getDetailData($item->DataItem);
- $item->Repeater2->dataBind();
- }
- }
-
- public function repeaterItemCreated($sender,$param)
- {
- static $itemIndex=0;
- $item=$param->Item;
- if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
- {
- $item->Cell->BackColor=$itemIndex%2 ? "#6078BF" : "#809FFF";
- $item->Cell->ForeColor='white';
- $itemIndex++;
- }
- }
-
- public function repeater2ItemCreated($sender,$param)
- {
- static $itemIndex=0;
- $item=$param->Item;
- if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
- {
- $item->Row->BackColor=$itemIndex%2 ? "#BFCFFF" : "#E6ECFF";
- $itemIndex++;
- }
- }
-}
-
+<?php
+
+class Sample2 extends TPage
+{
+ protected function getMasterData()
+ {
+ return array('North','West','East','South');
+ }
+
+ protected function getDetailData($region)
+ {
+ static $data=array(
+ 'North'=>array(
+ array('name'=>'John','age'=>30,'position'=>'Program Manager'),
+ array('name'=>'Edward','age'=>35,'position'=>'Developer'),
+ array('name'=>'Walter','age'=>28,'position'=>'Developer'),
+ ),
+ 'West'=>array(
+ array('name'=>'Cary','age'=>31,'position'=>'Senior Manager'),
+ array('name'=>'Ted','age'=>25,'position'=>'Developer'),
+ array('name'=>'Kevin','age'=>28,'position'=>'Developer'),
+ ),
+ 'East'=>array(
+ array('name'=>'Shawn','age'=>30,'position'=>'Sales Manager'),
+ array('name'=>'Larry','age'=>28,'position'=>'Document Writer'),
+ ),
+ 'South'=>array(
+ array('name'=>'King','age'=>30,'position'=>'Program Manager'),
+ array('name'=>'Carter','age'=>22,'position'=>'Developer'),
+ ),
+ );
+ return $data[$region];
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->Repeater->DataSource=$this->getMasterData();
+ $this->Repeater->dataBind();
+ }
+ }
+
+ public function dataBindRepeater2($sender,$param)
+ {
+ $item=$param->Item;
+ if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
+ {
+ $item->Repeater2->DataSource=$this->getDetailData($item->DataItem);
+ $item->Repeater2->dataBind();
+ }
+ }
+
+ public function repeaterItemCreated($sender,$param)
+ {
+ static $itemIndex=0;
+ $item=$param->Item;
+ if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
+ {
+ $item->Cell->BackColor=$itemIndex%2 ? "#6078BF" : "#809FFF";
+ $item->Cell->ForeColor='white';
+ $itemIndex++;
+ }
+ }
+
+ public function repeater2ItemCreated($sender,$param)
+ {
+ static $itemIndex=0;
+ $item=$param->Item;
+ if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
+ {
+ $item->Row->BackColor=$itemIndex%2 ? "#BFCFFF" : "#E6ECFF";
+ $itemIndex++;
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.php
index d4f4c8e9..dbaf598f 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample3.php
@@ -1,79 +1,79 @@
-<?php
-
-class Sample3 extends TPage
-{
- protected function getProducts()
- {
- return array(
- array('id'=>'ITN001','name'=>'Motherboard','category'=>'CAT004','price'=>100.00,'imported'=>true),
- array('id'=>'ITN002','name'=>'CPU','category'=>'CAT004','price'=>150.00,'imported'=>true),
- array('id'=>'ITN003','name'=>'Harddrive','category'=>'CAT003','price'=>80.00,'imported'=>true),
- array('id'=>'ITN006','name'=>'Keyboard','category'=>'CAT002','price'=>20.00,'imported'=>false),
- array('id'=>'ITN008','name'=>'CDRW drive','category'=>'CAT003','price'=>40.00,'imported'=>true),
- array('id'=>'ITN009','name'=>'Cooling fan','category'=>'CAT001','price'=>10.00,'imported'=>false),
- array('id'=>'ITN012','name'=>'Floppy drive','category'=>'CAT003','price'=>12.00,'imported'=>false),
- array('id'=>'ITN013','name'=>'CD drive','category'=>'CAT003','price'=>20.00,'imported'=>true),
- array('id'=>'ITN014','name'=>'DVD drive','category'=>'CAT003','price'=>80.00,'imported'=>true),
- array('id'=>'ITN015','name'=>'Mouse pad','category'=>'CAT001','price'=>5.00,'imported'=>false),
- );
- }
-
- protected function getCategories()
- {
- return array(
- array('id'=>'CAT001','name'=>'Accessories'),
- array('id'=>'CAT002','name'=>'Input Devices'),
- array('id'=>'CAT003','name'=>'Drives'),
- array('id'=>'CAT004','name'=>'Barebone'),
- );
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->Repeater->DataSource=$this->Products;
- $this->Repeater->dataBind();
- }
- }
-
- public function repeaterDataBound($sender,$param)
- {
- $item=$param->Item;
- if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
- {
- $item->ProductCategory->DataSource=$this->Categories;
- $item->ProductCategory->DataTextField='name';
- $item->ProductCategory->DataValueField='id';
- $item->ProductCategory->dataBind();
- $item->ProductCategory->SelectedValue=$item->DataItem['category'];
- }
- }
-
- public function saveInput($sender,$param)
- {
- if($this->IsValid)
- {
- $index=0;
- $products=$this->Products;
- $data=array();
- foreach($this->Repeater->Items as $item)
- {
- $item=array(
- 'id'=>$products[$index]['id'],
- 'name'=>$item->ProductName->Text,
- 'category'=>$item->ProductCategory->SelectedItem->Text,
- 'price'=>TPropertyValue::ensureFloat($item->ProductPrice->Text),
- 'imported'=>$item->ProductImported->Checked,
- );
- $data[]=$item;
- $index++;
- }
- $this->Repeater2->DataSource=$data;
- $this->Repeater2->dataBind();
- }
- }
-}
-
+<?php
+
+class Sample3 extends TPage
+{
+ protected function getProducts()
+ {
+ return array(
+ array('id'=>'ITN001','name'=>'Motherboard','category'=>'CAT004','price'=>100.00,'imported'=>true),
+ array('id'=>'ITN002','name'=>'CPU','category'=>'CAT004','price'=>150.00,'imported'=>true),
+ array('id'=>'ITN003','name'=>'Harddrive','category'=>'CAT003','price'=>80.00,'imported'=>true),
+ array('id'=>'ITN006','name'=>'Keyboard','category'=>'CAT002','price'=>20.00,'imported'=>false),
+ array('id'=>'ITN008','name'=>'CDRW drive','category'=>'CAT003','price'=>40.00,'imported'=>true),
+ array('id'=>'ITN009','name'=>'Cooling fan','category'=>'CAT001','price'=>10.00,'imported'=>false),
+ array('id'=>'ITN012','name'=>'Floppy drive','category'=>'CAT003','price'=>12.00,'imported'=>false),
+ array('id'=>'ITN013','name'=>'CD drive','category'=>'CAT003','price'=>20.00,'imported'=>true),
+ array('id'=>'ITN014','name'=>'DVD drive','category'=>'CAT003','price'=>80.00,'imported'=>true),
+ array('id'=>'ITN015','name'=>'Mouse pad','category'=>'CAT001','price'=>5.00,'imported'=>false),
+ );
+ }
+
+ protected function getCategories()
+ {
+ return array(
+ array('id'=>'CAT001','name'=>'Accessories'),
+ array('id'=>'CAT002','name'=>'Input Devices'),
+ array('id'=>'CAT003','name'=>'Drives'),
+ array('id'=>'CAT004','name'=>'Barebone'),
+ );
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->Repeater->DataSource=$this->Products;
+ $this->Repeater->dataBind();
+ }
+ }
+
+ public function repeaterDataBound($sender,$param)
+ {
+ $item=$param->Item;
+ if($item->ItemType==='Item' || $item->ItemType==='AlternatingItem')
+ {
+ $item->ProductCategory->DataSource=$this->Categories;
+ $item->ProductCategory->DataTextField='name';
+ $item->ProductCategory->DataValueField='id';
+ $item->ProductCategory->dataBind();
+ $item->ProductCategory->SelectedValue=$item->DataItem['category'];
+ }
+ }
+
+ public function saveInput($sender,$param)
+ {
+ if($this->IsValid)
+ {
+ $index=0;
+ $products=$this->Products;
+ $data=array();
+ foreach($this->Repeater->Items as $item)
+ {
+ $item=array(
+ 'id'=>$products[$index]['id'],
+ 'name'=>$item->ProductName->Text,
+ 'category'=>$item->ProductCategory->SelectedItem->Text,
+ 'price'=>TPropertyValue::ensureFloat($item->ProductPrice->Text),
+ 'imported'=>$item->ProductImported->Checked,
+ );
+ $data[]=$item;
+ $index++;
+ }
+ $this->Repeater2->DataSource=$data;
+ $this->Repeater2->dataBind();
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample4.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample4.php
index aabab157..fb0e4922 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample4.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample4.php
@@ -1,37 +1,37 @@
-<?php
-
-Prado::using('System.Collections.TDummyDataSource');
-
-class Sample4 extends TPage
-{
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- // use a dummy data source to create 3 repeater items
- $this->Repeater->DataSource=new TDummyDataSource(3);
- $this->Repeater->dataBind();
- }
- }
-
- public function itemCreated($sender,$param)
- {
- // $param->Item refers to the newly created repeater item
- $param->Item->Style="width:300px; margin:10px; margin-left:0px";
- }
-
- public function buttonClicked($sender,$param)
- {
- $links=array();
- foreach($this->Repeater->Items as $textBox)
- {
- if($textBox->Text!=='')
- $links[]=$textBox->Text;
- }
- $this->Repeater2->DataSource=$links;
- $this->Repeater2->dataBind();
- }
-}
-
+<?php
+
+Prado::using('System.Collections.TDummyDataSource');
+
+class Sample4 extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ // use a dummy data source to create 3 repeater items
+ $this->Repeater->DataSource=new TDummyDataSource(3);
+ $this->Repeater->dataBind();
+ }
+ }
+
+ public function itemCreated($sender,$param)
+ {
+ // $param->Item refers to the newly created repeater item
+ $param->Item->Style="width:300px; margin:10px; margin-left:0px";
+ }
+
+ public function buttonClicked($sender,$param)
+ {
+ $links=array();
+ foreach($this->Repeater->Items as $textBox)
+ {
+ if($textBox->Text!=='')
+ $links[]=$textBox->Text;
+ }
+ $this->Repeater2->DataSource=$links;
+ $this->Repeater2->dataBind();
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample5.php b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample5.php
index 60beb30e..de6e5bd9 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample5.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRepeater/Sample5.php
@@ -1,52 +1,52 @@
-<?php
-
-class Sample5 extends TPage
-{
- protected function getData()
- {
- return array(
- array(
- 'name'=>'North',
- 'detail'=>array(
- array('name'=>'John','age'=>30,'position'=>'Program Manager'),
- array('name'=>'Edward','age'=>35,'position'=>'Developer'),
- array('name'=>'Walter','age'=>28,'position'=>'Developer'),
- ),
- ),
- array(
- 'name'=>'West',
- 'detail'=>array(
- array('name'=>'Cary','age'=>31,'position'=>'Senior Manager'),
- array('name'=>'Ted','age'=>25,'position'=>'Developer'),
- array('name'=>'Kevin','age'=>28,'position'=>'Developer'),
- ),
- ),
- array(
- 'name'=>'East',
- 'detail'=>array(
- array('name'=>'Shawn','age'=>30,'position'=>'Sales Manager'),
- array('name'=>'Larry','age'=>28,'position'=>'Document Writer'),
- ),
- ),
- array(
- 'name'=>'South',
- 'detail'=>array(
- array('name'=>'King','age'=>30,'position'=>'Program Manager'),
- array('name'=>'Carter','age'=>22,'position'=>'Developer'),
- ),
- ),
- );
- }
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- if(!$this->IsPostBack)
- {
- $this->Repeater->DataSource=$this->getData();
- $this->Repeater->dataBind();
- }
- }
-}
-
+<?php
+
+class Sample5 extends TPage
+{
+ protected function getData()
+ {
+ return array(
+ array(
+ 'name'=>'North',
+ 'detail'=>array(
+ array('name'=>'John','age'=>30,'position'=>'Program Manager'),
+ array('name'=>'Edward','age'=>35,'position'=>'Developer'),
+ array('name'=>'Walter','age'=>28,'position'=>'Developer'),
+ ),
+ ),
+ array(
+ 'name'=>'West',
+ 'detail'=>array(
+ array('name'=>'Cary','age'=>31,'position'=>'Senior Manager'),
+ array('name'=>'Ted','age'=>25,'position'=>'Developer'),
+ array('name'=>'Kevin','age'=>28,'position'=>'Developer'),
+ ),
+ ),
+ array(
+ 'name'=>'East',
+ 'detail'=>array(
+ array('name'=>'Shawn','age'=>30,'position'=>'Sales Manager'),
+ array('name'=>'Larry','age'=>28,'position'=>'Document Writer'),
+ ),
+ ),
+ array(
+ 'name'=>'South',
+ 'detail'=>array(
+ array('name'=>'King','age'=>30,'position'=>'Program Manager'),
+ array('name'=>'Carter','age'=>22,'position'=>'Developer'),
+ ),
+ ),
+ );
+ }
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack)
+ {
+ $this->Repeater->DataSource=$this->getData();
+ $this->Repeater->dataBind();
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TRequiredFieldValidator/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TRequiredFieldValidator/Home.php
index 88d2dbf2..1c5efbcf 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TRequiredFieldValidator/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TRequiredFieldValidator/Home.php
@@ -1,8 +1,8 @@
-<?php
-
-class Home extends TPage
-{
-
-}
-
+<?php
+
+class Home extends TPage
+{
+
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.php
index c1c8a711..228fd727 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TSlider/Home.php
@@ -1,9 +1,9 @@
<?php
class Home extends TPage
-{
- public function onInit ($param)
- {
- parent::onInit($param);
+{
+ public function onInit ($param)
+ {
+ parent::onInit($param);
}
public function submit1 ($sender, $param)
{
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TTabPanel/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TTabPanel/Home.php
index badbca73..b03361b8 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TTabPanel/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TTabPanel/Home.php
@@ -1,7 +1,7 @@
-<?php
-
-class Home extends TPage
-{
-}
-
+<?php
+
+class Home extends TPage
+{
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TTable/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TTable/Home.php
index fa5efe38..505a6ded 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TTable/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TTable/Home.php
@@ -1,33 +1,33 @@
-<?php
-
-class Home extends TPage
-{
- public function onLoad($param)
- {
- $this->Table->GridLines='Both';
-
- $row=new TTableRow;
- $this->Table->Rows[]=$row;
-
- $cell=new TTableHeaderCell;
- $cell->Text='Header 1';
- $row->Cells[]=$cell;
-
- $cell=new TTableHeaderCell;
- $cell->Text='Header 2';
- $row->Cells[]=$cell;
-
- $row=new TTableRow;
- $this->Table->Rows[]=$row;
-
- $cell=new TTableCell;
- $cell->Text='Cell 1';
- $row->Cells[]=$cell;
-
- $cell=new TTableCell;
- $cell->Text='Cell 2';
- $row->Cells[]=$cell;
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function onLoad($param)
+ {
+ $this->Table->GridLines='Both';
+
+ $row=new TTableRow;
+ $this->Table->Rows[]=$row;
+
+ $cell=new TTableHeaderCell;
+ $cell->Text='Header 1';
+ $row->Cells[]=$cell;
+
+ $cell=new TTableHeaderCell;
+ $cell->Text='Header 2';
+ $row->Cells[]=$cell;
+
+ $row=new TTableRow;
+ $this->Table->Rows[]=$row;
+
+ $cell=new TTableCell;
+ $cell->Text='Cell 1';
+ $row->Cells[]=$cell;
+
+ $cell=new TTableCell;
+ $cell->Text='Cell 2';
+ $row->Cells[]=$cell;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TTextBox/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TTextBox/Home.php
index f8aa0825..2ac0cb3f 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TTextBox/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TTextBox/Home.php
@@ -1,22 +1,22 @@
-<?php
-
-class Home extends TPage
-{
- public function onLoad($param)
- {
- parent::onLoad($param);
- $this->Output->dataBind();
- }
-
- public function textChanged($sender,$param)
- {
- $sender->Text="text changed";
- }
-
- public function submitText($sender,$param)
- {
- $this->TextBox1->Text="You just entered '".$this->TextBox1->Text."'.";
- }
-}
-
+<?php
+
+class Home extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ $this->Output->dataBind();
+ }
+
+ public function textChanged($sender,$param)
+ {
+ $sender->Text="text changed";
+ }
+
+ public function submitText($sender,$param)
+ {
+ $this->TextBox1->Text="You just entered '".$this->TextBox1->Text."'.";
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TValidationSummary/Home.php b/demos/quickstart/protected/pages/Controls/Samples/TValidationSummary/Home.php
index 88d2dbf2..1c5efbcf 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TValidationSummary/Home.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TValidationSummary/Home.php
@@ -1,8 +1,8 @@
-<?php
-
-class Home extends TPage
-{
-
-}
-
+<?php
+
+class Home extends TPage
+{
+
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample1.php b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample1.php
index 20440e62..5d9bcb1d 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample1.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample1.php
@@ -1,11 +1,11 @@
-<?php
-
-class Sample1 extends TPage
-{
- public function wizardCompleted($sender,$param)
- {
- $this->Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue;
- }
-}
-
+<?php
+
+class Sample1 extends TPage
+{
+ public function wizardCompleted($sender,$param)
+ {
+ $this->Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.php b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.php
index a508fbf3..61572075 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample2.php
@@ -1,11 +1,11 @@
-<?php
-
-class Sample2 extends TPage
-{
- public function wizardCompleted($sender,$param)
- {
- $this->Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue;
- }
-}
-
+<?php
+
+class Sample2 extends TPage
+{
+ public function wizardCompleted($sender,$param)
+ {
+ $this->Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample3.php b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample3.php
index d85d041a..6e767cd4 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample3.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample3.php
@@ -1,25 +1,25 @@
-<?php
-
-class Sample3 extends TPage
-{
- public function wizard3Completed($sender,$param)
- {
- if($this->StudentCheckBox->Checked)
- {
- $str="You are a college student.<br/>";
- $str.="You are in major: ".$this->DropDownList11->SelectedValue."<br/>";
- $str.="Your favorite sport is: ".$this->DropDownList22->SelectedValue;
- }
- else
- $str="Your favorite sport is: ".$this->DropDownList22->SelectedValue;
- $this->Wizard3Result->Text=$str;
- }
-
- public function wizard3NextStep($sender,$param)
- {
- if($param->CurrentStepIndex===0 && !$this->StudentCheckBox->Checked)
- $this->Wizard3->ActiveStepIndex=2;
- }
-}
-
+<?php
+
+class Sample3 extends TPage
+{
+ public function wizard3Completed($sender,$param)
+ {
+ if($this->StudentCheckBox->Checked)
+ {
+ $str="You are a college student.<br/>";
+ $str.="You are in major: ".$this->DropDownList11->SelectedValue."<br/>";
+ $str.="Your favorite sport is: ".$this->DropDownList22->SelectedValue;
+ }
+ else
+ $str="Your favorite sport is: ".$this->DropDownList22->SelectedValue;
+ $this->Wizard3Result->Text=$str;
+ }
+
+ public function wizard3NextStep($sender,$param)
+ {
+ if($param->CurrentStepIndex===0 && !$this->StudentCheckBox->Checked)
+ $this->Wizard3->ActiveStepIndex=2;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample4.php b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample4.php
index 6b79698d..c7317654 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample4.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample4.php
@@ -1,11 +1,11 @@
-<?php
-
-class Sample4 extends TPage
-{
- public function wizardCompleted($sender,$param)
- {
- $this->Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue;
- }
-}
-
+<?php
+
+class Sample4 extends TPage
+{
+ public function wizardCompleted($sender,$param)
+ {
+ $this->Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample5.php b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample5.php
index 4ab6d08b..4fb64395 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample5.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TWizard/Sample5.php
@@ -1,12 +1,12 @@
-<?php
-
-class Sample5 extends TPage
-{
- public function wizardCompleted($sender,$param)
- {
- $this->Result1->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue;
- $this->Result2->Text="Your favorite sport is: " . $this->Step2->DropDownList2->SelectedValue;
- }
-}
-
+<?php
+
+class Sample5 extends TPage
+{
+ public function wizardCompleted($sender,$param)
+ {
+ $this->Result1->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue;
+ $this->Result2->Text="Your favorite sport is: " . $this->Step2->DropDownList2->SelectedValue;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Database/Samples/Scaffold/Home.php b/demos/quickstart/protected/pages/Database/Samples/Scaffold/Home.php
index 45d72f1f..4801baed 100644
--- a/demos/quickstart/protected/pages/Database/Samples/Scaffold/Home.php
+++ b/demos/quickstart/protected/pages/Database/Samples/Scaffold/Home.php
@@ -1,33 +1,33 @@
-<?php
-
-Prado::using('System.Data.ActiveRecord.TActiveRecord');
-Prado::using('System.Data.ActiveRecord.Scaffold.TScaffoldView');
-
-class AddressRecord extends TActiveRecord
-{
- const TABLE='addresses';
-
- public $id;
- public $username;
- public $phone;
-
- //for demo, we use static db here
- //otherwise we should use TActiveRecordConfig in application.xml
- private static $_db;
- public function getDbConnection()
- {
- if(self::$_db===null)
- {
- $file = dirname(__FILE__).'/sqlite.db';
- self::$_db = new TDbConnection("sqlite:{$file}");
- }
- return self::$_db;
- }
-}
-
-class Home extends TPage
-{
-
-}
-
+<?php
+
+Prado::using('System.Data.ActiveRecord.TActiveRecord');
+Prado::using('System.Data.ActiveRecord.Scaffold.TScaffoldView');
+
+class AddressRecord extends TActiveRecord
+{
+ const TABLE='addresses';
+
+ public $id;
+ public $username;
+ public $phone;
+
+ //for demo, we use static db here
+ //otherwise we should use TActiveRecordConfig in application.xml
+ private static $_db;
+ public function getDbConnection()
+ {
+ if(self::$_db===null)
+ {
+ $file = dirname(__FILE__).'/sqlite.db';
+ self::$_db = new TDbConnection("sqlite:{$file}");
+ }
+ return self::$_db;
+ }
+}
+
+class Home extends TPage
+{
+
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php b/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php
index 711600aa..6aff0859 100644
--- a/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php
+++ b/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php
@@ -1,121 +1,121 @@
-<?php
-class Home extends TPage
-{
- public function onLoad($param)
- {
- if (!$this->IsPostBack)
- $this->GameMultiView->ActiveView=$this->IntroView;
- }
-
- public function selectLevel($sender,$param)
- {
- if(($selection=$this->LevelSelection->SelectedValue)==='')
- {
- $this->LevelError->Visible=true;
- return;
- }
- else
- $this->Level=TPropertyValue::ensureInteger($selection);
- $this->Word=$this->generateWord();
- $this->GuessWord=str_repeat('_',strlen($this->Word));
- $this->Misses=0;
- $this->GameMultiView->ActiveView=$this->GuessView;
- }
-
- public function guessWord($sender,$param)
- {
- $sender->Enabled=false;
- $letter=$sender->Text;
- $word=$this->Word;
- $guessWord=$this->GuessWord;
- $pos=0;
- $success=false;
- while(($pos=strpos($word,$letter,$pos))!==false)
- {
- $guessWord[$pos]=$letter;
- $success=true;
- $pos++;
- }
- if($success)
- {
- $this->GuessWord=$guessWord;
- if($guessWord===$word)
- $this->GameMultiView->ActiveView=$this->WinView;
- }
- else
- {
- $this->Misses++;
- if($this->Misses>=$this->Level)
- $this->giveUp(null,null);
- }
- }
-
- public function giveUp($sender,$param)
- {
- $this->GameMultiView->ActiveView=$this->LoseView;
- }
-
- public function startAgain($sender,$param)
- {
- $this->GameMultiView->ActiveView=$this->IntroView;
- $this->LevelError->Visible=false;
- for($letter=65;$letter<=90;++$letter)
- {
- $guessLetter='Guess'.chr($letter);
- $this->$guessLetter->Enabled=true;
- }
- }
-
- protected function generateWord()
- {
- $wordFile=dirname(__FILE__).'/words.txt';
- $words=preg_split("/[\s,]+/",file_get_contents($wordFile));
- do
- {
- $i=rand(0,count($words)-1);
- $word=$words[$i];
- } while(strlen($word)<5 || !preg_match('/^[a-z]*$/i',$word));
- return strtoupper($word);
- }
-
- public function setLevel($value)
- {
- $this->setViewState('Level',$value,0);
- }
-
- public function getLevel()
- {
- return $this->getViewState('Level',0);
- }
-
- public function setWord($value)
- {
- $this->setViewState('Word',$value,'');
- }
-
- public function getWord()
- {
- return $this->getViewState('Word','');
- }
-
- public function getGuessWord()
- {
- return $this->getViewState('GuessWord','');
- }
-
- public function setGuessWord($value)
- {
- $this->setViewState('GuessWord',$value,'');
- }
-
- public function setMisses($value)
- {
- $this->setViewState('Misses',$value,0);
- }
-
- public function getMisses()
- {
- return $this->getViewState('Misses',0);
- }
-}
+<?php
+class Home extends TPage
+{
+ public function onLoad($param)
+ {
+ if (!$this->IsPostBack)
+ $this->GameMultiView->ActiveView=$this->IntroView;
+ }
+
+ public function selectLevel($sender,$param)
+ {
+ if(($selection=$this->LevelSelection->SelectedValue)==='')
+ {
+ $this->LevelError->Visible=true;
+ return;
+ }
+ else
+ $this->Level=TPropertyValue::ensureInteger($selection);
+ $this->Word=$this->generateWord();
+ $this->GuessWord=str_repeat('_',strlen($this->Word));
+ $this->Misses=0;
+ $this->GameMultiView->ActiveView=$this->GuessView;
+ }
+
+ public function guessWord($sender,$param)
+ {
+ $sender->Enabled=false;
+ $letter=$sender->Text;
+ $word=$this->Word;
+ $guessWord=$this->GuessWord;
+ $pos=0;
+ $success=false;
+ while(($pos=strpos($word,$letter,$pos))!==false)
+ {
+ $guessWord[$pos]=$letter;
+ $success=true;
+ $pos++;
+ }
+ if($success)
+ {
+ $this->GuessWord=$guessWord;
+ if($guessWord===$word)
+ $this->GameMultiView->ActiveView=$this->WinView;
+ }
+ else
+ {
+ $this->Misses++;
+ if($this->Misses>=$this->Level)
+ $this->giveUp(null,null);
+ }
+ }
+
+ public function giveUp($sender,$param)
+ {
+ $this->GameMultiView->ActiveView=$this->LoseView;
+ }
+
+ public function startAgain($sender,$param)
+ {
+ $this->GameMultiView->ActiveView=$this->IntroView;
+ $this->LevelError->Visible=false;
+ for($letter=65;$letter<=90;++$letter)
+ {
+ $guessLetter='Guess'.chr($letter);
+ $this->$guessLetter->Enabled=true;
+ }
+ }
+
+ protected function generateWord()
+ {
+ $wordFile=dirname(__FILE__).'/words.txt';
+ $words=preg_split("/[\s,]+/",file_get_contents($wordFile));
+ do
+ {
+ $i=rand(0,count($words)-1);
+ $word=$words[$i];
+ } while(strlen($word)<5 || !preg_match('/^[a-z]*$/i',$word));
+ return strtoupper($word);
+ }
+
+ public function setLevel($value)
+ {
+ $this->setViewState('Level',$value,0);
+ }
+
+ public function getLevel()
+ {
+ return $this->getViewState('Level',0);
+ }
+
+ public function setWord($value)
+ {
+ $this->setViewState('Word',$value,'');
+ }
+
+ public function getWord()
+ {
+ return $this->getViewState('Word','');
+ }
+
+ public function getGuessWord()
+ {
+ return $this->getViewState('GuessWord','');
+ }
+
+ public function setGuessWord($value)
+ {
+ $this->setViewState('GuessWord',$value,'');
+ }
+
+ public function setMisses($value)
+ {
+ $this->setViewState('Misses',$value,0);
+ }
+
+ public function getMisses()
+ {
+ return $this->getViewState('Misses',0);
+ }
+}
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/Search.php b/demos/quickstart/protected/pages/Search.php
index d2dfa7da..c36eba54 100644
--- a/demos/quickstart/protected/pages/Search.php
+++ b/demos/quickstart/protected/pages/Search.php
@@ -1,56 +1,56 @@
-<?php
-/*
- * Created on 7/05/2006
- */
-
-class Search extends TPage
-{
- public function onLoad($param)
- {
- if(!$this->IsPostBack && strlen($text = $this->search->getText()) > 0)
- {
- $quickstart = $this->getApplication()->getModule("quickstart_search");
- $hits_1 = $quickstart->find($text);
- $this->quickstart_results->setDataSource($hits_1);
- $this->quickstart_results->dataBind();
-
- $this->emptyResult->setVisible(!count($hits_1));
- }
- }
-
- public function highlightSearch($text)
- {
- $words = str_word_count($text, 1);
- $keys = str_word_count(strtolower($this->search->getText()),1);
- $where = 0;
- $t = count($words);
- for($i = 0; $i<$t; $i++)
- {
- if($this->containsKeys(strtolower($words[$i]), $keys))
- {
- $words[$i] = '<span class="searchterm">'.$words[$i].'</span>';
- $where = $i;
- break;
- }
- }
-
- $min = $where - 15 < 0 ? 0 : $where - 15;
- $max = $where + 15 > $t ? $t : $where + 15;
- $subtext = array_splice($words, $min, $max-$min);
- $prefix = $min == 0 ? '' : '...';
- $suffix = $max == $t ? '' : '...';
- return $prefix.implode(' ', $subtext).$suffix;
- }
-
- protected function containsKeys($word, $keys)
- {
- foreach($keys as $key)
- {
- if(is_int(strpos($word, $key)))
- return true;
- }
- return false;
- }
-}
-
+<?php
+/*
+ * Created on 7/05/2006
+ */
+
+class Search extends TPage
+{
+ public function onLoad($param)
+ {
+ if(!$this->IsPostBack && strlen($text = $this->search->getText()) > 0)
+ {
+ $quickstart = $this->getApplication()->getModule("quickstart_search");
+ $hits_1 = $quickstart->find($text);
+ $this->quickstart_results->setDataSource($hits_1);
+ $this->quickstart_results->dataBind();
+
+ $this->emptyResult->setVisible(!count($hits_1));
+ }
+ }
+
+ public function highlightSearch($text)
+ {
+ $words = str_word_count($text, 1);
+ $keys = str_word_count(strtolower($this->search->getText()),1);
+ $where = 0;
+ $t = count($words);
+ for($i = 0; $i<$t; $i++)
+ {
+ if($this->containsKeys(strtolower($words[$i]), $keys))
+ {
+ $words[$i] = '<span class="searchterm">'.$words[$i].'</span>';
+ $where = $i;
+ break;
+ }
+ }
+
+ $min = $where - 15 < 0 ? 0 : $where - 15;
+ $max = $where + 15 > $t ? $t : $where + 15;
+ $subtext = array_splice($words, $min, $max-$min);
+ $prefix = $min == 0 ? '' : '...';
+ $suffix = $max == $t ? '' : '...';
+ return $prefix.implode(' ', $subtext).$suffix;
+ }
+
+ protected function containsKeys($word, $keys)
+ {
+ foreach($keys as $key)
+ {
+ if(is_int(strpos($word, $key)))
+ return true;
+ }
+ return false;
+ }
+}
+
?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ViewSource.php b/demos/quickstart/protected/pages/ViewSource.php
index f267f318..2bbcf097 100644
--- a/demos/quickstart/protected/pages/ViewSource.php
+++ b/demos/quickstart/protected/pages/ViewSource.php
@@ -1,112 +1,112 @@
-<?php
-
-class ViewSource extends TPage
-{
- private $_path=null;
- private $_fullPath=null;
- private $_fileType=null;
-
- public function onLoad($param)
- {
- parent::onLoad($param);
- $path=$this->Request['path'];
- $fullPath=realpath($this->Service->BasePath.'/'.$path);
- $fileExt=$this->getFileExtension($fullPath);
- if($fullPath!==false && is_file($fullPath) && strpos($fullPath,$this->Service->BasePath)!==false)
- {
- if($this->isFileTypeAllowed($fileExt))
- {
- $this->_fullPath=strtr($fullPath,'\\','/');
- $this->_path=strtr(substr($fullPath,strlen($this->Service->BasePath)),'\\','/');
- }
- }
- if($this->_fullPath===null)
- throw new THttpException(500,'File Not Found: %s',$path);
-
- $this->SourceList->DataSource=$this->SourceFiles;
- $this->SourceList->dataBind();
-
- $this->Highlighter->Language=$this->getFileLanguage($fileExt);
- if($this->Request['lines']==='false')
- $this->Highlighter->ShowLineNumbers=false;
- $this->SourceView->Text=file_get_contents($this->_fullPath);
- }
-
- public function getFilePath()
- {
- return $this->_path;
- }
-
- protected function getSourceFiles()
- {
- $list=array();
- $basePath=dirname($this->_fullPath);
- if($dh=opendir($basePath))
- {
- while(($file=readdir($dh))!==false)
- {
- if(is_file($basePath.'/'.$file))
- {
- $extension=$this->getFileExtension($basePath.'/'.$file);
- if($this->isFileTypeAllowed($extension))
- {
- $fileType=$this->getFileType($extension);
- $list[]=array(
- 'name'=>$file,
- 'type'=>$fileType,
- 'active'=>basename($this->_fullPath)===$file,
- 'url'=>'?page=ViewSource&amp;path=/'.ltrim(strtr(dirname($this->_path),'\\','/').'/'.$file,'/')
- );
- }
- }
-
- }
- closedir($dh);
- }
- foreach($list as $item)
- $aux[]=$item['name'];
- array_multisort($aux, SORT_ASC, $list);
- return $list;
- }
-
- protected function isFileTypeAllowed($extension)
- {
- return in_array($extension,array('tpl','page','php','html'));
- }
-
- protected function getFileExtension($fileName)
- {
- if(($pos=strrpos($fileName,'.'))===false)
- return '';
- else
- return substr($fileName,$pos+1);
- }
-
- protected function getFileType($extension)
- {
- if($extension==='tpl' || $extension==='page')
- return 'Template file';
- else
- return 'Class file';
- }
-
- protected function getFileLanguage($extension)
- {
- switch($extension)
- {
- case 'page' :
- case 'tpl' :
- return 'prado';
- case 'php' :
- return 'php';
- break;
- case 'xml' :
- return 'xml';
- break;
- default :
- return 'html';
- }
- }
-}
-
+<?php
+
+class ViewSource extends TPage
+{
+ private $_path=null;
+ private $_fullPath=null;
+ private $_fileType=null;
+
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ $path=$this->Request['path'];
+ $fullPath=realpath($this->Service->BasePath.'/'.$path);
+ $fileExt=$this->getFileExtension($fullPath);
+ if($fullPath!==false && is_file($fullPath) && strpos($fullPath,$this->Service->BasePath)!==false)
+ {
+ if($this->isFileTypeAllowed($fileExt))
+ {
+ $this->_fullPath=strtr($fullPath,'\\','/');
+ $this->_path=strtr(substr($fullPath,strlen($this->Service->BasePath)),'\\','/');
+ }
+ }
+ if($this->_fullPath===null)
+ throw new THttpException(500,'File Not Found: %s',$path);
+
+ $this->SourceList->DataSource=$this->SourceFiles;
+ $this->SourceList->dataBind();
+
+ $this->Highlighter->Language=$this->getFileLanguage($fileExt);
+ if($this->Request['lines']==='false')
+ $this->Highlighter->ShowLineNumbers=false;
+ $this->SourceView->Text=file_get_contents($this->_fullPath);
+ }
+
+ public function getFilePath()
+ {
+ return $this->_path;
+ }
+
+ protected function getSourceFiles()
+ {
+ $list=array();
+ $basePath=dirname($this->_fullPath);
+ if($dh=opendir($basePath))
+ {
+ while(($file=readdir($dh))!==false)
+ {
+ if(is_file($basePath.'/'.$file))
+ {
+ $extension=$this->getFileExtension($basePath.'/'.$file);
+ if($this->isFileTypeAllowed($extension))
+ {
+ $fileType=$this->getFileType($extension);
+ $list[]=array(
+ 'name'=>$file,
+ 'type'=>$fileType,
+ 'active'=>basename($this->_fullPath)===$file,
+ 'url'=>'?page=ViewSource&amp;path=/'.ltrim(strtr(dirname($this->_path),'\\','/').'/'.$file,'/')
+ );
+ }
+ }
+
+ }
+ closedir($dh);
+ }
+ foreach($list as $item)
+ $aux[]=$item['name'];
+ array_multisort($aux, SORT_ASC, $list);
+ return $list;
+ }
+
+ protected function isFileTypeAllowed($extension)
+ {
+ return in_array($extension,array('tpl','page','php','html'));
+ }
+
+ protected function getFileExtension($fileName)
+ {
+ if(($pos=strrpos($fileName,'.'))===false)
+ return '';
+ else
+ return substr($fileName,$pos+1);
+ }
+
+ protected function getFileType($extension)
+ {
+ if($extension==='tpl' || $extension==='page')
+ return 'Template file';
+ else
+ return 'Class file';
+ }
+
+ protected function getFileLanguage($extension)
+ {
+ switch($extension)
+ {
+ case 'page' :
+ case 'tpl' :
+ return 'prado';
+ case 'php' :
+ return 'php';
+ break;
+ case 'xml' :
+ return 'xml';
+ break;
+ default :
+ return 'html';
+ }
+ }
+}
+
?> \ No newline at end of file