本文整理汇总了PHP中System::import方法的典型用法代码示例。如果您正苦于以下问题:PHP System::import方法的具体用法?PHP System::import怎么用?PHP System::import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System::import方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Hashtable
/**
* @brief Retourne une collection des paramètres du contexte
* @return Hashtable
*/
public function &getParams()
{
System::import('System.ADT.Hashtable');
$rv =& new Hashtable();
foreach ($this->_params as $key => $value) {
$rv->put($key, $this->_params[$key]);
}
return $rv;
}
示例2: createNew
/**
* @brief Instancie la classe concrête adéquate pour le driver fournit
* @param $driver IDataSourceDriver driver de connexion
* @return DbmsDataSource
*/
private static function createNew(IDataSourceDriver &$driver)
{
$rv = null;
if ('mysql' == $driver->getScheme()) {
System::import('System.DataSource.Dbms.DbmsMysql');
$rv =& new DbmsMysql($driver);
} else {
throw new Exception('Unsupported dbms driver scheme');
}
return $rv;
}
示例3: createNew
/**
* @brief Instancie et retourne un �l�ment de formulaire
* @param $enum_const const \ref FormInputType
* @param $input_name string Nom de l'�l�ment
* @return FormInput
* @throw Exception
*/
public static function createNew($enum_const, $input_name)
{
$rv = null;
if (FormInputEnumeration::TYPE_TEXT == $enum_const) {
System::import('System.FormInput.Inputs.TextField');
$rv =& new TextField($input_name);
} elseif (FormInputEnumeration::TYPE_CHECKBOX == $enum_const) {
System::import('System.FormInput.Inputs.Checkbox');
$rv =& new Checkbox($input_name);
}
if (!is_null($rv)) {
FormInput::registerItem($rv);
}
return $rv;
}
示例4: XmlDataGridSource
/**
* @brief Instancie la classe concrête correspondante à la signature de driver fournie
* @param $driverSignature string signature du driver
* @return DataGridSource
* @throw Exception
*/
public final function &createNew($driverSignature)
{
$rv = null;
$dgDriver =& DataSourceDriver::createNew($driverSignature);
if ('xml' == $dgDriver->getScheme()) {
System::import('System.DataGrid.DataSources.XmlDataGridSource');
$rv =& new XmlDataGridSource($dgDriver);
/**
* @todo Supprimer ce if = 'mysql' car on devrait pas avoir a connaitre le type de dbms
* modification du driver ?
* appel à une méthode statique de dbmsdatasource/dbmsdatagridsource ?
*/
} elseif ('mysql' == $dgDriver->getScheme()) {
System::import('System.DataGrid.DataSources.DbmsDataGridSource');
$rv =& new DbmsDataGridSource($dgDriver);
} else {
throw new Exception('Unsupported datasource scheme');
}
return $rv;
}
示例5: __construct
<?php
/**
* @package ADT.Iterators
* @class AbstractCollectionIterator
* @author Jimmy CHARLEBOIS
* @date 21-02-2007
* @brief Classe abstraire pour iterateur de collection
*/
System::import('System.Interfaces.Iteration.IDynamicIterator');
System::import('System.Exceptions.IllegalArgumentException');
abstract class AbstractCollectionIterator implements IDynamicIterator
{
private $_collection;
private $_pointeur;
public function __construct(ICollection &$collection)
{
$this->_collection =& $collection;
$this->_pointeur = -1;
}
public function __clone()
{
$this->_collection = clone $this->_collection;
$this->rewind();
}
public function rewind()
{
$this->_pointeur = -1;
}
public function hasNext()
{
示例6: __construct
<?php
/**
* @package ADT
* @class AbstractScalar
* @author Jimmy CHARLEBOIS
* @date 21-02-2007
* @brief Classe abstraite pour les objets ADT scalaire
*/
System::import('System.Interfaces.ADT.IADT');
System::import('System.Interfaces.Comparator.IComparable');
abstract class AbstractScalar implements IADT, IComparable
{
private $_value;
protected function __construct($value)
{
$this->_value = $value;
}
public function getValue()
{
return $this->_value;
}
public function toString()
{
return (string) $this;
}
public function compareTo(IComparable $o)
{
$rv = 0;
if ($this->getValue() < $o->getValue()) {
$rv = -1;
示例7: getColumnCount
<?php
/**
* @package Table
* @interface ITableModel
* @author Jimmy CHARLEBOIS
* @date 28-02-2007
* @brief
*/
System::import('System.Interfaces.MVC.IModel');
interface ITableModel extends IModel
{
// public function addTableModelListener( ITableListener &$listener );
// public function removeTableModelListener( ITableListener &$listener );
/**
* @brief Retourne le nombre de colonne pr�sentes dans le mod�le
* @return integer
*/
public function getColumnCount();
/**
* @brief Retourne le libell� associ�e � une colonne
* @param $columnIndex integer le num�ro de la colonne
* @return string
*/
public function getColumnName($columnIndex);
/**
* @brief Retourne le nombre de lignes pr�sentes dans le mod�le
* @return integer
*/
public function getRowCount();
/**
示例8: Caddy
System::export($caddyId, '-- Caddy ID --');
/*
System::export( $s->delete( $caddyId ), '-- Delete caddy --' );
*/
$caddy =& $s->loadById($caddyId);
if (is_null($caddy)) {
$caddy =& new Caddy();
}
System::export($s->getDateUpdate(), '-- Last update time --');
$t =& new CaddyItem('AZERTY', 1, 0);
$caddy->removeCaddyItem($t);
$s->save();
$db->dispose();
System::export('-- saving to caddies.xml --');
System::import('System.DataSource.XmlDataSource');
System::import('System.Caddy.Storage.CaddyXmlBlobStorage');
$xml =& new XmlDataSource(DataSourceDriver::createNew('xml://caddies.xml/'));
$s =& new CaddyXmlBlobStorage($xml, $caddy);
$xml->connect();
System::export($s->save($caddyId));
$caddy =& $s->loadById($caddyId);
if (is_null($caddy)) {
$caddy =& new Caddy();
}
$xml->dispose();
System::export($caddy->size(), '-- caddy\' size --');
System::export('-- iterate items --');
$iterator =& $caddy->getIterator();
while ($iterator->hasNext()) {
$caddyItem =& $iterator->next();
System::export($caddyItem, 'élément n°' . $iterator->key());
示例9: __construct
<?php
/**
* @package IO
* @class SysFile
* @author Jimmy CHARLEBOIS
* @date 24-01-2007
* @brief Manipulation de fichier
*/
System::import('System.Interfaces.IResource');
System::import('System.Exceptions.IOException');
class SysFile implements IResource
{
private $_filename;
private $_path;
private $_extension;
protected $_filepath;
protected $_resource;
/** @defgroup FileAccessType Constantes pour définir le type d'accès au log */
/*@{*/
/** @brief Accès en écriture seule (mode écrasement) */
const WRITE_ACCESS = 1;
/** @brief Accès en lecture seule */
const READ_ACCESS = 2;
/** @brief Accès en écriture seule (mode ajout) */
const APPEND_ACCESS = 4;
/** @brief Permet l'écriture de données binaires */
const BINARY_ACCESS = 8;
/*@}*/
public function __construct($filepath)
{
示例10: __construct
<?php
/**
* @package Context
* @class RuntimeContext
* @author Jimmy CHARLEBOIS
* @date 04-12-2006
* @brief Décoration de contexte pour contexte d'exécution
*/
System::import('System.Interfaces.Context.IContext');
class RuntimeContext implements IContext
{
private $_context;
private $_runtime_vars;
public function __construct(IContext $context)
{
$this->_context =& $context;
$this->_runtime_vars = array();
}
public function __call($methodName, $args)
{
if (is_callable(array($this->_context, $methodName))) {
return call_user_func_array(array($this->_context, $methodName), $args);
}
}
public function &getParams()
{
return $this->_context->getParams();
}
public function hasParam($key)
{
示例11: __construct
<?php
/**
* @package Form
* @class FormChecker
* @author Jimmy CHARLEBOIS
* @date 13-06-2006
* @brief Représentation d'un formulaire à vérifier
*/
System::import('System.Interfaces.MVC.IModel');
System::import('System.Form.FormChecker.Field');
System::import('System.Form.FormChecker.Helper.*');
System::import('System.Form.FormChecker.Modifier.*');
class FormChecker implements IModel
{
private $_ItsFields;
private $_ItsErrors;
/** @brief Contexte d'exécution partagé par tous les éléments */
private static $_context = null;
const REQUIRED = true;
const TYPE_TEXT = 1;
const TYPE_SELECT = 2;
const TYPE_NUMERIC = 4;
const TYPE_FLOAT = 8;
const TYPE_RADIO = 16;
const TYPE_CHECKBOX = 32;
const TYPE_UPLOAD = 64;
public function __construct()
{
if (is_null(self::$_context)) {
throw new Exception('Context must be defined');
示例12: __construct
<?php
/**
* @package ADT
* @class AbstractTypedList
* @author Jimmy CHARLEBOIS
* @date 21-02-2007
* @brief Classe abstraite pour gérer des List avec des éléments typés
* @example adt-typedlist-loader.php
*/
System::import('System.Interfaces.ADT.IList');
System::import('System.ADT.AbstractTypedCollection');
System::import('System.Exceptions.TypeMismatchException');
abstract class AbstractTypedList extends AbstractTypedCollection implements IList
{
protected function __construct($type, IList &$list)
{
parent::__construct($type, $list);
}
public function set($index, $o)
{
if (!is_a($o, $this->_type)) {
throw new TypeMismatchException(sprintf('Argument must be an instance of %s object', $this->_type));
}
$this->_collection->set($index, $o);
}
public function &get($index)
{
return $this->_collection->get($index);
}
public function indexOf($o)
示例13: __construct
<?php
/**
* @package DataSource
* @class DbmsMysql
* @author Jimmy CHARLEBOIS
* @date 02-01-2007
* @brief Implémentation concrête de DbmsDataSource pour MySQL
*/
System::import('System.DataSource.Dbms.ResultSets.ResultSetMysql');
class DbmsMysql extends DbmsDataSource
{
public function __construct(IDataSourceDriver $driver)
{
parent::__construct($driver);
}
public function connect()
{
if (is_resource($this->getResource())) {
return true;
}
$driver =& $this->getDriver();
$res = @mysql_connect($driver->getHost(), $driver->getUsername(), $driver->getPassword());
if (!$res) {
throw new Exception('Unable to connect with ' . $driver->toString());
}
$this->setResource($res);
return @mysql_select_db($driver->getDbName(), $res);
}
public function close()
{
示例14:
<?php
/**
* @package Network.Http
* @class HttpMessage
* @author Jimmy CHARLEBOIS
* @date 14-02-2007
* @brief Classe sous jacente encapsulant un message HTTP (requête ou réponse)
*/
System::import('System.Interfaces.Network.IHttpMessage');
class HttpMessage implements IHttpMessage
{
private $_type;
private $_url;
private $_method;
private $_version;
private $_raw;
private $_headers;
private $_body;
private $_querystring;
private $_response_code;
private $_response_statut;
const EOL = "\r\n";
/** @defgroup HttpMessageType Constantes pour les méthodes d'envoi d'un message Http */
/*@{*/
const REQUEST = 1;
const RESPONSE = 2;
/*@}*/
/** @defgroup HttpMessageMethod Constantes pour les méthodes d'envoi d'un message Http */
/*@{*/
const METHOD_POST = 'post';
示例15: __construct
<?php
/**
* @package Log
* @class FileLog
* @author Jimmy CHARLEBOIS
* @date 24-01-2007
* @brief Fichier de journalisation
* @code
* $log =& new FileLog( 'test.log' );
* $log->write( 'Un message à logguer !' );
* $log->dispose();
* @endcode
*/
System::import('System.Interfaces.Log.ILog');
System::import('System.IO.SysFile');
class FileLog implements ILog, IResource
{
private $_resource;
public function __construct($filename)
{
$this->_resource = new SysFile($filename);
$this->_resource->open(SysFile::APPEND_ACCESS);
}
public function write($data)
{
$data = sprintf('[%s] %s%s', date('Y-m-d H:i:s'), $data, System::crlf);
return $this->_resource->write($data);
}
public function dispose()
{