blob: de2bbdf69922aaaca25906c346e96939a846b508 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
<?php
/**
* Description of TWsat
* Inspired in both Microsoft Web Site Administration Tool(WSAT) and Yii's Gii.
* @version 1.0
* @author Daniel Sampedro darthdaniel85@gmail.com
* @since Prado 3.3
*
* To use TWsatService, configure it in the application specification like following:
* <code>
* <services>
* <service id="wsat" class="System.Wsat.TWsatService" Password="my_secret_password" />
* </services>
* </code>
* ...and then you need to go to http://localhost/yoursite/index.php?wsat=TWsatLogin
* and generate code and configure your site.
*/
class TWsatService extends TPageService {
private $_pass = '';
//-----------------------------------------------------------------------------
public function init($config) {
if ($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal) {
throw new TInvalidOperationException("You should not use Prado WSAT in any of the production modes.");
}
if (empty($this->_pass)) {
throw new TConfigurationException("You need to specify the Password attribute.");
}
$this->setDefaultPage("TWsatHome");
$this->_startThemeManager();
parent::init($config);
}
public function getBasePath() {
$basePath = Prado::getPathOfNamespace("System.Wsat.pages");
return realpath($basePath);
}
private function _startThemeManager() {
$themeManager = new TThemeManager;
$themeManager->BasePath = "System.Wsat.themes";
$url = Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getPathOfNamespace('System.Wsat'));
$themeManager->BaseUrl = $url . DIRECTORY_SEPARATOR . "themes";
$themeManager->init(null);
$this->setThemeManager($themeManager);
}
public function getPassword() {
return $this->_pass;
}
public function setPassword($_pass) {
$this->_pass = $_pass;
}
}
?>
|