00001 <?php
00010 class views_handler_field_profile_date extends views_handler_field_date {
00011 function options_form(&$form, &$form_state) {
00012 parent::options_form($form, $form_state);
00013
00014 unset($form['date_format']['#options']['time ago']);
00015 }
00016
00020 function render($values) {
00021 $value = $this->get_value($values);
00022 if (!$value) {
00023 return;
00024 }
00025 $value = unserialize($value);
00026 $format = $this->options['date_format'];
00027 switch ($format) {
00028 case 'custom':
00029 $format = $this->options['custom_date_format'];
00030 break;
00031 case 'small':
00032 $format = variable_get('date_format_short', 'm/d/Y - H:i');
00033 break;
00034 case 'medium':
00035 $format = variable_get('date_format_medium', 'D, m/d/Y - H:i');
00036 break;
00037 case 'large':
00038 $format = variable_get('date_format_long', 'l, F j, Y - H:i');
00039 break;
00040 }
00041
00042
00043
00044
00045
00046
00047 $date = gmmktime(0, 0, 0, $value['month'], $value['day'], $value['year']);
00048 $replace = array(
00049
00050 'd' => sprintf('%02d', $value['day']),
00051 'D' => NULL,
00052 'l' => NULL,
00053 'N' => NULL,
00054 'S' => date('S', $date),
00055 'w' => NULL,
00056 'j' => $value['day'],
00057
00058 'F' => date('F', $date),
00059 'm' => sprintf('%02d', $value['month']),
00060 'M' => date('M', $date),
00061 'n' => date('n', $date),
00062
00063 'Y' => $value['year'],
00064 'y' => substr($value['year'], 2, 2),
00065
00066
00067 'a' => NULL,
00068 'A' => NULL,
00069 'g' => NULL,
00070 'G' => NULL,
00071 'h' => NULL,
00072 'H' => NULL,
00073 'i' => NULL,
00074 's' => NULL,
00075 ':' => NULL,
00076 'T' => NULL,
00077 ' - ' => NULL,
00078 ':' => NULL,
00079 );
00080
00081 return strtr($format, $replace);
00082 }
00083 }