Example #1
0
 public function getDisplayValue()
 {
     if ($this->type == "NUMERIC") {
         return ($this->value[0] == "." ? "0" : "") . $this->value;
     } else {
         return parent::getDisplayValue();
     }
 }
Example #2
0
 function getDisplayValue($record)
 {
     // format createdBy/updatedBy dates
     require_once SCRIPT_DIR . '/lib/fieldtypes/date.php';
     $dateFields = array('createdDate', 'updatedDate');
     if (in_array($this->name, $dateFields)) {
         return @DateField::getDisplayValue($record);
         // XXX: supress warning about calling a non-static method statically
     }
     // format createByUserNum/updatedByUserNum
     $value = parent::getDatabaseValue($record);
     $userNumFields = array('createdByUserNum', 'updatedByUserNum');
     if (in_array($this->name, $userNumFields)) {
         $accountsTable = "{$GLOBALS['TABLE_PREFIX']}accounts";
         $query = mysql_escapef("SELECT username FROM `{$accountsTable}` WHERE num = ?", $value);
         list($username) = mysql_get_query($query, true);
         $value = $username;
         return $value;
     }
     return parent::getDisplayValue($record);
 }