skills_ranking.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @author Julio Montoya <gugli100@gmail.com>
  5. */
  6. $cidReset = true;
  7. require_once __DIR__.'/../inc/global.inc.php';
  8. api_block_anonymous_users();
  9. Skill::isAllowed(api_get_user_id());
  10. //Add the JS needed to use the jqgrid
  11. $htmlHeadXtra[] = api_get_jqgrid_js();
  12. $interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('Skills')];
  13. //jqgrid will use this URL to do the selects
  14. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_user_skill_ranking';
  15. //The order is important you need to check the the $column variable in the model.ajax.php file
  16. $columns = [
  17. get_lang('Photo'),
  18. get_lang('First name'),
  19. get_lang('Last name'),
  20. get_lang('Skills acquired'),
  21. get_lang('Currently learning'),
  22. get_lang('Rank'),
  23. ];
  24. $column_model = [
  25. [
  26. 'name' => 'photo',
  27. 'index' => 'photo',
  28. 'width' => '10',
  29. 'align' => 'center',
  30. 'sortable' => 'false',
  31. ],
  32. [
  33. 'name' => 'firstname',
  34. 'index' => 'firstname',
  35. 'width' => '70',
  36. 'align' => 'center',
  37. 'sortable' => 'false',
  38. ],
  39. [
  40. 'name' => 'lastname',
  41. 'index' => 'lastname',
  42. 'width' => '70',
  43. 'align' => 'center',
  44. 'sortable' => 'false',
  45. ],
  46. [
  47. 'name' => 'skills_acquired',
  48. 'index' => 'skills_acquired',
  49. 'width' => '30 ',
  50. 'align' => 'center',
  51. 'sortable' => 'false',
  52. ],
  53. [
  54. 'name' => 'currently_learning',
  55. 'index' => 'currently_learning',
  56. 'width' => '30',
  57. 'align' => 'center',
  58. 'sortable' => 'false',
  59. ],
  60. [
  61. 'name' => 'rank',
  62. 'index' => 'rank',
  63. 'width' => '30',
  64. 'align' => 'center',
  65. 'sortable' => 'false',
  66. ],
  67. ];
  68. //Autowidth
  69. $extra_params['autowidth'] = 'true';
  70. //height auto
  71. $extra_params['height'] = 'auto';
  72. //$extra_params['excel'] = 'excel';
  73. //$extra_params['rowList'] = array(10, 20 ,30);
  74. $jqgrid = Display::grid_js(
  75. 'skill_ranking',
  76. $url,
  77. $columns,
  78. $column_model,
  79. $extra_params,
  80. [],
  81. null,
  82. true
  83. );
  84. $content = Display::grid_html('skill_ranking');
  85. $tpl = new Template(get_lang('Ranking'));
  86. $tpl->assign('jqgrid_html', $jqgrid);
  87. $template = $tpl->get_template('skill/skill_ranking.tpl');
  88. $content .= $tpl->fetch($template);
  89. $tpl->assign('content', $content);
  90. $tpl->display_one_col_template();