Ejemplo n.º 1
0
 function printValue($val, $h, $css)
 {
     $align = '';
     // Maybe formalise 'time_length' filter, but check SQL pre-filter also
     if ($h['filter_special'] == 'time_length') {
         // $val = format_time_interval_prefs($val);
         $val = format_time_interval($val, true, '%.2f');
         if (!$val) {
             $val = 0;
         }
     } elseif ($h['description'] == 'time_input_length') {
         $val = format_time_interval($val, true, '%.2f');
         if (!$val) {
             $val = 0;
         }
     }
     switch ($h['filter']) {
         case 'date':
             // we leave the date in 0000-000-00 00:00:00 format
             break;
         case 'currency':
             if ($val) {
                 $val = format_money($val);
             } else {
                 $val = 0;
             }
             break;
         case 'number':
             $align = 'align="right"';
             if (!$val) {
                 $val = 0;
             }
             break;
     }
     if (is_numeric($val)) {
         echo $val . ", ";
     } else {
         // escape " character (csv)
         $val = str_replace('"', '""', $val);
         echo '"' . $val . '" , ';
     }
 }
Ejemplo n.º 2
0
 function printValue($val, $h, $css)
 {
     $align = '';
     // Maybe formalise 'time_length' filter, but check SQL pre-filter also
     if ($h['filter_special'] == 'time_length') {
         // $val = format_time_interval_prefs($val);
         $val = format_time_interval($val, true, '%.2f');
         if (!$val) {
             $val = 0;
         }
     } elseif ($h['description'] == 'time_input_length') {
         $val = format_time_interval($val, true, '%.2f');
         if (!$val) {
             $val = 0;
         }
     }
     switch ($h['filter']) {
         case 'date':
             if ($val) {
                 $val = format_date($val, 'short');
             }
             break;
         case 'currency':
             if ($val) {
                 $val = format_money($val);
             } else {
                 $val = 0;
             }
             break;
         case 'number':
             $align = 'align="right"';
             if (!$val) {
                 $val = 0;
             }
             break;
     }
     echo '<td ' . $align . ' ' . $css . '>' . $val . "</td>\n";
 }
Ejemplo n.º 3
0
function format_time_interval_prefs($time)
{
    global $prefs;
    $hours_only = $prefs['time_intervals_notation'] == 'hours_only';
    return format_time_interval($time, $hours_only);
}
Ejemplo n.º 4
0
 function printValue($val, $h, $css = '')
 {
     $xml = '<table:table-cell ';
     $align = '';
     $format = 'office:value-type="string"';
     // Maybe formalise 'time_length' filter, but check SQL pre-filter also
     if ($h['filter_special'] == 'time_length') {
         // $val = format_time_interval_prefs($val);
         $val = format_time_interval($val, true, '%.2f');
         if (!$val) {
             $val = 0;
         }
     } elseif ($h['description'] == 'time_input_length') {
         $val = format_time_interval($val, true, '%.2f');
         if (!$val) {
             $val = 0;
         }
     }
     switch ($h['filter']) {
         case 'date':
             if ($val) {
                 $val = format_date($val, 'short');
             }
             // not tested XXX
             break;
         case 'currency':
             if ($val) {
                 $val = format_money($val);
             } else {
                 $val = 0;
             }
             break;
         case 'number':
             if (!$val) {
                 $val = 0;
             }
             $align = 'align="right"';
             // not used
             $format = 'office:value-type="float" office:value="' . $val . '"';
             break;
     }
     $xml .= $format . '>';
     $xml .= '<text:p>' . $val . '</text:p>';
     $xml .= '</table:table-cell>';
     fwrite($this->fcontent, $xml);
 }
Ejemplo n.º 5
0
         $list_pos = $_REQUEST['list_pos'];
     }
     if ($list_pos >= $number_of_rows) {
         $list_pos = 0;
     }
     // Position to the page info start
     if ($list_pos > 0) {
         if (!lcm_data_seek($result, $list_pos)) {
             lcm_panic("Error seeking position {$list_pos} in the result");
         }
     }
     // Show page of the list
     for ($i = 0; $i < $prefs['page_rows'] && ($row = lcm_fetch_array($result)); $i++) {
         echo "\t<tr>";
         echo '<td class="tbl_cont_' . ($i % 2 ? 'dark' : 'light') . '">' . format_date($row['start_time'], 'short') . '</td>';
         echo '<td class="tbl_cont_' . ($i % 2 ? 'dark' : 'light') . '">' . ($prefs['time_intervals'] == 'absolute' ? format_date($row['end_time'], 'short') : format_time_interval(strtotime($row['end_time']) - strtotime($row['start_time']), $prefs['time_intervals_notation'] == 'hours_only')) . '</td>';
         echo '<td class="tbl_cont_' . ($i % 2 ? 'dark' : 'light') . '">' . _Tkw('appointments', $row['type']) . '</td>';
         echo '<td class="tbl_cont_' . ($i % 2 ? 'dark' : 'light') . '">' . '<a href="app_det.php?app=' . $row['id_app'] . '" class="content_link">' . $row['title'] . '</a></td>';
         // [ML] removed, not very useful.
         // echo '<td class="tbl_cont_' . ($i % 2 ? 'dark' : 'light') . '">'
         //	. format_date($row['reminder'], 'short') . '</td>';
         echo "</tr>\n";
     }
     show_list_end($list_pos, $number_of_rows);
 }
 echo "</p>\n";
 if ($author_session['id_author'] == $author) {
     echo '<p><a href="edit_app.php?app=0" class="create_new_lnk">' . _T('app_button_new') . '</a></p>';
 }
 break;
 //
Ejemplo n.º 6
0
function show_listfu_item($item, $cpt, $screen = 'general')
{
    global $prefs;
    echo "<tr>\n";
    // Id case
    if ($screen == 'case') {
        echo '<td valign="top"><abbr title="' . $item['title'] . '">' . $item['id_case'] . '</abbr></td>';
    } else {
        echo '<td valign="top">' . $item['id_followup'] . '</abbr></td>';
    }
    // Start date
    echo '<td valign="top">' . format_date($item['date_start'], 'short') . '</td>';
    // Time
    echo '<td valign="top">';
    $fu_date_end = vider_date($item['date_end']);
    if ($prefs['time_intervals'] == 'absolute') {
        if ($fu_date_end) {
            echo format_date($item['date_end'], 'short');
        }
    } else {
        $fu_time = $fu_date_end ? strtotime($item['date_end']) - strtotime($item['date_start']) : 0;
        echo format_time_interval($fu_time, $prefs['time_intervals_notation'] == 'hours_only');
    }
    echo '</td>';
    // Author initials
    if ($screen != 'author') {
        echo '<td valign="top">' . get_person_initials($item) . '</td>';
    }
    // Type
    echo '<td valign="top">' . _Tkw('followups', $item['type']) . '</td>';
    // Description
    $cut_fu = isset($_REQUEST['more_fu_desc']) && $_REQUEST['more_fu_desc'] ? false : true;
    $short_description = get_fu_description($item, $cut_fu);
    if ($item['hidden'] == 'Y') {
        $short_description .= ' <img src="images/jimmac/stock_trash-16.png" ' . 'height="16" width="16" border="0" ' . 'title="' . _T('fu_info_is_deleted') . '" ' . 'alt="' . _T('fu_info_is_deleted') . '" />';
    }
    echo '<td valign="top">';
    echo '<a href="fu_det.php?followup=' . $item['id_followup'] . '" class="content_link">' . $short_description . '</a>';
    echo '</td>';
    echo "</tr>\n";
}