function getThumnailSize($limitWidth, $limitHeight, $width, $height) { $size['width'] = 0; $size['height'] = 0; if ($width >= $height) { $percent = getPercentage($width, $limitWidth); $size['width'] = $limitWidth; $size['height'] = $height * $percent / 100; } else { $percent = getPercentage($height, $limitHeight); $size['width'] = $width * $percent / 100; $size['height'] = $limitHeight; } return $size; }
/** * Calculate service percentages * @access public * @param array $serversData * @param array $services * @param boolean $retOne * @return array */ function calculatePercentages(array $serversData, array $services, $retOne = false) { $ret = array(); foreach ($serversData as $server) { foreach ($services as $serviceName => $service) { list($column1, $column2) = array_pad(explode(":", $service['dbcolumns']), 2, 1); if (is_numeric($column2)) { $server[$column2] = $column2; } $percent = getPercentage($server[$column1], $server[$column2]); $retOne ? $ret[$serviceName] = $percent : ($ret[$server['server_id']][$serviceName] = $percent); } } return $ret; }
$s = ($row["status"] == 2 ? 2 : 1) * ($row["inpool"] == $db_true ? 1 : -1); // print "$row[collection] / $s / $row[inpool] $db_true / $row[count]<br/>"; $a[$row["collection"]][$s] = $row["count"]; $t[$s] = $row["count"]; $total[$s]++; $todojs .= ($todojs ? "," : "todo = new Array(") . "'$row[collection]'"; } $res->free(); } // Output totals print "<h1>Statistics</h1>"; $p1=getPercentage($t["1"] + $t["-1"],$t["1"]+$t["2"]+$t["-1"]+$t["-2"]); $p2=getPercentage($t[1],$t[1]+$t[2]); ?> <div> <div><?php echo $p1; ?> % of documents are to assess</div> <div><?php echo $p2; ?> % of original pool documents are to assess</div> </div> <?
/** * */ function collectTestProjectMetrics($tplanMetrics, $cfg) { $mm = array(); $mm['executed']['value'] = getPercentage($tplanMetrics['total']['executed'], $tplanMetrics['total']['active'], $cfg['round_precision']); $mm['executed']['label_key'] = 'progress_absolute'; foreach ($cfg['statusSetForDisplay'] as $status_verbose => $label_key) { $mm[$status_verbose]['value'] = getPercentage($tplanMetrics['total'][$status_verbose], $tplanMetrics['total']['active'], $cfg['round_precision']); $mm[$status_verbose]['label_key'] = $label_key; } return $mm; }
echo sizeof($status[1]); ?> <div style="font-size:small;"> <? if (sizeof($status[1]) == 0) $unassessed[] = $id; foreach($status[1] as $key => $value) print "<div>$value[0]</div>"; ?></div> </td> <td><?php echo sizeof($status[0]); ?> <div style="font-size:small; text-align: left;"><? foreach($status[0] as $key => $value) { print "<div style='padding: 2px;'>"; print getBar(getPercentage($value[2], $value[1]+$value[2]) . " % done", $value[1], $value[2]); print " $value[0]</div>"; } ?></div></td></tr><? } ?></tbody></table> <a name="unassessed"/> <h2>Unassessed topics</h2> <? sort($unassessed); foreach($unassessed as $topic) { print "<div>$topic</div>"; }?> <a name="logins"/>
// if no platforms are to be shown -> no grouping if ($gui->show_platforms) { $table->setGroupByColumnName($labels['test_plan']); } $table->setSortByColumnName($labels['progress']); $table->sortDirection = 'DESC'; $table->showGroupItemsCount = true; $table->title = $labels['href_metrics_dashboard']; $gui->tableSet = array($table); // collect test project metrics $gui->project_metrics = array(); // get overall progress $gui->project_metrics['executed']['value'] = getPercentage($gui->tplan_metrics['total']['executed'], $gui->tplan_metrics['total']['active'], $round_precision); $gui->project_metrics['executed']['label_key'] = 'progress_absolute'; foreach ($result_cfg['status_label'] as $key => $status) { $gui->project_metrics[$key]['value'] = getPercentage($gui->tplan_metrics['total'][$key], $gui->tplan_metrics['total']['active'], $round_precision); $gui->project_metrics[$key]['label_key'] = $status; } } $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->display($templateCfg->template_dir . $templateCfg->default_template); /** * * @internal revisions * */ function getMetrics(&$db, $userObj, $args, $result_cfg, $labels) { $user_id = $args->currentUserID; $tproject_id = $args->tproject_id;