From 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 Mon Sep 17 00:00:00 2001 From: ctrlaltca <> Date: Thu, 12 Jul 2012 11:21:01 +0000 Subject: standardize the use of unix eol; use svn properties to enforce native eol --- demos/quickstart/index.php | 34 +- demos/quickstart/index2.php | 34 +- .../protected/QuickStartGlobalization.php | 60 +-- .../protected/controls/Comments/CommentBlock.php | 212 +++++------ .../protected/controls/Comments/comments.js | 412 ++++++++++----------- demos/quickstart/protected/controls/DocLink.php | 60 +-- demos/quickstart/protected/controls/Layout.php | 94 ++--- .../protected/controls/RequiresVersion.php | 30 +- demos/quickstart/protected/controls/RunBar.php | 44 +-- .../quickstart/protected/controls/SampleLayout.php | 24 +- demos/quickstart/protected/controls/SearchBox.php | 80 ++-- .../quickstart/protected/controls/SinceVersion.php | 30 +- demos/quickstart/protected/controls/TopicList.php | 14 +- demos/quickstart/protected/index/ZendSearch.php | 108 +++--- .../ActiveControls/Samples/TActiveButton/Home.php | 38 +- .../Samples/TActiveCheckBox/Home.php | 30 +- .../Samples/TActiveCheckBoxList/Home.php | 50 +-- .../Samples/TActiveCustomValidator/Home.php | 20 +- .../Samples/TActiveDataGrid/Sample1.php | 72 ++-- .../Samples/TActiveDataGrid/Sample2.php | 170 ++++----- .../Samples/TActiveDataGrid/Sample3.php | 378 +++++++++---------- .../Samples/TActiveDataGrid/Sample4.php | 40 +- .../Samples/TActiveDataGrid/Sample5.php | 156 ++++---- .../Samples/TActiveDataList/Home.php | 262 ++++++------- .../Samples/TActiveDropDownList/Home.php | 118 +++--- .../Samples/TActiveFileUpload/Home.php | 40 +- .../Samples/TActiveHyperLink/Home.php | 50 +-- .../ActiveControls/Samples/TActiveImage/Home.php | 32 +- .../Samples/TActiveImageButton/Home.php | 34 +- .../Samples/TActiveLinkButton/Home.php | 26 +- .../ActiveControls/Samples/TActiveListBox/Home.php | 128 +++---- .../Samples/TActiveMultiView/Home.php | 28 +- .../ActiveControls/Samples/TActivePanel/Home.php | 40 +- .../Samples/TActiveRadioButton/Home.php | 52 +-- .../Samples/TActiveRadioButtonList/Home.php | 50 +-- .../Samples/TActiveRepeater/Home.php | 156 ++++---- .../Samples/TActiveTableRow/Home.php | 42 +-- .../ActiveControls/Samples/TAutoComplete/Home.php | 68 ++-- .../Samples/TCallbackClientScript/Home.php | 56 +-- .../Samples/TCallbackClientSide/Home.php | 22 +- .../Samples/TCallbackOptions/Home.php | 22 +- .../protected/pages/Advanced/Samples/I18N/Home.php | 88 ++--- .../pages/Advanced/Samples/I18N/LanguageList.php | 36 +- .../Controls/Samples/LabeledTextBox1/Home.php | 24 +- .../Samples/LabeledTextBox1/LabeledTextBox.php | 34 +- .../Controls/Samples/LabeledTextBox2/Home.php | 24 +- .../Samples/LabeledTextBox2/LabeledTextBox.php | 64 ++-- .../Controls/Samples/ResetValidation/Home.php | 14 +- .../pages/Controls/Samples/TAccordion/Home.php | 32 +- .../pages/Controls/Samples/TBulletedList/Home.php | 22 +- .../pages/Controls/Samples/TButton/Home.php | 26 +- .../pages/Controls/Samples/TCaptcha/Home.php | 52 +-- .../pages/Controls/Samples/TCheckBox/Home.php | 20 +- .../pages/Controls/Samples/TCheckBoxList/Home.php | 138 +++---- .../Controls/Samples/TClientSideValidator/Home.php | 32 +- .../Controls/Samples/TCompareValidator/Home.php | 14 +- .../pages/Controls/Samples/TConditional/Home.php | 12 +- .../Controls/Samples/TCustomValidator/Home.php | 34 +- .../pages/Controls/Samples/TDataGrid/Sample1.php | 80 ++-- .../pages/Controls/Samples/TDataGrid/Sample2.php | 170 ++++----- .../pages/Controls/Samples/TDataGrid/Sample3.php | 378 +++++++++---------- .../pages/Controls/Samples/TDataGrid/Sample4.php | 40 +- .../pages/Controls/Samples/TDataGrid/Sample5.php | 134 +++---- .../pages/Controls/Samples/TDataGrid/Sample6.php | 110 +++--- .../pages/Controls/Samples/TDataList/Sample1.php | 80 ++-- .../pages/Controls/Samples/TDataList/Sample2.php | 262 ++++++------- .../Controls/Samples/TDataTypeValidator/Home.php | 14 +- .../pages/Controls/Samples/TDropDownList/Home.php | 136 +++---- .../Samples/TEmailAddressValidator/Home.php | 14 +- .../pages/Controls/Samples/TFileUpload/Home.php | 40 +- .../pages/Controls/Samples/THtmlArea/Home.php | 40 +- .../pages/Controls/Samples/TImageButton/Home.php | 34 +- .../pages/Controls/Samples/TImageMap/Home.php | 20 +- .../pages/Controls/Samples/TKeyboard/Home.php | 20 +- .../pages/Controls/Samples/TLinkButton/Home.php | 26 +- .../pages/Controls/Samples/TListBox/Home.php | 156 ++++---- .../pages/Controls/Samples/TMultiView/Home.php | 28 +- .../pages/Controls/Samples/TPager/Sample1.php | 162 ++++---- .../pages/Controls/Samples/TPanel/Home.php | 20 +- .../pages/Controls/Samples/TPlaceHolder/Home.php | 30 +- .../pages/Controls/Samples/TRadioButton/Home.php | 52 +-- .../Controls/Samples/TRadioButtonList/Home.php | 136 +++---- .../Controls/Samples/TRangeValidator/Home.php | 14 +- .../Samples/TRegularExpressionValidator/Home.php | 14 +- .../Controls/Samples/TRepeater/RegionDisplay.php | 54 +-- .../pages/Controls/Samples/TRepeater/Sample1.php | 80 ++-- .../pages/Controls/Samples/TRepeater/Sample2.php | 156 ++++---- .../pages/Controls/Samples/TRepeater/Sample3.php | 156 ++++---- .../pages/Controls/Samples/TRepeater/Sample4.php | 72 ++-- .../pages/Controls/Samples/TRepeater/Sample5.php | 102 ++--- .../Samples/TRequiredFieldValidator/Home.php | 14 +- .../pages/Controls/Samples/TSlider/Home.php | 8 +- .../pages/Controls/Samples/TTabPanel/Home.php | 12 +- .../pages/Controls/Samples/TTable/Home.php | 64 ++-- .../pages/Controls/Samples/TTextBox/Home.php | 42 +-- .../Controls/Samples/TValidationSummary/Home.php | 14 +- .../pages/Controls/Samples/TWizard/Sample1.php | 20 +- .../pages/Controls/Samples/TWizard/Sample2.php | 20 +- .../pages/Controls/Samples/TWizard/Sample3.php | 48 +-- .../pages/Controls/Samples/TWizard/Sample4.php | 20 +- .../pages/Controls/Samples/TWizard/Sample5.php | 22 +- .../pages/Database/Samples/Scaffold/Home.php | 64 ++-- .../pages/Fundamentals/Samples/Hangman/Home.php | 240 ++++++------ demos/quickstart/protected/pages/Search.php | 110 +++--- demos/quickstart/protected/pages/ViewSource.php | 222 +++++------ 105 files changed, 3916 insertions(+), 3916 deletions(-) (limited to 'demos/quickstart') diff --git a/demos/quickstart/index.php b/demos/quickstart/index.php index 43c0b436..6efff1af 100644 --- a/demos/quickstart/index.php +++ b/demos/quickstart/index.php @@ -1,18 +1,18 @@ -run(); - +run(); + ?> \ No newline at end of file diff --git a/demos/quickstart/index2.php b/demos/quickstart/index2.php index f3d8dd90..30df9480 100644 --- a/demos/quickstart/index2.php +++ b/demos/quickstart/index2.php @@ -1,18 +1,18 @@ -run(); - +run(); + ?> \ No newline at end of file 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 @@ -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); - } - } - } -} - +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 @@ -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 << - {$username} on {$record->date_added}. -
{$content}
- -EOD; - } +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 << + {$username} on {$record->date_added}. +
{$content}
+ +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 = "
"+comments+"
 
"; - 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 = "
"+comments+"
 
"; + 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 @@ -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'); - } - } -} - +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 @@ -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.='&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"; - } - } -} - +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.='&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 @@ -setViewState('Version',$value); - } - - public function getVersion() - { - return $this->getViewState('Version'); - } -} - +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 @@ -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'; - } -} - +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 @@ -Request['notheme'])) - $this->Service->RequestedPage->EnableTheming=false; - parent::__construct(); - } -} - +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 @@ -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); - } - } -} - +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 @@ -setViewState('Version',$value); - } - - public function getVersion() - { - return $this->getViewState('Version'); - } -} - +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 @@ - \ 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 @@ -_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)); - } -} - +_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 @@ -Text="Name: {$param->CommandName}, Param: {$param->CommandParameter}"; - else - $sender->Text="I'm clicked"; - } - - public function buttonCallback($sender, $param) - { - $sender->Text .= ' using callback'; - } -} - +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 @@ -Text= $sender->ClientID . " clicked"; - } - - public function checkboxCallback($sender, $param) - { - $sender->Text .= ' using callback'; - } -} - +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 @@ -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); - } -} - +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 @@ -IsValid = $this->textbox1->Text == 'Prado'; - } -} - +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 @@ -'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(); - } -} - +'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 @@ -'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(); - } -} - +'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 @@ -_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(); - } -} - +_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 @@ - $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(); - } -} - + $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 @@ -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(); - } -} - +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 @@ -_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(); - } -} - +_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 @@ -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"; - } -} - +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 @@ -HasFile) - { - $this->Result->Text=" - You just uploaded a file: -
- Name: {$sender->FileName} -
- Size: {$sender->FileSize} -
- Type: {$sender->FileType}"; - } - } -} - +HasFile) + { + $this->Result->Text=" + You just uploaded a file: +
+ Name: {$sender->FileName} +
+ Size: {$sender->FileSize} +
+ 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 @@ -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; - } -} +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 @@ -imageTest->ImageUrl=$this->publishAsset("hello_world.gif"); - } - - public function buttonClicked2($sender, $param) - { - $this->imageTest->ImageUrl=$this->publishAsset("hello_world2.gif"); - } -} - +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 @@ -Result2->Text="Callback parameter: $param->CallbackParameter"; - } - else - { - $this->Result->Text="You clicked at ($param->X,$param->Y)"; - } - } -} - +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 @@ -Text="Callback Parameter: {$param->CallbackParameter}"; - else - $sender->Text="I'm clicked"; - } -} - +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 @@ -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"; - } -} - +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 @@ -MultiView->ActiveViewIndex===2) - { - $this->Result1->Text="Your text input is: ".$this->Memo->Text; - $this->Result2->Text="Your color choice is: ".$this->DropDownList->SelectedValue; - } - } -} - +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 @@ -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); - } -} - +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 @@ -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; - } -} - +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 @@ -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); - } -} - +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 @@ -'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(); - } - } -} - +'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 @@ -Text .= "
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); - } -} - +Text .= "
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 @@ -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') - ); - } -} - -?> +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 @@ -radio1->SelectedValue) - { - case 1: - $this->getCallbackClient()->evaluateScript(""); - 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; - } - } -} - +radio1->SelectedValue) + { + case 1: + $this->getCallbackClient()->evaluateScript(""); + 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 @@ - \ 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 @@ - \ 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 @@ -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(); - } -} - +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 @@ - \ 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 @@ -Text=$this->Input->TextBox->Text; - } -} - +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 @@ -ensureChildControls(); - return $this->getRegisteredObject('Label'); - } - - public function getTextBox() - { - $this->ensureChildControls(); - return $this->getRegisteredObject('TextBox'); - } -} - +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 @@ -Text=$this->Input->TextBox->Text; - } -} - +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 @@ -_label=new TLabel; - $this->_label->setID('Label'); - $this->getControls()->add($this->_label); - $this->getControls()->add(' '); - $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; - } -} - +_label=new TLabel; + $this->_label->setID('Label'); + $this->getControls()->add($this->_label); + $this->getControls()->add(' '); + $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 @@ - \ 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 @@ -lab1->Text=""; - } - - public function executeTransaction($sender, $param) - { - $this->lab1->Text="executeTransaction ok"; - } -} - +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 @@ -Items[$param->Index]; - $this->Result->Text="You clicked $item->Text : $item->Value."; - } -} - +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 @@ -Text="Name: {$param->CommandName}, Param: {$param->CommandParameter}"; - else - $sender->Text="I'm clicked"; - } -} - +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 @@ -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!"; - } -} - +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 @@ -Text="I'm clicked"; - } -} - +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 @@ -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); - } - -} - +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 @@ -enabled = $this->check1->checked; - } - - function onPreRender($param) - { - //always re-enable the validator2 so as to display the client-side validator - $this->validator2->enabled=true; - } -} - +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 @@ - \ 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 @@ - \ 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 @@ -Value!=='test') - $param->IsValid=false; - } - - public function serverValidateNoControl($sender,$param) - { - if($this->TextBox4->Text!=='test') - $param->IsValid=false; - } -} - +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 @@ -'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(); - } - } -} - +'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 @@ -'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(); - } -} - +'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 @@ -_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(); - } -} - +_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 @@ - $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(); - } -} - + $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 @@ -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(); - } -} - +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 @@ -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(); - } -} - +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 @@ -'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(); - } - } -} - +'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 @@ -_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(); - } -} - +_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 @@ - \ 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 @@ -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); - } -} - +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 @@ - \ 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 @@ -HasFile) - { - $this->Result->Text=" - You just uploaded a file: -
- Name: {$sender->FileName} -
- Size: {$sender->FileSize} -
- Type: {$sender->FileType}"; - } - } -} - +HasFile) + { + $this->Result->Text=" + You just uploaded a file: +
+ Name: {$sender->FileName} +
+ Size: {$sender->FileSize} +
+ 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 @@ -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; - } -} - +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 @@ -Result2->Text="Command name: $param->CommandName, Command parameter: $param->CommandParameter"; - } - else - { - $this->Result->Text="You clicked at ($param->X,$param->Y)"; - } - } -} - +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 @@ -Result->Text="Your post value is : ".$param->PostBackValue; - } -} - +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 @@ -Result->Text='You have entered "'.$this->PasswordInput->Text.'".'; - } -} - +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 @@ -Text="Name: {$param->CommandName}, Param: {$param->CommandParameter}"; - else - $sender->Text="I'm clicked"; - } -} - +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 @@ -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); - } -} - +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 @@ -MultiView->ActiveViewIndex===2) - { - $this->Result1->Text="Your text input is: ".$this->Memo->Text; - $this->Result2->Text="Your color choice is: ".$this->DropDownList->SelectedValue; - } - } -} - +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 @@ -'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(); - } -} - +'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 @@ -Result->Text="You have clicked on '$sender->Text'."; - } -} - +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 @@ -Text='dynamic'; - $label->BackColor='silver'; - $this->PlaceHolder1->Controls[]=$label; - $this->PlaceHolder1->Controls[]=' content'; - } -} - +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 @@ -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; - } -} - +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 @@ -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); - } -} - +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 @@ - \ 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 @@ - \ 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 @@ -Data 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++; - } -} - +Data 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 @@ -'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(); - } - } -} - +'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 @@ -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++; - } - } -} - +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 @@ -'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(); - } - } -} - +'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 @@ -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(); - } -} - +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 @@ -'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(); - } - } -} - +'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 @@ - \ 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 @@ \ 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 @@ -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; - } -} - +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 @@ -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."'."; - } -} - +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 @@ - \ 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 @@ -Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue; - } -} - +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 @@ -Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue; - } -} - +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 @@ -StudentCheckBox->Checked) - { - $str="You are a college student.
"; - $str.="You are in major: ".$this->DropDownList11->SelectedValue."
"; - $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; - } -} - +StudentCheckBox->Checked) + { + $str="You are a college student.
"; + $str.="You are in major: ".$this->DropDownList11->SelectedValue."
"; + $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 @@ -Result->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue; - } -} - +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 @@ -Result1->Text="Your favorite color is: " . $this->DropDownList1->SelectedValue; - $this->Result2->Text="Your favorite sport is: " . $this->Step2->DropDownList2->SelectedValue; - } -} - +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 @@ - \ 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 @@ -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); - } -} +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 @@ -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] = ''.$words[$i].''; - $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; - } -} - +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] = ''.$words[$i].''; + $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 @@ -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&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'; - } - } -} - +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&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 -- cgit v1.2.3