| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class jControllerCmdLine extends jController { |
|---|
| 20 |
|
|---|
| 21 |
protected $_options; |
|---|
| 22 |
protected $_parameters; |
|---|
| 23 |
|
|---|
| 24 |
protected $allowed_options; |
|---|
| 25 |
protected $allowed_parameters; |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
* |
|---|
| 29 |
* @param jRequest $request |
|---|
| 30 |
*/ |
|---|
| 31 |
function __construct ($request){ |
|---|
| 32 |
$this->request = $request; |
|---|
| 33 |
$params = $this->request->params; |
|---|
| 34 |
unset($params['module']); |
|---|
| 35 |
unset($params['action']); |
|---|
| 36 |
$action = new jSelectorAct($this->request->params['action']); |
|---|
| 37 |
list($this->_options,$this->_parameters) = jCmdUtils::getOptionsAndParams($params,$this->allowed_options[$action->method] , $this->allowed_parameters[$action->method]); |
|---|
| 38 |
|
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
protected function param ($parName, $parDefaultValue=null, $useDefaultIfEmpty=false){ |
|---|
| 42 |
if (isset($this->_parameters[$parName])) { |
|---|
| 43 |
if($this->_parameters[$parName] == '' && $useDefaultIfEmpty) |
|---|
| 44 |
return $parDefaultValue; |
|---|
| 45 |
else |
|---|
| 46 |
return $this->_parameters[$parName]; |
|---|
| 47 |
} else { |
|---|
| 48 |
return $parDefaultValue; |
|---|
| 49 |
} |
|---|
| 50 |
} |
|---|
| 51 |
|
|---|
| 52 |
protected function option($name) { |
|---|
| 53 |
if (isset($this->_options[$name])) { |
|---|
| 54 |
return $this->_options[$name]; |
|---|
| 55 |
} else { |
|---|
| 56 |
return false; |
|---|
| 57 |
} |
|---|
| 58 |
} |
|---|
| 59 |
|
|---|
| 60 |
} |
|---|
| 61 |
|
|---|
| 62 |
?> |
|---|
| 63 |
|
|---|