diff options
author | ctrlaltca <> | 2012-07-12 11:21:01 +0000 |
---|---|---|
committer | ctrlaltca <> | 2012-07-12 11:21:01 +0000 |
commit | 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 (patch) | |
tree | e08bf04f0823650a231227ac3499121270172a23 /demos/northwind-db | |
parent | 3e4e6e66aeb3f8fea4e1eb4237498ef9d2358f63 (diff) |
standardize the use of unix eol; use svn properties to enforce native eol
Diffstat (limited to 'demos/northwind-db')
-rw-r--r-- | demos/northwind-db/index.php | 54 | ||||
-rw-r--r-- | demos/northwind-db/protected/database/Category.php | 50 | ||||
-rw-r--r-- | demos/northwind-db/protected/database/Customer.php | 64 | ||||
-rw-r--r-- | demos/northwind-db/protected/database/Employee.php | 94 | ||||
-rw-r--r-- | demos/northwind-db/protected/database/Order.php | 82 | ||||
-rw-r--r-- | demos/northwind-db/protected/database/OrderDetail.php | 52 | ||||
-rw-r--r-- | demos/northwind-db/protected/database/Product.php | 70 | ||||
-rw-r--r-- | demos/northwind-db/protected/database/Region.php | 48 | ||||
-rw-r--r-- | demos/northwind-db/protected/database/Shipper.php | 48 | ||||
-rw-r--r-- | demos/northwind-db/protected/database/Supplier.php | 66 | ||||
-rw-r--r-- | demos/northwind-db/protected/database/Territory.php | 118 | ||||
-rw-r--r-- | demos/northwind-db/protected/pages/NorthwindCrud.php | 54 |
12 files changed, 400 insertions, 400 deletions
diff --git a/demos/northwind-db/index.php b/demos/northwind-db/index.php index 94e60d49..ef243159 100644 --- a/demos/northwind-db/index.php +++ b/demos/northwind-db/index.php @@ -1,28 +1,28 @@ -<?php
-
-$basePath=dirname(__FILE__);
-$frameworkPath=$basePath.'/../../framework/prado.php';
-$assetsPath=$basePath.'/assets';
-$runtimePath=$basePath.'/protected/runtime';
-
-if(!is_file($frameworkPath))
- die("Unable to find prado framework path $frameworkPath.");
-if(!is_writable($assetsPath))
- die("Please make sure that the directory $assetsPath is writable by Web server process.");
-if(!is_writable($runtimePath))
- die("Please make sure that the directory $runtimePath is writable by Web server process.");
-
-/** SQLite Northwind database file **/
-$sqlite_dir = $basePath.'/protected/data';
-$sqlite_db = $sqlite_dir.'/Northwind.db';
-if(!is_writable($sqlite_dir))
- die("Please make sure that the directory $sqlite_dir is writable by Web server process.");
-if(!is_writable($sqlite_db))
- die("Please make sure that the sqlite database file $sqlite_db is writable by Web server process.");
-
-require_once($frameworkPath);
-
-$application=new TApplication;
-$application->run();
-
+<?php + +$basePath=dirname(__FILE__); +$frameworkPath=$basePath.'/../../framework/prado.php'; +$assetsPath=$basePath.'/assets'; +$runtimePath=$basePath.'/protected/runtime'; + +if(!is_file($frameworkPath)) + die("Unable to find prado framework path $frameworkPath."); +if(!is_writable($assetsPath)) + die("Please make sure that the directory $assetsPath is writable by Web server process."); +if(!is_writable($runtimePath)) + die("Please make sure that the directory $runtimePath is writable by Web server process."); + +/** SQLite Northwind database file **/ +$sqlite_dir = $basePath.'/protected/data'; +$sqlite_db = $sqlite_dir.'/Northwind.db'; +if(!is_writable($sqlite_dir)) + die("Please make sure that the directory $sqlite_dir is writable by Web server process."); +if(!is_writable($sqlite_db)) + die("Please make sure that the sqlite database file $sqlite_db is writable by Web server process."); + +require_once($frameworkPath); + +$application=new TApplication; +$application->run(); + ?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Category.php b/demos/northwind-db/protected/database/Category.php index 06fc979f..d708ee96 100644 --- a/demos/northwind-db/protected/database/Category.php +++ b/demos/northwind-db/protected/database/Category.php @@ -1,26 +1,26 @@ -<?php
-/**
- * Auto generated by prado-cli.php on 2007-05-01 05:24:53.
- */
-class Category extends TActiveRecord
-{
- const TABLE='Categories';
-
- public $CategoryID;
- public $CategoryName;
- public $Description;
- public $Picture;
-
- public $Products=array();
-
- public static $RELATIONS=array
- (
- 'Products' => array(self::HAS_MANY, 'Product'),
- );
-
- public static function finder($className=__CLASS__)
- {
- return parent::finder($className);
- }
-}
+<?php +/** + * Auto generated by prado-cli.php on 2007-05-01 05:24:53. + */ +class Category extends TActiveRecord +{ + const TABLE='Categories'; + + public $CategoryID; + public $CategoryName; + public $Description; + public $Picture; + + public $Products=array(); + + public static $RELATIONS=array + ( + 'Products' => array(self::HAS_MANY, 'Product'), + ); + + public static function finder($className=__CLASS__) + { + return parent::finder($className); + } +} ?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Customer.php b/demos/northwind-db/protected/database/Customer.php index 810f2a6a..464b384d 100644 --- a/demos/northwind-db/protected/database/Customer.php +++ b/demos/northwind-db/protected/database/Customer.php @@ -1,33 +1,33 @@ -<?php
-/**
- * Auto generated by prado-cli.php on 2007-05-01 05:28:47.
- */
-class Customer extends TActiveRecord
-{
- const TABLE='Customers';
-
- public $CustomerID;
- public $CompanyName;
- public $ContactName;
- public $ContactTitle;
- public $Address;
- public $City;
- public $Region;
- public $PostalCode;
- public $Country;
- public $Phone;
- public $Fax;
-
- public $Orders=array();
-
- public static $RELATIONS = array
- (
- 'Orders' => array(self::HAS_MANY, 'Order'),
- );
-
- public static function finder($className=__CLASS__)
- {
- return parent::finder($className);
- }
-}
+<?php +/** + * Auto generated by prado-cli.php on 2007-05-01 05:28:47. + */ +class Customer extends TActiveRecord +{ + const TABLE='Customers'; + + public $CustomerID; + public $CompanyName; + public $ContactName; + public $ContactTitle; + public $Address; + public $City; + public $Region; + public $PostalCode; + public $Country; + public $Phone; + public $Fax; + + public $Orders=array(); + + public static $RELATIONS = array + ( + 'Orders' => array(self::HAS_MANY, 'Order'), + ); + + public static function finder($className=__CLASS__) + { + return parent::finder($className); + } +} ?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Employee.php b/demos/northwind-db/protected/database/Employee.php index 1e0f090e..573b887d 100644 --- a/demos/northwind-db/protected/database/Employee.php +++ b/demos/northwind-db/protected/database/Employee.php @@ -1,48 +1,48 @@ -<?php
-/**
- * Auto generated by prado-cli.php on 2007-05-01 05:29:32.
- */
-class Employee extends TActiveRecord
-{
- const TABLE='Employees';
-
- public $EmployeeID;
- public $LastName;
- public $FirstName;
- public $Title;
- public $TitleOfCourtesy;
- public $BirthDate;
- public $HireDate;
- public $Address;
- public $City;
- public $Region;
- public $PostalCode;
- public $Country;
- public $HomePhone;
- public $Extension;
- public $Photo;
- public $Notes;
- public $ReportsTo;
- public $PhotoPath;
-
- public $Territories=array();
- public $Orders=array();
- public $Subordinates=array();
- public $Superior;
-
- public static $RELATIONS = array
- (
- 'Territories' => array(self::MANY_TO_MANY, 'Territory', 'EmployeeTerritories'),
- 'Orders' => array(self::HAS_MANY, 'Order'),
-
- //parent children relationship
- 'Subordinates' => array(self::HAS_MANY, 'Employee'),
- 'Superior' => array(self::BELONGS_TO, 'Employee')
- );
-
- public static function finder($className=__CLASS__)
- {
- return parent::finder($className);
- }
-}
+<?php +/** + * Auto generated by prado-cli.php on 2007-05-01 05:29:32. + */ +class Employee extends TActiveRecord +{ + const TABLE='Employees'; + + public $EmployeeID; + public $LastName; + public $FirstName; + public $Title; + public $TitleOfCourtesy; + public $BirthDate; + public $HireDate; + public $Address; + public $City; + public $Region; + public $PostalCode; + public $Country; + public $HomePhone; + public $Extension; + public $Photo; + public $Notes; + public $ReportsTo; + public $PhotoPath; + + public $Territories=array(); + public $Orders=array(); + public $Subordinates=array(); + public $Superior; + + public static $RELATIONS = array + ( + 'Territories' => array(self::MANY_TO_MANY, 'Territory', 'EmployeeTerritories'), + 'Orders' => array(self::HAS_MANY, 'Order'), + + //parent children relationship + 'Subordinates' => array(self::HAS_MANY, 'Employee'), + 'Superior' => array(self::BELONGS_TO, 'Employee') + ); + + public static function finder($className=__CLASS__) + { + return parent::finder($className); + } +} ?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Order.php b/demos/northwind-db/protected/database/Order.php index 228fb2b5..2a425102 100644 --- a/demos/northwind-db/protected/database/Order.php +++ b/demos/northwind-db/protected/database/Order.php @@ -1,42 +1,42 @@ -<?php
-/**
- * Auto generated by prado-cli.php on 2007-05-01 05:29:47.
- */
-class Order extends TActiveRecord
-{
- const TABLE='Orders';
-
- public $OrderID;
- public $CustomerID;
- public $EmployeeID;
- public $OrderDate;
- public $RequiredDate;
- public $ShippedDate;
- public $ShipVia;
- public $Freight;
- public $ShipName;
- public $ShipAddress;
- public $ShipCity;
- public $ShipRegion;
- public $ShipPostalCode;
- public $ShipCountry;
-
- public $OrderDetails=array();
- public $Customer;
- public $Shipper;
- public $Employee;
-
- public static $RELATIONS = array
- (
- 'OrderDetails' => array(self::HAS_MANY, 'OrderDetail'),
- 'Customer' => array(self::BELONGS_TO, 'Customer'),
- 'Shipper' => array(self::BELONGS_TO, 'Shipper'),
- 'Employee' => array(self::BELONGS_TO, 'Employee'),
- );
-
- public static function finder($className=__CLASS__)
- {
- return parent::finder($className);
- }
-}
+<?php +/** + * Auto generated by prado-cli.php on 2007-05-01 05:29:47. + */ +class Order extends TActiveRecord +{ + const TABLE='Orders'; + + public $OrderID; + public $CustomerID; + public $EmployeeID; + public $OrderDate; + public $RequiredDate; + public $ShippedDate; + public $ShipVia; + public $Freight; + public $ShipName; + public $ShipAddress; + public $ShipCity; + public $ShipRegion; + public $ShipPostalCode; + public $ShipCountry; + + public $OrderDetails=array(); + public $Customer; + public $Shipper; + public $Employee; + + public static $RELATIONS = array + ( + 'OrderDetails' => array(self::HAS_MANY, 'OrderDetail'), + 'Customer' => array(self::BELONGS_TO, 'Customer'), + 'Shipper' => array(self::BELONGS_TO, 'Shipper'), + 'Employee' => array(self::BELONGS_TO, 'Employee'), + ); + + public static function finder($className=__CLASS__) + { + return parent::finder($className); + } +} ?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/OrderDetail.php b/demos/northwind-db/protected/database/OrderDetail.php index 1732b0d9..47f77351 100644 --- a/demos/northwind-db/protected/database/OrderDetail.php +++ b/demos/northwind-db/protected/database/OrderDetail.php @@ -1,27 +1,27 @@ -<?php
-
-class OrderDetail extends TActiveRecord
-{
- const TABLE='Order Details';
-
- public $OrderID;
- public $ProductID;
- public $UnitPrice;
- public $Quantity;
- public $Discount;
-
- public $Product;
- public $Order;
-
- public static $RELATIONS = array
- (
- 'Product' => array(self::BELONGS_TO, 'Product'),
- 'Order' => array(self::BELONGS_TO, 'Order'),
- );
-
- public static function finder($className=__CLASS__)
- {
- return parent::finder($className);
- }
-}
+<?php + +class OrderDetail extends TActiveRecord +{ + const TABLE='Order Details'; + + public $OrderID; + public $ProductID; + public $UnitPrice; + public $Quantity; + public $Discount; + + public $Product; + public $Order; + + public static $RELATIONS = array + ( + 'Product' => array(self::BELONGS_TO, 'Product'), + 'Order' => array(self::BELONGS_TO, 'Order'), + ); + + public static function finder($className=__CLASS__) + { + return parent::finder($className); + } +} ?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Product.php b/demos/northwind-db/protected/database/Product.php index 93736ab8..088fbbd2 100644 --- a/demos/northwind-db/protected/database/Product.php +++ b/demos/northwind-db/protected/database/Product.php @@ -1,36 +1,36 @@ -<?php
-/**
- * Auto generated by prado-cli.php on 2007-05-01 05:31:51.
- */
-class Product extends TActiveRecord
-{
- const TABLE='Products';
-
- public $ProductID;
- public $ProductName;
- public $SupplierID;
- public $CategoryID;
- public $QuantityPerUnit;
- public $UnitPrice;
- public $UnitsInStock;
- public $UnitsOnOrder;
- public $ReorderLevel;
- public $Discontinued;
-
- public $Supplier;
- public $Category;
- public $OrderDetails=array();
-
- public static $RELATIONS = array
- (
- 'Supplier' => array(self::BELONGS_TO, 'Supplier'),
- 'Category' => array(self::BELONGS_TO, 'Category'),
- 'OrderDetails' => array(self::HAS_MANY, 'OrderDetail'),
- );
-
- public static function finder($className=__CLASS__)
- {
- return parent::finder($className);
- }
-}
+<?php +/** + * Auto generated by prado-cli.php on 2007-05-01 05:31:51. + */ +class Product extends TActiveRecord +{ + const TABLE='Products'; + + public $ProductID; + public $ProductName; + public $SupplierID; + public $CategoryID; + public $QuantityPerUnit; + public $UnitPrice; + public $UnitsInStock; + public $UnitsOnOrder; + public $ReorderLevel; + public $Discontinued; + + public $Supplier; + public $Category; + public $OrderDetails=array(); + + public static $RELATIONS = array + ( + 'Supplier' => array(self::BELONGS_TO, 'Supplier'), + 'Category' => array(self::BELONGS_TO, 'Category'), + 'OrderDetails' => array(self::HAS_MANY, 'OrderDetail'), + ); + + public static function finder($className=__CLASS__) + { + return parent::finder($className); + } +} ?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Region.php b/demos/northwind-db/protected/database/Region.php index 3d1c2a84..6473e682 100644 --- a/demos/northwind-db/protected/database/Region.php +++ b/demos/northwind-db/protected/database/Region.php @@ -1,25 +1,25 @@ -<?php
-/**
- * Auto generated by prado-cli.php on 2007-05-01 05:32:34.
- */
-class Region extends TActiveRecord
-{
- const TABLE='Region';
-
- public $RegionID;
- public $RegionDescription;
-
- //comment out the following line to use lazy loading
- //public $Territories=array();
-
- public static $RELATIONS = array
- (
- 'Territories' => array(self::HAS_MANY, 'Territory')
- );
-
- public static function finder($className=__CLASS__)
- {
- return parent::finder($className);
- }
-}
+<?php +/** + * Auto generated by prado-cli.php on 2007-05-01 05:32:34. + */ +class Region extends TActiveRecord +{ + const TABLE='Region'; + + public $RegionID; + public $RegionDescription; + + //comment out the following line to use lazy loading + //public $Territories=array(); + + public static $RELATIONS = array + ( + 'Territories' => array(self::HAS_MANY, 'Territory') + ); + + public static function finder($className=__CLASS__) + { + return parent::finder($className); + } +} ?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Shipper.php b/demos/northwind-db/protected/database/Shipper.php index a3f0aeb3..f90548ea 100644 --- a/demos/northwind-db/protected/database/Shipper.php +++ b/demos/northwind-db/protected/database/Shipper.php @@ -1,25 +1,25 @@ -<?php
-/**
- * Auto generated by prado-cli.php on 2007-05-01 05:32:57.
- */
-class Shipper extends TActiveRecord
-{
- const TABLE='Shippers';
-
- public $ShipperID;
- public $CompanyName;
- public $Phone;
-
- public $Orders = array();
-
- public static $RELATIONS = array
- (
- 'Orders' => array(self::HAS_MANY, 'Order'),
- );
-
- public static function finder($className=__CLASS__)
- {
- return parent::finder($className);
- }
-}
+<?php +/** + * Auto generated by prado-cli.php on 2007-05-01 05:32:57. + */ +class Shipper extends TActiveRecord +{ + const TABLE='Shippers'; + + public $ShipperID; + public $CompanyName; + public $Phone; + + public $Orders = array(); + + public static $RELATIONS = array + ( + 'Orders' => array(self::HAS_MANY, 'Order'), + ); + + public static function finder($className=__CLASS__) + { + return parent::finder($className); + } +} ?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Supplier.php b/demos/northwind-db/protected/database/Supplier.php index 7cabdde5..bc3b44e0 100644 --- a/demos/northwind-db/protected/database/Supplier.php +++ b/demos/northwind-db/protected/database/Supplier.php @@ -1,34 +1,34 @@ -<?php
-/**
- * Auto generated by prado-cli.php on 2007-05-01 05:33:08.
- */
-class Supplier extends TActiveRecord
-{
- const TABLE='Suppliers';
-
- public $SupplierID;
- public $CompanyName;
- public $ContactName;
- public $ContactTitle;
- public $Address;
- public $City;
- public $Region;
- public $PostalCode;
- public $Country;
- public $Phone;
- public $Fax;
- public $HomePage;
-
- public $Products=array();
-
- public static $RELATIONS=array
- (
- 'Products' => array(self::HAS_MANY, 'Product')
- );
-
- public static function finder($className=__CLASS__)
- {
- return parent::finder($className);
- }
-}
+<?php +/** + * Auto generated by prado-cli.php on 2007-05-01 05:33:08. + */ +class Supplier extends TActiveRecord +{ + const TABLE='Suppliers'; + + public $SupplierID; + public $CompanyName; + public $ContactName; + public $ContactTitle; + public $Address; + public $City; + public $Region; + public $PostalCode; + public $Country; + public $Phone; + public $Fax; + public $HomePage; + + public $Products=array(); + + public static $RELATIONS=array + ( + 'Products' => array(self::HAS_MANY, 'Product') + ); + + public static function finder($className=__CLASS__) + { + return parent::finder($className); + } +} ?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/database/Territory.php b/demos/northwind-db/protected/database/Territory.php index 16f33dea..96006bb1 100644 --- a/demos/northwind-db/protected/database/Territory.php +++ b/demos/northwind-db/protected/database/Territory.php @@ -1,60 +1,60 @@ -<?php
-/**
- * Auto generated by prado-cli.php on 2007-05-01 05:33:28.
- */
-class Territory extends TActiveRecord
-{
- const TABLE='Territories';
-
- public $TerritoryID;
- public $TerritoryDescription;
- public $RegionID;
-
- private $_region;
- private $_employees;
-
- public static $RELATIONS = array
- (
- 'Region' => array(self::BELONGS_TO, 'Region'),
- 'Employees' => array(self::HAS_MANY, 'Employee', 'EmployeeTerritories')
- );
-
- /**
- * @return Region
- */
- public function getRegion()
- {
- //lazy load the region
- if($this->_region===null)
- $this->_region = Region::finder()->findByPk($this->RegionID);
- return $this->_region;
- }
-
- public function setRegion($value)
- {
- $this->_region=$value;
- }
-
- /**
- * @return Employee[]
- */
- public function getEmployees()
- {
- //lazy load
- if($this->_employees==null)
- $this->setEmployees($this->withEmployees()->findByPk($this->TerritoryID)->getEmployees());
- return $this->_employees;
- }
-
- public function setEmployees($value)
- {
- //ensure TList
- $this->_employees = $value instanceof TList ? $value : new TList($value);
- }
-
- public static function finder($className=__CLASS__)
- {
- return parent::finder($className);
- }
-}
+<?php +/** + * Auto generated by prado-cli.php on 2007-05-01 05:33:28. + */ +class Territory extends TActiveRecord +{ + const TABLE='Territories'; + + public $TerritoryID; + public $TerritoryDescription; + public $RegionID; + + private $_region; + private $_employees; + + public static $RELATIONS = array + ( + 'Region' => array(self::BELONGS_TO, 'Region'), + 'Employees' => array(self::HAS_MANY, 'Employee', 'EmployeeTerritories') + ); + + /** + * @return Region + */ + public function getRegion() + { + //lazy load the region + if($this->_region===null) + $this->_region = Region::finder()->findByPk($this->RegionID); + return $this->_region; + } + + public function setRegion($value) + { + $this->_region=$value; + } + + /** + * @return Employee[] + */ + public function getEmployees() + { + //lazy load + if($this->_employees==null) + $this->setEmployees($this->withEmployees()->findByPk($this->TerritoryID)->getEmployees()); + return $this->_employees; + } + + public function setEmployees($value) + { + //ensure TList + $this->_employees = $value instanceof TList ? $value : new TList($value); + } + + public static function finder($className=__CLASS__) + { + return parent::finder($className); + } +} ?>
\ No newline at end of file diff --git a/demos/northwind-db/protected/pages/NorthwindCrud.php b/demos/northwind-db/protected/pages/NorthwindCrud.php index 57694caa..72297ac8 100644 --- a/demos/northwind-db/protected/pages/NorthwindCrud.php +++ b/demos/northwind-db/protected/pages/NorthwindCrud.php @@ -1,28 +1,28 @@ -<?php
-
-class NorthwindCrud extends TPage
-{
- function onInit($param)
- {
- $classes = $this->getRecordClassList(Prado::getPathOfNamespace('Application.database.*'));
- $this->class_list->dataSource = $classes;
- $this->class_list->dataBind();
- }
-
- protected function getRecordClassList($directory)
- {
- $list=array();
- $folder=@opendir($directory);
- while($entry=@readdir($folder))
- {
- if($entry[0]==='.')
- continue;
- else if(is_file($directory.'/'.$entry) && strpos($entry,'.php'))
- $list[] = str_replace('.php', '', $entry);
- }
- closedir($folder);
- return $list;
- }
-}
-
+<?php + +class NorthwindCrud extends TPage +{ + function onInit($param) + { + $classes = $this->getRecordClassList(Prado::getPathOfNamespace('Application.database.*')); + $this->class_list->dataSource = $classes; + $this->class_list->dataBind(); + } + + protected function getRecordClassList($directory) + { + $list=array(); + $folder=@opendir($directory); + while($entry=@readdir($folder)) + { + if($entry[0]==='.') + continue; + else if(is_file($directory.'/'.$entry) && strpos($entry,'.php')) + $list[] = str_replace('.php', '', $entry); + } + closedir($folder); + return $list; + } +} + ?>
\ No newline at end of file |