diff --git a/library/Nmc/Auth/Interface.php b/library/Nmc/Auth/Interface.php
index 1d5bcec349fba42bdb9b7dd5c29e1f1f96ecabb6..da5cf0fb28d64e84132a2c6cfe7cde533b8a372d 100644
--- a/library/Nmc/Auth/Interface.php
+++ b/library/Nmc/Auth/Interface.php
@@ -1,6 +1,5 @@
<?php
-require_once('Zend.php');
Zend_Loader::loadClass('Nmc_Auth_Exception');
interface Nmc_Auth_Interface
diff --git a/library/Nmc/Auth/Ldap.php b/library/Nmc/Auth/Ldap.php
index 990280c5376f845c64cd63a515ec41260364dd3d..0a56497e3a1bdac405c473e83c5e1325851846f4 100644
--- a/library/Nmc/Auth/Ldap.php
+++ b/library/Nmc/Auth/Ldap.php
@@ -1,6 +1,5 @@
<?php
-require_once 'Zend.php';
require_once 'Nmc/Auth/Interface.php';
class Nmc_Auth_Ldap implements Nmc_Auth_Interface
@@ -26,5 +25,3 @@ class Nmc_Auth_Ldap implements Nmc_Auth_Interface
return true;
}
}
-
-?>
\ No newline at end of file
diff --git a/library/Nmc/Auth/Multi.php b/library/Nmc/Auth/Multi.php
index c1171f95265ecb152274d72a5d614082a0bcb67c..513991ddeb97b51f25b5d34f73bc6d4aa02b15d4 100644
--- a/library/Nmc/Auth/Multi.php
+++ b/library/Nmc/Auth/Multi.php
@@ -1,6 +1,5 @@
<?php
-require_once 'Zend.php';
require_once 'Nmc/Auth/Interface.php';
class Nmc_Auth_Multi implements Nmc_Auth_Interface
@@ -55,5 +54,3 @@ class Nmc_Auth_Multi implements Nmc_Auth_Interface
return true;
}
}
-
-?>
\ No newline at end of file
diff --git a/library/Nmc/Auth/Mysql.php b/library/Nmc/Auth/Mysql.php
index 1a0b21a57c109c57737613aac8e2f63bdc23e356..3d84c31a00415b3a83410cbda0d51d65b51c1173 100644
--- a/library/Nmc/Auth/Mysql.php
+++ b/library/Nmc/Auth/Mysql.php
@@ -1,6 +1,5 @@
<?php
-require_once('Zend.php');
require_once 'Nmc/Auth/Interface.php';
class Nmc_Auth_Mysql implements Nmc_Auth_Interface
@@ -15,12 +14,12 @@ class Nmc_Auth_Mysql implements Nmc_Auth_Interface
public function login( $user_name, $password )
{
$db = $this->table->getAdapter();
- $where = $db->quoteInto('user_name=?', $user_name)
+ $where = $db->quoteInto('userName=?', $user_name)
. ' AND '
. $db->quoteInto('password=?', md5($password));
$data = $this->table->fetchAll($where);
if( count( $data->toArray() ) == 0 ) {
- throw new Nmc_Auth_Exception( 'MySQL: user_name or password incorrect.');
+ throw new Nmc_Auth_Exception( 'MySQL: userName or password incorrect.');
}
return true;
diff --git a/library/Nmc/Db/RowManager.php b/library/Nmc/Db/RowManager.php
index a07d06fb00813d483858c74e59d692146e5c3fa5..e9117c5e03e2418ecd46641cf6238ab1dc52483c 100644
--- a/library/Nmc/Db/RowManager.php
+++ b/library/Nmc/Db/RowManager.php
@@ -11,7 +11,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
require_once 'Nmc/SingletonInterface.php';
/**
diff --git a/library/Nmc/Db/SessionHandler.php b/library/Nmc/Db/SessionHandler.php
index 46591e06bbdbedf839690cf955eb97f6d0f26458..9fe1c8bf0286757febfca2454947137da2c0553e 100644
--- a/library/Nmc/Db/SessionHandler.php
+++ b/library/Nmc/Db/SessionHandler.php
@@ -12,7 +12,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
/**
* Nmc_Db_SessionHandler - Use a Db Table as your session handler
diff --git a/library/Nmc/Db/Table.php b/library/Nmc/Db/Table.php
index 482131595142a2d4ee2faa9eeb7e83d2d757c1f7..aaef856dae3b399b36efbff4ad9093c02e64d94a 100644
--- a/library/Nmc/Db/Table.php
+++ b/library/Nmc/Db/Table.php
@@ -1,7 +1,5 @@
<?php
-require_once('Zend.php');
-
require_once 'Nmc/SingletonInterface.php';
Zend_Loader::loadClass('Zend_Db_Table');
diff --git a/library/Nmc/Db/Table/AclRecord.php b/library/Nmc/Db/Table/AclRecord.php
index a868f96dae78d9a76350821b017426354ee22895..834ee03b1bbd8d75ac71b0be00b4cadc46caae87 100644
--- a/library/Nmc/Db/Table/AclRecord.php
+++ b/library/Nmc/Db/Table/AclRecord.php
@@ -1,6 +1,5 @@
<?php
-require_once('Zend.php');
Zend_Loader::loadClass('Zend_Db_Table_Row');
abstract class Nmc_Db_Table_AclRow extends Zend_Db_Table_Row
diff --git a/library/Nmc/Db/Table/DataType/Date.php b/library/Nmc/Db/Table/DataType/Date.php
new file mode 100644
index 0000000000000000000000000000000000000000..efa53381ce43bfddf73c1c6183e270b8e716b153
--- /dev/null
+++ b/library/Nmc/Db/Table/DataType/Date.php
@@ -0,0 +1,46 @@
+<?php
+
+require_once 'Nmc/Db/Table/DataType/Interface.php';
+
+class Nmc_Db_Table_DataType_Date implements Nmc_Db_Table_DataType_Interface
+{
+ /**
+ * Stores the date object
+ *
+ * @var Zend_Date
+ */
+ protected $_dateObject = null;
+
+ public function setColumnData($columnData)
+ {
+ if ($columnData) {
+ $this->_dateObject = new Zend_Date($columnData);
+ }
+ }
+
+ public function setObject($object)
+ {
+ if (is_null($object)) {
+ $this->_dateObject = null;
+ return;
+ }
+ if(!$object instanceof Zend_Date) {
+ throw new Nmc_Exception('Attempt to set wrong data type');
+ }
+
+ $this->_dateObject = $object;
+ }
+
+ public function getColumnData()
+ {
+ if ($this->_dateObject) {
+ return $this->_dateObject->getTimestamp();
+ }
+ return null;
+ }
+
+ public function getObject()
+ {
+ return $this->_dateObject;
+ }
+}
\ No newline at end of file
diff --git a/library/Nmc/Db/Table/DataType/Interface.php b/library/Nmc/Db/Table/DataType/Interface.php
new file mode 100644
index 0000000000000000000000000000000000000000..98e0c5491843d196abd37fd1af7837c6085e40f4
--- /dev/null
+++ b/library/Nmc/Db/Table/DataType/Interface.php
@@ -0,0 +1,9 @@
+<?php
+
+interface Nmc_Db_Table_DataType_Interface
+{
+ public function setColumnData($columnData);
+ public function setObject($object);
+ public function getColumnData();
+ public function getObject();
+}
diff --git a/library/Nmc/Db/Table/Relation/Abstract.php b/library/Nmc/Db/Table/Relation/Abstract.php
index 2268330fce1563ea57a1bdb74c13bc09b5effdde..43f74cbf9166cde458626f45fb26204d5ae32afc 100644
--- a/library/Nmc/Db/Table/Relation/Abstract.php
+++ b/library/Nmc/Db/Table/Relation/Abstract.php
@@ -1,7 +1,5 @@
<?php
-require_once('Zend.php');
-
require_once 'Nmc/Db/Table/Relation/Interface.php';
/**
diff --git a/library/Nmc/Db/Table/Relation/Extend.php b/library/Nmc/Db/Table/Relation/Extend.php
index f9614277d593a18100bc45905676dbdc4b20493e..65955c5cd1009217c6b53d2cc137eaf2d7a4c176 100644
--- a/library/Nmc/Db/Table/Relation/Extend.php
+++ b/library/Nmc/Db/Table/Relation/Extend.php
@@ -12,8 +12,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
-
/**
* Nmc_Db_Table_Relation_Extend - A one to one relation where one table extends another
*
diff --git a/library/Nmc/Db/Table/Relation/HasMany.php b/library/Nmc/Db/Table/Relation/HasMany.php
index 45873adfe3f22acee5722114d376e188b3a8cfdf..f8c9765cbc666484b2d88d60e39c85596cf9ad5f 100644
--- a/library/Nmc/Db/Table/Relation/HasMany.php
+++ b/library/Nmc/Db/Table/Relation/HasMany.php
@@ -12,8 +12,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
-
/**
* Nmc_Db_Table_Relation_HasMany - A relation where one row is the parent of many others
*
@@ -45,6 +43,17 @@ class Nmc_Db_Table_Relation_HasMany extends Nmc_Db_Table_Relation_Abstract
protected $_attributeName;
+ protected $_saveChildRows = true;
+
+ /**
+ * The linking table, if one is used
+ *
+ * @var Nmc_Db_Table
+ */
+ protected $_linkingTable;
+
+ protected $_linkingForeignKeyName;
+
/**
* The set of rows belonging to this relation
*
@@ -71,11 +80,43 @@ class Nmc_Db_Table_Relation_HasMany extends Nmc_Db_Table_Relation_Abstract
$this->_attributeName = $attributeName;
}
+ /**
+ * If the rows are related via a linking table, use this function to tell
+ * the parent table how to use the linking table.
+ *
+ * @param Nmc_Db_Table $linkingTable
+ * @param unknown_type $foreignKeyName
+ */
+ public function setLinkingTable(Nmc_Db_Table $linkingTable, $foreignKeyName)
+ {
+ $this->_linkingTable = $linkingTable;
+ $this->_linkingForeignKeyName = $foreignKeyName;
+ }
+
+ public function setSaveChildRows($value = true)
+ {
+ $this->_saveChildRows = $value;
+ }
+
public function register()
{
$db = $this->_childTable->getAdapter();
- $where = $db->quoteInto($this->_foreignKeyName . ' = ?', $this->_row->getPrimaryKey());
- $this->_rowset = $this->_childTable->fetchAll($where);
+
+ if ($this->_linkingTable) {
+ $where = $db->quoteInto($this->_foreignKeyName . ' = ?', $this->_row->getPrimaryKey());
+ $linkingRowset = $this->_linkingTable->fetchAll($where);
+
+ $keys = array();
+ foreach($linkingRowset as $row) {
+ $keys[] = $row->{$this->_linkingForeignKeyName};
+ }
+
+ $this->_rowset = $this->_childTable->find($keys);
+
+ } else {
+ $where = $db->quoteInto($this->_foreignKeyName . ' = ?', $this->_row->getPrimaryKey());
+ $this->_rowset = $this->_childTable->fetchAll($where);
+ }
}
public function onPostGet($name)
@@ -102,58 +143,67 @@ class Nmc_Db_Table_Relation_HasMany extends Nmc_Db_Table_Relation_Abstract
public function onPostSave()
{
- $selectedRows = $this->_rowset;
- $where = $this->_childTable->getAdapter()->quoteInto(
- $this->_foreignKeyName . ' = ?', $this->_row->getPrimaryKey()
- );
- $currentRows = $this->_childTable->fetchAll($where);
-
- $removedRows = $currentRows->getRowsNotInCommonWith($selectedRows);
-
- foreach($removedRows as $removedRow) {
- $removedRow->delete();
- }
-
- foreach($selectedRows as $selectedRow) {
- $foreignKeyName = $this->_foreignKeyName;
- $selectedRow->$foreignKeyName = $this->_row->getPrimaryKey();
- $selectedRow->save();
- }
+ if (!$this->_saveChildRows) {
+ return;
+ }
+ $db = $this->_childTable->getAdapter();
+ if ($this->_linkingTable) {
+ $keys = array(-1);
+ foreach($this->_rowset as $row) {
+ $keys[] = $row->getPrimaryKey();
+ }
+ $where = array();
+ $where[] = $db->quoteInto($this->_foreignKeyName . ' = ?', $this->_row->getPrimaryKey());
+ $where[] = $db->quoteInto($this->_linkingForeignKeyName . ' IN(?)', $keys);
+ $where = implode(' AND ', $where);
+ $selectedRows = $this->_linkingTable->fetchAll($where);
+ $where = $db->quoteInto(
+ $this->_foreignKeyName . ' = ?', $this->_row->getPrimaryKey()
+ );
+ $currentRows = $this->_linkingTable->fetchAll($where);
+ $removedRows = $currentRows->getRowsNotInCommonWith($selectedRows);
+ foreach ($removedRows as $removedRow) {
+ $removedRow->delete();
+ }
+ foreach ($this->_rowset as $row) {
+ $row->save();
+
+ $where = array();
+ $where[] = $db->quoteInto($this->_foreignKeyName . ' = ?', $this->_row->getPrimaryKey());
+ $where[] = $db->quoteInto($this->_linkingForeignKeyName . ' = ?', $row->getPrimaryKey());
+ $where = implode(' AND ', $where);
+ $linkingRow = $this->_linkingTable->fetchAll($where);
+ if ($linkingRow->count() == 0) {
+ $linkingRow = $this->_linkingTable->fetchNew();
+ $linkingRow->{$this->_foreignKeyName} = $this->_row->getPrimaryKey();
+ $linkingRow->{$this->_linkingForeignKeyName} = $row->getPrimaryKey();
+ $linkingRow->save();
+ }
+ }
+ } else {
+ $selectedRows = $this->_rowset;
+ $where = $db->quoteInto(
+ $this->_foreignKeyName . ' = ?', $this->_row->getPrimaryKey()
+ );
+ $currentRows = $this->_childTable->fetchAll($where);
- /*
- $newRows = array();
- foreach($this->_rowset as $row) {
- $row->{$this->_foreignKeyName} = $this->_row->getPrimaryKey();
- $newRows[] = $row;
- }
+ $removedRows = $currentRows->getRowsNotInCommonWith($selectedRows);
- $where = $this->_childTable->getAdapter()->quoteInto($this->_foreignKeyName . ' = ?', $this->_row->getPrimaryKey());
- $currentRows = $this->_childTable->fetchAll($where);
-
- foreach($currentRows as $currentRow) {
- $keepRow = false;
- foreach($newRows as $key => $newRow) {
- if($currentRow->equalTo($newRow)) {
- $keepRow = true;
- if($currentRow !== $newRow) {
- unset($newRows[$key]);
- }
- }
- }
- if(!$keepRow) {
- $currentRow->delete();
+ foreach($removedRows as $removedRow) {
+ $removedRow->delete();
}
- }
- foreach($newRows as $newRow) {
- $newRow->save();
- }
- */
+ foreach($selectedRows as $selectedRow) {
+ $foreignKeyName = $this->_foreignKeyName;
+ $selectedRow->$foreignKeyName = $this->_row->getPrimaryKey();
+ $selectedRow->save();
+ }
+ }
}
public function onPostClone(Nmc_Db_Table_Row $newParentRow)
diff --git a/library/Nmc/Db/Table/Relation/HasOne.php b/library/Nmc/Db/Table/Relation/HasOne.php
index 8fd2145c7484a55253948a1a2831f41f3ae11fdf..bf2110c8d1d366a7288eaa429bf9bee2bd4ea5c1 100644
--- a/library/Nmc/Db/Table/Relation/HasOne.php
+++ b/library/Nmc/Db/Table/Relation/HasOne.php
@@ -12,8 +12,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
-
/**
* Nmc_Db_Table_Relation_HasOne - A relation where one row is the parent of a single other row
*
diff --git a/library/Nmc/Db/Table/Row.php b/library/Nmc/Db/Table/Row.php
index 86422a81a170cca45808fed65603f31bb19d38cc..66b55758f26f16ec1112b4247569c6b3d8d34ce1 100644
--- a/library/Nmc/Db/Table/Row.php
+++ b/library/Nmc/Db/Table/Row.php
@@ -37,6 +37,8 @@ class Nmc_Db_Table_Row extends Zend_Db_Table_Row
protected $_relations = array();
+ protected $_dataTypes = array();
+
protected $_uuid;
public function __construct($config = array())
@@ -181,6 +183,9 @@ class Nmc_Db_Table_Row extends Zend_Db_Table_Row
protected function _get($name)
{
+ if (array_key_exists($name, $this->_dataTypes)) {
+ return $this->_dataTypes[$name]->getObject();
+ }
return parent::__get($name);
}
@@ -219,6 +224,9 @@ class Nmc_Db_Table_Row extends Zend_Db_Table_Row
protected function _set($name, $value)
{
+ if (array_key_exists($name, $this->_dataTypes)) {
+ return $this->_dataTypes[$name]->setObject($value);
+ }
return parent::__set($name, $value);
}
@@ -275,6 +283,9 @@ class Nmc_Db_Table_Row extends Zend_Db_Table_Row
protected function _save()
{
+ foreach ($this->_dataTypes as $columnName => $columnType) {
+ $this->_data[$columnName] = $columnType->getColumnData();
+ }
parent::save();
}
@@ -289,6 +300,15 @@ class Nmc_Db_Table_Row extends Zend_Db_Table_Row
$this->_relations[] = $relation;
}
+ protected function _registerColumnDataType($columnName, Nmc_Db_Table_DataType_Interface $dataType)
+ {
+ if(!array_key_exists($columnName, $this->_data)) {
+ throw new Nmc_Exception('Column does not exist');
+ }
+ $this->_dataTypes[$columnName] = $dataType;
+ $dataType->setColumnData($this->_data[$columnName]);
+ }
+
/**
* Duplicates record in database and sets current record to
* the duplicated record.
diff --git a/library/Nmc/EqualToInterface.php b/library/Nmc/EqualToInterface.php
index f802ed5c9477163467e1885d5019ddc75636b2bd..b1d19a08274e4a9c43a47bebdda2ae5dbb3240ce 100644
--- a/library/Nmc/EqualToInterface.php
+++ b/library/Nmc/EqualToInterface.php
@@ -11,8 +11,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
-
/**
* Objects implementing the equalTo interface supply the equalTo() function
* This function is used to do custom equality comparisons.
@@ -29,5 +27,3 @@ interface Nmc_EqualToInterface {
public function equalTo($object);
}
-
-?>
\ No newline at end of file
diff --git a/library/Nmc/Image.php b/library/Nmc/Image.php
index c2d1346cf270b57a21abf5a9e4643e6d268e0216..4aba73cf7c78eb453703f2c7b4171959b3ebd6d3 100644
--- a/library/Nmc/Image.php
+++ b/library/Nmc/Image.php
@@ -1,6 +1,5 @@
<?php
-require_once('Zend.php');
Zend_Loader::loadClass('Zend_Filter');
Zend_Loader::loadClass('Nmc_Math_OrderedPair');
Zend_Loader::loadClass('Nmc_Image_Exception');
diff --git a/library/Nmc/Image/Abstract.php b/library/Nmc/Image/Abstract.php
index 5caab74cda7dde8dc62014fadff3552c455ef27f..a35d5d7c07ffd64806efa7babdb5036914f8f11b 100644
--- a/library/Nmc/Image/Abstract.php
+++ b/library/Nmc/Image/Abstract.php
@@ -1,6 +1,5 @@
<?php
-require_once('Zend.php');
Zend_Loader::loadClass('Zend_Filter');
Zend_Loader::loadClass('Nmc_Math_OrderedPair');
Zend_Loader::loadClass('Nmc_Image_Exception');
diff --git a/library/Nmc/Image/Color.php b/library/Nmc/Image/Color.php
index 31da8e17d34592b83dd7ffbafe585d1154e8f9ea..9812ab419438e8e996195dcccb5efe4884d9cf30 100644
--- a/library/Nmc/Image/Color.php
+++ b/library/Nmc/Image/Color.php
@@ -11,8 +11,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
-
/**
* Color Class
*
diff --git a/library/Nmc/Image/Jpeg.php b/library/Nmc/Image/Jpeg.php
index 2773b9a3883733870ae0397c76bf1fa4022fe562..8c9212ffc2fec3385c3ef12cb52666499479ab5e 100644
--- a/library/Nmc/Image/Jpeg.php
+++ b/library/Nmc/Image/Jpeg.php
@@ -12,7 +12,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
Zend_Loader::loadClass('Nmc_Image');
/**
diff --git a/library/Nmc/Image/Png.php b/library/Nmc/Image/Png.php
index e548d63c534962c45a9eb20f0f95bd9ee4f9349e..cb1e963305c87793b45b8589448ce00561ed26a3 100644
--- a/library/Nmc/Image/Png.php
+++ b/library/Nmc/Image/Png.php
@@ -12,7 +12,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
Zend_Loader::loadClass('Nmc_Image');
/**
diff --git a/library/Nmc/Ldap.php b/library/Nmc/Ldap.php
index b616eee9b64532034ae283e4b878f1204ed78f1f..37f1481ba8fabab07f85bf9fc358db0396bf0d37 100644
--- a/library/Nmc/Ldap.php
+++ b/library/Nmc/Ldap.php
@@ -11,8 +11,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
-
/**
* LDAP Class
*
diff --git a/library/Nmc/Ldap/Exception.php b/library/Nmc/Ldap/Exception.php
index 1e0ea62c05df8a148272a9898d38365102de220a..23ef904b0a453bd7cf924df92e2dc564e954d217 100644
--- a/library/Nmc/Ldap/Exception.php
+++ b/library/Nmc/Ldap/Exception.php
@@ -11,8 +11,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
-
/**
* NMC LDAP Exception
*
diff --git a/library/Nmc/Math/OrderedPair.php b/library/Nmc/Math/OrderedPair.php
index 6d1454bd977022e9a6666ad98938ad47ad67305c..4270f03d2c37dbc7a5803273d5faa54d8d88f63a 100644
--- a/library/Nmc/Math/OrderedPair.php
+++ b/library/Nmc/Math/OrderedPair.php
@@ -11,7 +11,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
Zend_Loader::loadClass('Zend_Filter');
Zend_Loader::loadClass('Nmc_Math_Exception');
diff --git a/library/Nmc/Model/AclGroups.php b/library/Nmc/Model/AclGroups.php
index 85c5f73523b71a025d34f01e7a30899167923b58..eef0fc10b37ee3c26e51d697fbeb8622e9d1a7b0 100644
--- a/library/Nmc/Model/AclGroups.php
+++ b/library/Nmc/Model/AclGroups.php
@@ -1,11 +1,8 @@
<?php
-require_once('Zend.php');
Zend_Loader::loadClass('Zend_Db_Table');
class Nmc_Model_AclGroups extends Zend_Db_Table
{
}
-
-?>
\ No newline at end of file
diff --git a/library/Nmc/Model/AclOthers.php b/library/Nmc/Model/AclOthers.php
index 8bb76662ddd479bbad73ab8979a39554be8b4724..3af268dae1eda46e63b8cd70492199649980e252 100644
--- a/library/Nmc/Model/AclOthers.php
+++ b/library/Nmc/Model/AclOthers.php
@@ -1,6 +1,5 @@
<?php
-require_once('Zend.php');
Zend_Loader::loadClass('Zend_Db_Table');
class Nmc_Model_AclOthers extends Zend_Db_Table
diff --git a/library/Nmc/Model/AclUsers.php b/library/Nmc/Model/AclUsers.php
index 4dd64f500642c1c68003657ab3d311915feee018..fdfaadcb928a2dd34f442f88f12367c3467c582e 100644
--- a/library/Nmc/Model/AclUsers.php
+++ b/library/Nmc/Model/AclUsers.php
@@ -1,6 +1,5 @@
<?php
-require_once('Zend.php');
Zend_Loader::loadClass('Zend_Db_Table');
class Nmc_Model_AclUsers extends Zend_Db_Table
diff --git a/library/Nmc/Model/UserInterface.php b/library/Nmc/Model/UserInterface.php
index 5be412020ffa7e443775a834f0900618d1efc250..2a1761b1e4f491e0de5a0895cb764fe4a582d0c0 100644
--- a/library/Nmc/Model/UserInterface.php
+++ b/library/Nmc/Model/UserInterface.php
@@ -11,8 +11,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
-
interface Nmc_Model_UserInterface
{
public function getId();
diff --git a/library/Nmc/Semaphore.php b/library/Nmc/Semaphore.php
index bcb6270956560b35de22838d3ae8f06ce1f1b11a..0f90a23463ce5f85e3476a821c6571bbc1a24c2c 100644
--- a/library/Nmc/Semaphore.php
+++ b/library/Nmc/Semaphore.php
@@ -11,8 +11,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
-
/**
* Nmc_Semaphore
*
diff --git a/library/Nmc/User.php b/library/Nmc/User.php
index a84a0bc8fa3af09b14aefd0684051ae711b513bd..e981fda3a74a7631b8b6dc49fbf87f28b5605e61 100644
--- a/library/Nmc/User.php
+++ b/library/Nmc/User.php
@@ -11,7 +11,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
require_once 'Nmc/Model/UserInterface.php';
/**
diff --git a/library/Nmc/View.php b/library/Nmc/View.php
index 493767c0d36e85fabacda7c1bed03152f885a0c3..b90daf1161625f770432293f2f8b2e899788c7e0 100644
--- a/library/Nmc/View.php
+++ b/library/Nmc/View.php
@@ -11,8 +11,6 @@
* @since File available since Release 0.0.1
*/
-require_once('Zend.php');
-
/**
* NMC_View
*
@@ -39,6 +37,10 @@ class Nmc_View extends Zend_View {
function __construct($config = array())
{
parent::__construct($config);
+ $this->addHelperPath(FRAMEWORK_PATH . DIRECTORY_SEPARATOR . 'library'
+ . DIRECTORY_SEPARATOR . 'Nmc'
+ . DIRECTORY_SEPARATOR . 'View'
+ . DIRECTORY_SEPARATOR . 'Helper', 'Nmc_View_Helper_');
$this->addScriptPath(APPLICATION_PATH . DIRECTORY_SEPARATOR . 'views');
$this->css_files = array();
$this->css_files[] = '/css/index.css';
diff --git a/library/Nmc/View/Helper/FormSelectDay.php b/library/Nmc/View/Helper/FormSelectDay.php
new file mode 100644
index 0000000000000000000000000000000000000000..fa55c5fc1d503183bcb93c1fb92f69be6f3ff68d
--- /dev/null
+++ b/library/Nmc/View/Helper/FormSelectDay.php
@@ -0,0 +1,15 @@
+<?php
+
+class Nmc_View_Helper_FormSelectDay extends Zend_View_Helper_FormSelect
+{
+ public function formSelectDay($name, $value = null, $attribs = null, $listsep = "<br />\n")
+ {
+ $options = array();
+ $options[-1] = '--Day--';
+ for ($i = 1; $i <= 31; $i++) {
+ $options[$i] = $i;
+ }
+
+ return parent::formSelect($name, $value, $attribs, $options, $listsep);
+ }
+}
diff --git a/library/Nmc/View/Helper/FormSelectMonth.php b/library/Nmc/View/Helper/FormSelectMonth.php
new file mode 100644
index 0000000000000000000000000000000000000000..ee7765c11280cbe36b91d091c216f0d6859f1cc2
--- /dev/null
+++ b/library/Nmc/View/Helper/FormSelectMonth.php
@@ -0,0 +1,25 @@
+<?php
+
+class Nmc_View_Helper_FormSelectMonth extends Zend_View_Helper_FormSelect
+{
+ public function formSelectMonth($name, $value = null, $attribs = null, $listsep = "<br />\n")
+ {
+ $options = array(
+ -1 => '--Month--',
+ 1 => 'January',
+ 2 => 'February',
+ 3 => 'March',
+ 4 => 'April',
+ 5 => 'May',
+ 6 => 'June',
+ 7 => 'July',
+ 8 => 'August',
+ 9 => 'September',
+ 10 => 'October',
+ 11 => 'November',
+ 12 => 'December'
+ );
+
+ return parent::formSelect($name, $value, $attribs, $options, $listsep);
+ }
+}
diff --git a/library/Nmc/View/Helper/FormSelectYear.php b/library/Nmc/View/Helper/FormSelectYear.php
new file mode 100644
index 0000000000000000000000000000000000000000..ccbb495a986cb0d75830285a521dc7a00cecfe42
--- /dev/null
+++ b/library/Nmc/View/Helper/FormSelectYear.php
@@ -0,0 +1,15 @@
+<?php
+
+class Nmc_View_Helper_FormSelectYear extends Zend_View_Helper_FormSelect
+{
+ public function formSelectYear($name, $value = null, $attribs = null, $listsep = "<br />\n")
+ {
+ $options = array();
+ $options[-1] = '--Year--';
+ for ($i = 2006; $i <= date('Y'); $i++) {
+ $options[$i] = $i;
+ }
+
+ return parent::formSelect($name, $value, $attribs, $options, $listsep);
+ }
+}
diff --git a/library/Nmc/View/Oss.php b/library/Nmc/View/Oss.php
index b9c561fce2c8acb43484898c4cecbd8ac6dd74ca..0c7082a5be74b8fa62d45caa2d28f720b7a1ea38 100644
--- a/library/Nmc/View/Oss.php
+++ b/library/Nmc/View/Oss.php
@@ -1,7 +1,5 @@
<?php
-require_once('Zend.php');
-
class Nmc_View_Oss
{
diff --git a/library/Nmc/View/Unl.php b/library/Nmc/View/Unl.php
index 8e3bd7c5f8fa2b509d982ce4092cbb7919a6a674..0d75377538e68c9243e68f83a525162b8bfbd481 100644
--- a/library/Nmc/View/Unl.php
+++ b/library/Nmc/View/Unl.php
@@ -1,6 +1,5 @@
<?php
-require_once('Zend.php');
Zend_Loader::loadClass('Zend_View');
class Nmc_View_Unl extends Zend_View