PageRenderTime 54ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/plugins/alaxos/views/helpers/alaxos_paginator.php

https://github.com/zpartakov/pmCake
PHP | 55 lines | 37 code | 6 blank | 12 comment | 10 complexity | f8f159f2073c3b50877daee21f8d4c99 MD5 | raw file
Possible License(s): LGPL-3.0, GPL-3.0
  1. <?php
  2. /**
  3. * @deprecated From version 1.3 of CakePHP, it is not useful anymore
  4. * @author Nicolas Rod <nico@alaxos.com>
  5. * @license http://www.opensource.org/licenses/mit-license.php The MIT License
  6. * @link http://www.alaxos.ch
  7. */
  8. class AlaxosPaginatorHelper extends PaginatorHelper
  9. {
  10. var $helpers = array('Html', 'Ajax', 'Alaxos.AlaxosHtml');
  11. /**
  12. * @deprecated From version 1.3 of CakePHP, the core PaginatorHelper does exactly the same
  13. */
  14. public function sort_dir($property_name, $title, $sort, $direction = 'asc', $nowrap_title = false, $link_params = null)
  15. {
  16. $title = ___($title, true);
  17. $title = $nowrap_title ? $this->AlaxosHtml->nowrap($title) : $title;
  18. $url_array = array();
  19. $url_array['direction'] = ($sort == $property_name && $direction == 'asc') ? 'desc' : 'asc';
  20. if(isset($link_params) && is_array($link_params))
  21. {
  22. $param_str = '';
  23. foreach($link_params as $param_name => $param_value)
  24. {
  25. $param_str .= $param_name . ':' . $param_value;
  26. }
  27. $url_array[] = $param_str;
  28. }
  29. if(StringTool :: start_with(Configure::version(), '1.2'))
  30. {
  31. /*
  32. * Hack for CakePHP prior to 1.3: there was a bug on the sort direction
  33. */
  34. $class = ($sort == $property_name && $direction == 'asc') ? 'asc' : (($sort == $property_name) ? 'desc' : '');
  35. }
  36. else
  37. {
  38. trigger_error('AlaxosPaginator->sort_dir() is deprecated. Use CakePHP 1.3 PaginatorHelper instead.', E_USER_NOTICE);
  39. $class = null;
  40. }
  41. echo $this->sort($title,
  42. $property_name,
  43. array('url' => $url_array,
  44. 'class' => $class,
  45. 'escape' => false)
  46. );
  47. }
  48. }
  49. ?>