コード例 #1
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false, $style = 'default')
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
     } else {
         $value = $this->getValue();
     }
     return $value == 1 ? "Yes" : "No";
 }
コード例 #2
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false)
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
     } else {
         $value = $this->getValue();
     }
     return $value;
 }
コード例 #3
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false)
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
     } else {
         $value = $this->getValue();
     }
     if (strlen($value) > 0) {
         return "********";
     } else {
         return "";
     }
 }
コード例 #4
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false, $style = 'default')
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
     } else {
         $value = $this->getValue();
     }
     $this->setupEnum();
     if (array_key_exists($value, $this->enum_values)) {
         return $this->enum_values[$value];
     } else {
         return $value;
     }
 }
コード例 #5
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false, $style = 'default')
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
     } else {
         $value = $this->getValue();
     }
     if ($value instanceof I2CE_Date) {
         return $value->displayDate();
     } else {
         return I2CE_Date::blank()->displayDate();
     }
 }
コード例 #6
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @param string $style.  Defaults to 'default'
  * @return mixed
  */
 public function _getDisplayValue($entry = false, $style = 'default')
 {
     if ($entry instanceof I2CE_Entry) {
         $values = $entry->getValue();
     } else {
         $values = $this->getValue();
     }
     if (!is_array($values)) {
         $values = array();
     }
     $ret = array();
     $ff = I2CE_FormFactory::instance();
     $style = $this->ensureStyle($style);
     $styles = array($style);
     if ($style != 'default') {
         $styles[] = 'default';
     }
     foreach ($values as $value) {
         list($form, $id) = $value;
         if ($id == '0' || $id == '') {
             continue;
         }
         if (!$form) {
             continue;
         }
         $printfargs = array();
         $printf = '';
         foreach ($styles as $s) {
             $printf_path = "meta/display/{$form}/{$s}/printf";
             $printfargs_path = "meta/display/{$form}/{$s}/printf_args";
             if (!$this->optionsHasPath($printf_path) || !is_string($printf = $this->getOptionsByPath($printf_path))) {
                 continue;
             }
             if (!$this->optionsHasPath($printfargs_path) || !is_array($printfargs = $this->getOptionsByPath($printfargs_path))) {
                 continue;
             }
             if (strlen($printf) == 0) {
                 continue;
             }
             if (count($printfargs) == 0) {
                 continue;
             }
             ksort($printfargs);
             break;
         }
         $formid = "{$form}|{$id}";
         if (!$this->isValidForm($form) || !$printf || count($printfargs) == 0) {
             $ret[] = $formid;
             continue;
         }
         $formObj = $ff->createForm($formid);
         if (!$formObj instanceof I2CE_Form) {
             continue;
         }
         $formObj->populate();
         $printfvals = array();
         foreach ($printfargs as $printfarg) {
             if (!($fieldObj = $formObj->getField($printfarg)) instanceof I2CE_FormField) {
                 $printfvals[] = '';
                 continue;
             }
             $printfvals[] = $fieldObj->getDisplayValue();
         }
         $ret[] = @vsprintf($printf, $printfvals);
     }
     return implode(",", $ret);
 }
コード例 #7
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false, $style = 'default')
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
     } else {
         $value = $this->getValue();
     }
     return implode(", ", $value);
 }
コード例 #8
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If an I2CE_Entry object is passed then it will return the value
  * for that entry assuming it's an entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false)
 {
     if ($entry instanceof I2CE_Entry) {
         if (strlen($entry->getValue()) == 0) {
             return '';
         }
         $size = (int) (strlen($entry->getValue()) / 1024);
         $postfix = 'kb';
         if ($size > 1024) {
             $postfix = 'MB';
             $size = (int) ($size / 1024);
         }
         //return $entry->getMimeType() . ' File Size: ' . $size . $postfix;
         return $this->file_name . ' : ' . $size . $postfix;
     } else {
         if (strlen($this->value) == 0) {
             return '';
         }
         $size = (int) (strlen($this->value) / 1024);
         $postfix = 'kb';
         if ($size > 1024) {
             $postfix = 'MB';
             $size = (int) ($size / 1024);
         }
         //return $this->getMimeType() . ' File Size: ' . $size . $postfix;
         return $this->file_name . ' : ' . $size . $postfix;
     }
 }
コード例 #9
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false)
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
     } else {
         $value = $this->getValue();
     }
     if ($this->getGenerate()) {
         return "Will be generated.";
     } else {
         return $value;
     }
 }
コード例 #10
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false)
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
         if (is_string($value)) {
             $value = doubleval(str_replace(",", "", $value));
             if (preg_match('/\\s*(-?[0-9]*(\\.[0-9]*))?\\s*%\\s*$/', $value)) {
                 $value = (double) $matches[1];
             }
         }
         return number_format($value, 1) . ' %';
     } else {
         if ($this->isValid()) {
             $value = $this->getValue();
             if (is_string($value)) {
                 $value = doubleval(str_replace(",", "", $value));
                 if (preg_match('/\\s*(-?[0-9]*(\\.[0-9]*))?\\s*%\\s*$/', $value)) {
                     $value = (double) $matches[1];
                 }
             }
             return number_format($value, 1) . ' %';
         } else {
             return '%';
         }
     }
 }
コード例 #11
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @param string $style.  Defaults to 'default'
  * @return mixed
  */
 public function _getDisplayValue($entry = false, $style = 'default')
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
     } else {
         $value = $this->getValue();
     }
     if (!is_array($value) || count($value) != 2) {
         return '';
     }
     list($form, $id) = $value;
     if ($id == '0' || $id == '') {
         return '';
     }
     if (!$form) {
         return '';
     }
     $formid = "{$form}|{$id}";
     $ff = I2CE_FormFactory::instance();
     $formObj = $ff->createForm($formid);
     if (!$formObj instanceof I2CE_Form) {
         return '';
     }
     $formObj->populate();
     if (!$this->isValidForm($form)) {
         return $formid;
     }
     $style = $this->ensureStyle($style);
     $styles = array($style);
     if ($style != 'default') {
         $styles[] = 'default';
     }
     foreach ($styles as $s) {
         $printf_path = "meta/display/{$form}/{$s}/printf";
         $printfargs_path = "meta/display/{$form}/{$s}/printf_args";
         $printfargstyles_path = "meta/display/{$form}/{$s}/printf_arg_styles";
         if (!$this->optionsHasPath($printf_path) || !is_string($printf = $this->getOptionsByPath($printf_path))) {
             continue;
         }
         if (!$this->optionsHasPath($printfargs_path) || !is_array($printfargs = $this->getOptionsByPath($printfargs_path))) {
             continue;
         }
         if (!$this->optionsHasPath($printfargstyles_path) || !is_array($printfarg_styles = $this->getOptionsByPath($printfargstyles_path))) {
             $printfarg_styles = array();
         }
         if (strlen($printf) == 0) {
             continue;
         }
         if (count($printfargs) == 0) {
             continue;
         }
         ksort($printfargs);
         $printfvals = array();
         foreach ($printfargs as $printfarg) {
             if (!($fieldObj = $formObj->getField($printfarg)) instanceof I2CE_FormField) {
                 $printfvals[] = '';
             } else {
                 if ($fieldObj instanceof I2CE_FormField_MAP) {
                     if (!array_key_exists($printfarg, $printfarg_styles) || !is_string($argstyle = $printfarg_styles[$printfarg])) {
                         $argstyle = 'default';
                     }
                     if (($mapObj = $fieldObj->getMappedFormObject()) instanceof I2CE_List) {
                         $printfvals[] = $mapObj->name($argstyle);
                     } else {
                         $printfvals[] = $fieldObj->getDisplayValue();
                     }
                 } else {
                     $printfvals[] = $fieldObj->getDisplayValue();
                 }
             }
         }
         return @vsprintf($printf, $printfvals);
     }
     //if we made it here, we have no valid displays.  try to do something.
     $default_value = $this->getDisplayValue();
     if ($default_value) {
         return $default_value;
     }
     return $formid;
 }
コード例 #12
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false, $style = 'default')
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
         if (is_string($value)) {
             $value = intval(str_replace(",", "", $value));
             if (preg_match('/\\s*(-?[0-9]+)\\s*%\\s*$/', $value)) {
                 $value = (int) $matches[1];
             }
         }
         return $value . ' %';
     } else {
         if ($this->isValid()) {
             $value = $this->getValue();
             if (is_string($value)) {
                 $value = intval(str_replace(",", "", $value));
                 if (preg_match('/\\s*(-?[0-9]+)\\s*%\\s*$/', $value)) {
                     $value = (int) $matches[1];
                 }
             }
             return $value . ' %';
         } else {
             return '%';
         }
     }
 }
コード例 #13
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false, $style = 'default')
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
         return number_format($value, 2);
     } else {
         if ($this->isValid()) {
             $value = $this->getValue();
             return number_format($value, 2);
         } else {
             return '';
         }
     }
 }
コード例 #14
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false)
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
     } else {
         $value = $this->getValue();
     }
     $vals = array();
     foreach ($value as $k => $v) {
         $vals[] = "{$k}: {$v} ";
     }
     return implode(", ", $vals);
 }
コード例 #15
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false)
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
     } else {
         $value = $this->getValue();
     }
     $map_list = array();
     foreach ($value as $map_value) {
         $map_list[] = I2CE_List::lookup($map_value[1], $map_value[0]);
     }
     return implode(", ", $map_list);
 }
コード例 #16
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If a I2CE_Entry object has been passed to this method then it will return the value for that entry assuming it's an 
  * entry for this field.
  * @param boolean $number_format If true, call number_format on the returned value.
  * @return mixed
  */
 public function getDisplayValue($entry = false, $number_format = false)
 {
     if ($entry instanceof I2CE_Entry) {
         $value = $entry->getValue();
     } else {
         $value = $this->getValue();
     }
     $curr_value = parent::getFromDB($value[0]);
     $curr_string = I2CE_List::lookup($curr_value[1], $curr_value[0]);
     $number_value = $value[1];
     if ($number_format) {
         $number_value = number_format($number_value);
     }
     return $curr_string . $number_value;
 }
コード例 #17
0
 /**
  * Returns the value of this field as a human readable format.
  * @param I2CE_Entry $entry If an I2CE_Entry object is passed then it will return the value
  * for that entry assuming it's an entry for this field.
  * @return mixed
  */
 public function getDisplayValue($entry = false, $style = 'default')
 {
     if ($entry instanceof I2CE_Entry) {
         if (strlen($entry->getValue()) == 0) {
             return '';
         }
         $size = (int) ($this->getContentLength() / 1024);
         $postfix = 'kb';
         if ($size > 1024) {
             $postfix = 'MB';
             $size = (int) ($size / 1024);
         }
         //return $entry->getMimeType() . ' File Size: ' . $size . $postfix;
         return $this->file_name . ' : ' . $size . $postfix;
     } else {
         if (strlen($this->value) == 0) {
             return '(No Data)';
         }
         $size = (int) ($this->getContentLength() / 1024);
         $postfix = 'kb';
         if ($size > 1024) {
             $postfix = 'MB';
             $size = (int) ($size / 1024);
         }
         //return $this->getMimeType() . ' File Size: ' . $size . $postfix;
         if ($this->file_name) {
             $ret = $this->file_name;
         } else {
             $ret = $this->name;
         }
         $ret .= ' : ' . $size . $postfix;
         if ($this->mime_type) {
             $ret .= ' (' . $this->mime_type . ')';
         }
         return $ret;
     }
 }