PageRenderTime 28ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/source/components/com_pfmilestones/site/views/milestones/tmpl/default.php

https://github.com/projectfork/Projectfork
PHP | 266 lines | 230 code | 25 blank | 11 comment | 39 complexity | f13c4dd5bafe92fb7cd1b627a3792646 MD5 | raw file
  1. <?php
  2. /**
  3. * @package pkg_projectfork
  4. * @subpackage com_pfmilestones
  5. *
  6. * @author Tobias Kuhn (eaxs)
  7. * @copyright Copyright (C) 2006-2013 Tobias Kuhn. All rights reserved.
  8. * @license http://www.gnu.org/licenses/gpl.html GNU/GPL, see LICENSE.txt
  9. */
  10. defined('_JEXEC') or die();
  11. JHtml::_('pfhtml.script.listform');
  12. $list_order = $this->escape($this->state->get('list.ordering'));
  13. $list_dir = $this->escape($this->state->get('list.direction'));
  14. $user = JFactory::getUser();
  15. $uid = $user->get('id');
  16. $pid = (int) $this->state->get('filter.project');
  17. $filter_in = ($this->state->get('filter.isset') ? 'in ' : '');
  18. $tasks_enabled = PFApplicationHelper::enabled('com_pftasks');
  19. $repo_enabled = PFApplicationHelper::enabled('com_pfrepo');
  20. $cmnts_enabled = PFApplicationHelper::enabled('com_pfcomments');
  21. $doc = JFactory::getDocument();
  22. $style = '.large {'
  23. . 'font-size: 20px;'
  24. . 'line-height: 24px;'
  25. . '}'
  26. . '.medium {'
  27. . 'font-size: 16px;'
  28. . 'line-height: 22px;'
  29. . '}'
  30. . '.margin-none {'
  31. . 'margin: 0;'
  32. . '}';
  33. $doc->addStyleDeclaration( $style );
  34. $print_url = PFmilestonesHelperRoute::getMilestonesRoute($this->state->get('filter.project'))
  35. . '&tmpl=component&layout=print';
  36. $print_opt = 'width=1024,height=600,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no';
  37. $itemid = PFApplicationHelper::getActiveMenuItemId();
  38. $list_url = PFmilestonesHelperRoute::getMilestonesRoute($this->params->get('filter_category'), $itemid);
  39. $return_url = base64_encode($list_url);
  40. ?>
  41. <div id="projectfork" class="category-list<?php echo $this->pageclass_sfx;?> view-milestones PrintArea all">
  42. <?php if ($this->params->get('show_page_heading', 1)) : ?>
  43. <h1><?php echo $this->escape($this->params->get('page_heading')); ?></h1>
  44. <?php endif; ?>
  45. <div class="clearfix"></div>
  46. <div class="cat-items">
  47. <form name="adminForm" id="adminForm" action="<?php echo JRoute::_($list_url); ?>" method="post">
  48. <div class="btn-toolbar btn-toolbar-top">
  49. <?php echo $this->toolbar;?>
  50. <div class="filter-project btn-group">
  51. <?php echo JHtml::_('pfhtml.project.filter');?>
  52. </div>
  53. <a class="btn button" id="print_btn" href="javascript:void(0);" onclick="window.open('<?php echo JRoute::_($print_url);?>', 'print', '<?php echo $print_opt; ?>')">
  54. <?php echo JText::_('COM_PROJECTFORK_PRINT'); ?>
  55. </a>
  56. </div>
  57. <?php if (!$this->params->get('show_filter', '1')) : ?>
  58. <div style="display: none !important">
  59. <?php else : ?>
  60. <div class="<?php echo $filter_in;?>collapse" id="filters">
  61. <?php endif; ?>
  62. <div class="btn-toolbar clearfix">
  63. <div class="filter-search btn-group pull-left">
  64. <input type="text" name="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER_SEARCH'); ?>" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" />
  65. </div>
  66. <div class="filter-search-buttons btn-group pull-left">
  67. <button type="submit" class="btn" rel="tooltip" title="<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>"><span aria-hidden="true" class="icon-search"></span></button>
  68. <button type="button" class="btn" rel="tooltip" title="<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><span aria-hidden="true" class="icon-remove"></span></button>
  69. </div>
  70. <?php if ($pid) : ?>
  71. <div class="filter-author btn-group pull-left">
  72. <select id="filter_author" name="filter_author" class="inputbox input-small" onchange="this.form.submit()">
  73. <option value=""><?php echo JText::_('JOPTION_SELECT_AUTHOR');?></option>
  74. <?php echo JHtml::_('select.options', $this->authors, 'value', 'text', $this->state->get('filter.author'), true);?>
  75. </select>
  76. </div>
  77. <?php endif; ?>
  78. <?php if ($this->access->get('core.edit.state') || $this->access->get('core.edit')) : ?>
  79. <div class="filter-published btn-group pull-left">
  80. <select name="filter_published" class="inputbox input-small" onchange="this.form.submit()">
  81. <option value=""><?php echo JText::_('JOPTION_SELECT_PUBLISHED');?></option>
  82. <?php echo JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true);?>
  83. </select>
  84. </div>
  85. <?php endif; ?>
  86. <div class="btn-group filter-order pull-left">
  87. <select name="filter_order" class="inputbox input-small" onchange="this.form.submit()">
  88. <?php echo JHtml::_('select.options', $this->sort_options, 'value', 'text', $list_order, true);?>
  89. </select>
  90. </div>
  91. <div class="btn-group folder-order-dir pull-left">
  92. <select name="filter_order_Dir" class="inputbox input-small" onchange="this.form.submit()">
  93. <?php echo JHtml::_('select.options', $this->order_options, 'value', 'text', $list_dir, true);?>
  94. </select>
  95. </div>
  96. <?php if ($pid) : ?>
  97. <div class="clearfix clr"></div>
  98. <hr />
  99. <div class="filter-labels">
  100. <?php echo JHtml::_('pfhtml.label.filter', 'com_pfmilestones.milestone', $pid, $this->state->get('filter.labels'));?>
  101. </div>
  102. <?php endif; ?>
  103. </div>
  104. </div>
  105. <?php
  106. $k = 0;
  107. $current_project = '';
  108. foreach($this->items AS $i => $item) :
  109. $access = PFmilestonesHelper::getActions($item->id);
  110. $can_create = $access->get('core.create');
  111. $can_edit = $access->get('core.edit');
  112. $can_edit_own = ($access->get('core.edit.own') && $item->created_by == $uid);
  113. $can_checkin = ($user->authorise('core.manage', 'com_checkin') || $item->checked_out == $uid || $item->checked_out == 0);
  114. $can_change = ($access->get('core.edit.state') && $can_checkin);
  115. // Calculate milestone progress
  116. $task_count = (int) $item->tasks;
  117. $completed = (int) $item->completed_tasks;
  118. $progress = $item->progress;
  119. // Repo directory
  120. $repo_dir = (int) $this->params->get('repo_dir');
  121. if ($item->progress >= 67) $progress_class = 'info';
  122. if ($item->progress == 100) $progress_class = 'success';
  123. if ($item->progress < 67) $progress_class = 'warning';
  124. if ($item->progress < 34) $progress_class = 'danger label-important';
  125. // Prepare the watch button
  126. $watch = '';
  127. if ($uid) {
  128. $options = array('div-class' => '', 'a-class' => 'btn-mini');
  129. $watch = JHtml::_('pfhtml.button.watch', 'milestones', $i, $item->watching, $options);
  130. }
  131. ?>
  132. <?php if ($item->project_title != $current_project && $pid <= 0) : ?>
  133. <h3><?php echo $this->escape($item->project_title);?></h3>
  134. <hr />
  135. <?php $current_project = $item->project_title; endif; ?>
  136. <div class="row-fluid">
  137. <div class="span1 hidden-phone">
  138. <div class="thumbnail center">
  139. <div class="label <?php if ($progress == 100) : echo "label-success hasTooltip"; endif;?>" rel="tooltip" <?php if ($progress == 100) : echo "title=\"" . JText::_('COM_PROJECTFORK_FIELD_COMPLETE_LABEL') . "\""; endif;?>>
  140. <div class="large"><?php echo JHtml::_('date', $item->end_date, JText::_('d')); ?></div>
  141. <div class="medium"><?php echo JHtml::_('date', $item->end_date, JText::_('M')); ?></div>
  142. </div>
  143. </div>
  144. <hr />
  145. <?php if ($tasks_enabled) : ?>
  146. <div class="progress progress-<?php echo $progress_class;?> progress-striped progress-milestone">
  147. <div class="bar" style="min-width:20px; width: <?php echo ($progress > 0) ? $progress . "%": "20px";?>">
  148. <span class="">
  149. <?php echo $progress;?>%
  150. </span>
  151. </div>
  152. </div>
  153. <?php endif; ?>
  154. </div>
  155. <div class="span11">
  156. <div class="well well-small margin-none">
  157. <span class="pull-right"><?php echo JHtml::_('pfhtml.label.datetime', $item->end_date); ?></span>
  158. <?php if ($can_change || $uid) : ?>
  159. <label for="cb<?php echo $i; ?>" class="checkbox pull-left">
  160. <?php echo JHtml::_('pf.html.id', $i, $item->id); ?>
  161. </label>
  162. <?php endif; ?>
  163. <h4>
  164. <?php if ($item->checked_out) : ?>
  165. <span aria-hidden="true" class="icon-lock"></span>
  166. <?php endif; ?>
  167. <a href="<?php echo JRoute::_(PFmilestonesHelperRoute::getMilestoneRoute($item->slug, $item->project_slug));?>">
  168. <?php echo $this->escape($item->title);?>
  169. </a>
  170. <?php if ($item->label_count) : echo JHtml::_('pfhtml.label.labels', $item->labels); endif; ?>
  171. </h4>
  172. <div class="well-description">
  173. <?php echo JHtml::_('pf.html.truncate', $item->description, 180); ?>
  174. </div>
  175. <hr />
  176. <div class="btn-toolbar margin-none">
  177. <?php if ($can_edit || $can_edit_own) : ?>
  178. <div class="btn-group">
  179. <a class="btn btn-mini" href="<?php echo JRoute::_('index.php?option=com_pfmilestones&task=form.edit&id=' . $item->slug . '&return=' . $return_url);?>">
  180. <span aria-hidden="true" class="icon-pencil"></span><?php echo JText::_('COM_PROJECTFORK_ACTION_EDIT'); ?>
  181. </a>
  182. </div>
  183. <?php endif; ?>
  184. <?php if ($cmnts_enabled) : ?>
  185. <div class="btn-group">
  186. <a class="btn btn-mini" href="<?php echo JRoute::_(PFmilestonesHelperRoute::getMilestoneRoute($item->slug, $item->project_slug));?>#comments">
  187. <span aria-hidden="true" class="icon-comment"></span> <?php echo $item->comments; ?> <?php echo JText::_('COM_PROJECTFORK_COMMENTS'); ?>
  188. </a>
  189. </div>
  190. <?php endif; ?>
  191. <?php if ($tasks_enabled) : ?>
  192. <div class="btn-group">
  193. <a href="<?php echo JRoute::_(PFtasksHelperRoute::getTasksRoute($item->project_slug, $item->slug));?>" class="btn btn-mini">
  194. <span aria-hidden="true" class="icon-list-view"></span>
  195. <?php echo (int) $item->tasklists;?> <?php echo JText::_('JGRID_HEADING_TASKLISTS'); ?>
  196. </a>
  197. </div>
  198. <?php endif; ?>
  199. <?php if ($tasks_enabled) : ?>
  200. <div class="btn-group">
  201. <a href="<?php echo JRoute::_(PFtasksHelperRoute::getTasksRoute($item->project_slug, $item->slug));?>" class="btn btn-mini">
  202. <span aria-hidden="true" class="icon-checkmark"></span>
  203. <?php echo (int) $item->tasks;?> <?php echo JText::_('JGRID_HEADING_TASKS'); ?>
  204. </a>
  205. </div>
  206. <?php endif; ?>
  207. <?php if ($repo_enabled) : ?>
  208. <div class="btn-group">
  209. <a href="<?php echo JRoute::_(PFrepoHelperRoute::getRepositoryRoute($item->project_slug, $repo_dir));?>" class="btn btn-mini">
  210. <span aria-hidden="true" class="icon-flag-2"></span>
  211. <?php echo (int) $item->attachments;?> <?php echo JText::_('COM_PROJECTFORK_FIELDSET_ATTACHMENTS'); ?>
  212. </a>
  213. </div>
  214. <?php endif; ?>
  215. <?php echo $watch; ?>
  216. </div>
  217. </div>
  218. </div>
  219. </div>
  220. <hr />
  221. <?php
  222. $k = 1 - $k;
  223. endforeach;
  224. ?>
  225. <?php if ($this->pagination->get('pages.total') > 1) : ?>
  226. <div class="pagination center">
  227. <?php echo $this->pagination->getPagesLinks(); ?>
  228. </div>
  229. <p class="counter center"><?php echo $this->pagination->getPagesCounter(); ?></p>
  230. <?php endif; ?>
  231. <div class="filters center">
  232. <span class="display-limit">
  233. <?php echo $this->pagination->getLimitBox(); ?>
  234. </span>
  235. </div>
  236. <input type="hidden" id="boxchecked" name="boxchecked" value="0"/>
  237. <input type="hidden" name="task" value="" />
  238. <?php echo JHtml::_('form.token'); ?>
  239. </form>
  240. </div>
  241. </div>