@@ -68,8 +68,7 @@ |
||
| 68 | 68 | $manager->configureXml($file); |
| 69 | 69 | $this->cacheSqlMapManager($manager); |
| 70 | 70 | } |
| 71 | - } |
|
| 72 | - elseif($this->getConnectionID() !== '') { |
|
| 71 | + } elseif($this->getConnectionID() !== '') { |
|
| 73 | 72 | $manager->setDbConnection($this->getDbConnection()); |
| 74 | 73 | } |
| 75 | 74 | return $manager; |
@@ -31,19 +31,19 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | private $_configFile; |
| 33 | 33 | private $_sqlmap; |
| 34 | - private $_enableCache = false; |
|
| 34 | + private $_enableCache=false; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * File extension of external configuration file |
| 38 | 38 | */ |
| 39 | - const CONFIG_FILE_EXT = '.xml'; |
|
| 39 | + const CONFIG_FILE_EXT='.xml'; |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * @return string module ID + configuration file path. |
| 43 | 43 | */ |
| 44 | 44 | private function getCacheKey() |
| 45 | 45 | { |
| 46 | - return $this->getID() . $this->getConfigFile(); |
|
| 46 | + return $this->getID().$this->getConfigFile(); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function clearCache() |
| 53 | 53 | { |
| 54 | - $cache = $this->getApplication()->getCache(); |
|
| 55 | - if($cache !== null) { |
|
| 54 | + $cache=$this->getApplication()->getCache(); |
|
| 55 | + if($cache!==null) { |
|
| 56 | 56 | $cache->delete($this->getCacheKey()); |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | * @since 3.1.7 |
| 67 | 67 | */ |
| 68 | 68 | public function getSqlMapManager() { |
| 69 | - if(($manager = $this->loadCachedSqlMapManager()) === null) |
|
| 69 | + if(($manager=$this->loadCachedSqlMapManager())===null) |
|
| 70 | 70 | { |
| 71 | - $manager = new TSqlMapManager($this->getDbConnection()); |
|
| 72 | - if(strlen($file = $this->getConfigFile()) > 0) |
|
| 71 | + $manager=new TSqlMapManager($this->getDbConnection()); |
|
| 72 | + if(strlen($file=$this->getConfigFile()) > 0) |
|
| 73 | 73 | { |
| 74 | 74 | $manager->configureXml($file); |
| 75 | 75 | $this->cacheSqlMapManager($manager); |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | - elseif($this->getConnectionID() !== '') { |
|
| 78 | + elseif($this->getConnectionID()!=='') { |
|
| 79 | 79 | $manager->setDbConnection($this->getDbConnection()); |
| 80 | 80 | } |
| 81 | 81 | return $manager; |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | if($this->getEnableCache()) |
| 91 | 91 | { |
| 92 | - $cache = $this->getApplication()->getCache(); |
|
| 93 | - if($cache !== null) { |
|
| 94 | - $dependencies = null; |
|
| 95 | - if($this->getApplication()->getMode() !== TApplicationMode::Performance) |
|
| 96 | - $dependencies = $manager->getCacheDependencies(); |
|
| 92 | + $cache=$this->getApplication()->getCache(); |
|
| 93 | + if($cache!==null) { |
|
| 94 | + $dependencies=null; |
|
| 95 | + if($this->getApplication()->getMode()!==TApplicationMode::Performance) |
|
| 96 | + $dependencies=$manager->getCacheDependencies(); |
|
| 97 | 97 | return $cache->set($this->getCacheKey(), $manager, 0, $dependencies); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | if($this->getEnableCache()) |
| 110 | 110 | { |
| 111 | - $cache = $this->getApplication()->getCache(); |
|
| 112 | - if($cache !== null) |
|
| 111 | + $cache=$this->getApplication()->getCache(); |
|
| 112 | + if($cache!==null) |
|
| 113 | 113 | { |
| 114 | - $manager = $cache->get($this->getCacheKey()); |
|
| 114 | + $manager=$cache->get($this->getCacheKey()); |
|
| 115 | 115 | if($manager instanceof TSqlMapManager) |
| 116 | 116 | return $manager; |
| 117 | 117 | } |
@@ -135,14 +135,14 @@ discard block |
||
| 135 | 135 | public function setConfigFile($value) |
| 136 | 136 | { |
| 137 | 137 | if(is_file($value)) |
| 138 | - $this->_configFile = $value; |
|
| 138 | + $this->_configFile=$value; |
|
| 139 | 139 | else |
| 140 | 140 | { |
| 141 | - $file = Prado::getPathOfNamespace($value, self::CONFIG_FILE_EXT); |
|
| 142 | - if($file === null || !is_file($file)) |
|
| 141 | + $file=Prado::getPathOfNamespace($value, self::CONFIG_FILE_EXT); |
|
| 142 | + if($file===null || !is_file($file)) |
|
| 143 | 143 | throw new TConfigurationException('sqlmap_configfile_invalid', $value); |
| 144 | 144 | else |
| 145 | - $this->_configFile = $file; |
|
| 145 | + $this->_configFile=$file; |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function setEnableCache($value) |
| 154 | 154 | { |
| 155 | - $this->_enableCache = TPropertyValue::ensureBoolean($value); |
|
| 155 | + $this->_enableCache=TPropertyValue::ensureBoolean($value); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -177,8 +177,8 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function getClient() |
| 179 | 179 | { |
| 180 | - if($this->_sqlmap === null) |
|
| 181 | - $this->_sqlmap = $this->createSqlMapGateway(); |
|
| 180 | + if($this->_sqlmap===null) |
|
| 181 | + $this->_sqlmap=$this->createSqlMapGateway(); |
|
| 182 | 182 | return $this->_sqlmap; |
| 183 | 183 | } |
| 184 | 184 | } |
@@ -177,8 +177,7 @@ |
||
| 177 | 177 | try |
| 178 | 178 | { |
| 179 | 179 | return TPropertyAccess::get($object, $property->getProperty()); |
| 180 | - } |
|
| 181 | - catch (TInvalidPropertyException $e) |
|
| 180 | + } catch (TInvalidPropertyException $e) |
|
| 182 | 181 | { |
| 183 | 182 | throw new TSqlMapException( |
| 184 | 183 | 'sqlmap_unable_to_get_property_for_parameter', |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function __construct() |
| 52 | 52 | { |
| 53 | - $this->_properties = new TList; |
|
| 54 | - $this->_propertyMap = new TMap; |
|
| 53 | + $this->_properties=new TList; |
|
| 54 | + $this->_propertyMap=new TMap; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function setID($value) |
| 69 | 69 | { |
| 70 | - $this->_ID = $value; |
|
| 70 | + $this->_ID=$value; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function setExtends($value) |
| 93 | 93 | { |
| 94 | - $this->_extend = $value; |
|
| 94 | + $this->_extend=$value; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -145,15 +145,15 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function getPropertyValue($registry, $property, $parameterValue) |
| 147 | 147 | { |
| 148 | - $value = $this->getObjectValue($parameterValue, $property); |
|
| 148 | + $value=$this->getObjectValue($parameterValue, $property); |
|
| 149 | 149 | |
| 150 | - if(($handler = $this->createTypeHandler($property, $registry)) !== null) |
|
| 151 | - $value = $handler->getParameter($value); |
|
| 150 | + if(($handler=$this->createTypeHandler($property, $registry))!==null) |
|
| 151 | + $value=$handler->getParameter($value); |
|
| 152 | 152 | |
| 153 | - $value = $this->nullifyDefaultValue($property, $value); |
|
| 153 | + $value=$this->nullifyDefaultValue($property, $value); |
|
| 154 | 154 | |
| 155 | - if(($type = $property->getType()) !== null) |
|
| 156 | - $value = $registry->convertToType($type, $value); |
|
| 155 | + if(($type=$property->getType())!==null) |
|
| 156 | + $value=$registry->convertToType($type, $value); |
|
| 157 | 157 | |
| 158 | 158 | return $value; |
| 159 | 159 | } |
@@ -167,10 +167,10 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | protected function createTypeHandler($property, $registry) |
| 169 | 169 | { |
| 170 | - $type = $property->getTypeHandler() ? $property->getTypeHandler() : $property->getType(); |
|
| 171 | - $handler = $registry->getTypeHandler($type); |
|
| 172 | - if($handler === null && $property->getTypeHandler()) |
|
| 173 | - $handler = Prado::createComponent($type); |
|
| 170 | + $type=$property->getTypeHandler() ? $property->getTypeHandler() : $property->getType(); |
|
| 171 | + $handler=$registry->getTypeHandler($type); |
|
| 172 | + if($handler===null && $property->getTypeHandler()) |
|
| 173 | + $handler=Prado::createComponent($type); |
|
| 174 | 174 | return $handler; |
| 175 | 175 | } |
| 176 | 176 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | { |
| 188 | 188 | return TPropertyAccess::get($object, $property->getProperty()); |
| 189 | 189 | } |
| 190 | - catch (TInvalidPropertyException $e) |
|
| 190 | + catch(TInvalidPropertyException $e) |
|
| 191 | 191 | { |
| 192 | 192 | throw new TSqlMapException( |
| 193 | 193 | 'sqlmap_unable_to_get_property_for_parameter', |
@@ -207,10 +207,10 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | protected function nullifyDefaultValue($property, $value) |
| 209 | 209 | { |
| 210 | - if(($nullValue = $property->getNullValue()) !== null) |
|
| 210 | + if(($nullValue=$property->getNullValue())!==null) |
|
| 211 | 211 | { |
| 212 | - if($nullValue === $value) |
|
| 213 | - $value = null; |
|
| 212 | + if($nullValue===$value) |
|
| 213 | + $value=null; |
|
| 214 | 214 | } |
| 215 | 215 | return $value; |
| 216 | 216 | } |
@@ -164,8 +164,7 @@ |
||
| 164 | 164 | return $handler->createNewInstance(); |
| 165 | 165 | else |
| 166 | 166 | return $registry->createInstanceOf($this->getClass()); |
| 167 | - } |
|
| 168 | - catch (TSqlMapException $e) |
|
| 167 | + } catch (TSqlMapException $e) |
|
| 169 | 168 | { |
| 170 | 169 | throw new TSqlMapException( |
| 171 | 170 | 'sqlmap_unable_to_create_new_instance', |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function __construct() |
| 56 | 56 | { |
| 57 | - $this->_columns = new TMap; |
|
| 57 | + $this->_columns=new TMap; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function setID($value) |
| 72 | 72 | { |
| 73 | - $this->_ID = $value; |
|
| 73 | + $this->_ID=$value; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function setClass($value) |
| 88 | 88 | { |
| 89 | - $this->_class = $value; |
|
| 89 | + $this->_class=$value; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function setExtends($value) |
| 112 | 112 | { |
| 113 | - $this->_extends = $value; |
|
| 113 | + $this->_extends=$value; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function setGroupBy($value) |
| 128 | 128 | { |
| 129 | - $this->_groupBy = $value; |
|
| 129 | + $this->_groupBy=$value; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function setDiscriminator(TDiscriminator $value) |
| 144 | 144 | { |
| 145 | - $this->_discriminator = $value; |
|
| 145 | + $this->_discriminator=$value; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function addResultProperty(TResultProperty $property) |
| 153 | 153 | { |
| 154 | - $this->_columns[$property->getProperty()] = $property; |
|
| 154 | + $this->_columns[$property->getProperty()]=$property; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -162,15 +162,15 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function createInstanceOfResult($registry) |
| 164 | 164 | { |
| 165 | - $handler = $registry->getTypeHandler($this->getClass()); |
|
| 165 | + $handler=$registry->getTypeHandler($this->getClass()); |
|
| 166 | 166 | try |
| 167 | 167 | { |
| 168 | - if($handler !== null) |
|
| 168 | + if($handler!==null) |
|
| 169 | 169 | return $handler->createNewInstance(); |
| 170 | 170 | else |
| 171 | 171 | return $registry->createInstanceOf($this->getClass()); |
| 172 | 172 | } |
| 173 | - catch (TSqlMapException $e) |
|
| 173 | + catch(TSqlMapException $e) |
|
| 174 | 174 | { |
| 175 | 175 | throw new TSqlMapException( |
| 176 | 176 | 'sqlmap_unable_to_create_new_instance', |
@@ -186,16 +186,16 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function resolveSubMap($registry, $row) |
| 188 | 188 | { |
| 189 | - $subMap = $this; |
|
| 190 | - if(($disc = $this->getDiscriminator()) !== null) |
|
| 189 | + $subMap=$this; |
|
| 190 | + if(($disc=$this->getDiscriminator())!==null) |
|
| 191 | 191 | { |
| 192 | - $value = $disc->getMapping()->getPropertyValue($registry, $row); |
|
| 193 | - $subMap = $disc->getSubMap((string)$value); |
|
| 192 | + $value=$disc->getMapping()->getPropertyValue($registry, $row); |
|
| 193 | + $subMap=$disc->getSubMap((string) $value); |
|
| 194 | 194 | |
| 195 | - if($subMap === null) |
|
| 196 | - $subMap = $this; |
|
| 197 | - elseif($subMap !== $this) |
|
| 198 | - $subMap = $subMap->resolveSubMap($registry, $row); |
|
| 195 | + if($subMap===null) |
|
| 196 | + $subMap=$this; |
|
| 197 | + elseif($subMap!==$this) |
|
| 198 | + $subMap=$subMap->resolveSubMap($registry, $row); |
|
| 199 | 199 | } |
| 200 | 200 | return $subMap; |
| 201 | 201 | } |
@@ -112,8 +112,7 @@ |
||
| 112 | 112 | && strlen($datetime[1]) == 1) |
| 113 | 113 | { |
| 114 | 114 | $pattern = $datetime; |
| 115 | - } |
|
| 116 | - else //no subpattern, try the presets |
|
| 115 | + } else //no subpattern, try the presets |
|
| 117 | 116 | $pattern = $this->getPreset($string); |
| 118 | 117 | |
| 119 | 118 | //no presets found, use the string as the pattern |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | * A set of pattern presets and their respective formatting shorthand. |
| 73 | 73 | * @var array |
| 74 | 74 | */ |
| 75 | - private static $_patternPresets = [ |
|
| 76 | - 'fulldate' => 'P','full' => 'P', |
|
| 77 | - 'longdate' => 'D','long' => 'd', |
|
| 78 | - 'mediumdate' => 'p','medium' => 'p', |
|
| 79 | - 'shortdate' => 'd','short' => 'd', |
|
| 75 | + private static $_patternPresets=[ |
|
| 76 | + 'fulldate' => 'P', 'full' => 'P', |
|
| 77 | + 'longdate' => 'D', 'long' => 'd', |
|
| 78 | + 'mediumdate' => 'p', 'medium' => 'p', |
|
| 79 | + 'shortdate' => 'd', 'short' => 'd', |
|
| 80 | 80 | 'fulltime' => 'Q', 'longtime' => 'T', |
| 81 | 81 | 'mediumtime' => 'q', 'shorttime' => 't']; |
| 82 | 82 | |
@@ -95,35 +95,35 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function getPattern() |
| 97 | 97 | { |
| 98 | - $string = $this->getViewState('Pattern', ''); |
|
| 98 | + $string=$this->getViewState('Pattern', ''); |
|
| 99 | 99 | |
| 100 | - $pattern = null; |
|
| 100 | + $pattern=null; |
|
| 101 | 101 | |
| 102 | 102 | //try the subpattern of "date time" presets |
| 103 | - $subpatterns = explode(' ', $string, 2); |
|
| 104 | - $datetime = []; |
|
| 105 | - if(count($subpatterns) == 2) |
|
| 103 | + $subpatterns=explode(' ', $string, 2); |
|
| 104 | + $datetime=[]; |
|
| 105 | + if(count($subpatterns)==2) |
|
| 106 | 106 | { |
| 107 | - $datetime[] = $this->getPreset($subpatterns[0]); |
|
| 108 | - $datetime[] = $this->getPreset($subpatterns[1]); |
|
| 107 | + $datetime[]=$this->getPreset($subpatterns[0]); |
|
| 108 | + $datetime[]=$this->getPreset($subpatterns[1]); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | //we have a good subpattern |
| 112 | - if(count($datetime) == 2 |
|
| 113 | - && strlen($datetime[0]) == 1 |
|
| 114 | - && strlen($datetime[1]) == 1) |
|
| 112 | + if(count($datetime)==2 |
|
| 113 | + && strlen($datetime[0])==1 |
|
| 114 | + && strlen($datetime[1])==1) |
|
| 115 | 115 | { |
| 116 | - $pattern = $datetime; |
|
| 116 | + $pattern=$datetime; |
|
| 117 | 117 | } |
| 118 | 118 | else //no subpattern, try the presets |
| 119 | - $pattern = $this->getPreset($string); |
|
| 119 | + $pattern=$this->getPreset($string); |
|
| 120 | 120 | |
| 121 | 121 | //no presets found, use the string as the pattern |
| 122 | 122 | //and let the DateFormat handle it. |
| 123 | - if($pattern === null) |
|
| 124 | - $pattern = $string; |
|
| 125 | - if (!is_array($pattern) && strlen($pattern) == 0) |
|
| 126 | - $pattern = null; |
|
| 123 | + if($pattern===null) |
|
| 124 | + $pattern=$string; |
|
| 125 | + if(!is_array($pattern) && strlen($pattern)==0) |
|
| 126 | + $pattern=null; |
|
| 127 | 127 | return $pattern; |
| 128 | 128 | } |
| 129 | 129 | |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | protected function getPreset($string) |
| 136 | 136 | { |
| 137 | - $string = strtolower($string); |
|
| 137 | + $string=strtolower($string); |
|
| 138 | 138 | foreach(self::$_patternPresets as $pattern => $preset) |
| 139 | 139 | { |
| 140 | - if($string == $pattern) |
|
| 140 | + if($string==$pattern) |
|
| 141 | 141 | return $preset; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public function getValue() |
| 150 | 150 | { |
| 151 | - $value = $this->getViewState('Value', ''); |
|
| 151 | + $value=$this->getViewState('Value', ''); |
|
| 152 | 152 | if(empty($value)) |
| 153 | 153 | { |
| 154 | - $defaultText = $this->getDefaultText(); |
|
| 154 | + $defaultText=$this->getDefaultText(); |
|
| 155 | 155 | if(empty($defaultText)) |
| 156 | 156 | return time(); |
| 157 | 157 | } |
@@ -219,29 +219,29 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | protected function getFormattedDate() |
| 221 | 221 | { |
| 222 | - $value = $this->getValue(); |
|
| 223 | - $defaultText = $this->getDefaultText(); |
|
| 222 | + $value=$this->getValue(); |
|
| 223 | + $defaultText=$this->getDefaultText(); |
|
| 224 | 224 | if(empty($value) && !empty($defaultText)) |
| 225 | 225 | return $this->getDefaultText(); |
| 226 | 226 | |
| 227 | - $app = $this->getApplication()->getGlobalization(); |
|
| 227 | + $app=$this->getApplication()->getGlobalization(); |
|
| 228 | 228 | |
| 229 | 229 | //initialized the default class wide formatter |
| 230 | - if(self::$formatter === null) |
|
| 231 | - self::$formatter = new DateFormat($app->getCulture()); |
|
| 230 | + if(self::$formatter===null) |
|
| 231 | + self::$formatter=new DateFormat($app->getCulture()); |
|
| 232 | 232 | |
| 233 | - $culture = $this->getCulture(); |
|
| 233 | + $culture=$this->getCulture(); |
|
| 234 | 234 | |
| 235 | 235 | //return the specific cultural formatted date time |
| 236 | - if(strlen($culture) && $app->getCulture() !== $culture) |
|
| 236 | + if(strlen($culture) && $app->getCulture()!==$culture) |
|
| 237 | 237 | { |
| 238 | - $formatter = new DateFormat($culture); |
|
| 238 | + $formatter=new DateFormat($culture); |
|
| 239 | 239 | return $formatter->format($value, |
| 240 | 240 | $this->getPattern(), |
| 241 | 241 | $this->getCharset()); |
| 242 | 242 | } |
| 243 | 243 | //return the application wide culture formatted date time. |
| 244 | - $result = self::$formatter->format($value, |
|
| 244 | + $result=self::$formatter->format($value, |
|
| 245 | 245 | $this->getPattern(), |
| 246 | 246 | $this->getCharset()); |
| 247 | 247 | return $result; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function setDecayRate($value) |
| 81 | 81 | { |
| 82 | - $decay = TPropertyValue::ensureFloat($value); |
|
| 82 | + $decay=TPropertyValue::ensureFloat($value); |
|
| 83 | 83 | if($decay < 0) |
| 84 | 84 | throw new TConfigurationException('callback_decay_be_not_negative', $this->getID()); |
| 85 | 85 | $this->setViewState('Decay', $decay); |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | protected function getTriggerOptions() |
| 92 | 92 | { |
| 93 | - $options = parent::getTriggerOptions(); |
|
| 94 | - $options['PropertyName'] = $this->getPropertyName(); |
|
| 95 | - $options['Interval'] = $this->getInterval(); |
|
| 96 | - $options['Decay'] = $this->getDecayRate(); |
|
| 93 | + $options=parent::getTriggerOptions(); |
|
| 94 | + $options['PropertyName']=$this->getPropertyName(); |
|
| 95 | + $options['Interval']=$this->getInterval(); |
|
| 96 | + $options['Decay']=$this->getDecayRate(); |
|
| 97 | 97 | return $options; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -119,8 +119,7 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $this->raiseCallbackEvent($param); |
| 121 | 121 | return true; |
| 122 | - } |
|
| 123 | - else return false; |
|
| 122 | + } else return false; |
|
| 124 | 123 | } |
| 125 | 124 | |
| 126 | 125 | /** |
@@ -163,8 +162,7 @@ discard block |
||
| 163 | 162 | parent::render($writer); |
| 164 | 163 | if ($this->getActiveControl()->canUpdateClientSide()) |
| 165 | 164 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
| 166 | - } |
|
| 167 | - else |
|
| 165 | + } else |
|
| 168 | 166 | { |
| 169 | 167 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
| 170 | 168 | // If we update a TActiveTableRow on callback, we shouldn't update all childs, |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function raiseCallbackEvent($param) |
| 105 | 105 | { |
| 106 | - $parameter = new TActiveTableRowEventParameter($this->getResponse(), $param->getCallbackParameter(), $this->getRowIndex()); |
|
| 106 | + $parameter=new TActiveTableRowEventParameter($this->getResponse(), $param->getCallbackParameter(), $this->getRowIndex()); |
|
| 107 | 107 | $this->onRowSelected($parameter); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function bubbleEvent($sender, $param) |
| 119 | 119 | { |
| 120 | - if ($param instanceof TActiveTableCellEventParameter) |
|
| 120 | + if($param instanceof TActiveTableCellEventParameter) |
|
| 121 | 121 | { |
| 122 | 122 | $this->raiseCallbackEvent($param); |
| 123 | 123 | return true; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | parent::addAttributesToRender($writer); |
| 149 | 149 | $writer->addAttribute('id', $this->getClientID()); |
| 150 | - if ($this->hasEventHandler('OnRowSelected')) |
|
| 150 | + if($this->hasEventHandler('OnRowSelected')) |
|
| 151 | 151 | $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions()); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -160,10 +160,10 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function render($writer) |
| 162 | 162 | { |
| 163 | - if ($this->getHasPreRendered()) |
|
| 163 | + if($this->getHasPreRendered()) |
|
| 164 | 164 | { |
| 165 | 165 | parent::render($writer); |
| 166 | - if ($this->getActiveControl()->canUpdateClientSide()) |
|
| 166 | + if($this->getActiveControl()->canUpdateClientSide()) |
|
| 167 | 167 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
| 168 | 168 | } |
| 169 | 169 | else |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
| 172 | 172 | // If we update a TActiveTableRow on callback, we shouldn't update all childs, |
| 173 | 173 | // because the whole content will be replaced by the parent. |
| 174 | - if ($this->getHasControls()) |
|
| 174 | + if($this->getHasControls()) |
|
| 175 | 175 | { |
| 176 | - foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control) |
|
| 176 | + foreach($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control) |
|
| 177 | 177 | $control->getActiveControl()->setEnableUpdate(false); |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | protected function getPostBackOptions() |
| 188 | 188 | { |
| 189 | - $options['ID'] = $this->getClientID(); |
|
| 190 | - $options['EventTarget'] = $this->getUniqueID(); |
|
| 189 | + $options['ID']=$this->getClientID(); |
|
| 190 | + $options['EventTarget']=$this->getUniqueID(); |
|
| 191 | 191 | return $options; |
| 192 | 192 | } |
| 193 | 193 | |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function getRowIndex() |
| 201 | 201 | { |
| 202 | - foreach ($this->getTable()->getRows() as $key => $row) |
|
| 203 | - if ($row == $this) return $key; |
|
| 202 | + foreach($this->getTable()->getRows() as $key => $row) |
|
| 203 | + if($row==$this) return $key; |
|
| 204 | 204 | throw new TConfigurationException('tactivetablerow_control_notincollection', get_class($this), $this->getUniqueID()); |
| 205 | 205 | } |
| 206 | 206 | |
@@ -211,14 +211,14 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public function getTable() |
| 213 | 213 | { |
| 214 | - if ($this->_table === null) |
|
| 214 | + if($this->_table===null) |
|
| 215 | 215 | { |
| 216 | - $table = $this->getParent(); |
|
| 217 | - while (!($table instanceof TTable) && $table !== null) |
|
| 216 | + $table=$this->getParent(); |
|
| 217 | + while(!($table instanceof TTable) && $table!==null) |
|
| 218 | 218 | { |
| 219 | - $table = $table->getParent(); |
|
| 219 | + $table=$table->getParent(); |
|
| 220 | 220 | } |
| 221 | - if ($table instanceof TTable) $this->_table = $table; |
|
| 221 | + if($table instanceof TTable) $this->_table=$table; |
|
| 222 | 222 | else throw new TConfigurationException('tactivetablerow_control_outoftable', get_class($this), $this->getUniqueID()); |
| 223 | 223 | } |
| 224 | 224 | return $this->_table; |
@@ -47,8 +47,8 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | public function __construct($response, $parameter) |
| 49 | 49 | { |
| 50 | - $this->_response = $response; |
|
| 51 | - $this->_parameter = $parameter; |
|
| 50 | + $this->_response=$response; |
|
| 51 | + $this->_parameter=$parameter; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -64,10 +64,10 @@ |
||
| 64 | 64 | */ |
| 65 | 65 | protected function getTriggerOptions() |
| 66 | 66 | { |
| 67 | - $options = parent::getTriggerOptions(); |
|
| 68 | - $name = preg_replace('/^on/', '', $this->getEventName()); |
|
| 69 | - $options['EventName'] = strtolower($name); |
|
| 70 | - $options['StopEvent'] = $this->getPreventDefaultAction(); |
|
| 67 | + $options=parent::getTriggerOptions(); |
|
| 68 | + $name=preg_replace('/^on/', '', $this->getEventName()); |
|
| 69 | + $options['EventName']=strtolower($name); |
|
| 70 | + $options['StopEvent']=$this->getPreventDefaultAction(); |
|
| 71 | 71 | return $options; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -518,16 +518,14 @@ |
||
| 518 | 518 | { |
| 519 | 519 | $this->setIsValid(true); |
| 520 | 520 | $this->onValidationSuccess(); |
| 521 | - } |
|
| 522 | - else |
|
| 521 | + } else |
|
| 523 | 522 | { |
| 524 | 523 | if($target) |
| 525 | 524 | $target->setIsValid(false); |
| 526 | 525 | $this->setIsValid(false); |
| 527 | 526 | $this->onValidationError(); |
| 528 | 527 | } |
| 529 | - } |
|
| 530 | - else |
|
| 528 | + } else |
|
| 531 | 529 | { |
| 532 | 530 | $this->evaluateIsValid(); |
| 533 | 531 | $this->setIsValid(true); |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | /** |
| 82 | 82 | * @var boolean whether the validation succeeds |
| 83 | 83 | */ |
| 84 | - private $_isValid = true; |
|
| 84 | + private $_isValid=true; |
|
| 85 | 85 | /** |
| 86 | 86 | * @var boolean whether the validator has been registered with the page |
| 87 | 87 | */ |
| 88 | - private $_registered = false; |
|
| 88 | + private $_registered=false; |
|
| 89 | 89 | /** |
| 90 | 90 | * @var TValidatorClientSide validator client-script options. |
| 91 | 91 | */ |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * them specially. |
| 96 | 96 | * @var array list of control class names |
| 97 | 97 | */ |
| 98 | - private static $_clientClass = ['THtmlArea', 'THtmlArea4', 'TDatePicker', 'TListBox', 'TCheckBoxList']; |
|
| 98 | + private static $_clientClass=['THtmlArea', 'THtmlArea4', 'TDatePicker', 'TListBox', 'TCheckBoxList']; |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Constructor. |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | parent::onInit($param); |
| 117 | 117 | $this->getPage()->getValidators()->add($this); |
| 118 | - $this->_registered = true; |
|
| 118 | + $this->_registered=true; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -124,9 +124,9 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public function onUnload($param) |
| 126 | 126 | { |
| 127 | - if($this->_registered && ($page = $this->getPage()) !== null) |
|
| 127 | + if($this->_registered && ($page=$this->getPage())!==null) |
|
| 128 | 128 | $page->getValidators()->remove($this); |
| 129 | - $this->_registered = false; |
|
| 129 | + $this->_registered=false; |
|
| 130 | 130 | parent::onUnload($param); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | protected function addAttributesToRender($writer) |
| 139 | 139 | { |
| 140 | - $display = $this->getDisplay(); |
|
| 141 | - $visible = $this->getEnabled(true) && !$this->getIsValid(); |
|
| 142 | - if($display === TValidatorDisplayStyle::None || (!$visible && $display === TValidatorDisplayStyle::Dynamic)) |
|
| 140 | + $display=$this->getDisplay(); |
|
| 141 | + $visible=$this->getEnabled(true) && !$this->getIsValid(); |
|
| 142 | + if($display===TValidatorDisplayStyle::None || (!$visible && $display===TValidatorDisplayStyle::Dynamic)) |
|
| 143 | 143 | $writer->addStyleAttribute('display', 'none'); |
| 144 | 144 | elseif(!$visible) |
| 145 | 145 | $writer->addStyleAttribute('visibility', 'hidden'); |
@@ -154,29 +154,29 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | protected function getClientScriptOptions() |
| 156 | 156 | { |
| 157 | - $control = $this->getValidationTarget(); |
|
| 158 | - $options['ID'] = $this->getClientID(); |
|
| 159 | - $options['FormID'] = $this->getPage()->getForm()->getClientID(); |
|
| 160 | - $options['Display'] = $this->getDisplay(); |
|
| 161 | - $options['ErrorMessage'] = $this->getErrorMessage(); |
|
| 157 | + $control=$this->getValidationTarget(); |
|
| 158 | + $options['ID']=$this->getClientID(); |
|
| 159 | + $options['FormID']=$this->getPage()->getForm()->getClientID(); |
|
| 160 | + $options['Display']=$this->getDisplay(); |
|
| 161 | + $options['ErrorMessage']=$this->getErrorMessage(); |
|
| 162 | 162 | if($this->getFocusOnError()) |
| 163 | 163 | { |
| 164 | - $options['FocusOnError'] = $this->getFocusOnError(); |
|
| 165 | - $options['FocusElementID'] = $this->getFocusElementID(); |
|
| 164 | + $options['FocusOnError']=$this->getFocusOnError(); |
|
| 165 | + $options['FocusElementID']=$this->getFocusElementID(); |
|
| 166 | 166 | } |
| 167 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
| 167 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
| 168 | 168 | if($control) |
| 169 | - $options['ControlToValidate'] = $control->getClientID(); |
|
| 170 | - $options['ControlCssClass'] = $this->getControlCssClass(); |
|
| 169 | + $options['ControlToValidate']=$control->getClientID(); |
|
| 170 | + $options['ControlCssClass']=$this->getControlCssClass(); |
|
| 171 | 171 | |
| 172 | - $options['ControlType'] = $this->getClientControlClass($control); |
|
| 173 | - $options['Enabled'] = $this->getEnabled(true); |
|
| 172 | + $options['ControlType']=$this->getClientControlClass($control); |
|
| 173 | + $options['Enabled']=$this->getEnabled(true); |
|
| 174 | 174 | |
| 175 | 175 | //get date format from date picker target control |
| 176 | 176 | if($control instanceof TDatePicker) |
| 177 | - $options['DateFormat'] = $control->getDateFormat(); |
|
| 177 | + $options['DateFormat']=$control->getDateFormat(); |
|
| 178 | 178 | |
| 179 | - $options = array_merge($options, $this->getClientSide()->getOptions()->toArray()); |
|
| 179 | + $options=array_merge($options, $this->getClientSide()->getOptions()->toArray()); |
|
| 180 | 180 | |
| 181 | 181 | return $options; |
| 182 | 182 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | foreach(self::$_clientClass as $type) |
| 194 | 194 | if($control instanceof $type) |
| 195 | 195 | return $type; |
| 196 | - $reflectionClass = new \ReflectionClass($control); |
|
| 196 | + $reflectionClass=new \ReflectionClass($control); |
|
| 197 | 197 | return $reflectionClass->getShortName(); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function getClientSide() |
| 217 | 217 | { |
| 218 | - if($this->_clientSide === null) |
|
| 219 | - $this->_clientSide = $this->createClientSide(); |
|
| 218 | + if($this->_clientSide===null) |
|
| 219 | + $this->_clientSide=$this->createClientSide(); |
|
| 220 | 220 | return $this->_clientSide; |
| 221 | 221 | } |
| 222 | 222 | |
@@ -236,15 +236,15 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | public function renderClientControlScript($writer) |
| 238 | 238 | { |
| 239 | - $scripts = $this->getPage()->getClientScript(); |
|
| 240 | - if ($this->getEnableClientScript()) |
|
| 239 | + $scripts=$this->getPage()->getClientScript(); |
|
| 240 | + if($this->getEnableClientScript()) |
|
| 241 | 241 | $scripts->registerPradoScript('validator'); |
| 242 | - $formID = $this->getPage()->getForm()->getClientID(); |
|
| 243 | - $scriptKey = "TBaseValidator:$formID"; |
|
| 242 | + $formID=$this->getPage()->getForm()->getClientID(); |
|
| 243 | + $scriptKey="TBaseValidator:$formID"; |
|
| 244 | 244 | if($this->getEnableClientScript() && !$scripts->isEndScriptRegistered($scriptKey)) |
| 245 | 245 | { |
| 246 | - $manager['FormID'] = $formID; |
|
| 247 | - $options = TJavaScript::encode($manager); |
|
| 246 | + $manager['FormID']=$formID; |
|
| 247 | + $options=TJavaScript::encode($manager); |
|
| 248 | 248 | $scripts->registerEndScript($scriptKey, "new Prado.ValidationManager({$options});"); |
| 249 | 249 | } |
| 250 | 250 | if($this->getEnableClientScript()) |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * Override parent implementation to update the control CSS Class before |
| 256 | 256 | * the validated control is rendered |
| 257 | 257 | */ |
| 258 | - public function onPreRender ($param) |
|
| 258 | + public function onPreRender($param) |
|
| 259 | 259 | { |
| 260 | 260 | parent::onPreRender($param); |
| 261 | 261 | $this->updateControlCssClass(); |
@@ -268,17 +268,17 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | protected function updateControlCssClass() |
| 270 | 270 | { |
| 271 | - if(($cssClass = $this->getControlCssClass()) !== '') |
|
| 271 | + if(($cssClass=$this->getControlCssClass())!=='') |
|
| 272 | 272 | { |
| 273 | - $control = $this->getValidationTarget(); |
|
| 273 | + $control=$this->getValidationTarget(); |
|
| 274 | 274 | if($control instanceof TWebControl) |
| 275 | 275 | { |
| 276 | - $class = preg_replace('/ ' . preg_quote($cssClass) . '/', '', $control->getCssClass()); |
|
| 276 | + $class=preg_replace('/ '.preg_quote($cssClass).'/', '', $control->getCssClass()); |
|
| 277 | 277 | if(!$this->getIsValid()) |
| 278 | 278 | { |
| 279 | - $class .= ' ' . $cssClass; |
|
| 279 | + $class.=' '.$cssClass; |
|
| 280 | 280 | $control->setCssClass($class); |
| 281 | - } elseif ($control->getIsValid()) |
|
| 281 | + } elseif($control->getIsValid()) |
|
| 282 | 282 | $control->setCssClass($class); |
| 283 | 283 | } |
| 284 | 284 | } |
@@ -289,11 +289,11 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | protected function registerClientScriptValidator() |
| 291 | 291 | { |
| 292 | - $key = 'prado:' . $this->getClientID(); |
|
| 292 | + $key='prado:'.$this->getClientID(); |
|
| 293 | 293 | if(!$this->getPage()->getClientScript()->isEndScriptRegistered($key)) |
| 294 | 294 | { |
| 295 | - $options = TJavaScript::encode($this->getClientScriptOptions()); |
|
| 296 | - $script = 'new ' . $this->getClientClassName() . '(' . $options . ');'; |
|
| 295 | + $options=TJavaScript::encode($this->getClientScriptOptions()); |
|
| 296 | + $script='new '.$this->getClientClassName().'('.$options.');'; |
|
| 297 | 297 | $this->getPage()->getClientScript()->registerEndScript($key, $script); |
| 298 | 298 | } |
| 299 | 299 | } |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | public function setEnabled($value) |
| 323 | 323 | { |
| 324 | - $value = TPropertyValue::ensureBoolean($value); |
|
| 324 | + $value=TPropertyValue::ensureBoolean($value); |
|
| 325 | 325 | parent::setEnabled($value); |
| 326 | 326 | if(!$value) |
| 327 | - $this->_isValid = true; |
|
| 327 | + $this->_isValid=true; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |
@@ -418,17 +418,17 @@ discard block |
||
| 418 | 418 | */ |
| 419 | 419 | public function getFocusElementID() |
| 420 | 420 | { |
| 421 | - if(($id = $this->getViewState('FocusElementID', '')) === '') |
|
| 421 | + if(($id=$this->getViewState('FocusElementID', ''))==='') |
|
| 422 | 422 | { |
| 423 | - $target = $this->getValidationTarget(); |
|
| 423 | + $target=$this->getValidationTarget(); |
|
| 424 | 424 | /* Workaround: TCheckBoxList and TRadioButtonList nests the actual |
| 425 | 425 | * inputs inside a table; we ensure the first input gets focused |
| 426 | 426 | */ |
| 427 | 427 | if($target instanceof TCheckBoxList && $target->getItemCount() > 0) |
| 428 | 428 | { |
| 429 | - $id = $target->getClientID() . '_c0'; |
|
| 429 | + $id=$target->getClientID().'_c0'; |
|
| 430 | 430 | } else { |
| 431 | - $id = $target->getClientID(); |
|
| 431 | + $id=$target->getClientID(); |
|
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | return $id; |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | */ |
| 474 | 474 | public function setIsValid($value) |
| 475 | 475 | { |
| 476 | - $this->_isValid = TPropertyValue::ensureBoolean($value); |
|
| 476 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | */ |
| 484 | 484 | public function getValidationTarget() |
| 485 | 485 | { |
| 486 | - if(($id = $this->getControlToValidate()) !== '' && ($control = $this->findControl($id)) !== null) |
|
| 486 | + if(($id=$this->getControlToValidate())!=='' && ($control=$this->findControl($id))!==null) |
|
| 487 | 487 | return $control; |
| 488 | 488 | else |
| 489 | 489 | throw new TConfigurationException('basevalidator_controltovalidate_invalid', get_class($this)); |
@@ -513,10 +513,10 @@ discard block |
||
| 513 | 513 | $this->onValidate(); |
| 514 | 514 | if($this->getVisible(true) && $this->getEnabled(true)) |
| 515 | 515 | { |
| 516 | - $target = $this->getValidationTarget(); |
|
| 516 | + $target=$this->getValidationTarget(); |
|
| 517 | 517 | // if the target is not a disabled web control |
| 518 | - if($target === null || |
|
| 519 | - ($target !== null && |
|
| 518 | + if($target===null || |
|
| 519 | + ($target!==null && |
|
| 520 | 520 | !($target instanceof TWebControl && !$target->getEnabled(true)))) |
| 521 | 521 | { |
| 522 | 522 | if($this->evaluateIsValid()) |
@@ -600,9 +600,9 @@ discard block |
||
| 600 | 600 | */ |
| 601 | 601 | public function renderContents($writer) |
| 602 | 602 | { |
| 603 | - if(($text = $this->getText()) !== '') |
|
| 603 | + if(($text=$this->getText())!=='') |
|
| 604 | 604 | $writer->write($text); |
| 605 | - elseif(($text = $this->getErrorMessage()) !== '') |
|
| 605 | + elseif(($text=$this->getErrorMessage())!=='') |
|
| 606 | 606 | $writer->write($text); |
| 607 | 607 | else |
| 608 | 608 | parent::renderContents($writer); |