@@ -5,21 +5,24 @@ |
||
| 5 | 5 | public function button1Clicked($sender,$param) |
| 6 | 6 | { |
| 7 | 7 | $this->Result1->Text="Button1 is clicked"; |
| 8 | - if($this->IsValid) |
|
| 9 | - $this->Result1->Text.=' and valid'; |
|
| 8 | + if($this->IsValid) { |
|
| 9 | + $this->Result1->Text.=' and valid'; |
|
| 10 | + } |
|
| 10 | 11 | } |
| 11 | 12 | |
| 12 | 13 | public function button2Clicked($sender,$param) |
| 13 | 14 | { |
| 14 | 15 | $this->Result2->Text="Button2 is clicked"; |
| 15 | - if($this->IsValid) |
|
| 16 | - $this->Result2->Text.=' and valid'; |
|
| 16 | + if($this->IsValid) { |
|
| 17 | + $this->Result2->Text.=' and valid'; |
|
| 18 | + } |
|
| 17 | 19 | } |
| 18 | 20 | |
| 19 | 21 | public function button3Clicked($sender,$param) |
| 20 | 22 | { |
| 21 | 23 | $this->Result3->Text="Button3 is clicked"; |
| 22 | - if($this->IsValid) |
|
| 23 | - $this->Result3->Text.=' and valid'; |
|
| 24 | + if($this->IsValid) { |
|
| 25 | + $this->Result3->Text.=' and valid'; |
|
| 26 | + } |
|
| 24 | 27 | } |
| 25 | 28 | } |
@@ -8,8 +8,9 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | protected function getData() |
| 10 | 10 | { |
| 11 | - if($this->_data===null) |
|
| 12 | - $this->loadData(); |
|
| 11 | + if($this->_data===null) { |
|
| 12 | + $this->loadData(); |
|
| 13 | + } |
|
| 13 | 14 | return $this->_data; |
| 14 | 15 | } |
| 15 | 16 | |
@@ -63,12 +64,14 @@ discard block |
||
| 63 | 64 | protected function updateBook($isbn,$title) |
| 64 | 65 | { |
| 65 | 66 | // In real applications, data should be saved to database using an SQL UPDATE statement |
| 66 | - if($this->_data===null) |
|
| 67 | - $this->loadData(); |
|
| 67 | + if($this->_data===null) { |
|
| 68 | + $this->loadData(); |
|
| 69 | + } |
|
| 68 | 70 | $updateRow=null; |
| 69 | - foreach($this->_data as $index=>$row) |
|
| 70 | - if($row['ISBN']===$isbn) |
|
| 71 | + foreach($this->_data as $index=>$row) { |
|
| 72 | + if($row['ISBN']===$isbn) |
|
| 71 | 73 | $updateRow=&$this->_data[$index]; |
| 74 | + } |
|
| 72 | 75 | if($updateRow!==null) |
| 73 | 76 | { |
| 74 | 77 | $updateRow['title']=$title; |
@@ -5,14 +5,16 @@ |
||
| 5 | 5 | public function validateUser($sender,$param) |
| 6 | 6 | { |
| 7 | 7 | $authManager=$this->Application->getModule('auth'); |
| 8 | - if(!$authManager->login($this->Username->Text,$this->Password->Text)) |
|
| 9 | - $param->IsValid=false; |
|
| 8 | + if(!$authManager->login($this->Username->Text,$this->Password->Text)) { |
|
| 9 | + $param->IsValid=false; |
|
| 10 | + } |
|
| 10 | 11 | } |
| 11 | 12 | |
| 12 | 13 | public function loginButtonClicked($sender,$param) |
| 13 | 14 | { |
| 14 | - if($this->Page->IsValid) |
|
| 15 | - $this->Response->redirect($this->Application->getModule('auth')->getReturnUrl()); |
|
| 15 | + if($this->Page->IsValid) { |
|
| 16 | + $this->Response->redirect($this->Application->getModule('auth')->getReturnUrl()); |
|
| 17 | + } |
|
| 16 | 18 | } |
| 17 | 19 | } |
| 18 | 20 | |
@@ -4,8 +4,9 @@ |
||
| 4 | 4 | $frameworkPath=$basePath.'/../../framework/prado.php'; |
| 5 | 5 | $assetsPath=$basePath.'/assets'; |
| 6 | 6 | |
| 7 | -if(!is_writable($assetsPath)) |
|
| 7 | +if(!is_writable($assetsPath)) { |
|
| 8 | 8 | die("Please make sure that the directory $assetsPath is writable by Web server process."); |
| 9 | +} |
|
| 9 | 10 | |
| 10 | 11 | require_once($frameworkPath); |
| 11 | 12 | |
@@ -4,8 +4,9 @@ discard block |
||
| 4 | 4 | { |
| 5 | 5 | public function addParsedObject($object) |
| 6 | 6 | { |
| 7 | - if ($object instanceof SimpleMenuItem) |
|
| 8 | - parent::addParsedObject($object); |
|
| 7 | + if ($object instanceof SimpleMenuItem) { |
|
| 8 | + parent::addParsedObject($object); |
|
| 9 | + } |
|
| 9 | 10 | } |
| 10 | 11 | |
| 11 | 12 | public function render($writer) |
@@ -67,14 +68,16 @@ discard block |
||
| 67 | 68 | { |
| 68 | 69 | $writer->addAttribute('href', $this->Service->constructUrl($path)); |
| 69 | 70 | |
| 70 | - if($path == $this->Page->getPagePath()) |
|
| 71 | - $writer->addAttribute('class', 'active'); |
|
| 71 | + if($path == $this->Page->getPagePath()) { |
|
| 72 | + $writer->addAttribute('class', 'active'); |
|
| 73 | + } |
|
| 72 | 74 | } elseif(null !== $url = $this->getUrl()) { |
| 73 | 75 | $writer->addAttribute('href', $url); |
| 74 | 76 | } |
| 75 | 77 | |
| 76 | - if($this->getTarget() !== null) |
|
| 77 | - $writer->addAttribute('target', $this->getTarget()); |
|
| 78 | + if($this->getTarget() !== null) { |
|
| 79 | + $writer->addAttribute('target', $this->getTarget()); |
|
| 80 | + } |
|
| 78 | 81 | |
| 79 | 82 | $writer->renderBeginTag("a"); |
| 80 | 83 | |
@@ -17,16 +17,18 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function getParameters() |
| 19 | 19 | { |
| 20 | - if($this->_parameters===null) |
|
| 21 | - $this->_parameters = new TAttributeCollection(); |
|
| 20 | + if($this->_parameters===null) { |
|
| 21 | + $this->_parameters = new TAttributeCollection(); |
|
| 22 | + } |
|
| 22 | 23 | return $this->_parameters; |
| 23 | 24 | } |
| 24 | 25 | |
| 25 | 26 | public function getFlashVars() |
| 26 | 27 | { |
| 27 | 28 | $params = array(); |
| 28 | - foreach($this->getParameters() as $name=>$value) |
|
| 29 | - $params[] = $name.'='.$value; |
|
| 29 | + foreach($this->getParameters() as $name=>$value) { |
|
| 30 | + $params[] = $name.'='.$value; |
|
| 31 | + } |
|
| 30 | 32 | return implode('&', $params); |
| 31 | 33 | } |
| 32 | 34 | |
@@ -25,8 +25,9 @@ discard block |
||
| 25 | 25 | public function getRegion() |
| 26 | 26 | { |
| 27 | 27 | //lazy load the region |
| 28 | - if($this->_region===null) |
|
| 29 | - $this->_region = Region::finder()->findByPk($this->RegionID); |
|
| 28 | + if($this->_region===null) { |
|
| 29 | + $this->_region = Region::finder()->findByPk($this->RegionID); |
|
| 30 | + } |
|
| 30 | 31 | return $this->_region; |
| 31 | 32 | } |
| 32 | 33 | |
@@ -41,8 +42,9 @@ discard block |
||
| 41 | 42 | public function getEmployees() |
| 42 | 43 | { |
| 43 | 44 | //lazy load |
| 44 | - if($this->_employees==null) |
|
| 45 | - $this->setEmployees($this->withEmployees()->findByPk($this->TerritoryID)->getEmployees()); |
|
| 45 | + if($this->_employees==null) { |
|
| 46 | + $this->setEmployees($this->withEmployees()->findByPk($this->TerritoryID)->getEmployees()); |
|
| 47 | + } |
|
| 46 | 48 | return $this->_employees; |
| 47 | 49 | } |
| 48 | 50 | |
@@ -15,10 +15,11 @@ |
||
| 15 | 15 | $folder=@opendir($directory); |
| 16 | 16 | while($entry=@readdir($folder)) |
| 17 | 17 | { |
| 18 | - if($entry[0]==='.') |
|
| 19 | - continue; |
|
| 20 | - else if(is_file($directory.'/'.$entry) && strpos($entry,'.php')) |
|
| 21 | - $list[] = str_replace('.php', '', $entry); |
|
| 18 | + if($entry[0]==='.') { |
|
| 19 | + continue; |
|
| 20 | + } else if(is_file($directory.'/'.$entry) && strpos($entry,'.php')) { |
|
| 21 | + $list[] = str_replace('.php', '', $entry); |
|
| 22 | + } |
|
| 22 | 23 | } |
| 23 | 24 | closedir($folder); |
| 24 | 25 | return $list; |
@@ -5,20 +5,25 @@ |
||
| 5 | 5 | $assetsPath=$basePath.'/assets'; |
| 6 | 6 | $runtimePath=$basePath.'/protected/runtime'; |
| 7 | 7 | |
| 8 | -if(!is_file($frameworkPath)) |
|
| 8 | +if(!is_file($frameworkPath)) { |
|
| 9 | 9 | die("Unable to find prado framework path $frameworkPath."); |
| 10 | -if(!is_writable($assetsPath)) |
|
| 10 | +} |
|
| 11 | +if(!is_writable($assetsPath)) { |
|
| 11 | 12 | die("Please make sure that the directory $assetsPath is writable by Web server process."); |
| 12 | -if(!is_writable($runtimePath)) |
|
| 13 | +} |
|
| 14 | +if(!is_writable($runtimePath)) { |
|
| 13 | 15 | die("Please make sure that the directory $runtimePath is writable by Web server process."); |
| 16 | +} |
|
| 14 | 17 | |
| 15 | 18 | /** SQLite Northwind database file **/ |
| 16 | 19 | $sqlite_dir = $basePath.'/protected/data'; |
| 17 | 20 | $sqlite_db = $sqlite_dir.'/Northwind.db'; |
| 18 | -if(!is_writable($sqlite_dir)) |
|
| 21 | +if(!is_writable($sqlite_dir)) { |
|
| 19 | 22 | die("Please make sure that the directory $sqlite_dir is writable by Web server process."); |
| 20 | -if(!is_writable($sqlite_db)) |
|
| 23 | +} |
|
| 24 | +if(!is_writable($sqlite_db)) { |
|
| 21 | 25 | die("Please make sure that the sqlite database file $sqlite_db is writable by Web server process."); |
| 26 | +} |
|
| 22 | 27 | |
| 23 | 28 | require_once($frameworkPath); |
| 24 | 29 | |