本文整理汇总了PHP中Prado::using方法的典型用法代码示例。如果您正苦于以下问题:PHP Prado::using方法的具体用法?PHP Prado::using怎么用?PHP Prado::using使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prado
的用法示例。
在下文中一共展示了Prado::using方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getZendSearch
protected function getZendSearch()
{
if (is_null($this->_search)) {
$this->importZendNamespace();
Prado::using('Zend.Search.Lucene');
$this->_search = new Zend_Search_Lucene($this->_data);
}
return $this->_search;
}
示例2: getSqlMapManager
/**
* Create and configure the data mapper using sqlmap configuration file.
* Or if cache is enabled and manager already cached load from cache.
* If cache is enabled, the data mapper instance is cached.
*
* @return TSqlMapManager SqlMap manager instance
* @since 3.1.7
*/
public function getSqlMapManager()
{
Prado::using('System.Data.SqlMap.TSqlMapManager');
if (($manager = $this->loadCachedSqlMapManager()) === null) {
$manager = new TSqlMapManager($this->getDbConnection());
if (strlen($file = $this->getConfigFile()) > 0) {
$manager->configureXml($file);
$this->cacheSqlMapManager($manager);
}
} elseif ($this->getConnectionID() !== '') {
$manager->setDbConnection($this->getDbConnection());
}
return $manager;
}
示例3: getInstance
/**
* Obtain database specific TDbMetaData class using the driver name of the database connection.
* @param TDbConnection database connection.
* @return TDbMetaData database specific TDbMetaData.
*/
public static function getInstance($conn)
{
$conn->setActive(true);
//must be connected before retrieving driver name
$driver = $conn->getDriverName();
switch (strtolower($driver)) {
case 'pgsql':
Prado::using('System.Data.Common.Pgsql.TPgsqlMetaData');
return new TPgsqlMetaData($conn);
case 'mysqli':
case 'mysql':
Prado::using('System.Data.Common.Mysql.TMysqlMetaData');
return new TMysqlMetaData($conn);
case 'sqlite':
//sqlite 3
//sqlite 3
case 'sqlite2':
//sqlite 2
Prado::using('System.Data.Common.Sqlite.TSqliteMetaData');
return new TSqliteMetaData($conn);
case 'mssql':
// Mssql driver on windows hosts
// Mssql driver on windows hosts
case 'sqlsrv':
// sqlsrv driver on windows hosts
// sqlsrv driver on windows hosts
case 'dblib':
// dblib drivers on linux (and maybe others os) hosts
Prado::using('System.Data.Common.Mssql.TMssqlMetaData');
return new TMssqlMetaData($conn);
case 'oci':
Prado::using('System.Data.Common.Oracle.TOracleMetaData');
return new TOracleMetaData($conn);
// case 'ibm':
// Prado::using('System.Data.Common.IbmDb2.TIbmDb2MetaData');
// return new TIbmDb2MetaData($conn);
// case 'ibm':
// Prado::using('System.Data.Common.IbmDb2.TIbmDb2MetaData');
// return new TIbmDb2MetaData($conn);
default:
throw new TDbException('ar_invalid_database_driver', $driver);
}
}
示例4: addStandalone
public function addStandalone($function, $id, $param = NULL)
{
$db = $this->Application->getModule('horuxDb')->DbConnection;
$db->Active = true;
$sql = "SELECT type FROM hr_device GROUP BY type";
$cmd = $db->createCommand($sql);
$data = $cmd->query();
$data = $data->readAll();
foreach ($data as $d) {
$type = $d['type'];
try {
Prado::using('horux.pages.hardware.device.' . $type . '.' . $type . '_standalone');
$class = $type . '_standalone';
if (class_exists($class)) {
$sa = new $class();
$sa->addStandalone($function, $id, $param);
}
} catch (Exception $e) {
//! do noting
}
}
}
示例5: callServiceComponent
/**
* @param mixed $params the function name and parameters
* @return mixed the component service response
* @soapmethod
*/
public function callServiceComponent($params)
{
if (is_array($params)) {
if (array_key_exists(0, $params)) {
if (array_key_exists(1, $params)) {
if (array_key_exists(2, $params)) {
try {
Prado::using('horux.pages.components.' . $params[0] . '.webservice.' . $params[1]);
$comp = new $params[1]();
if (method_exists($comp, $params[2])) {
if (array_key_exists(3, $params)) {
return $comp->{$params}[2]($params[3]);
} else {
return $comp->{$params}[2]();
}
} else {
return -4;
}
//Function not exists
} catch (Exception $e) {
return -5;
//class not exists
}
} else {
return -3;
//!Missing function
}
} else {
return -2;
}
//! Missing class
} else {
return -1;
//!Missing component
}
} else {
return false;
}
}
示例6: testCurrencyPatterns
<?php
//NOTE: This page require UTF-8 aware editors
Prado::using('System.I18N.core.NumberFormatInfo');
/**
* @package System.I18N.core
*/
class NumberFormatInfoTest extends PHPUnit_Framework_TestCase
{
function testCurrencyPatterns()
{
$numberInfo = NumberFormatInfo::getCurrencyInstance();
//there should be 2 decimal places.
$this->assertEquals($numberInfo->DecimalDigits, 2);
$this->assertEquals($numberInfo->DecimalSeparator, '.');
$this->assertEquals($numberInfo->GroupSeparator, ',');
//there should be only 1 grouping of size 3
$groupsize = array(3, false);
$this->assertEquals($numberInfo->GroupSizes, $groupsize);
//the default negative pattern prefix and postfix
$negPattern = array('-¤', '');
$this->assertEquals($numberInfo->NegativePattern, $negPattern);
//the default positive pattern prefix and postfix
$negPattern = array('¤', '');
$this->assertEquals($numberInfo->PositivePattern, $negPattern);
//the default currency symbol
$this->assertEquals($numberInfo->CurrencySymbol, 'US$');
$this->assertEquals($numberInfo->getCurrencySymbol('JPY'), '¥');
$this->assertEquals($numberInfo->NegativeInfinitySymbol, '-∞');
$this->assertEquals($numberInfo->PositiveInfinitySymbol, '+∞');
$this->assertEquals($numberInfo->NegativeSign, '-');
示例7: getTableInfoClass
/**
* TOracleMetaData class file.
*
* @author Marcos Nobre <marconobre[at]gmail[dot]com>
* @link http://www.pradosoft.com/
* @copyright Copyright © 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id: TOracleMetaData.php 2787 2010-03-17 14:58:30Z rojaro $
* @package System.Data.Common.Oracle
*/
/**
* Load the base TDbMetaData class.
*/
Prado::using('System.Data.Common.TDbMetaData');
Prado::using('System.Data.Common.Oracle.TOracleTableInfo');
Prado::using('System.Data.Common.Oracle.TOracleTableColumn');
/**
* TOracleMetaData loads Oracle database table and column information.
*
* @author Marcos Nobre <marconobre[at]gmail[dot]com>
* @version $Id: TOracleMetaData.php 2787 2010-03-17 14:58:30Z rojaro $
* @package System.Data.Common.Oracle
* @since 3.1
*/
class TOracleMetaData extends TDbMetaData
{
private $_defaultSchema = 'system';
/**
* @return string TDbTableInfo class name.
*/
protected function getTableInfoClass()
示例8:
<?php
/**
* TScaffoldSearch class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link https://github.com/pradosoft/prado
* @copyright Copyright © 2005-2015 The PRADO Group
* @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
* @version $Id$
* @package System.Data.ActiveRecord.Scaffold
*/
/**
* Import the scaffold base.
*/
Prado::using('System.Data.ActiveRecord.Scaffold.TScaffoldBase');
/**
* TScaffoldSearch provide a simple textbox and a button that is used
* to perform search on a TScaffoldListView with ID given by {@link setListViewID ListViewID}.
*
* The {@link getSearchText SearchText} property is a TTextBox and the
* {@link getSearchButton SearchButton} property is a TButton with label value "Search".
*
* Searchable fields of the Active Record can be restricted by specifying
* a comma delimited string of allowable fields in the
* {@link setSearchableFields SearchableFields} property. The default is null,
* meaning that most text type fields are searched (the default searchable fields
* are database dependent).
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @version $Id$
示例9:
<?php
/**
* TDbCache class file
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
* @copyright Copyright © 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id: TDbCache.php 2938 2011-06-01 07:46:44Z ctrlaltca@gmail.com $
* @package System.Caching
*/
Prado::using('System.Data.TDbConnection');
/**
* TDbCache class
*
* TDbCache implements a cache application module by storing cached data in a database.
*
* TDbCache relies on {@link http://www.php.net/manual/en/ref.pdo.php PDO} to retrieve
* data from databases. In order to use TDbCache, you need to enable the PDO extension
* as well as the corresponding PDO DB driver. For example, to use SQLite database
* to store cached data, you need both php_pdo and php_pdo_sqlite extensions.
*
* By default, TDbCache creates and uses an SQLite database under the application
* runtime directory. You may change this default setting by specifying the following
* properties:
* - {@link setConnectionID ConnectionID} or
* - {@link setConnectionString ConnectionString}, {@link setUsername Username} and {@link setPassword Pasword}.
*
* The cached data is stored in a table in the specified database.
* By default, the name of the table is called 'pradocache'. If the table does not
示例10: validateAttributes
protected function validateAttributes($type, $attributes)
{
Prado::using($type);
if (($pos = strrpos($type, '.')) !== false) {
$className = substr($type, $pos + 1);
} else {
$className = $type;
}
$class = new ReflectionClass($className);
if (is_subclass_of($className, 'TControl') || $className === 'TControl') {
foreach ($attributes as $name => $att) {
if (($pos = strpos($name, '.')) !== false) {
// a subproperty, so the first segment must be readable
$subname = substr($name, 0, $pos);
if (!$class->hasMethod('get' . $subname)) {
throw new TConfigurationException('template_property_unknown', $type, $subname);
}
} else {
if (strncasecmp($name, 'on', 2) === 0) {
// an event
if (!$class->hasMethod($name)) {
throw new TConfigurationException('template_event_unknown', $type, $name);
} else {
if (!is_string($att)) {
throw new TConfigurationException('template_eventhandler_invalid', $type, $name);
}
}
} else {
// a simple property
if (!($class->hasMethod('set' . $name) || $class->hasMethod('setjs' . $name) || $this->isClassBehaviorMethod($class, $name))) {
if ($class->hasMethod('get' . $name) || $class->hasMethod('getjs' . $name)) {
throw new TConfigurationException('template_property_readonly', $type, $name);
} else {
throw new TConfigurationException('template_property_unknown', $type, $name);
}
} else {
if (is_array($att) && $att[0] !== self::CONFIG_EXPRESSION) {
if (strcasecmp($name, 'id') === 0) {
throw new TConfigurationException('template_controlid_invalid', $type);
} else {
if (strcasecmp($name, 'skinid') === 0) {
throw new TConfigurationException('template_controlskinid_invalid', $type);
}
}
}
}
}
}
}
} else {
if (is_subclass_of($className, 'TComponent') || $className === 'TComponent') {
foreach ($attributes as $name => $att) {
if (is_array($att) && $att[0] === self::CONFIG_DATABIND) {
throw new TConfigurationException('template_databind_forbidden', $type, $name);
}
if (($pos = strpos($name, '.')) !== false) {
// a subproperty, so the first segment must be readable
$subname = substr($name, 0, $pos);
if (!$class->hasMethod('get' . $subname)) {
throw new TConfigurationException('template_property_unknown', $type, $subname);
}
} else {
if (strncasecmp($name, 'on', 2) === 0) {
throw new TConfigurationException('template_event_forbidden', $type, $name);
} else {
// id is still alowed for TComponent, even if id property doesn't exist
if (strcasecmp($name, 'id') !== 0 && !$class->hasMethod('set' . $name)) {
if ($class->hasMethod('get' . $name)) {
throw new TConfigurationException('template_property_readonly', $type, $name);
} else {
throw new TConfigurationException('template_property_unknown', $type, $name);
}
}
}
}
}
} else {
throw new TConfigurationException('template_component_required', $type);
}
}
}
示例11:
<?php
Prado::using('System.Data.ActiveRecord.*');
class Frecuencia extends TActiveRecord
{
const TABLE = 'frecuencia';
public $id_frecuencia;
public $frecuencia;
}
示例12:
<?php
/**
* TCache and cache dependency classes.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
* @copyright Copyright © 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
* @package System.Caching
*/
Prado::using('System.Collections.TList');
/**
* TCache class
*
* TCache is the base class for cache classes with different cache storage implementation.
*
* TCache implements the interface {@link ICache} with the following methods,
* - {@link get} : retrieve the value with a key (if any) from cache
* - {@link set} : store the value with a key into cache
* - {@link add} : store the value only if cache does not have this key
* - {@link delete} : delete the value with the specified key from cache
* - {@link flush} : delete all values from cache
*
* Each value is associated with an expiration time. The {@link get} operation
* ensures that any expired value will not be returned. The expiration time by
* the number of seconds. A expiration time 0 represents never expire.
*
* By definition, cache does not ensure the existence of a value
* even if it never expires. Cache is not meant to be an persistent storage.
*
示例13: getTableInfoClass
<?php
/**
* TMssqlMetaData class file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
* @copyright Copyright © 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
* @package System.Data.Common.Mssql
*/
/**
* Load the base TDbMetaData class.
*/
Prado::using('System.Data.Common.TDbMetaData');
Prado::using('System.Data.Common.Mssql.TMssqlTableInfo');
/**
* TMssqlMetaData loads MSSQL database table and column information.
*
* @author Wei Zhuo <weizho[at]gmail[dot]com>
* @package System.Data.Common.Mssql
* @since 3.1
*/
class TMssqlMetaData extends TDbMetaData
{
/**
* @return string TDbTableInfo class name.
*/
protected function getTableInfoClass()
{
return 'TMssqlTableInfo';
示例14: onLoad
<?php
Prado::using('horux.pages.openTime.sql');
class add extends Page
{
protected $timeArray = array();
protected $lastId = 0;
public function onLoad($param)
{
parent::onLoad($param);
}
public function onApply($sender, $param)
{
if ($this->Page->IsValid) {
if ($this->saveData()) {
$pBack = array('okMsg' => Prado::localize('The open time was added successfully'), 'id' => $this->lastId);
$this->Response->redirect($this->Service->constructUrl('openTime.mod', $pBack));
} else {
$pBack = array('koMsg' => Prado::localize('The open time was not added'));
}
}
}
public function onSave($sender, $param)
{
if ($this->Page->IsValid) {
if ($this->saveData()) {
$pBack = array('okMsg' => Prado::localize('The open time was added successfully'));
} else {
$pBack = array('koMsg' => Prado::localize('The open time was not added'));
}
$this->Response->redirect($this->Service->constructUrl('openTime.openTimeList', $pBack));
示例15: onInit
<?php
/**
* @author Daniel Sampedro Bello <darthdaniel85@gmail.com>
* @link https://github.com/pradosoft/prado
* @copyright Copyright © 2005-2015 The PRADO Group
* @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
* @version $Id$
* @since 3.3
* @package Wsat.pages
*/
Prado::using("System.Wsat.TWsatScaffoldingGenerator");
class TWsatScaffolding extends TPage
{
public function onInit($param)
{
parent::onInit($param);
$this->startVisual();
}
private function startVisual()
{
$scf_generator = new TWsatScaffoldingGenerator();
foreach ($scf_generator->getAllTableNames() as $tableName) {
$dynChb = new TCheckBox();
$dynChb->ID = "cb_{$tableName}";
$dynChb->Text = ucfirst($tableName);
$dynChb->Checked = true;
$this->registerObject("cb_{$tableName}", $dynChb);
$this->tableNames->getControls()->add($dynChb);
$this->tableNames->getControls()->add("</br>");
}