skills_ranking.php 2.4 KB

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