function PrintStory($story_Row) { global $statuscolour; global $Project; global $Sizecount; global $OSizecount; global $Toggle; global $Iterationcount; global $OIterationcount; global $DBConn; global $LockedIteration; // only for the backlog if ($Project['Backlog_ID'] == $story_Row['Iteration_ID']) { // update predictions // use average card size or current velocity is ave > velocity for unsized cards. if ($story_Row[Size] == "?") { if ($Project['Velocity'] > $Project['Average_Size']) { $Add_This = $Project['Average_Size']; } else { $Add_This = $Project['Velocity']; } } else { $Add_This = $story_Row[Size]; } // add the next story even if it overflows (Best Case) $OSizecount += $Add_This; if ($OSizecount >= $Project['Velocity']) { $OSizecount = 0; $OIterationcount += 1; } // only use complete stories that fit (Worst Case) if ($Sizecount + $Add_This > $Project['Velocity']) { $Iterationcount += 1; $Sizecount = $Add_This; // toggle the colour bands in the iteration for current velocity $Toggle = ($Toggle + 1) % 3; } else { $Sizecount += $Add_This; } } $Num_Children = Num_Children($story_Row['AID']); $class = 'storybox-div '; if ($_REQUEST['Type'] != 'tree') { $class .= ' alternate' . $Toggle . ' '; } else { $class .= ' smaller '; } if ($story_Row['Blocked'] != 0) { $class .= ' blocked'; } // special handling for releases as they cover multiple projects if ($_REQUEST['Root'] == 'iteration' || $_REQUEST['Root'] == 'release') { if (!empty($_REQUEST['IID'])) { if ($story_Row['Iteration_ID'] == $_REQUEST['IID']) { $class .= 'thisiteration'; } } } echo '<div class="' . $class . '" id="storybox' . $story_Row['AID'] . '">'; echo '<div class="right-box">'; if ($_REQUEST['Type'] != 'tree') { echo '<div class="minimenu-div" id="menu_div_' . $story_Row['AID'] . '">' . '<a href="story_Preview.php?id=' . $story_Row['AID'] . '&PID=' . $story_Row['Project_ID'] . '&IID=' . $story_Row['Iteration_ID'] . '" target="_blank" title="Print preview a story (Opens in new tab)"><img src="images/preview.png"></a> ' . '<a class="quickview" id="quickview' . $story_Row['ID'] . '" href="" onclick="javascript: return false;" title="Show more/less detail"><img src="images/more.png"></a> ' . '<a class="statuspopup" href="" onclick="javascript: return false;" title="Change Story Status"><img src="images/status.png"></a> ' . '<a class="iterationpopup" href="" onclick="javascript: return false;" title="Move to different Iteration"><img src="images/move.png"></a> ' . '<a href="story_Edit.php?AID=' . $story_Row['AID'] . '&PID=' . $story_Row['Project_ID'] . '&IID=' . $story_Row['Iteration_ID'] . '" title="Edit Story"><img src="images/edit.png"></a> '; if ($LockedIteration == 0) { echo '<a href="story_Delete.php?id=' . $story_Row['AID'] . '&PID=' . $story_Row['Project_ID'] . '&IID=' . $story_Row['Iteration_ID'] . '" title="Delete Story"><img src="images/delete.png"></a>'; } echo '</div>'; } echo '<div class="type-div">' . $story_Row['Type'] . '</div>'; echo '<div class="size-div" title="Story Size"> '; echo $story_Row['Size'] . ' '; // print probable iteration based on current velocity if on backlog if (empty($_REQUEST['Type'])) { if ($Project['Backlog_ID'] == $story_Row['Iteration_ID']) { echo '<div class="predicted-div" title="Predicted last/first iteration after last \'loaded\' iteration">(+' . $Iterationcount . '/' . $OIterationcount . ') </div>'; } } echo '</div>'; // size-div echo '</div>'; //right-box // set background of drag and drop handle to that of the status (for stories that can be worked on.) if ($Num_Children == 0) { echo '<div title="' . $statuspolicy[$story_Row['Status']] . '" class="storystatus" style="background: #' . $statuscolour[$story_Row['Status']] . '" id="span_div' . $story_Row['AID'] . '"></div>'; } else { echo '<div class="parentstorystatus" id="span_div' . $story_Row['AID'] . '"></div>'; } echo '<div class="storybody">'; echo '<div class="line-1-div">'; //display status of any child stories along with the sum of points for that status echo '<div class="childrenstatus-div"> '; if ($Num_Children != 0) { $astatus = explode(",", $story_Row['Children_Status']); for ($i = 0; $i < count($astatus); $i++) { $SSize = Get_Status_Points($story_Row['AID'], $astatus[$i], 0); if ($SSize != 0) { if ($statuscolour[$astatus[$i]] == '') { echo '<div title="' . $SSize . ' ' . $astatus[$i] . ' points" style=" display: inline-block;background-color:#bfbfbf;"> ' . $SSize . ' </div> '; } else { echo '<div title="' . $SSize . ' ' . $astatus[$i] . ' points" style=" display: inline-block;background-color:#' . $statuscolour[$astatus[$i]] . ';"> ' . $SSize . ' </div> '; } } } // let me get to a small tree echo '<a title="Show my children (#' . $story_Row['ID'] . ') as the root of the tree)"'; echo ' href="story_List.php?Type=tree&Root=' . $story_Row['ID'] . '&PID=' . $story_Row['Project_ID'] . '&IID=' . $story_Row['Iteration_ID'] . '">'; echo '<img src="images/tree-small.png"></a>'; } echo '</div>'; echo '<a href="story_Edit.php?AID=' . $story_Row['AID'] . '&PID=' . $story_Row['Project_ID'] . '&IID=' . $story_Row['Iteration_ID'] . '" title="Edit Story">#' . $story_Row['ID'] . '</a> ' . ' - ' . substr($story_Row['Summary'], 0, 150); echo '</div>'; // line 1 div echo '<div class="line-2-div" id="line-2-div' . $story_Row['ID'] . '">'; echo '<b>' . $Project['Desc_1'] . '</b> ' . html_entity_decode($story_Row['Col_1'], ENT_QUOTES); if ($Project['As_A']) { echo '<div><b>As A: </b>' . html_entity_decode($story_Row['As_A'], ENT_QUOTES) . '</div>'; } if ($Project['Col_2']) { echo '<div><b>' . $Project['Desc_2'] . '</b> ' . html_entity_decode($story_Row['Col_2'], ENT_QUOTES) . '</div>'; } if ($Project['Acceptance']) { echo '<div><b>Acceptance: </b>' . html_entity_decode($story_Row['Acceptance'], ENT_QUOTES) . '</div>'; } echo '</div>'; // line-2-div echo '<div class="line-3-div" id="line-3-div' . $story_Row['ID'] . '">'; if ($Num_Children == 0) { echo '<div class="status-div statuspopup" title="Change Story Status" style="background: #' . $statuscolour[$story_Row['Status']] . '" id="status_div' . $story_Row['AID'] . '">' . $story_Row['Status'] . '</div>'; } echo '<div class="iteration-div" id="status_div' . $story_Row['AID'] . '"> '; echo '<a href="story_List.php?&PID=' . $story_Row['Project_ID'] . '&IID=' . $story_Row['Iteration_ID'] . '#' . $story_Row['AID'] . '" title="Goto Iteration">'; echo Get_Iteration_Name($story_Row['Iteration_ID'], False) . '</a></div>'; // print the micromenu printMicromenu($story_Row['AID']); echo '<div class="owner-div">| ' . Get_User($story_Row['Owner_ID'], 0) . '</div>'; // If I am a child show all my parents echo '<div class="parents-div"> | '; if ($story_Row['Parent_Story_ID'] != 0) { $parentssql = 'SELECT @id :=(SELECT Parent_Story_ID FROM story WHERE AID = @id and Parent_Story_ID <> 0 ) AS parent FROM (SELECT @id :=' . $story_Row['AID'] . ') vars STRAIGHT_JOIN story WHERE @id is not NULL'; $parents_Res = mysqli_query($DBConn, $parentssql); if ($parents_row = mysqli_fetch_assoc($parents_Res)) { do { if ($parents_row['parent'] != NULL) { $parentsql = 'select ID, AID, Summary, Size from story where AID=' . $parents_row['parent'] . ' and AID<>0'; $parent_Res = mysqli_query($DBConn, $parentsql); if ($parent_row = mysqli_fetch_assoc($parent_Res)) { echo '<a title="' . $parent_row['Summary'] . '"'; echo ' href="story_List.php?Type=tree&Root=' . $parent_row['ID'] . '&PID=' . $story_Row['Project_ID'] . '&IID=' . $story_Row['Iteration_ID'] . '">'; echo ' #' . $parent_row['ID'] . ' (' . $parent_row['Size'] . ' pts)</a> '; } } } while ($parents_row = mysqli_fetch_assoc($parents_Res)); } } echo '</div>'; //Parents echo '|<div class="tags-div">'; if (strlen($story_Row['Tags']) != 0) { $aTags = explode(",", $story_Row['Tags']); foreach ($aTags as $Tag) { echo '<a class="tags-each ui-corner-all" title="Search for tag:' . $Tag . '" href="story_List.php?PID=' . $story_Row['Project_ID'] . '&searchstring=tag:' . $Tag . '&Type=search">' . $Tag . '</a>'; } } echo '</div>'; //tags-div echo '<div class="inline right-box" >'; echo getReleaseName($story_Row['Release_ID']); echo '</div>'; echo '<div class="hidden" id="alltasks_' . $story_Row['AID'] . '"></div>'; echo '<div class="hidden" id="commentspops_' . $story_Row['AID'] . '"></div> '; echo '<div class="hidden" id="allupload_' . $story_Row['AID'] . '"></div> '; echo '<div class="auditdialog hidden" id="allaudits_' . $story_Row['AID'] . '"></div> '; echo '</div>'; //line-3-div echo '</div>'; // storybody divline-3-div echo '</div>'; // storybox-div }
$rtyp = "story"; } else { $rtyp = "reportraw"; } echo '<li>' . '<a title = "Export ' . $Row['Desc'] . '" href="' . $rtyp . '_Export.php?PID=' . $_REQUEST['PID'] . '&IID=' . $_REQUEST['IID'] . '&etype=' . $Row['Desc'] . '&QID=' . $Row['ID'] . '"><img src="images/export-small.png"></a> ' . '<a title = "' . $Row['Desc'] . '" href="' . $rtyp . '_List.php?PID=' . $_REQUEST['PID'] . '&IID=' . $_REQUEST['IID'] . '&Type=search&QID=' . $Row['ID'] . '">' . $Row['Desc'] . '</a>' . '</li>'; } while ($Row = mysqli_fetch_assoc($Res)); } echo '</ul></li>'; // Iterations Stuff $topdate = $thisdate = date_create(Date("Y-m-d")); $thisdate = date_format($thisdate, 'Y-m-d'); date_add($topdate, date_interval_create_from_date_string('3 months')); $topdate = date_format($topdate, 'Y-m-d'); echo '<li><a href="#"> Iterations </a><ul>'; if (isset($_REQUEST['IID'])) { echo '<li><a href="story_Export.php?PID=' . $_REQUEST['PID'] . '&IID=' . $_REQUEST['IID'] . '">Export ' . Get_Iteration_Name($_REQUEST['IID'], False) . '</a></li>'; } // Iteration stuff echo '<li/>'; echo '<li><a href="iteration_Planning.php?PID=' . $_REQUEST['PID'] . '"><b>Iteration Planning</b></a></li>'; echo '<li/>'; // fetch the backlog (no scrum board option) if (isset($project_Row['Backlog_ID'])) { $sql = 'SELECT ID, Name, ( select count(AID) from story where story.Iteration_ID=' . $project_Row['Backlog_ID'] . ' and 0=(select count(Parent_Story_ID) from story as p where p.Parent_Story_ID = story.AID) ) as NumStories, ,( select Sum (Size) from story where story.Iteration_ID=' . $project_Row['Backlog_ID'] . ' and 0=(select count(Parent_Story_ID) from story as p where p.Parent_Story_ID = story.AID) ) as SumPoints FROM iteration where iteration.ID =' . $project_Row['Backlog_ID']; } else { $sql = 'SELECT ID, Name, ( select count(AID) from story where story.Iteration_ID=(select project.Backlog_ID from project where project.ID="' . $_REQUEST['PID'] . '") and 0=(select count(Parent_Story_ID) from story as p where p.Parent_Story_ID = story.AID) ) as NumStories, ( select Sum(Size) from story where story.Iteration_ID=(select project.Backlog_ID from project where project.ID="' . $_REQUEST['PID'] . '") and 0=(select count(Parent_Story_ID) from story as p where p.Parent_Story_ID = story.AID) ) as SumPoints FROM iteration where iteration.ID =(select project.Backlog_ID from project where project.ID=' . $_REQUEST['PID'] . ')'; } $iteration_Res = mysqli_query($DBConn, $sql); if ($iteration_Row = mysqli_fetch_assoc($iteration_Res)) { echo '<li>' . '<a href="story_List.php?PID=' . $_REQUEST['PID'] . '&IID=' . $iteration_Row['ID'] . '" title = "Product Backlog">' . substr($iteration_Row['Name'], 0, 14) . '</a>'; echo '<div class="smaller">';
<?php include 'include/header.inc.php'; echo '<div class="hidden" id="phpbread"><a href="project_List.php">My Projects</a>->'; echo '<a href="project_Summary.php?PID=' . $_REQUEST['PID'] . '">'; echo Get_Project_Name($_REQUEST['PID']); echo '</a>->'; echo Get_Iteration_Name($_REQUEST['IID']); echo '</div>'; ?> <script> $(function() { document.title = 'Practical Agile: '+$("#phpbread").text().substring(13); $("#breadcrumbs").html($("#phpbread").html()); if ($("#phpnavicons")){ $("#navicons").html($("#phpnavicons").html()); } $('.date').datepicker({ numberOfMonths: 2, dateFormat: "yy-mm-dd", showButtonPanel: true }); }); </script> <script> $(document).ready(function(){
<?php $sql = 'SELECT * FROM story where story.Project_ID=' . $_REQUEST['PID'] . ' and story.Iteration_ID=' . $_REQUEST['IID'] . ' and 0=(select count(Parent_Story_ID) from story as p where p.Parent_Story_ID = story.AID) order by story.Iteration_Rank'; Get_Project_Name($_REQUEST['PID']); $Res = mysqli_query($DBConn, $sql); $Toggle = 0; if ($Row = mysqli_fetch_assoc($Res)) { do { $Toggle = ($Toggle + 1) % 2; if ($Toggle == 1) { echo '<div id="container">'; } else { echo '<div id="containerr">'; } //############################ echo '<div class="left">' . '<a title="Edit Story" href="story_Edit.php?AID=' . $Row['AID'] . '&PID=' . $Row['Project_ID'] . '&IID=' . $Row['Iteration_ID'] . '">' . $Row['Type'] . ': #' . $Row['ID'] . '</A>'; $istring = Get_Iteration_Name($Row['Iteration_ID'], False); if ($istring != 'Backlog') { echo ' - ' . $istring; } if ($Row['Owner_ID'] != 0) { echo ' (' . Get_User($Row['Owner_ID'], 0) . ')'; } echo '</div>'; echo '<div class="right">' . $Row['Size'] . ' pts.' . '</div>'; echo '<div id="summary">' . ' ' . $Row['Summary'] . ' ' . '</div>'; echo '<div id="detail">'; if (strlen($Row['As_A']) > 0) { echo '<b>As a:</b> ' . html_entity_decode($Row['As_A'], ENT_QUOTES) . '<br>'; } echo '<b>' . $Project['Desc_1'] . '</b>' . html_entity_decode($Row['Col_1'], ENT_QUOTES) . '<br>'; if (strlen($Row['Col_2']) > 0) {
<?php include 'include/header.inc.php'; $showForm = true; if ($_REQUEST['delete']) { if (readonly($_REQUEST['PID']) == 0) { $sql = 'select count(*) as nums from story where Project_ID=' . $_REQUEST['PID'] . ' and story.Iteration_ID = ' . $_REQUEST['IID']; $iteration_Res = mysqli_query($DBConn, $sql); $iteration_Row = mysqli_fetch_assoc($iteration_Res); if ($iteration_Row['nums'] != 0) { if (mysqli_query($DBConn, 'DELETE FROM iteration WHERE ID=' . $_REQUEST['IID'])) { $showForm = false; $deleted = true; $sql = 'delete from points_log where Object_ID=' . $_REQUEST['OID']; mysqli_query($DBConn, $sql); } } } } if ($_REQUEST['nodelete']) { $showForm = false; $deleted = false; } if ($showForm) { echo '<form method="post" action="?"><p><h2>' . Get_Iteration_Name($_REQUEST['IID']) . '</h2><p>' . 'Are you sure you want to delete this Iteration?<br />' . '<input type="hidden" name="IID" value="' . $_REQUEST['IID'] . '">' . '<input type="submit" name="delete" value="Yes, Delete"> ' . '<input type="hidden" name="PID" value="' . $_REQUEST['PID'] . '">' . '<input type="submit" name="nodelete" value="No, Don\'t Delete">' . '</form>'; } else { header('Location:iteration_List.php?PID=' . $_REQUEST['PID']); } include 'include/footer.inc.php';
if (empty($_GET['etype'])) { $filename = "iteration_export.csv"; } else { $filename = $_GET['etype'] . "_export.csv"; } header("Content-Disposition: attachment; filename=\"{$filename}\""); header("Content-Type: text/csv; charset=UTF-16LE"); $out = fopen("php://output", 'w'); $flag = false; $sql = 'SELECT ID as Story, Epic_Rank, Iteration_Rank, ' . ' (select a.ID from story as a where a.AID = story.Parent_Story_ID) as Parent_Story_ID, ' . ' (select release_details.Name from release_details where release_details.ID = story.Release_ID) as Release_Name, ' . ' (select iteration.Name from iteration where iteration.ID = story.Iteration_ID) as Iteration, ' . ' (select user.Friendly_Name from user where user.ID = story.Owner_ID) as Owner, ' . ' Type, Status, Size, Blocked, Summary, Col_1, As_A, Col_2, Acceptance, Tags'; //add numchildren if we are exporting the project if (!empty($_GET['etype'])) { $sql .= ', (select count(c.ID) from story as c where c.Project_ID=' . $_GET['PID'] . ' and c.Parent_Story_ID = story.AID ) as Num_Children'; $audittext = ' Project ' . Get_Project_Name($_GET['PID']); } else { $audittext = ' Iteration ' . Get_Iteration_Name($_GET['IID']); } $sql .= ' FROM story where story.Project_ID=' . $_GET['PID']; if (!empty($_GET['QID'])) { $qsql = 'SELECT QSQL, Qorder, queries.Desc as qdesc FROM queries where ID=' . $_REQUEST['QID']; $QRes = mysqli_query($DBConn, $qsql); $QRow = mysqli_fetch_assoc($QRes); $audittext = ' Query ' . $_GET['QID'] . ' ' . $QRow['qdesc']; $cond = " " . $QRow['QSQL']; $cond = str_replace('{User}', $_SESSION['ID'], $cond); $cond = str_replace('{Iteration}', $_REQUEST['IID'], $cond); $cond = str_replace('{Project}', $_REQUEST['PID'], $cond); $cond = str_replace('{Backlog}', $Project['Backlog_ID'], $cond); $sql .= ' and ' . $cond . ' ' . $QRow['Qorder']; } // make sure that we dont get parent stories when this is an iteration export (only really applies for the backlog.)
function GetTree($tree_Res, $flag = '') { global $DBConn; if ($tree_Row = mysqli_fetch_assoc($tree_Res)) { do { if (empty($_REQUEST['RID']) || ($tree_Row['Release_ID'] == $_REQUEST['RID'] || Num_Children($tree_Row['AID']) != 0)) { echo '<li id="' . $tree_Row['AID'] . '" data-nodndflag="' . $flag . '" data-iteration="' . Get_Iteration_Name($tree_Row['Iteration_ID'], False) . '" data-iid="' . $tree_Row['Iteration_ID'] . '" data-pid="' . $tree_Row['Project_ID'] . '" >'; echo '<div class="treebox">'; PrintStory($tree_Row); echo '</div>'; // if i have children, then go and fetch them $sql = 'SELECT * FROM story WHERE story.Parent_Story_ID=' . $tree_Row['AID'] . ' order by story.Epic_Rank'; $Child_Res = mysqli_query($DBConn, $sql); if ($Child_Res) { echo '<ul>'; GetTree($Child_Res, $flag); echo '</ul>'; } echo '</li>'; } } while ($tree_Row = mysqli_fetch_assoc($tree_Res)); } }
<?php require_once 'include/dbconfig.inc.php'; require_once 'include/common.php'; $user_details = check_user($_SESSION['user_identifier']); if (!$user_details) { exit; } $sql = 'UPDATE story SET story.Iteration_ID=' . $_GET['IID'] . ' WHERE story.AID=' . $_GET['AID']; mysqli_query($DBConn, $sql); if ($_GET['mov'] == 'ltr') { echo Update_Iteration_Points($_GET['IID']); } else { Update_Iteration_Points($_GET['IID']); } if ($_GET['mov'] == 'rtl') { echo Update_Iteration_Points($_GET['OIID']); } else { Update_Iteration_Points($_GET['OIID']); } auditit($_GET['PID'], $_GET['AID'], $_SESSION['Email'], 'Move story', Get_Iteration_Name($_GET['OIID'], false), Get_Iteration_Name($_GET['IID'], false));