Created
December 8, 2008 05:29
-
-
Save minichate/33356 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From dbfec0365b3eb8d99a0be3b4b0501f06596bea54 Mon Sep 17 00:00:00 2001 | |
From: Christopher Troup <chris@norex.ca> | |
Date: Sun, 7 Dec 2008 22:30:32 -0400 | |
Subject: [PATCH] add extra DBColumns | |
--- | |
core/DBColumns.php | 42 ++++++++++++++++++++++++++---------------- | |
1 files changed, 26 insertions(+), 16 deletions(-) | |
diff --git a/core/DBColumns.php b/core/DBColumns.php | |
index 19f0081..e53597b 100644 | |
--- a/core/DBColumns.php | |
+++ b/core/DBColumns.php | |
@@ -36,11 +36,6 @@ class DBColumnTextBox extends DBColumn { | |
} | |
} | |
-class DBColumnTinytext extends DBColumn { | |
- function type() {return "tinytext";} | |
- function suggestedMysql() {return "tinytext";} | |
-} | |
- | |
class DBColumnsLongText extends DBColumn { | |
function type() {return 'longtext';} | |
function prepareCode() {return 's';} // TODO: NOT SURE YET "b" or "s" ?? | |
@@ -55,9 +50,8 @@ class DBColumnInteger extends DBColumn { | |
$value = 0; | |
$label = $this->label(); | |
extract($args); | |
- $el = $form->addElement ('text', $id, $label); | |
+ $el = $form->addElement ('integer', $id, $label); | |
$el->setValue($value); | |
- $form->addRule($id, 'Integer required', 'integer', null, 'client'); | |
return $el; | |
} | |
function suggestedMysql() {return "int(11)";} | |
@@ -150,6 +144,18 @@ class DBColumnId extends DBColumnInteger { | |
function suggestedMysql() {return "int(10) unsigned";} | |
} | |
+class DBColumnDBImage extends DBColumnInteger { | |
+ function type() {return "dbimage";} | |
+ function addElementTo($args) { | |
+ $value = null; | |
+ extract ($args); | |
+ $el = $form->addElement ('file', $id, $this->label()); | |
+ $el->setValue($value); | |
+ return $el; | |
+ } | |
+ function suggestedMysql() {return "int(10) unsigned";} | |
+} | |
+ | |
class DBColumnTinyMCE extends DBColumnsLongText { | |
function type() {return "tinymce";} | |
function addElementTo($args) { | |
@@ -194,6 +200,19 @@ class DBColumnTimestamp extends DBColumnText { | |
function suggestedMysql() {return "timestamp";} | |
} | |
+class DBColumnDateTime extends DBColumnTimestamp { | |
+ function type() {return "datetime";} | |
+ function addElementTo ($args) { | |
+ $value = null; | |
+ extract ($args); | |
+ $label = $this->label(); | |
+ $el = $form->addElement ('date', $id, $label, array('format'=>'d-M-Y H:i:s')); | |
+ $el->setValue($value); | |
+ return $el; | |
+ } | |
+ function suggestedMysql() {return "datetime";} | |
+} | |
+ | |
class DBColumnDate extends DBColumnTimestamp { | |
function type() {return "date";} | |
function toDB($obj) {$date = $obj ? $obj : new NDate(); return $date->get(MYSQL_DATE);} | |
@@ -238,15 +257,6 @@ public function __toString($item,$key) { | |
} | |
} | |
-class DBColumnCancel extends DBColumn { | |
- function type() {return "cancel";} | |
- function ignored() {return true;} | |
- function addElementTo($args) { | |
- extract ($args); | |
- return $form->addElement('button','cancel','Cancel',array("onClick"=> "window.location.href='Monthly.php'")); | |
- } | |
-} | |
- | |
/* ----------------------------- PUT NEW CLASSES ABOVE THIS LINE! ---------------------- */ | |
DBColumn::registerClasses(); | |
/* ------------------------------------------------------------------------------------- */ | |
-- | |
1.6.0.4+GitX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment