browsebygrid.html.php 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <div class='row cell' id='cards'>
  2. <?php foreach ($programs as $programID => $program):?>
  3. <div class='col' data-id='<?php echo $programID?>'>
  4. <div class='panel' data-url='<?php echo $this->createLink('program', 'index', "programID=$program->id", '', '', $program->id);?>'>
  5. <div class='panel-heading'>
  6. <strong class='program-name' title='<?php echo $program->name;?>'><?php echo $program->name;?></strong>
  7. <?php if($program->model === 'waterfall'): ?>
  8. <span class='program-type-label label label-warning label-outline'><?php echo $lang->program->waterfall; ?></span>
  9. <?php else: ?>
  10. <span class='program-type-label label label-info label-outline'><?php echo $lang->program->scrum; ?></span>
  11. <?php endif; ?>
  12. <nav class='panel-actions nav nav-default'>
  13. <li class='dropdown'>
  14. <a href='javascript:;' data-toggle='dropdown' class='panel-action'><i class='icon icon-ellipsis-v'></i></a>
  15. <ul class='dropdown-menu pull-right'>
  16. <li><?php common::printIcon('program', 'group', "programID=$program->id", $program, 'button', 'group');?></li>
  17. <li><?php common::printIcon('program', 'manageMembers', "programID=$program->id", $program, 'button', 'persons');?></li>
  18. <li><?php common::printicon('program', 'activate', "programid=$program->id", $program, 'button', '', '', 'iframe', true);?></li>
  19. <li><?php if(common::hasPriv('program', 'edit')) echo html::a($this->createLink("program", "edit", "programID=$program->id"), "<i class='icon-edit'></i> " . $lang->edit, '', "");?></li>
  20. <li><?php common::printIcon('program', 'start', "programID=$program->id", $program, 'button', '', '', 'iframe', true);?></li>
  21. <li><?php common::printIcon('program', 'suspend', "programID=$program->id", $program, 'button', '', '', 'iframe', true);?></li>
  22. <li><?php common::printIcon('program', 'close', "programID=$program->id", $program, 'button', '', '', 'iframe', true);?></li>
  23. <li><?php if(common::hasPriv('program', 'delete')) echo html::a($this->createLink("program", "delete", "programID=$program->id"), "<i class='icon-trash'></i> " . $lang->delete, 'hiddenwin', "");?></li>
  24. </ul>
  25. </li>
  26. </nav>
  27. </div>
  28. <div class='panel-body'>
  29. <div class='program-infos'>
  30. <span><i class='icon icon-group'></i> <?php printf($lang->program->membersUnit, $program->teamCount); ?></span>
  31. <span><i class='icon icon-clock'></i> <?php printf($lang->program->hoursUnit, $program->estimate); ?></span>
  32. <span><i class='icon icon-cost'></i> <?php echo $program->budget . '' . zget($lang->program->unitList, $program->budgetUnit);?></span>
  33. </div>
  34. <?php if($program->model === 'waterfall'): ?>
  35. <div class='program-detail program-stages'>
  36. <p class='text-muted'><?php echo $lang->program->ongoingStage; ?></p>
  37. <?php
  38. $programProjects = array();
  39. foreach($program->projects as $project)
  40. {
  41. if(!$project->parent) $programProjects[] = $project;
  42. }
  43. ?>
  44. <?php if(empty($programProjects)): ?>
  45. <div class='label label-outline'><?php echo zget($lang->project->statusList, $program->status);?></div>
  46. <?php else: ?>
  47. <div class='program-stages-container scrollbar-hover'>
  48. <div class='program-stages-row'>
  49. <?php foreach ($programProjects as $project): ?>
  50. <div class='program-stage-item is-<?php echo $project->status;?><?php if($project->status !== 'wait') echo ' is-going'; ?>'>
  51. <div><?php echo $project->name; ?></div>
  52. </div>
  53. <?php endforeach; ?>
  54. </div>
  55. </div>
  56. <?php endif; ?>
  57. </div>
  58. <?php else: ?>
  59. <?php $project = $program->projects ? current($program->projects) : '';?>
  60. <div class='program-detail program-iteration'>
  61. <p class='text-muted'><?php echo $lang->program->lastIteration; ?></p>
  62. <?php if($project):?>
  63. <div class='row'>
  64. <div class='col-xs-5'><?php echo $project->name; ?></div>
  65. <div class='col-xs-7'>
  66. <div class="progress progress-text-left">
  67. <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?php echo $project->hours->progress;?>" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $project->hours->progress;?>%">
  68. <span class="progress-text"><?php echo $project->hours->progress;?>%</span>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. <?php endif; ?>
  74. </div>
  75. <?php endif; ?>
  76. </div>
  77. </div>
  78. </div>
  79. <?php endforeach;?>
  80. <div class='col-xs-12' id='cardsFooter'>
  81. <?php $pager->show('right', 'pagerjs');?>
  82. </div>
  83. </div>
  84. <style>
  85. #mainMenu {padding-left: 10px; padding-right: 10px;}
  86. #cards {margin: 0 10px;}
  87. #cards > .col {width: 20%;}
  88. #cards .panel {margin: 10px 0; border: 1px solid #DCDCDC; border-radius: 2px; box-shadow: none; height: 146px; cursor: pointer;}
  89. #cards .panel:hover {border-color: #006AF1; box-shadow: 0 0 10px 0 rgba(0,0,100,.25);}
  90. #cards .panel-heading {padding: 12px 24px 10px 16px;}
  91. #cards .panel-body {padding: 0 16px 16px;}
  92. #cards .panel-actions {padding: 7px 0;}
  93. #cards .panel-actions .dropdown-menu > li > a {padding-left: 5px; text-align: left;}
  94. #cards .panel-actions .dropdown-menu > li > a > i {opacity: .5; display: inline-block; margin-right: 4px; width: 18px; text-align: center;}
  95. #cards .panel-actions .dropdown-menu > li > a:hover > i {opacity: 1;}
  96. #cards .program-type-label {padding: 1px 2px;}
  97. #cards .program-name {font-size: 16px; font-weight: normal; display: inline-block; max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;}
  98. #cards .program-infos {font-size: 12px;}
  99. #cards .program-infos > span {display: inline-block; line-height: 12px;}
  100. #cards .program-infos > span > .icon {font-size: 12px; display: inline-block; position: relative; top: -1px}
  101. #cards .program-infos > span + span {margin-left: 15px;}
  102. #cards .program-detail {position: absolute; bottom: 16px; left: 16px; right: 16px; font-size: 12px;}
  103. #cards .program-detail > p {margin-bottom: 8px;}
  104. #cards .program-detail .progress {height: 4px;}
  105. #cards .program-detail .progress-text-left .progress-text {width: 50px; left: -50px;}
  106. #cards .pager {margin: 0; float: right;}
  107. #cards .pager .btn {border: none}
  108. #cards .program-stages-container {margin: 0 -16px -16px -16px; padding: 0 4px; height: 46px; overflow-x: auto; position: relative;}
  109. #cards .program-stages:after {content: ' '; width: 30px; display: block; right: -16px; top: 16px; bottom: -6px; z-index: 1; background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%); position: absolute;}
  110. #cards .program-stages-row {position: relative; height: 30px; z-index: 0;}
  111. #cards .program-stage-item {white-space: nowrap; position: absolute; top: 0; min-width: 48px; padding-top: 13px; color: #838A9D;}
  112. #cards .program-stage-item > div {white-space: nowrap; overflow: visible; text-align: center; text-overflow: ellipsis;}
  113. #cards .program-stage-item:before {content: ' '; display: block; width: 8px; height: 8px; border-radius: 50%; background: #D1D1D1; position: absolute; left: 50%; margin-left: -4px; top: 0; z-index: 1;}
  114. #cards .program-stage-item + .program-stage-item:after {content: ' '; display: block; left: -50%; right: 50%; height: 2px; background-color: #D1D1D1; top: 3px; position: absolute; z-index: 0;}
  115. #cards .program-stage-item.is-going {color: #333;}
  116. #cards .program-stage-item.is-going::before {background-color: #0C64EB;}
  117. </style>
  118. <script>
  119. $(function()
  120. {
  121. /* Auto resize cards size */
  122. var minCardWidth = 280;
  123. var $cards = $('#cards');
  124. var resizeCards = function()
  125. {
  126. var cardsWidth = $cards.width();
  127. var bestColsSize = 1;
  128. while((cardsWidth / (bestColsSize + 1)) > minCardWidth)
  129. {
  130. bestColsSize++;
  131. }
  132. $cards.children('.col').css('width', (100 / bestColsSize) + '%');
  133. };
  134. resizeCards();
  135. $(window).on('resize', resizeCards);
  136. /* Auto resize stages */
  137. $cards.find('.program-stages-container').each(function()
  138. {
  139. var $container = $(this);
  140. var $row = $container.children();
  141. var totalWidth = 0;
  142. $row.children().each(function()
  143. {
  144. var $item = $(this);
  145. $item.css('left', totalWidth);
  146. totalWidth += $item.width();
  147. });
  148. $row.css('minWidth', totalWidth);
  149. });
  150. /* Make cards clickable */
  151. $cards.on('click', '.panel', function(e)
  152. {
  153. if(!$(e.target).closest('.panel-actions').length)
  154. {
  155. window.location.href = $(this).data('url');
  156. }
  157. });
  158. });
  159. </script>