summaryrefslogtreecommitdiff
path: root/framework/Wsat/TWsatService.php
blob: 009ad302ff597062c24fd1d59ba18d0cc9df8124 (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
<?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
 */
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");
        parent::init($config);        
    }

    public function getBasePath() {
        $basePath = Prado::getPathOfNamespace("System.Wsat.pages");
        return realpath($basePath);
    }

    public function getPassword() {
        return $this->_pass;
    }

    public function setPassword($_pass) {
        $this->_pass = $_pass;
    }

}

?>