本文整理汇总了PHP中prado类的典型用法代码示例。如果您正苦于以下问题:PHP prado类的具体用法?PHP prado怎么用?PHP prado使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了prado类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createApiProvider
/**
* Creates the API provider instance for the current request
* @param TRpcProtocol $protocolHandler instance
* @param string $providerId
*/
public function createApiProvider(TRpcProtocol $protocolHandler, $providerId)
{
$_properties = $this->apiProviders[$providerId];
if (($_providerClass = $_properties->remove('class')) === null) {
throw new TConfigurationException('rpcservice_apiprovider_required');
}
prado::using($_providerClass);
$_providerClassName = ($_pos = strrpos($_providerClass, '.')) !== false ? substr($_providerClass, $_pos + 1) : $_providerClass;
if (!is_subclass_of($_providerClassName, self::BASE_API_PROVIDER)) {
throw new TConfigurationException('rpcservice_apiprovider_invalid');
}
if (($_rpcServerClass = $_properties->remove('server')) === null) {
$_rpcServerClass = self::BASE_RPC_SERVER;
}
prado::using($_rpcServerClass);
$_rpcServerClassName = ($_pos = strrpos($_rpcServerClass, '.')) !== false ? substr($_rpcServerClass, $_pos + 1) : $_rpcServerClass;
if (!is_subclass_of($_rpcServerClassName, self::BASE_RPC_SERVER)) {
throw new TConfigurationException('rpcservice_rpcserver_invalid');
}
$_apiProvider = new $_providerClassName(new $_rpcServerClassName($protocolHandler));
$_apiProvider->setId($providerId);
foreach ($_properties as $_key => $_value) {
$_apiProvider->setSubProperty($_key, $_value);
}
return $_apiProvider;
}
示例2: getInstanceOfClass
/**
* get instance of
*
*/
public function getInstanceOfClass($className)
{
switch ($className) {
case 'Users':
prado::using('Application.logic.Logic_Users');
return new Logic_Users($this->db);
break;
case 'Penanggalan':
prado::using('Application.logic.Logic_Penanggalan');
return new Logic_Penanggalan($this->db);
break;
case 'Setup':
prado::using('Application.logic.Logic_Setup');
return new Logic_Setup($this->db);
break;
case 'DMaster':
prado::using('Application.logic.Logic_DMaster');
return new Logic_DMaster($this->db);
break;
case 'Obat':
prado::using('Application.logic.Logic_Obat');
return new Logic_Obat($this->db);
break;
case 'Report':
prado::using('Application.logic.Logic_Report');
return new Logic_Report($this->db);
break;
default:
throw new Exception("Logic_Factory.php :: {$className} tidak di ketahui");
}
}
示例3: setUp
public function setUp()
{
if (self::$app === null) {
self::$app = new TApplication(dirname(__FILE__) . '/app');
prado::setPathofAlias('App', dirname(__FILE__));
}
if (self::$config === null) {
// Simulate a config file
self::$config = new TXmlDocument('1.0', 'utf8');
self::$config->loadFromString('<users><user name="Joe" password="demo"/><user name="John" password="demo" /><user name="test" password="test" roles="Reader, User"/><role name="Administrator" users="John" /><role name="Writer" users="Joe, John" /></users>');
}
}
示例4: setUp
public function setUp()
{
if (self::$app === null) {
self::$app = new TApplication(dirname(__FILE__) . '/app');
prado::setPathofAlias('App', dirname(__FILE__));
}
if (self::$mgr === null) {
$config = new TXmlDocument('1.0', 'utf8');
$config->loadFromString('<users><user name="Joe" password="demo"/><user name="John" password="demo" /><role name="Administrator" users="John" /><role name="Writer" users="Joe,John" /></users>');
self::$mgr = new TUserManager();
self::$mgr->init($config);
}
}
示例5: getTable
/**
* Obtains the metadata for the named table.
* @param string table name
* @return TDbTableSchema table metadata. Null if the named table does not exist.
*/
public function getTable($name)
{
if (isset($this->_tables[$name])) {
return $this->_tables[$name];
} else {
if (!isset($this->_cacheExclude[$name]) && ($duration = $this->_connection->schemaCachingDuration) > 0 && ($cache = prado::getApplication()->getCache()) !== null) {
$key = 'prado:dbschema' . $this->_connection->connectionString . ':' . $this->_connection->username . ':' . $name;
if (($table = $cache->get($key)) === false) {
$table = $this->createTable($name);
$cache->set($key, $table, $duration);
}
return $this->_tables[$name] = $table;
} else {
return $this->_tables[$name] = $this->createTable($name);
}
}
}
示例6: linkOpen
/**
* digunakan untuk membuka koneksi ke server, dan memilih database
*
*/
private function linkOpen()
{
$this->prepareParameters();
switch ($this->DbType) {
case 'postgres':
prado::using('Application.lib.Database.PostgreSQL');
$this->Link = new PostgreSQL();
$config = array("host" => $this->Host, "port" => $this->DbPort, "user" => $this->UserName, "password" => $this->UserPassword, "dbname" => $this->DbName);
break;
case 'mysql':
prado::using('Application.lib.Database.MySQL');
$this->Link = new MySQL();
$config = array("host" => $this->Host, "user" => $this->UserName, "password" => $this->UserPassword, "dbname" => $this->DbName);
break;
default:
throw new Exception('No Driver Found.');
}
$this->Link->connectDB($config);
}
示例7: onInit
public function onInit($param)
{
//first i like to get all records...
$mydata = array();
// populates post data into the repeater
$companies = $this->buildData();
foreach ($companies as $companie) {
$criteria_p = new TActiveRecordCriteria();
$criteria_p->Condition = 'idta_partei = :idta_partei';
$criteria_p->Parameters[':idta_partei'] = $companie->idta_partei;
$templisteadresse = ParteiAdresseRecord::finder()->findAll($criteria_p);
$listeadresse = (array) $templisteadresse;
//print_r($listeadresse);
foreach ($listeadresse as $walker) {
$conditionx = new TActiveRecordCriteria();
$conditionx->Condition = 'idta_adresse = :idta_adresse';
$conditionx->Parameters[':idta_adresse'] = $walker->idta_adresse;
array_push($mydata, AdresseRecord::finder()->find($conditionx));
}
}
//print_r($mydata);
$ii = 0;
foreach ($mydata as $mylocaladress) {
$marker = prado::createComponent('BActiveGoogleMapMarker');
$marker->setID("p" . $ii);
//$marker->setTitle('Adress:'.$mylocaladress->adresse_town."-".$mylocaladress->adresse_street);
$marker->setTitle('Standort');
$marker->setPoint(array($mylocaladress->adresse_lat, $mylocaladress->adresse_long));
$marker->setVisible(true);
$infobulle = prado::createComponent('TLabel');
$infobulle->setID('greentradeinfo' . $mylocaladress->idta_adresse);
$infobulle->setText("Klappt");
$marker->addedControl($infobulle);
$this->GoogleMap->addMarker($marker);
if ($ii == 0) {
$this->GoogleMap->setCenter("(" . implode(",", array($mylocaladress->adresse_lat, $mylocaladress->adresse_long)) . ")");
}
$ii++;
}
}
示例8: setUp
public function setUp()
{
// Fake environment variables needed to determine path
$_SERVER['HTTP_HOST'] = 'localhost';
$_SERVER['SERVER_NAME'] = 'localhost';
$_SERVER['SERVER_PORT'] = '80';
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/demos/personal/index.php?page=Links';
$_SERVER['SCRIPT_NAME'] = '/demos/personal/index.php';
$_SERVER['PHP_SELF'] = '/demos/personal/index.php';
$_SERVER['QUERY_STRING'] = 'page=Links';
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
$_SERVER['PATH_INFO'] = __FILE__;
$_SERVER['HTTP_REFERER'] = 'http://www.pradosoft.com';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3';
$_SERVER['REMOTE_HOST'] = 'localhost';
if (self::$app === null) {
self::$app = new TApplication(dirname(__FILE__) . '/app');
}
if (self::$assetDir === null) {
self::$assetDir = dirname(__FILE__) . '/assets';
}
// Make asset directory if not exists
if (!file_exists(self::$assetDir)) {
if (is_writable(dirname(self::$assetDir))) {
mkdir(self::$assetDir);
} else {
throw new Exception('Directory ' . dirname(self::$assetDir) . ' is not writable');
}
} elseif (!is_dir(self::$assetDir)) {
throw new Exception(self::$assetDir . ' exists and is not a directory');
}
// Define an alias to asset directory
prado::setPathofAlias('AssetAlias', self::$assetDir);
}
示例9: __construct
<?php
/**
*
* digunakan untuk memproses setup aplikasi
*
*/
prado::using('Application.logic.Logic_Global');
class Logic_Setup extends Logic_Global
{
/**
*
* setting application
*/
private $settings;
/**
*
* file parameters xpath
*/
private $parameters;
public function __construct($db)
{
parent::__construct($db);
$this->loadSetting();
$this->parameters = $this->Application->getParameters();
}
/**
* digunakan untuk meload setting
*/
public function loadSetting($flush = false)
{
示例10: getPath
/**
*
* Mendapatkan Path
*
*/
public function getPath($path = null)
{
$_path = prado::getPathOfAlias('Application') . DIRECTORY_SEPARATOR;
if ($path === null) {
return $path = $_path;
} else {
return $_path . $path . DIRECTORY_SEPARATOR;
}
}
示例11: onLoad
<?php
prado::using('Application.MainPageSA');
class PerpetualStock extends MainPageSA
{
public $dataobat;
public function onLoad($param)
{
parent::onLoad($param);
$this->showSubMenuReportStock = true;
$this->showReportPerpetualStock = true;
$this->createObj('DMaster');
$this->createObj('Obat');
if (!$this->IsPostBack && !$this->IsCallBack) {
if (isset($_SESSION['currentPagePerpetualStock']['dataobat']['idobat'])) {
$this->detailProcess();
$this->populateData();
} else {
if (!isset($_SESSION['currentPagePerpetualStock']) || $_SESSION['currentPagePerpetualStock']['page_name'] != 'sa.report.PerpetualStock') {
$_SESSION['currentPagePerpetualStock'] = array('page_name' => 'sa.report.PerpetualStock', 'page_num' => 0, 'search' => false, 'dataobat' => array());
}
}
}
}
public function checkKodeObat($sender, $param)
{
$kode_obat = $param->Value;
if ($kode_obat != '') {
try {
if (!$this->DB->checkRecordIsExist('kode_obat', 'master_obat', $kode_obat)) {
throw new Exception("Kode Obat ({$kode_obat}) tidak tersedia silahkan ganti dengan yang lain.");
示例12: onPreRender
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of POrganisationSelection
*
* @author PFRENZ
*/
Prado::using('System.Web.UI.TTemplateControl');
prado::using('System.Web.UI.ActiveControls.TActiveControlAdapter');
class PTimeSelection extends TTemplateControl implements IActiveControl, ICallbackEventHandler
{
public function onPreRender($writer)
{
//$this->registerClientScripts();
}
public function __construct()
{
parent::__construct();
$this->setAdapter(new TActiveControlAdapter($this));
}
/**
* @return TBaseActiveControl basic active control options.
*/
public function getActiveControl()
{
return $this->getAdapter()->getBaseActiveControl();
}
示例13:
<?php
/**
* TSqliteCommandBuilder class file.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright Copyright © 2008-2009 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
prado::using('System.Testing.Data.Schema.TDbCommandBuilder');
/**
* TSqliteCommandBuilder provides basic methods to create query commands for SQLite tables.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Id: TSqliteCommandBuilder.php 2679 2009-06-15 07:49:42Z Christophe.Boulain $
* @package System.Testing.Data.Schema.sqlite
* @since 1.0
*/
class TSqliteCommandBuilder extends TDbCommandBuilder
{
/**
* Generates the expression for selecting rows with specified composite key values.
* This method is overridden because SQLite does not support the default
* IN expression with composite columns.
* @param TDbTableSchema the table schema
* @param array list of primary key values to be selected within
* @param string column prefix (ended with dot)
* @return string the expression for selection
* @since 1.0.4
*/
示例14: getGuestName
<?php
prado::using('Application.UserManager');
class Autorisasi extends TModule implements IUserManager
{
/**
* @return string name for a guest user
*/
public function getGuestName()
{
return 'Guest';
}
/**
* returns a user instance given the username
* @param string username, null if it is a guest
* @return TUser the user instance, null if the specified username is not the user database
*
*/
public function getUser($username = null)
{
if ($username === null) {
$user = new TUser($this);
$user->setIsGuest(true);
return $user;
} else {
$user = new TUser($this);
$um = new UserManager();
$um->setUser($username);
$datauser = $um->getDataUser();
$bool = true;
switch ($datauser['page']) {
示例15: quoteTableName
<?php
/**
* TMysqlSchema class file.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright Copyright © 2008-2009 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
prado::using('System.Testing.Data.Schema.TDbSchema');
prado::using('System.Testing.Data.Schema.mysql.TMysqlTableSchema');
prado::using('System.Testing.Data.Schema.mysql.TMysqlColumnSchema');
/**
* TMysqlSchema is the class for retrieving metadata information from a MySQL database (version 4.1.x and 5.x).
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Id: TMysqlSchema.php 2679 2009-06-15 07:49:42Z Christophe.Boulain $
* @package System.Testing.Data.Schema.mysql
* @since 1.0
*/
class TMysqlSchema extends TDbSchema
{
private $_tableNames;
private $_schemaNames;
/**
* Quotes a table name for use in a query.
* @param string table name
* @return string the properly quoted table name
*/
public function quoteTableName($name)