Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1069679
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jul 20, 6:27 AM
Size
3 KB
Mime Type
text/x-diff
Expires
Tue, Jul 22, 6:27 AM (5 h, 25 m)
Engine
blob
Format
Raw Data
Handle
692575
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/unlabeled/unlabeled-1.1.32/core/kernel/utility/formatters/serialized_formatter.php
===================================================================
--- branches/unlabeled/unlabeled-1.1.32/core/kernel/utility/formatters/serialized_formatter.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.1.32/core/kernel/utility/formatters/serialized_formatter.php (revision 4759)
@@ -0,0 +1,11 @@
+<?php
+
+class kSerializedFormatter extends kFormatter {
+
+ function Format($value, $field_name, $object, $format=null)
+ {
+ $data = unserialize($value);
+ return $data[$format];
+ }
+
+}
Property changes on: branches/unlabeled/unlabeled-1.1.32/core/kernel/utility/formatters/serialized_formatter.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.1.32/core/kernel/utility/formatters/unit_formatter.php
===================================================================
--- branches/unlabeled/unlabeled-1.1.32/core/kernel/utility/formatters/unit_formatter.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.1.32/core/kernel/utility/formatters/unit_formatter.php (revision 4759)
@@ -0,0 +1,84 @@
+<?php
+
+class kUnitFormatter extends kFormatter {
+
+ function PrepareOptions($field_name, &$field_options, &$object)
+ {
+ if( !isset($field_options['master_field']) )
+ {
+ $regional =& $this->Application->recallObject('lang.current');
+ $add_fields = Array();
+ $options_a = Array('type' => 'int','error_field' => $field_name,'master_field' => $field_name,'format' => '%d' );
+ $options_b = Array('type' => 'double','error_field' => $field_name,'master_field' => $field_name,'format' => '%0.2f' );
+ switch( $regional->GetDBField('UnitSystem') )
+ {
+ case 2: // US/UK
+ $field_options_copy = $field_options;
+ unset($field_options_copy['min_value_exc']);
+ $add_fields[$field_name.'_a'] = array_merge_recursive2($field_options_copy, $options_a);
+ $add_fields[$field_name.'_b'] = array_merge_recursive2($field_options_copy, $options_b);
+ break;
+ default:
+ }
+ $add_fields = array_merge_recursive2($add_fields, $object->VirtualFields);
+ $object->setVirtualFields($add_fields);
+ }
+ }
+
+ function UpdateMasterFields($field, $value, &$options, &$object)
+ {
+ if( !isset($options['master_field']) )
+ {
+ $regional =& $this->Application->recallObject('lang.current');
+ switch( $regional->GetDBField('UnitSystem') )
+ {
+ case 2: // US/UK
+ $major = $object->GetDirtyField($field.'_a');
+ $minor = $object->GetDirtyField($field.'_b');
+ if($major === '' && $minor === '')
+ {
+ $value = null;
+ }
+ elseif($major === null && $minor === null)
+ {
+ unset($object->Fields[$field]);
+ return;
+ }
+ else
+ {
+ $value = Pounds2Kg($major, $minor);
+ }
+ break;
+ default:
+ }
+ $object->SetDBField($field, $value);
+ }
+ }
+
+ function UpdateSubFields($field, $value, &$options, &$object)
+ {
+ if( !isset($options['master_field']) )
+ {
+ $regional =& $this->Application->recallObject('lang.current');
+ switch( $regional->GetDBField('UnitSystem') )
+ {
+ case 2: // US/UK
+ if($value === null)
+ {
+ $major = null;
+ $minor = null;
+ }
+ else
+ {
+ list($major,$minor) = Kg2Pounds($value);
+ /*$major = floor( $value / 0.5 );
+ $minor = ($value - $major * 0.5) * 32;*/
+ }
+ $object->SetDBField($field.'_a', $major);
+ $object->SetDBField($field.'_b', $minor);
+ break;
+ default:
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.1.32/core/kernel/utility/formatters/unit_formatter.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.1
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Event Timeline
Log In to Comment