本文整理汇总了PHP中convertSecondToTime函数的典型用法代码示例。如果您正苦于以下问题:PHP convertSecondToTime函数的具体用法?PHP convertSecondToTime怎么用?PHP convertSecondToTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了convertSecondToTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _fiche
function _fiche(&$PDOdb, &$assetOf, $mode = 'edit', $fk_product_to_add = 0, $fk_nomenclature = 0)
{
global $langs, $db, $conf, $user, $hookmanager;
/***************************************************
* PAGE
*
* Put here all code to build page
****************************************************/
$parameters = array('id' => $assetOf->getId());
$reshook = $hookmanager->executeHooks('doActions', $parameters, $assetOf, $mode);
// Note that $action and $object may have been modified by hook
//pre($assetOf,true);
llxHeader('', $langs->trans('OFAsset'), '', '');
print dol_get_fiche_head(ofPrepareHead($assetOf, 'assetOF'), 'fiche', $langs->trans('OFAsset'));
?>
<style type="text/css">
#assetChildContener .OFMaster {
background:#fff;
-webkit-box-shadow: 4px 4px 5px 0px rgba(50, 50, 50, 0.52);
-moz-box-shadow: 4px 4px 5px 0px rgba(50, 50, 50, 0.52);
box-shadow: 4px 4px 5px 0px rgba(50, 50, 50, 0.52);
margin-bottom:20px;
}
</style>
<div class="OFContent" rel="<?php
echo $assetOf->getId();
?>
"> <?php
$TPrixFournisseurs = array();
//$form=new TFormCore($_SERVER['PHP_SELF'],'formeq'.$assetOf->getId(),'POST');
//Affichage des erreurs
if (!empty($assetOf->errors)) {
?>
<br><div class="error">
<?php
foreach ($assetOf->errors as $error) {
echo $error . "<br>";
setEventMessage($error, 'errors');
}
$assetOf->errors = array();
?>
</div><br>
<?php
}
$form = new TFormCore();
$form->Set_typeaff($mode);
$doliform = new Form($db);
if (!empty($_REQUEST['fk_product'])) {
echo $form->hidden('fk_product', $_REQUEST['fk_product']);
}
$TBS = new TTemplateTBS();
$liste = new TListviewTBS('asset');
$TBS->TBS->protect = false;
$TBS->TBS->noerr = true;
$PDOdb = new TPDOdb();
$TNeeded = array();
$TToMake = array();
$TNeeded = _fiche_ligne($form, $assetOf, "NEEDED");
$TToMake = _fiche_ligne($form, $assetOf, "TO_MAKE");
$TIdCommandeFourn = $assetOf->getElementElement($PDOdb);
$HtmlCmdFourn = '';
if (count($TIdCommandeFourn)) {
foreach ($TIdCommandeFourn as $idcommandeFourn) {
$cmd = new CommandeFournisseur($db);
$cmd->fetch($idcommandeFourn);
$HtmlCmdFourn .= $cmd->getNomUrl(1) . " - " . $cmd->getLibStatut(0);
}
}
ob_start();
$doliform->select_produits('', 'fk_product', '', $conf->product->limit_size, 0, -1, 2, '', 3, array());
$select_product = ob_get_clean();
$Tid = array();
//$Tid[] = $assetOf->rowid;
if ($assetOf->getId() > 0) {
$assetOf->getListeOFEnfants($PDOdb, $Tid);
}
$TWorkstation = array();
foreach ($assetOf->TAssetWorkstationOF as $k => &$TAssetWorkstationOF) {
$ws =& $TAssetWorkstationOF->ws;
$TWorkstation[] = array('libelle' => '<a href="' . dol_buildpath('workstation/workstation.php?id=' . $ws->rowid . '&action=view', 2) . '">' . $ws->name . '</a>', 'fk_user' => visu_checkbox_user($PDOdb, $form, $ws->fk_usergroup, $TAssetWorkstationOF->users, 'TAssetWorkstationOF[' . $k . '][fk_user][]', $assetOf->status), 'fk_project_task' => visu_project_task($db, $TAssetWorkstationOF->fk_project_task, $form->type_aff, 'TAssetWorkstationOF[' . $k . '][progress]'), 'fk_task' => visu_checkbox_task($PDOdb, $form, $TAssetWorkstationOF->fk_asset_workstation, $TAssetWorkstationOF->tasks, 'TAssetWorkstationOF[' . $k . '][fk_task][]', $assetOf->status), 'nb_hour' => $assetOf->status == 'DRAFT' && $mode == "edit" ? $form->texte('', 'TAssetWorkstationOF[' . $k . '][nb_hour]', $TAssetWorkstationOF->nb_hour, 3, 10) : ($conf->global->ASSET_USE_CONVERT_TO_TIME ? convertSecondToTime($TAssetWorkstationOF->nb_hour * 3600) : price($TAssetWorkstationOF->nb_hour)), 'nb_hour_real' => $assetOf->status == 'OPEN' && $mode == "edit" ? $form->texte('', 'TAssetWorkstationOF[' . $k . '][nb_hour_real]', $TAssetWorkstationOF->nb_hour_real, 3, 10) : ($conf->global->ASSET_USE_CONVERT_TO_TIME ? convertSecondToTime($TAssetWorkstationOF->nb_hour_real * 3600) : price($TAssetWorkstationOF->nb_hour_real)), 'nb_days_before_beginning' => $assetOf->status == 'DRAFT' && $mode == "edit" ? $form->texte('', 'TAssetWorkstationOF[' . $k . '][nb_days_before_beginning]', $TAssetWorkstationOF->nb_days_before_beginning, 3, 10) : $TAssetWorkstationOF->nb_days_before_beginning, 'delete' => $mode == 'edit' && $assetOf->status == 'DRAFT' ? '<a href="javascript:deleteWS(' . $assetOf->getId() . ',' . $TAssetWorkstationOF->getId() . ');">' . img_picto('Supprimer', 'delete.png') . '</a>' : '', 'note_private' => $assetOf->status == 'DRAFT' && $mode == 'edit' ? $form->zonetexte('', 'TAssetWorkstationOF[' . $k . '][note_private]', $TAssetWorkstationOF->note_private, 50, 1) : $TAssetWorkstationOF->note_private, 'rang' => $assetOf->status == 'DRAFT' && $mode == "edit" ? $form->texte('', 'TAssetWorkstationOF[' . $k . '][rang]', $TAssetWorkstationOF->rang, 3, 10) : $TAssetWorkstationOF->rang, 'id' => $ws->getId());
}
$client = new Societe($db);
if ($assetOf->fk_soc > 0) {
$client->fetch($assetOf->fk_soc);
}
$commande = new Commande($db);
if ($assetOf->fk_commande > 0) {
$commande->fetch($assetOf->fk_commande);
}
$TOFParent = array_merge(array(0 => ''), $assetOf->getCanBeParent($PDOdb));
$hasParent = false;
if (!empty($assetOf->fk_assetOf_parent)) {
$TAssetOFParent = new TAssetOF();
$TAssetOFParent->load($PDOdb, $assetOf->fk_assetOf_parent);
$hasParent = true;
}
$parameters = array('id' => $assetOf->getId());
//.........这里部分代码省略.........
示例2: dol_print_date
$tasktmp->label = $obj->label;
print $tasktmp->getNomUrl(1, 'withproject', 'task', 1, '<br>');
} else {
print $langs->trans("NoTasks");
}
print '</td>';
print '<td align="center">' . dol_print_date($db->jdate($obj->dateo), 'day') . '</td>';
print '<td align="center">' . dol_print_date($db->jdate($obj->datee), 'day') . '</td>';
print '<td align="right"><a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $obj->taskid . '&withproject=1">';
print convertSecondToTime($obj->planned_workload, 'allhourmin');
print '</a></td>';
print '<td align="right">';
print $obj->taskid > 0 ? $obj->progress . '%' : '';
print '</td>';
print '<td align="right"><a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $obj->taskid . '&withproject=1">';
print convertSecondToTime($obj->timespent, 'allhourmin');
print '</a></td>';
print '<td align="right">';
if (!empty($obj->taskid)) {
if (empty($obj->planned_workload) > 0) {
$percentcompletion = $langs->trans("WorkloadNotDefined");
} else {
$percentcompletion = intval($obj->duration_effective * 100 / $obj->planned_workload) . '%';
}
}
print $percentcompletion;
print '</td>';
print "</tr>\n";
$i++;
}
if ($num > $max) {
示例3: dol_print_date
} else {
print ' ';
}
print '</td></tr>';
}
// Date start
print '<tr><td>' . $langs->trans("DateStart") . '</td><td colspan="3">';
print dol_print_date($object->date_start, 'dayhour');
print '</td></tr>';
// Date end
print '<tr><td>' . $langs->trans("DateEnd") . '</td><td colspan="3">';
print dol_print_date($object->date_end, 'dayhour');
print '</td></tr>';
// Planned workload
print '<tr><td>' . $langs->trans("PlannedWorkload") . '</td><td colspan="3">';
print convertSecondToTime($object->planned_workload, 'allhourmin');
print '</td></tr>';
// Progress declared
print '<tr><td>' . $langs->trans("ProgressDeclared") . '</td><td colspan="3">';
print $object->progress . ' %';
print '</td></tr>';
// Progress calculated
print '<tr><td>' . $langs->trans("ProgressCalculated") . '</td><td colspan="3">';
if ($object->planned_workload) {
$tmparray = $object->getSummaryOfTimeSpent();
if ($tmparray['total_duration'] > 0) {
print round($tmparray['total_duration'] / $object->planned_workload * 100, 2) . ' %';
} else {
print '0 %';
}
} else {
示例4: dol_print_date
print '</td></tr>';
}
}
// Civility
print '<tr><td>' . $langs->trans("UserTitle") . '</td><td colspan="3">';
print $object->getCivilityLabel();
print '</td></tr>';
// Date To Birth
print '<tr>';
if (!empty($object->birthday)) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
print '<td>' . $langs->trans("DateToBirth") . '</td><td colspan="3">' . dol_print_date($object->birthday, "day");
print ' ';
//var_dump($birthdatearray);
$ageyear = convertSecondToTime($now - $object->birthday, 'year') - 1970;
$agemonth = convertSecondToTime($now - $object->birthday, 'month') - 1;
if ($ageyear >= 2) {
print '(' . $ageyear . ' ' . $langs->trans("DurationYears") . ')';
} else {
if ($agemonth >= 2) {
print '(' . $agemonth . ' ' . $langs->trans("DurationMonths") . ')';
} else {
print '(' . $agemonth . ' ' . $langs->trans("DurationMonth") . ')';
}
}
print ' - ';
if ($object->birthday_alert) {
print $langs->trans("BirthdayAlertOn");
} else {
print $langs->trans("BirthdayAlertOff");
}
示例5: while
}
$var = true;
while ($i < $num) {
$objp = $db->fetch_object($resql);
$var = !$var;
// Ligne en mode visu
if ($action != 'editline' || GETPOST('line_id', 'int') != $objp->rowid) {
print '<tr ' . $bc[$var] . '>';
print '<td>';
print '<a name="' . $objp->rowid . '"></a>';
// ancre pour retourner sur la ligne
print dol_htmlentitiesbr($objp->description);
// Date
print '<td align="center" width="150">' . dol_print_date($db->jdate($objp->date_intervention), 'dayhour') . '</td>';
// Duration
print '<td align="right" width="150">' . convertSecondToTime($objp->duree) . '</td>';
print "</td>\n";
// Icone d'edition et suppression
if ($object->statut == 0 && $user->rights->ficheinter->creer) {
print '<td align="center">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=editline&line_id=' . $objp->rowid . '#' . $objp->rowid . '">';
print img_edit();
print '</a>';
print '</td>';
print '<td align="center">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=ask_deleteline&line_id=' . $objp->rowid . '">';
print img_delete();
print '</a></td>';
if ($num > 1) {
print '<td align="center">';
if ($i > 0) {
示例6: write_file
//.........这里部分代码省略.........
$pdf->MultiCell(0, 3, '');
// Set interline to 3
$pdf->SetTextColor(0, 0, 0);
$tab_top = 50;
$tab_height = 200;
$tab_top_newpage = 40;
$tab_height_newpage = 210;
// Affiche notes
if (!empty($object->note_public)) {
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxref - 1, $tab_top - 2, dol_htmlentitiesbr($object->note_public), 0, 1);
$nexY = $pdf->GetY();
$height_note = $nexY - ($tab_top - 2);
// Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192, 192, 192);
$pdf->Rect($this->marge_gauche, $tab_top - 3, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
$tab_height = $tab_height - $height_note;
$tab_top = $nexY + 6;
} else {
$height_note = 0;
}
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
// Boucle sur les lignes
for ($i = 0; $i < $nblignes; $i++) {
$curY = $nexY;
// Description of ligne
$ref = $object->lines[$i]->ref;
$libelleline = $object->lines[$i]->label;
$progress = $object->lines[$i]->progress . '%';
$datestart = dol_print_date($object->lines[$i]->date_start, 'day');
$dateend = dol_print_date($object->lines[$i]->date_end, 'day');
$planned_workload = convertSecondToTime($object->lines[$i]->planned_workload, 'allhourmin');
$pdf->SetFont('', '', $default_font_size - 1);
// Dans boucle pour gerer multi-page
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L');
$pdf->SetXY($this->posxlabel, $curY);
$pdf->MultiCell($this->posxworkload - $this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L');
$pdf->SetXY($this->posxworkload, $curY);
$pdf->MultiCell($this->posxprogress - $this->posxworkload, 3, $planned_workload, 0, 'R');
$pdf->SetXY($this->posxprogress, $curY);
$pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, $progress, 0, 'R');
$pdf->SetXY($this->posxdatestart, $curY);
$pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $datestart, 0, 'C');
$pdf->SetXY($this->posxdateend, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdateend, 3, $dateend, 0, 'C');
$pageposafter = $pdf->getPage();
$pdf->SetFont('', '', $default_font_size - 1);
// On repositionne la police par defaut
$nexY = $pdf->GetY();
// Add line
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < $nblignes - 1) {
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
$pdf->SetLineStyle(array('dash' => 0));
}
$nexY += 2;
// Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter) {
$pdf->setPage($pagenb);
if ($pagenb == 1) {
示例7: select_duration
/**
* Function to show a form to select a duration on a page
*
* @param string $prefix Prefix
* @param int $iSecond Default preselected duration (number of seconds)
* @param int $disabled Disable the combo box
* @param string $typehour If 'select' then input hour and input min is a combo, if 'text' input hour is in text and input min is a combo
* @param string $minunderhours If 1, show minutes selection under the hours
* @return void
*/
function select_duration($prefix, $iSecond = '', $disabled = 0, $typehour = 'select', $minunderhours = 0)
{
global $langs;
$hourSelected = 0;
$minSelected = 0;
if ($iSecond) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
$hourSelected = convertSecondToTime($iSecond, 'allhour');
$minSelected = convertSecondToTime($iSecond, 'min');
}
if ($typehour == 'select') {
print '<select class="flat" name="' . $prefix . 'hour"' . ($disabled ? ' disabled="disabled"' : '') . '>';
for ($hour = 0; $hour < 25; $hour++) {
print '<option value="' . $hour . '"';
if ($hourSelected == $hour) {
print " selected=\"true\"";
}
print ">" . $hour . "</option>";
}
print "</select>";
} elseif ($typehour == 'text') {
print '<input type="text" size="3" name="' . $prefix . 'hour"' . ($disabled ? ' disabled="disabled"' : '') . ' class="flat" value="' . (int) $hourSelected . '">';
}
print $langs->trans('Hours');
if ($minunderhours) {
print '<br>';
} else {
print " ";
}
print '<select class="flat" name="' . $prefix . 'min"' . ($disabled ? ' disabled="disabled"' : '') . '>';
for ($min = 0; $min <= 55; $min = $min + 5) {
print '<option value="' . $min . '"';
if ($minSelected == $min) {
print ' selected="selected"';
}
print '>' . $min . '</option>';
}
print "</select>";
print $langs->trans('Minutes') . " ";
}
示例8:
{
print $fullhour;
// TODO Add delay taking account of working hours per day and working day per week
//if ($workingdelay != $fullhour) print '<br>('.$workingdelay.')';
}
//else print '--:--';
print '</td>';
}
// Time spent
if (! empty($arrayfields['t.duration_effective']['checked']))
{
$showlineingray=0;$showproject=1;
print '<td class="center">';
if ($showlineingray) print '<i>';
else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject?'':'&withproject=1').'">';
if ($obj->duration_effective) print convertSecondToTime($obj->duration_effective,$timespentoutputformat);
else print '--:--';
if ($showlineingray) print '</i>';
else print '</a>';
print '</td>';
}
// Calculated progress
if (! empty($arrayfields['t.progress_calculated']['checked']))
{
print '<td class="center">';
if ($obj->planned_workload || $obj->duration_effective)
{
if ($obj->planned_workload) print round(100 * $obj->duration_effective / $obj->planned_workload,2).' %';
else print $langs->trans('WorkloadNotDefined');
}
print '</td>';
示例9: in
$sql.= " AND p.rowid in (".$projectsListId.")";
$sql.= " GROUP BY p.rowid, p.ref, p.title";
$var=false;
$resql = $db->query($sql);
if ( $resql )
{
while ($row = $db->fetch_object($resql))
{
print "<tr $bc[$var]>";
print '<td>';
$projectstatic->id=$row->rowid;
$projectstatic->ref=$row->ref;
print $projectstatic->getNomUrl(1);
print '</td>';
print '<td align="right">'.convertSecondToTime($row->nb).'</td>';
print "</tr>\n";
$var=!$var;
}
$db->free($resql);
}
else
{
dol_print_error($db);
}
print "</table>";
print '</td></tr></table>';
llxFooter();
示例10: img_edit
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '">';
} else {
if ($user->rights->projet->creer) {
print ' ';
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=editline&lineid=' . $task_time->rowid . ($withproject ? '&withproject=1' : '') . '">';
print img_edit();
print '</a>';
print ' ';
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=deleteline&lineid=' . $task_time->rowid . ($withproject ? '&withproject=1' : '') . '">';
print img_delete();
print '</a>';
}
}
print '</td>';
print "</tr>\n";
$total += $task_time->task_duration;
$totalvalue += price2num($task_time->thm * $task_time->task_duration / 3600);
}
print '<tr class="liste_total"><td colspan="3" class="liste_total">' . $langs->trans("Total") . '</td>';
print '<td align="right" class="nowrap liste_total">' . convertSecondToTime($total, 'allhourmin') . '</td>';
if ($conf->salaries->enabled) {
print '<td align="right">' . price($totalvalue, 1, $langs, 1, -1, -1, $conf->currency) . '</td>';
}
print '<td> </td>';
print '</tr>';
print "</table>";
print "</form>";
}
}
llxFooter();
$db->close();
示例11: projectLinesPerWeek
/**
* Output a task line into a perday intput mode
*
* @param string $inc Line number (start to 0, then increased by recursive call)
* @param int $firstdaytoshow First day to show
* @param User|null $fuser Restrict list to user if defined
* @param string $parent Id of parent project to show (0 to show all)
* @param Task[] $lines Array of lines
* @param int $level Level (start to 0, then increased/decrease by recursive call)
* @param string $projectsrole Array of roles user has on project
* @param string $tasksrole Array of roles user has on task
* @param string $mine Show only task lines I am assigned to
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
* @return $inc
*/
function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask = 1)
{
global $db, $user, $bc, $langs;
global $form, $formother, $projectstatic, $taskstatic;
$lastprojectid = 0;
$var = true;
$numlines = count($lines);
for ($i = 0; $i < $numlines; $i++) {
if ($parent == 0) {
$level = 0;
}
if ($lines[$i]->fk_parent == $parent) {
// Break on a new project
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
$var = !$var;
$lastprojectid = $lines[$i]->fk_project;
$projectstatic->id = $lines[$i]->fk_project;
$projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id);
// Load time spent into this->weekWorkLoad and this->weekWorkLoadPerTaks for all day of a week
}
// If we want all or we have a role on task, we show it
if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) {
print "<tr " . $bc[$var] . ">\n";
// Project
print '<td class="nowrap">';
$projectstatic->id = $lines[$i]->fk_project;
$projectstatic->ref = $lines[$i]->projectref;
$projectstatic->title = $lines[$i]->projectlabel;
$projectstatic->public = $lines[$i]->public;
print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole") . ': ' . $projectsrole[$lines[$i]->fk_project]);
print "</td>";
// Ref
print '<td class="nowrap">';
$taskstatic->id = $lines[$i]->id;
$taskstatic->ref = $lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id;
print $taskstatic->getNomUrl(1, 'withproject', 'time');
print '</td>';
// Label task
print "<td>";
print '<!-- Task id = ' . $lines[$i]->id . ' -->';
for ($k = 0; $k < $level; $k++) {
print " ";
}
$taskstatic->id = $lines[$i]->id;
$taskstatic->ref = $lines[$i]->label;
$taskstatic->date_start = $lines[$i]->date_start;
$taskstatic->date_end = $lines[$i]->date_end;
print $taskstatic->getNomUrl(0, 'withproject', 'time');
//print "<br>";
//for ($k = 0 ; $k < $level ; $k++) print " ";
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
print "</td>\n";
// Planned Workload
print '<td align="right">';
if ($lines[$i]->planned_workload) {
print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
} else {
print '--:--';
}
print '</td>';
// Progress declared %
print '<td align="right">';
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
print '</td>';
// Time spent by everybody
print '<td align="right">';
// $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user
if ($lines[$i]->duration) {
print '<a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $lines[$i]->id . '">';
print convertSecondToTime($lines[$i]->duration, 'allhourmin');
print '</a>';
} else {
print '--:--';
}
print "</td>\n";
// Time spent by user
print '<td align="right">';
$tmptimespent = $taskstatic->getSummaryOfTimeSpent();
if ($tmptimespent['total_duration']) {
print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin');
} else {
print '--:--';
}
print "</td>\n";
$disabledproject = 1;
//.........这里部分代码省略.........
示例12: select_duration
/**
* Function to show a form to select a duration on a page
*
* @param string $prefix prefix
* @param int $iSecond Default preselected duration (number of seconds)
* @param int $disabled Disable the combo box
* @return void
*/
function select_duration($prefix, $iSecond = '', $disabled = 0)
{
if ($iSecond) {
require_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php";
$hourSelected = convertSecondToTime($iSecond, 'hour');
$minSelected = convertSecondToTime($iSecond, 'min');
}
print '<select class="flat" name="' . $prefix . 'hour"' . ($disabled ? ' disabled="disabled"' : '') . '>';
for ($hour = 0; $hour < 24; $hour++) {
print '<option value="' . $hour . '"';
if ($hourSelected == $hour) {
print " selected=\"true\"";
}
print ">" . $hour . "</option>";
}
print "</select>";
print "H ";
print '<select class="flat" name="' . $prefix . 'min"' . ($disabled ? ' disabled="disabled"' : '') . '>';
for ($min = 0; $min <= 55; $min = $min + 5) {
print '<option value="' . $min . '"';
if ($minSelected == $min) {
print ' selected="selected"';
}
print '>' . $min . '</option>';
}
print "</select>";
print "M ";
}
示例13: _task
function _task(&$db, $id_task, $values = array())
{
global $user, $langs, $conf;
$task = new Task($db);
if ($id_task) {
$task->fetch($id_task);
$task->fetch_optionals($id_task);
}
if (!empty($values)) {
_set_values($task, $values);
if ($values['status'] == 'inprogress') {
if ($task->progress == 0) {
$task->progress = 5;
} else {
if ($task->progress == 100) {
$task->progress = 95;
}
}
} else {
if ($values['status'] == 'finish') {
$task->progress = 100;
} else {
if ($values['status'] == 'todo') {
$task->progress = 0;
}
}
}
$task->status = $values['status'];
$task->update($user);
}
$task->date_delivery = 0;
if ($task->date_end > 0 && $task->planned_workload > 0) {
$velocity = scrum_getVelocity($db, $task->fk_project);
$task->date_delivery = _get_delivery_date_with_velocity($db, $task, $velocity);
}
$dayInSecond = 86400;
if ($conf->global->TIMESHEET_WORKING_HOUR_PER_DAY) {
$dayInSecond = 60 * 60 * $conf->global->TIMESHEET_WORKING_HOUR_PER_DAY;
}
$task->aff_time = convertSecondToTime($task->duration_effective, 'all', $dayInSecond);
$task->aff_planned_workload = convertSecondToTime($task->planned_workload, 'all', $dayInSecond);
$task->time_rest = $task->planned_workload * (1 - $task->progress / 100);
$task->aff_time_rest = $langs->trans('TimeRest') . ' : ' . convertSecondToTime($task->time_rest, 'all', $dayInSecond);
$task->long_description = $task->divers = '';
if ((int) $task->array_options['options_fk_of'] > 0 && $conf->of->enabled) {
if (!isset($PDOdb)) {
$PDOdb = new TPDOdb();
}
$of = new TAssetOF();
$of->withChild = false;
$of->load($PDOdb, $task->array_options['options_fk_of']);
$link_of = !empty($conf->of->enabled) ? dol_buildpath('/of/fiche_of.php?id=' . $task->array_options['options_fk_of'], 1) : '';
if ($of->fk_soc > 0) {
$soc = new Societe($db);
$soc->fetch($of->fk_soc);
}
$task->divers .= '[<a href="' . $link_of . '">' . $of->numero . '</a>] ' . (!empty($soc) ? $soc->getNomUrl() : '') . '<br />';
if ($of->fk_commande > 0) {
dol_include_once('/commande/class/commande.class.php');
$commande = new Commande($db);
$commande->fetch($of->fk_commande);
$task->divers .= $commande->getNomUrl(1) . '<br />';
}
}
if ((int) $task->array_options['options_fk_product'] > 0 && (empty($conf->global->SCRUMBOARD_ICON_SET) || $conf->global->SCRUMBOARD_ICON_SET != 'null')) {
dol_include_once('/product/class/product.class.php');
$product = new Product($db);
if ($product->fetch((int) $task->array_options['options_fk_product']) > 0) {
$task->divers .= '[' . $product->getNomUrl() . ' ' . $product->label . ']<br />';
$nb_picto = $product->id % 49 - 1;
$y_picto = floor($nb_picto / 7);
$x_picto = $nb_picto - $y_picto * 7;
$w_cell = 27;
$h_cell = 28;
$task->divers .= '<div class="picto" style="float:left; margin-left:3px; background-image:url(./img/' . (!empty($conf->global->SCRUMBOARD_ICON_SET) ? $conf->global->SCRUMBOARD_ICON_SET : 'animal-icons-mini') . '.png);background-position:' . $w_cell * -$x_picto . 'px ' . $h_cell * -$y_picto . 'px;width:' . $w_cell . 'px; height:' . $h_cell . 'px;"></div>';
//var_dump(array($nb_picto,$y_picto, $x_picto,$task->divers));
}
}
if (!empty($task->note_private)) {
$task->divers .= '<br />' . $task->note_private;
}
if ($task->date_start > 0) {
$task->long_description .= $langs->trans('TaskDateStart') . ' : ' . dol_print_date($task->date_start) . '<br />';
}
if ($task->date_end > 0) {
$task->long_description .= $langs->trans('TaskDateEnd') . ' : ' . dol_print_date($task->date_end) . '<br />';
}
if ($task->date_delivery > 0 && $task->date_delivery > $task->date_end) {
$task->long_description .= $langs->trans('TaskDateShouldDelivery') . ' : ' . dol_print_date($task->date_delivery) . '<br />';
}
$task->long_description .= $task->description;
$task->project = new Project($db);
$task->project->fetch($task->fk_project);
$task->project->fetch_optionals($task->fk_project, 'color');
if (!empty($conf->global->SCRUM_SHOW_LINKED_CONTACT)) {
getTContact($task);
}
return _as_array($task);
}
示例14: projectLinesb
/**
* Output a task line
*
* @param string $inc ?
* @param string $parent ?
* @param Object $lines ?
* @param int $level ?
* @param string $projectsrole ?
* @param string $tasksrole ?
* @param string $mine Show only task lines I am assigned to
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
* @return $inc
*/
function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask = 0)
{
global $user, $bc, $langs;
global $form, $projectstatic, $taskstatic;
$lastprojectid = 0;
$var = true;
$numlines = count($lines);
for ($i = 0; $i < $numlines; $i++) {
if ($parent == 0) {
$level = 0;
}
if ($lines[$i]->fk_parent == $parent) {
// Break on a new project
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
$var = !$var;
$lastprojectid = $lines[$i]->fk_project;
}
// If we want all or we have a role on task, we show it
if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) {
print "<tr " . $bc[$var] . ">\n";
// Project
print "<td>";
$projectstatic->id = $lines[$i]->fk_project;
$projectstatic->ref = $lines[$i]->projectref;
$projectstatic->public = $lines[$i]->public;
$projectstatic->label = $langs->transnoentitiesnoconv("YourRole") . ': ' . $projectsrole[$lines[$i]->fk_project];
print $projectstatic->getNomUrl(1);
print "</td>";
// Ref
print '<td>';
$taskstatic->id = $lines[$i]->id;
$taskstatic->ref = $lines[$i]->id;
print $taskstatic->getNomUrl(1);
print '</td>';
// Label task
print "<td>";
for ($k = 0; $k < $level; $k++) {
print " ";
}
$taskstatic->id = $lines[$i]->id;
$taskstatic->ref = $lines[$i]->label;
print $taskstatic->getNomUrl(0);
print "</td>\n";
// Date start
print '<td align="center">';
print dol_print_date($lines[$i]->date_start, 'dayhour');
print '</td>';
// Date end
print '<td align="center">';
print dol_print_date($lines[$i]->date_end, 'dayhour');
print '</td>';
// Planned Workload
print '<td align="right">';
if ($lines[$i]->planned_workload) {
print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
} else {
print '--:--';
}
print '</td>';
// Progress declared %
print '<td align="right">';
print $lines[$i]->progress . ' %';
print '</td>';
// Time spent
print '<td align="right">';
if ($lines[$i]->duration) {
print '<a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $lines[$i]->id . '">';
print convertSecondToTime($lines[$i]->duration, 'allhourmin');
print '</a>';
} else {
print '--:--';
}
print "</td>\n";
$disabledproject = 1;
$disabledtask = 1;
//print "x".$lines[$i]->fk_project;
//var_dump($lines[$i]);
//var_dump($projectsrole[$lines[$i]->fk_project]);
// If at least one role for project
if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
$disabledproject = 0;
$disabledtask = 0;
}
// If $restricteditformytask is on and I have no role on task, i disable edit
if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) {
$disabledtask = 1;
}
//.........这里部分代码省略.........
示例15: while
if ($num > 0) {
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>' . $langs->trans("LastInterventions", $num <= $MAXLIST ? "" : $MAXLIST) . '</td><td align="right"><a href="' . DOL_URL_ROOT . '/fichinter/list.php?socid=' . $object->id . '">' . $langs->trans("AllInterventions") . ' <span class="badge">' . $num . '</span></td></tr></table></td>';
print '</tr>';
$var = !$var;
}
$i = 0;
while ($i < $num && $i < $MAXLIST) {
$objp = $db->fetch_object($resql);
$fichinter_static->id = $objp->id;
$fichinter_static->statut = $objp->fk_statut;
print "<tr " . $bc[$var] . ">";
print '<td class="nowrap"><a href="' . DOL_URL_ROOT . '/fichinter/card.php?id=' . $objp->id . '">' . img_object($langs->trans("ShowPropal"), "propal") . ' ' . $objp->ref . '</a></td>' . "\n";
//print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->startdate)).'</td>'."\n";
print '<td align="right" style="min-width: 60px">' . convertSecondToTime($objp->duration) . '</td>' . "\n";
print '<td align="right" class="nowrap" style="min-width: 60px">' . $fichinter_static->getLibStatut(5) . '</td>' . "\n";
print '</tr>';
$var = !$var;
$i++;
}
$db->free($resql);
if ($num > 0) {
print "</table>";
}
} else {
dol_print_error($db);
}
}
/*
* Last invoices