PageRenderTime 50ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/site/views/animals/tmpl/default.php

https://github.com/snellcode/ARCNA-Animals
PHP | 362 lines | 249 code | 89 blank | 24 comment | 26 complexity | 78e71d32259684b61d7ea9a43e812b42 MD5 | raw file
  1. <?php
  2. /**
  3. * @version 0.0.1
  4. * @package ARCNAAnimals
  5. * @author Phil Snell
  6. * @author mail phil@snellcode.com
  7. * @link http://snellcode.com
  8. * @copyright Copyright (C) 2010 Phil Snell - All rights reserved.
  9. * @license GNU/GPL
  10. */
  11. $filter_species = JRequest::getWord('filter_species');
  12. // no direct access
  13. defined('_JEXEC') or die('Restricted access');
  14. JHTML::_('behavior.keepalive');
  15. $option = JRequest::getCmd('option');
  16. $view = JRequest::getCmd('view' );
  17. $Itemid = JRequest::getInt('Itemid');
  18. // for the filters available, make the reset button javascript
  19. $availableFilters = array('species','location_state','real_time_need','real_time_status');
  20. $filterResetJavascript = '';
  21. foreach( $availableFilters as $availableFilter ) {
  22. $filterResetJavascript .= "document.adminForm.getElementById('filter_{$availableFilter}').value='0';";
  23. }
  24. $filterResetJavascript .= "document.adminForm.submit();";
  25. $doc =& JFactory::getDocument();
  26. $doc->addStyleDeclaration("
  27. #whitebox #editcell div {
  28. text-align:center !important;
  29. }
  30. .list-footer {
  31. padding:10px;
  32. }
  33. #editcell {
  34. font-size:10px;
  35. }
  36. .adminlist {
  37. width:100%;
  38. border-collapse:collapse;
  39. }
  40. .adminlist select {
  41. font-size:10px;
  42. }
  43. .adminlist th {
  44. padding:2px;
  45. text-align:center;
  46. vertical-align:top;
  47. }
  48. .adminlist .row0,
  49. .adminlist .adminlistSort th {
  50. background:#eee;
  51. }
  52. .adminlist th,
  53. .adminlist tbody td {
  54. border:1px solid #ccc;
  55. }
  56. .arcnaButton {
  57. border:1px solid #09c;
  58. background:#ccc;
  59. padding:5px;
  60. display:block;
  61. text-align:center;
  62. }
  63. ");
  64. ?>
  65. <form action="<?php echo $this->action;?>" method="post" name="adminForm">
  66. <?php /*
  67. <table>
  68. <tr>
  69. <td align="left" width="100%">
  70. <?php echo JText::_( 'Filter' ); ?>:
  71. <input type="text" name="filter_search" id="filter_search" value="<?php echo $this->state->filter_search;?>" class="text_area" onchange="document.adminForm.submit();" />
  72. <button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
  73. <button onclick="document.getElementById('filter_search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
  74. </td>
  75. </tr>
  76. </table>
  77. */
  78. ?>
  79. <div id="editcell">
  80. <table class="adminlist">
  81. <thead>
  82. <?php if( $this->user->gid >= 19 ) : ?>
  83. <tr><th colspan='23'><a class='arcnaButton' href='<?php echo JRoute::_("index.php?option={$option}&task=add"); ?>'>Submit a new record</a></th></tr>
  84. <?php endif; ?>
  85. <tr class="adminlistSort">
  86. <th style="width:100px">Sort by :</th>
  87. <th width="1%" nowrap="nowrap">
  88. <?php echo JHTML::_('grid.sort', 'id', 'id', $this->state->filter_order_Dir, $this->state->filter_order ); ?>
  89. </th>
  90. <?php if( $this->params->get('show_species', 1 ) ) : ?>
  91. <th><?php echo JHTML::_('grid.sort', 'species', 'species', $this->state->filter_order_Dir, $this->state->filter_order ); ?></th>
  92. <?php endif; ?>
  93. <th><?php echo JHTML::_('grid.sort', 'Breed', 'breed', $this->state->filter_order_Dir, $this->state->filter_order ); ?></th>
  94. <th><?php echo JHTML::_('grid.sort', 'Age', 'age', $this->state->filter_order_Dir, $this->state->filter_order ); ?></th>
  95. <th>
  96. <?php echo JHTML::_('grid.sort', 'Gender', 'gender', $this->state->filter_order_Dir, $this->state->filter_order ); ?>
  97. </th>
  98. <th>
  99. <?php echo JHTML::_('grid.sort', 'State', 'location_state', $this->state->filter_order_Dir, $this->state->filter_order ); ?>
  100. </th>
  101. <th>
  102. <?php echo JHTML::_('grid.sort', 'City', 'location_city', $this->state->filter_order_Dir, $this->state->filter_order ); ?>
  103. </th>
  104. <th>
  105. <?php echo JHTML::_('grid.sort', 'Shelter Name', 'shelter_name', $this->state->filter_order_Dir, $this->state->filter_order ); ?>
  106. </th>
  107. <?php if( $this->params->get('show_real_time_need', 1 ) ) : ?>
  108. <th><?php echo JHTML::_('grid.sort', 'Real Time Need', 'real_time_need', $this->state->filter_order_Dir, $this->state->filter_order ); ?></th>
  109. <?php endif; ?>
  110. <?php if( $this->params->get('show_real_time_status', 1 ) ) : ?>
  111. <th><?php echo JHTML::_('grid.sort', 'Real Time Status', 'real_time_status', $this->state->filter_order_Dir, $this->state->filter_order ); ?></th>
  112. <?php endif; ?>
  113. <?php if( $this->params->get('show_available_date', 1 ) ) : ?>
  114. <th><?php echo JHTML::_('grid.sort', 'Available Date', 'available_date', $this->state->filter_order_Dir, $this->state->filter_order ); ?></th>
  115. <?php endif; ?>
  116. <?php if( $this->params->get('show_pull_by_date', 1 ) ) : ?>
  117. <th><?php echo JHTML::_('grid.sort', 'Pull By Date', 'pull_by_date', $this->state->filter_order_Dir, $this->state->filter_order ); ?></th>
  118. <?php endif; ?>
  119. <?php if( $this->params->get('show_created', 1 ) ) : ?>
  120. <th><?php echo JHTML::_('grid.sort', 'created', 'created', $this->state->filter_order_Dir, $this->state->filter_order ); ?></th>
  121. <?php endif; ?>
  122. </tr>
  123. <tr class="adminlistFilter">
  124. <th>
  125. Filters : <a href="#" onclick="<?php echo $filterResetJavascript;?>">reset all</a>
  126. </th>
  127. <th>
  128. </th>
  129. <?php if( $this->params->get('show_species', 1 ) ) : ?>
  130. <th><?php echo JHTML::_('arcna.filter', 'species', $this->state->filter_species); ?></th>
  131. <?php endif; ?>
  132. <th>
  133. </th>
  134. <th>
  135. </th>
  136. <th>
  137. </th>
  138. <th>
  139. <?php echo JHTML::_('arcna.filter', 'location_state', $this->state->filter_location_state); ?>
  140. </th>
  141. <th>
  142. </th>
  143. <th>
  144. </th>
  145. <?php if( $this->params->get('show_real_time_need', 1 ) ) : ?>
  146. <th><?php echo JHTML::_('arcna.filter', 'real_time_need', $this->state->filter_real_time_need); ?></th>
  147. <?php endif; ?>
  148. <?php if( $this->params->get('show_real_time_status', 1 ) ) : ?>
  149. <th><?php echo JHTML::_('arcna.filter', 'real_time_status', $this->state->filter_real_time_status ); ?></th>
  150. <?php endif; ?>
  151. <?php if( $this->params->get('show_available_date', 1 ) ) : ?>
  152. <th></th>
  153. <?php endif; ?>
  154. <?php if( $this->params->get('show_pull_by_date', 1 ) ) : ?>
  155. <th></th>
  156. <?php endif; ?>
  157. <?php if( $this->params->get('show_created', 1 ) ) : ?>
  158. <th></th>
  159. <?php endif; ?>
  160. </tr>
  161. </thead>
  162. <tfoot>
  163. <tr>
  164. <td colspan="23">
  165. <?php echo $this->pagination->getListFooter(); ?>
  166. </td>
  167. </tr>
  168. </tfoot>
  169. <tbody>
  170. <?php
  171. $k = 0;
  172. for ($i=0, $n=count( $this->items ); $i < $n; $i++) {
  173. $item = &$this->items[$i];
  174. $slug = JFilterOutput::stringUrlSafe( $item->location_state .'-'.$item->location_city . '-' . $item->name );
  175. $url = JRoute::_("index.php?option={$option}&amp;task=edit&amp;cid[]={$item->id}:{$slug}");
  176. $checked = JHTML::_('grid.checkedout', $item, $i );
  177. $published = JHTML::_('grid.published', $item, $i );
  178. $isCheckedOut = JTable::isCheckedOut($this->user->get ('id'), $item->checked_out );
  179. $thumbnail = JHTML::_('arcna.thumbnail', $item->image, 100, 100 );
  180. ?>
  181. <tr class="<?php echo "row$k"; ?>">
  182. <td align="center">
  183. <?php
  184. if ( $isCheckedOut ) {
  185. echo $thumbnail;
  186. } else {
  187. ?>
  188. <span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Item' );?>::<?php echo $this->escape($item->name); ?>">
  189. <a href="<?php echo $url; ?>">
  190. <?php echo $thumbnail; ?>
  191. </a>
  192. </span>
  193. <?php
  194. }
  195. ?>
  196. <?php
  197. if ( $isCheckedOut ) {
  198. echo $this->escape($item->name);
  199. } else {
  200. ?>
  201. <span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Item' );?>::<?php echo $this->escape($item->name); ?>">
  202. <a href="<?php echo $url; ?>">
  203. <?php echo $this->escape($item->name); ?></a></span>
  204. <?php
  205. }
  206. ?>
  207. </td>
  208. <td align="center">
  209. <?php
  210. if ( $isCheckedOut ) {
  211. echo $this->escape($item->id);
  212. } else {
  213. ?>
  214. <span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit Item' );?>::<?php echo $this->escape($item->name); ?>">
  215. <h1><a href="<?php echo $url; ?>"><?php echo $this->escape($item->id); ?></a></h1>
  216. </span>
  217. <?php
  218. }
  219. ?>
  220. </td>
  221. <?php if( $this->params->get('show_species', 1 ) ) : ?>
  222. <td align="center"><?php echo $item->species; ?></td>
  223. <?php endif; ?>
  224. <td align="center">
  225. <?php echo $item->breed; ?>
  226. </td>
  227. <td align="center">
  228. <?php echo $item->age; ?>
  229. </td>
  230. <td align="center">
  231. <?php echo $item->gender; ?>
  232. </td>
  233. <td align="center">
  234. <?php echo $item->location_state; ?>
  235. </td>
  236. <td align="center">
  237. <?php echo $item->location_city; ?>
  238. </td>
  239. <td align="center">
  240. <?php echo $item->shelter_name; ?>
  241. </td>
  242. <?php if( $this->params->get('show_real_time_need', 1 ) ) : ?>
  243. <td align="center"><?php echo $item->real_time_need; ?></td>
  244. <?php endif; ?>
  245. <?php if( $this->params->get('show_real_time_status', 1 ) ) : ?>
  246. <td align="center"><?php echo $item->real_time_status; ?></td>
  247. <?php endif; ?>
  248. <?php if( $this->params->get('show_available_date', 1 ) ) : ?>
  249. <td align="center"><?php echo JFactory::getDate( $item->available_date )->toFormat('%m/%d/%Y'); ?></td>
  250. <?php endif; ?>
  251. <?php if( $this->params->get('show_pull_by_date', 1 ) ) : ?>
  252. <td align="center"><?php echo JFactory::getDate( $item->pull_by_date )->toFormat('%m/%d/%Y'); ?></td>
  253. <?php endif; ?>
  254. <?php if( $this->params->get('show_created', 1 ) ) : ?>
  255. <td align="center"><?php echo JFactory::getDate( $item->created )->toFormat('%m/%d/%Y'); ?></td>
  256. <?php endif; ?>
  257. </tr>
  258. <?php
  259. $k = 1 - $k;
  260. }
  261. ?>
  262. </tbody>
  263. </table>
  264. </div>
  265. <input type="hidden" name="option" value="<?php echo $option;?>" />
  266. <input type="hidden" name="view" value="<?php echo $view;?>" />
  267. <input type="hidden" name="Itemid" value="<?php echo $Itemid;?>" />
  268. <input type="hidden" name="task" value="" />
  269. <input type="hidden" name="viewcache" value="0" />
  270. <input type="hidden" name="filter_order" value="<?php echo $this->state->filter_order; ?>" />
  271. <input type="hidden" name="filter_order_Dir" value="<?php echo $this->state->filter_order_Dir; ?>" />
  272. <?php echo JHTML::_( 'form.token' ); ?>
  273. </form>