Example #1
0
 protected function getFieldType($field)
 {
     if ($this->table_type == "db") {
         $ftype = WRGetFieldType($this->FullFieldName($field));
     } elseif ($this->table_type == "project") {
         $ftype = $this->pSet->getFieldType($field);
     } else {
         $fields_type = WRGetAllCustomFieldType();
         $ftype = $fields_type[$field];
     }
     return $ftype;
 }
    $start = true;
    $align_skip = false;

    $groupstart = array();

    for ($i = 0; $i < count($rpt_array['group_fields']) - 1; $i++){
	$arr = $rpt_array['group_fields'][$i];
	$groupstart[$arr['name']] = 0;
	$groupvalue[$arr['name']] = "";
    }

    $rowinfo = array();

    $fields_type = array();
    if (is_wr_custom())
	$fields_type = WRGetAllCustomFieldType();

    include_once getabspath('classes/controls/ViewControlsContainer.php');
    $pSet = new ProjectSettings($_SESSION["webobject"]["table"], PAGE_REPORT);
    $viewControls = new ViewControlsContainer($pSet, PAGE_REPORT);
    while ($data = db_fetch_array($rs)){
	$firstnewgroup = true;
	$row = array();
	$arr_group = array();
	$arr_value = array();

	//	check if starting new group
	for ($i = 0; $i < count($rpt_array['group_fields']) - 1; $i++){
	    $arr = $rpt_array['group_fields'][$i];
	    $newgroup_[$arr['name']] = false;
	    $arr_group[$i]["newgroup"] = false;
 function getDisplayValue($index, $value)
 {
     global $locale_info;
     $field = $this->xml_array["group_fields"][$index]["name"];
     if ($value == "" || is_null($value)) {
         return "";
     }
     if ($this->table_type == "db") {
         $ftype = WRGetFieldType($this->FullFieldName($field));
     } elseif ($this->table_type == "project") {
         $ftype = GetFieldType($field, "");
     } else {
         $fields_type = WRGetAllCustomFieldType();
         $ftype = $fields_type[$field];
     }
     $arr = array();
     $arr = $this->xml_array["group_fields"];
     for ($i = 0; $i < count($arr) - 1; $i++) {
         if ($field == $arr[$i]["name"] && $index == $i) {
             $int_type = $arr[$i]["int_type"];
             break;
         }
     }
     if ($int_type == 0) {
         return $value;
     } elseif (IsNumberType($ftype)) {
         $start = $value - $value % $int_type;
         $end = $start + $int_type;
         return $start . " - " . $end;
     } elseif (IsCharType($ftype)) {
         return substr($value, 0, $int_type);
     } elseif (IsDateFieldType($ftype)) {
         $dvalue = substr($value, 0, 4) . '-' . substr($value, 4, 2) . '-' . substr($value, 6, 2);
         if (strlen($value) == 10) {
             $dvalue .= " " . substr($value, 8, 2) . "00:00";
         } elseif (strlen($value) == 12) {
             $dvalue .= " " . substr($value, 8, 2) . ":" . substr($value, 10, 2) . ":00";
         }
         $tm = db2time($dvalue);
         if (!count($tm)) {
             return "";
         }
         if ($int_type == 1) {
             // DATE_INTERVAL_YEAR
             return $tm[0];
         } elseif ($int_type == 2) {
             // DATE_INTERVAL_QUARTER
             return $tm[0] . "/Q" . $tm[1];
         } elseif ($int_type == 3) {
             // DATE_INTERVAL_MONTH
             return @$locale_info["LOCALE_SABBREVMONTHNAME" . $tm[1]] . " " . $tm[0];
         } elseif ($int_type == 4) {
             // DATE_INTERVAL_WEEK
             $dates = $this->getDatesByWeek($tm[1] + 1, $tm[0]);
             return format_shortdate(db2time($dates[0])) . ' - ' . format_shortdate(db2time($dates[1]));
         } elseif ($int_type == 5) {
             // DATE_INTERVAL_DAY
             return format_shortdate($tm);
         } elseif ($int_type == 6) {
             // DATE_INTERVAL_HOUR
             $tm[4] = 0;
             $tm[5] = 0;
             return str_format_datetime($tm);
         } elseif ($int_type == 7) {
             // DATE_INTERVAL_MINUTE
             $tm[5] = 0;
             return str_format_datetime($tm);
         } else {
             return str_format_datetime($tm);
         }
     }
 }