本文整理汇总了PHP中DataSource类的典型用法代码示例。如果您正苦于以下问题:PHP DataSource类的具体用法?PHP DataSource怎么用?PHP DataSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataSource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: DataBind
function DataBind()
{
//$this->DataSource = new DataSource();
$ds = new DataSource($this->DataSource);
$ds->DataList = $this->DataSource;
$ds->arrDataColumns = $this->DataColumns;
$this->Data = $ds->GetData($this->DataColumns);
}
开发者ID:rogerwebmaster,项目名称:Philweb,代码行数:8,代码来源:BaseDataControl.class.php
示例2: findAll
/**
* Find all DB records and generate array with arrays that filled by records data.
*/
public function findAll($where = '1=1', $limit = null)
{
$sql = 'SELECT * FROM ' . $this->tableName() . ' WHERE ' . $where . ' ' . ($limit !== null ? ' LIMIT ' . $limit : '');
$sth = new DataSource($sql);
$models = array();
while (($model = $sth->getLine()) !== false) {
$models[] = $model;
}
return $models;
}
开发者ID:zahar-g,项目名称:small_mvc_frmwrk,代码行数:13,代码来源:Model.php
示例3: handle
private function handle($col)
{
$globalDAO = new GlobalDAO(DataSource::getInstance());
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$content = trim(remove_slashes($_POST['content']));
if ($globalDAO->update($col, $content)) {
$message = array('type' => 'info', 'value' => 'Lưu thành công.');
} else {
$message = array('type' => 'error', 'value' => 'Có lỗi xảy ra!');
}
$this->registry->template->message = $message;
$this->registry->template->content = $content;
$tmp = $globalDAO->select($col);
$this->registry->template->content_backup = $tmp;
} else {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$tmp = $globalDAO->select($col);
$this->registry->template->content = $tmp;
$this->registry->template->content_backup = $tmp;
}
}
if ($col == 'about') {
$s = '“Giới thiệu”';
} else {
if ($col == 'contact') {
$s = '“Liên hệ”';
}
}
$this->registry->template->tile_title = 'Soạn thảo trang ' . $s;
$this->registry->template->tile_content = 'admin/compose.php';
$this->registry->template->show('admin/layout/admin.php');
}
开发者ID:katatunix,项目名称:gaby-shop,代码行数:32,代码来源:compose.php
示例4: getBrands
public function getBrands()
{
$brands = array();
$pdo = DataSource::load();
$data = array();
$statement = 'SELECT brand.*, category.name AS categoryName FROM brand
LEFT JOIN category ON brand.category = category.id
WHERE deleted = 0';
if (!empty($this->categoryId)) {
$statement .= ' AND category = :category';
$data['category'] = $this->categoryId;
}
if ($this->status !== null) {
$statement .= ' AND status = :status';
$data['status'] = $this->status;
}
if (!empty($this->orderBy)) {
$statement .= ' ORDER BY ' . $this->orderBy;
}
if (!empty($this->limit)) {
$statement .= ' LIMIT ' . (int) $this->limit;
}
if (!empty($this->offset)) {
$statement .= ' OFFSET ' . (int) $this->offset;
}
$preparedStatement = $pdo->prepare($statement);
$preparedStatement->execute($data);
$brandsData = $preparedStatement->fetchAll();
foreach ($brandsData as $brandData) {
$brand = new Brand();
$brand->setProperties($brandData);
$brands[] = $brand;
}
return $brands;
}
开发者ID:Aqro,项目名称:findguidelines,代码行数:35,代码来源:BrandQuery.php
示例5: index
public function index()
{
if (empty($_GET['seo_url'])) {
$this->notFound();
return;
}
$promoDAO = new PromoDAO(DataSource::getInstance());
$promo = $promoDAO->findBySeoUrl($_GET['seo_url']);
if (!$promo) {
$this->notFound();
return;
}
$categoryDAO = new CatDAO(DataSource::getInstance());
$categories_list = $categoryDAO->findByAll_Navigation();
$cart = getCart();
$this->registry->template->categories_list = $categories_list;
$this->registry->template->cart = $cart;
$this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
$this->registry->template->is_promo_active = TRUE;
$this->registry->template->promo = $promo;
$this->registry->template->related_promos = $promoDAO->findNewestList();
$this->registry->template->tile_title = $promo['subject'];
$this->registry->template->tile_content = 'promo.php';
$this->registry->template->tile_footer = 'footer.php';
$this->registry->template->show('layout/user.php');
}
开发者ID:katatunix,项目名称:gaby-shop,代码行数:26,代码来源:promo.php
示例6: loader
public function loader()
{
$this->getController();
if (!is_readable($this->file)) {
$this->file = $this->path . '/error404.php';
$this->controller = 'error404';
}
include $this->file;
$pos = strrpos($this->controller, '/');
if ($pos) {
$this->controller = substr($this->controller, $pos + 1);
}
$class = $this->controller . 'Controller';
$controller = new $class($this->registry);
session_start();
if (!is_callable(array($controller, $this->action))) {
$action = 'index';
} else {
$action = $this->action;
}
$controller->countStats();
if ($controller->checkPermission($action)) {
$controller->{$action}();
} else {
$controller->showError777();
}
DataSource::closeCon();
}
开发者ID:katatunix,项目名称:gaby-shop,代码行数:28,代码来源:Router.class.php
示例7: __construct
public function __construct($config = array())
{
parent::__construct($config);
$this->Node = ClassRegistry::init('Nodes.Node');
$this->TypeField = ClassRegistry::init('CustomFields.TypeField');
$this->columns = $this->Node->getDataSource()->columns;
}
开发者ID:cvo-technologies,项目名称:croogo-nodes-datasource-plugin,代码行数:7,代码来源:CroogoNodesSource.php
示例8: __construct
public function __construct($init = array())
{
$this->clazz = get_class($this);
$this->dirty = false;
$this->ds = DataSource::getSettings(SPHORM_ENV);
if (!isset(self::$reflectors[$this->clazz])) {
self::$reflectors[$this->clazz] = new ReflectionClass($this->clazz);
}
$this->loadStaticFields();
if (isset($this->mapping['table'])) {
$this->table = $this->mapping['table'];
} else {
$this->table = $this->clazz;
}
if (!empty($init)) {
foreach ($init as $key => $val) {
if (is_int($key)) {
throw new Excetion('Illegal argument: init parameters require assoc array...');
}
$this->data[$key] = $val;
}
}
//check if current clazz was defined as a bean
$beansAsKeys = array_flip(Beans::$beans);
if (!isset($beansAsKeys[$this->clazz])) {
throw new Exception('Undefined bean ' . $this->clazz . '. Please check Beans.php');
}
$this->db = new Db($this->ds, $this->clazz, $this->table, false);
$this->createOrUpdateDbModel();
}
开发者ID:codegooglecom,项目名称:sphorm,代码行数:30,代码来源:Sphorm.php
示例9: index
public function index()
{
$globalDAO = new GlobalDAO(DataSource::getInstance());
$this->registry->template->count_stats = $globalDAO->getStats();
$this->registry->template->tile_title = 'Trang quản trị';
$this->registry->template->tile_content = 'admin/dashboard.php';
$this->registry->template->show('admin/layout/admin.php');
}
开发者ID:katatunix,项目名称:gaby-shop,代码行数:8,代码来源:dashboard.php
示例10: convert
/**
* Source currency
* @param $source
*
* Destination currency
* @param $destination
*
* Amount to convert
* @param $amount
*/
function convert($source, $destination, $amount)
{
$currencies = $this->source->fetch();
if (!isset($currencies[$source])) {
throw new \RuntimeException("Currency not found: {$source}");
}
if (!isset($currencies[$destination])) {
throw new \RuntimeException("Currency not found: {$destination}");
}
return $amount * $currencies[$destination] / $currencies[$source];
}
开发者ID:Et3rnal1,项目名称:currency,代码行数:21,代码来源:Converter.php
示例11:
function __construct($config)
{
parent::__construct($config);
$this->api_key = $this->config['api_key'];
$this->username = $this->config['username'];
$this->password = $this->config['password'];
}
开发者ID:Jewgonewild,项目名称:Pikchur-Datasource-for-CakePHP,代码行数:7,代码来源:pikchur_source.php
示例12: __construct
public function __construct($config = array(), $autoConnect = true)
{
parent::__construct($config);
$config['region'] = $this->region;
$this->S3 = S3Client::factory($config);
$this->bucketName = $config['bucket_name'];
}
开发者ID:katsukii,项目名称:cakephp2_aws_s3_datasource,代码行数:7,代码来源:S3.php
示例13: __construct
/**
* Datasource constructor, creates the Configuration, Connection and DocumentManager objects
*
* ### You can pass the following configuration options
*
* - server: name of the server that will be used to connect to Mongo (default: `localhost`)
* - database: name of the database to use when connecting to Mongo (default: `cake`)
* - documentPaths: array containing a list of full path names where Document classes can be located (default: `App::path('Model')`)
* - proxyDir: full path to the directory that will contain the generated proxy classes for each document (default: `TMP . 'cache'`)
* - proxyNamespace: string representing the namespace the proxy classes will reside in (default: `Proxies`)
* - hydratorDir: directory well the hydrator classes will be generated in (default: `TMP . 'cache'`)
* - hydratorNamespace: string representing the namespace the hydrator classes will reside in (default: `Hydrators`)
*
* @param arary $config
* @param boolean $autoConnect whether this object should attempt connection on creation
* @throws MissingConnectionException if it was not possible to connect to MongoDB
*/
public function __construct($config = array(), $autoConnect = true)
{
$modelPaths = $this->_cleanupPaths(App::path('Model'));
$this->_baseConfig = array('proxyDir' => TMP . 'cache', 'proxyNamespace' => 'Proxies', 'hydratorDir' => TMP . 'cache', 'hydratorNamespace' => 'Hydrators', 'server' => 'localhost', 'database' => 'cake', 'documentPaths' => $modelPaths, 'prefix' => null);
foreach (CakePlugin::loaded() as $plugin) {
$this->_baseConfig['documentPaths'] = array_merge($this->_baseConfig['documentPaths'], $this->_cleanupPaths(App::path('Model', $plugin)));
}
parent::__construct($config);
extract($this->config, EXTR_OVERWRITE);
$configuration = new Configuration();
$configuration->setProxyDir($proxyDir);
$configuration->setProxyNamespace($proxyNamespace);
$configuration->setHydratorDir($hydratorDir);
$configuration->setHydratorNamespace($hydratorNamespace);
$configuration->setDefaultDB($database);
$configuration->setMetadataDriverImpl($this->_getMetadataReader($documentPaths));
if (Configure::read('debug') === 0) {
$configuration->setAutoGenerateHydratorClasses(false);
$configuration->setAutoGenerateProxyClasses(false);
$configuration->setMetadataCacheImpl(new ApcCache());
}
$this->configuration = $configuration;
$this->connection = new Connection($server, array(), $configuration);
$this->documentManager = DocumentManager::create($this->connection, $configuration);
$this->documentManager->getEventManager()->addEventListener(array(Events::prePersist, Events::preUpdate, Events::preRemove, Events::postPersist, Events::postUpdate, Events::postRemove), $this);
try {
if ($autoConnect) {
$this->connect();
}
} catch (Exception $e) {
throw new MissingConnectionException(array('class' => get_class($this)));
}
$this->setupLogger();
}
开发者ID:beyondkeysystem,项目名称:MongoCake,代码行数:51,代码来源:CakeMongoSource.php
示例14: describe
/**
* Since Datasource has the method `describe()`, it won't be caught `__call()`.
* This ensures it is called on the original datasource properly.
*
* @param mixed $model
* @return mixed
*/
public function describe($model)
{
if (method_exists($this->source, 'describe')) {
return $this->source->describe($model);
}
return $this->describe($model);
}
开发者ID:jeremyharris,项目名称:cacher,代码行数:14,代码来源:CacheSource.php
示例15: HttpSocket
function __construct($config)
{
parent::__construct($config);
$this->Http =& new HttpSocket();
$this->email = $this->config['email'];
$this->password = $this->config['password'];
}
开发者ID:naterkane,项目名称:lithium-foursquare-datasource,代码行数:7,代码来源:foursquare-source.php
示例16: __construct
/**
* Constructor
* @param array $config An array defining the configuration settings
*/
public function __construct($config)
{
//Construct API version in this to go to SalesforceBaseClass!
parent::__construct($config);
$this->_baseConfig = $config;
$this->connect();
}
开发者ID:richardvella,项目名称:Salesforce-Enterprise-API-CakePHP-2.x-Plugin,代码行数:11,代码来源:SalesforceSource.php
示例17: closeCon
public static function closeCon()
{
if (self::$instance) {
self::$instance->closeSql();
self::$instance = NULL;
}
}
开发者ID:katatunix,项目名称:gaby-shop,代码行数:7,代码来源:DataSource.class.php
示例18: HttpSocket
function __construct($config)
{
parent::__construct($config);
$this->Http =& new HttpSocket();
$this->username = $this->config['username'];
$this->password = $this->config['password'];
}
开发者ID:afzet,项目名称:cake-cart,代码行数:7,代码来源:twitter_source.php
示例19: read
public function read(Model $model, $queryData = array(), $recursive = null)
{
parent::read($model, $queryData, $recursive);
$services = array();
if (!empty($queryData['conditions']['servicos'])) {
if (is_array($queryData['conditions']['servicos'])) {
foreach ($queryData['conditions']['servicos'] as $servico) {
$services[] = $this->services[$servico];
}
} else {
$services = $this->services[$queryData['conditions']['servicos']];
}
} else {
// SET DEFAULT FORMAT
$this->format = ECTFormatos::FORMATO_CAIXA_PACOTE;
}
if (!empty($queryData['conditions']['formato'])) {
$this->format = $queryData['conditions']['formato'];
}
// GET VALUES
$return = $this->_getECTValues($queryData['conditions']['altura'], $queryData['conditions']['comprimento'], $queryData['conditions']['largura'], $queryData['conditions']['peso'], $queryData['conditions']['ceporigem'], $queryData['conditions']['cep'], $services, $this->format);
// CONVERTS ARRAY ITERATOR TO ARRAY
$return = iterator_to_array($return, true);
// CONVERT ARRAY OBJECTS TO ARRAY
$return = $this->_toArray($return);
// INSERT MODEL NAME AND RETURNS
return $this->_fixReturn($return);
}
开发者ID:John-Henrique,项目名称:CakePHP-Correios-Datasource,代码行数:28,代码来源:CorreiosSource.php
示例20: HttpSocket
function __construct($config)
{
parent::__construct($config);
$this->Http =& new HttpSocket();
$this->params['login'] = $this->config['login'];
$this->params['apiKey'] = $this->config['apiKey'];
}
开发者ID:studdrcom,项目名称:Bitly-Datasource-for-CakePHP,代码行数:7,代码来源:bitly_source.php
注:本文中的DataSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论