templates/Institution/viewinstitution.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}OceanExpert - A Directory of Marine and Freshwater Professionals{% endblock %}
  3. {% block stylesheets %}
  4.     <link rel="stylesheet" type="text/css" href="{{ asset('css/bootstrap.min.css') }}">
  5.     <link rel="stylesheet" type="text/css" href="{{ asset('css/font-awesome.min.css') }}">
  6.     <link rel="stylesheet" type="text/css" href="{{ asset('css/navbar-login.css') }}">
  7.     <link rel="stylesheet" type="text/css" href="{{ asset('css/social-buttons.css') }}">
  8.     <link rel="stylesheet" type="text/css" href="{{ asset('css/style.css') }}">
  9.     <link rel="stylesheet" type="text/css" href="{{ asset('css/advancedSearch.css') }}">
  10.     <link rel="stylesheet" type="text/css" href="{{ asset('css/search.css') }}">
  11.     <link rel="stylesheet" type="text/css" href="{{ asset('css/google-fonts.css') }}">
  12.     <link rel="stylesheet" type="text/css" href="{{ asset('css/AdminLTE.min.css') }}">
  13.     <link rel="stylesheet" type="text/css" href="{{ asset('css/tipped.css') }}">
  14.     <link rel="stylesheet" type="text/css" href="{{ asset('css/institution.css') }}">
  15. {% endblock %}
  16. {% block body %}
  17.     {% include('navbarlogin.html.twig') %}
  18.     <!-- JSON-LD will be used for SEO and OIH -->
  19.     <script type="application/ld+json">
  20.         {{ OIHData | raw }}
  21.     </script>
  22.     <div class="container-fluid">
  23.         <!-- Content Wrapper. Contains page content -->
  24.         <div class="">
  25.             <!-- Content Header (Page header) -->
  26.             <section class="content-header">
  27.             </section>
  28.             <section class="content">
  29.                 <div class="row">
  30.                     <div class="col-md-3">
  31.                         <!-- Profile Image -->
  32.                         <div class="box box-primary">
  33.                             <div class="box-body box-profile">
  34.                                 {% if institute.idInst is defined and institute.idInst | trim != "" %}
  35.                                     <h4 class="text-center">OceanExpert ID : <strong>{{ institute.idInst }}</strong></h4>
  36.                                 {% endif %}
  37.                                 <div class="inst-logo">
  38.                                     {% if institute.instLogo != "" %}
  39.                                         {% if institute.instUrl != "" %}
  40.                                             <a href="{% if institute.instUrl starts with "http" %}{{ institute.instUrl }}{% else %}{{ 'http://' ~ institute.instUrl }}{% endif %}" target="_blank">
  41.                                                 <img src="{{ asset('uploads/institutes/'~institute.idInst~'/'~institute.instLogo)}}" class="img-thumbnail inst-image">
  42.                                             </a>
  43.                                         {% else %}
  44.                                             <img src="{{ asset('uploads/institutes/'~institute.idInst~'/'~institute.instLogo)}}" class="img-thumbnail inst-image">
  45.                                         {% endif %}
  46.                                       
  47.                                     {% else %}
  48.                                         <i class="fa fa-university fa-5x" aria-hidden="true"></i>
  49.                                     {% endif %}
  50.                                 </div>
  51.                                 <p class="lead text-center">{{ institute.instName }}<br/>
  52.                                     <small><strong>
  53.                                             {% if institute.acronym is defined and institute.acronym != "" %}
  54.                                                 {{ institute.acronym }}
  55.                                             {% endif %}
  56.                                         </strong></small>
  57.                                 </p>
  58.                                 {% if institute.instNameEng is defined and institute.instNameEng != "" %}
  59.                                     <p class="text-center">({{ institute.instNameEng }})</p>
  60.                                 {% endif %}
  61.                                 {% if (app.user is not null and ((institute.createdId is defined and institute.createdId == app.user.id) or (institute.lastEditId is defined and institute.lastEditId == app.user.id)) ) or is_granted('ROLE_GLOBAL_EDITOR') %}
  62.                                     <div class="text-center">
  63.                                         {% if is_granted('ROLE_GLOBAL_EDITOR') %}
  64.                                             {% if institute.activated is defined and institute.activated  == 0 %}
  65.                                                 <span class="statusBtn"><button class="btn btn-success activate"><i
  66.                                                                 class="fa fa-check"
  67.                                                                 aria-hidden="true"></i> Activate</button></span>
  68.                                             {% elseif institute.activated is defined and institute.activated == 1 %}
  69.                                                 <span class="statusBtn"><button class="btn btn-danger ban"><i
  70.                                                                 class="fa fa-ban"
  71.                                                                 aria-hidden="true"></i> Deactivate</button></span>
  72.                                             {% elseif institute.activated is defined and institute.activated == 2 %}
  73.                                                 <span class="statusBtn"><button class="btn btn-warning activate"><i
  74.                                                                 class="fa fa-check"
  75.                                                                 aria-hidden="true"></i> Un-delete</button></span>
  76.                                             {% endif %}
  77.                                         {% endif %}
  78.                                         <a href="{{ path('edit_institution',{'instId': institute.idInst}) }}"
  79.                                            class="btn btn-primary"><i class="fa fa-user" aria-hidden="true"></i> Edit
  80.                                             Institution</a>
  81.                                     </div>
  82.                                 {% endif %}
  83.                                 </p>
  84.                             </div>
  85.                             <!-- /.box-body -->
  86.                         </div>
  87.                         <!-- /.box -->
  88.                         <div class="box box-primary">
  89.                             <div class="box-body">
  90.                                 <strong><i class="fa icon-profile fa-map-marker margin-r-5" aria-hidden="true"></i>
  91.                                     Address</strong>
  92.                                 <div class="data">
  93.                                     {{ institute.address |raw }}
  94.                                 </div>
  95.                                 {% if institute.insttypeName is defined and institute.insttypeName != "" %}
  96.                                     <hr class="details">
  97.                                     <strong><i class="fa icon-profile fa-flag margin-r-5" aria-hidden="true"></i>
  98.                                         Type</strong>
  99.                                     <p class="data tex-center">{{ institute.insttypeName }}</p>
  100.                                 {% endif %}
  101.                                 {% if institute.instEmail is defined and institute.instEmail != "" %}
  102.                                     <hr class="details">
  103.                                     <strong><i class="fa icon-profile fa-envelope margin-r-5"></i> Email</strong>
  104.                                     {% if app.user.email is defined %}
  105.                                         <p class="data tex-center"><a
  106.                                                     href="mailto:{{ institute.instEmail }}">{{ institute.instEmail }}</a>
  107.                                         </p>
  108.                                     {% else %}
  109.                                         <p class="data tex-center">Please login to view email.</p>
  110.                                     {% endif %}
  111.                                 {% endif %}
  112.                                 {% if institute.instTel is defined and institute.instTel != "" %}
  113.                                     <hr class="details">
  114.                                     <strong><i class="fa icon-profile fa-phone-square margin-r-5"></i>
  115.                                         Telephone</strong>
  116.                                     <p class="data tex-center">{{ institute.instTel }}</p>
  117.                                 {% endif %}
  118.                                 {% if institute.instFax is defined and institute.instFax != "" %}
  119.                                     <hr class="details">
  120.                                     <strong><i class="fa icon-profile fa-fax margin-r-5"></i> Fax</strong>
  121.                                     <p class="data tex-center">{{ institute.instFax }}</p>
  122.                                 {% endif %}
  123.                             </div>
  124.                         </div>
  125.                         {% if institute.parentIdInst is defined and institute.parentIdInst != "" and institute.parentIdInst != 0 %}
  126.                             <div class="box box-primary">
  127.                                 <div class="box-body">
  128.                                     <strong><i class="fa icon-profile fa-university margin-r-5" aria-hidden="true"></i>
  129.                                         Parent institute</strong>
  130.                                     {% if institute.parentInstLogo is defined and institute.parentInstLogo != "" %}
  131.                                         {% set instUrl = asset('uploads/institutes/'~institute.parentIdInst~'/'~institute.parentInstLogo) %}
  132.                                     {% else %}
  133.                                         {% set instUrl = asset('assets/uploads/institute.png') %}
  134.                                     {% endif %}
  135.                                     <div class="text-center">
  136.                                         <a href="{{ path('view_institution', {'instId': institute.parentIdInst}) }}"
  137.                                            class="profile-url">
  138.                                             <img class="group list-group-image lazy img-thumbnail img-responsive"
  139.                                                  data-original="{{ instUrl }}"></a>
  140.                                         <div class="caption">
  141.                                             <p class="text-center">
  142.                                                 <strong><a href="{{ path('view_institution', {'instId': institute.parentIdInst}) }}"
  143.                                                            class="profile-url">{{ institute.parentInstName }}</a></strong>
  144.                                                 <br/><strong>{{ institute.parentAcronym }}</strong>
  145.                                                 <br/>({{ institute.parentInstNameEng }})
  146.                                             </p>
  147.                                         </div>
  148.                                     </div>
  149.                                 </div>
  150.                             </div>
  151.                         {% endif %}
  152.                     </div>
  153.                     <!-- /.col -->
  154.                     <div class="col-md-9">
  155.                         {% if (institute.instUrl is defined and institute.instUrl != "") or (institute.edmoCode is defined and institute.edmoCode != "") or (institute.seaRegions is defined and institute.seaRegions | length > 0) or (institute.activities is defined and institute.activities != "") %}
  156.                             <!-- About Me Box -->
  157.                             <div class="box box-primary">
  158.                                 <!-- /.box-header -->
  159.                                 <div class="box-body">
  160.                                     {% if institute.instUrl is defined and institute.instUrl != "" %}
  161.                                         <strong><i class="fa icon-profile fa-internet-explorer margin-r-5"
  162.                                                    aria-hidden="true"></i> Website</strong>
  163.                                         <p class="data tex-center"><a href="{% if institute.instUrl starts with "http" %}{{ institute.instUrl }}{% else %}{{ 'http://' ~ institute.instUrl }}{% endif %}" target="_blank">{{ institute.instUrl }}</a></p>
  164.                                     {% endif %}
  165.                                     {% if institute.edmoCode is defined and institute.edmoCode != "" %}
  166.                                         <hr>
  167.                                         <strong><i class="fa icon-profile fa-barcode margin-r-5" aria-hidden="true"></i>
  168.                                             EDMO code</strong>
  169.                                         <p class="data tex-center"><a href="http://seadatanet.maris2.nl/v_edmo/print.asp?n_code={{institute.edmoCode}}" target="_blank">{{ institute.edmoCode }}</a></p>
  170.                                     {% endif %}
  171.                                     {% if institute.seaRegions is defined and institute.seaRegions | length > 0 %}
  172.                                         <hr>
  173.                                         <strong><i class="fa icon-profile fa-globe margin-r-5" aria-hidden="true"></i>
  174.                                             Sea Region of study</strong>
  175.                                         <p class="data tex-center">
  176.                                             {% for seaRegion in institute.seaRegions %}
  177.                                                 {{ seaRegion.name }}<br/>
  178.                                             {% endfor %}
  179.                                         </p>
  180.                                     {% endif %}
  181.                                     {% if institute.activities is defined and institute.activities != "" %}
  182.                                         <hr>
  183.                                         <strong><i class="fa icon-profile fa-compass margin-r-5" aria-hidden="true"></i>
  184.                                             Activities</strong>
  185.                                         <p class="data tex-center">{{ institute.activities|raw }}</p>
  186.                                     {% endif %}
  187.                                 </div>
  188.                                 <!-- /.box-body -->
  189.                             </div>
  190.                         {% endif %}
  191.                         <!-- /.box -->
  192.                         {% if members.getTotalItemCount > 0 %}
  193.                             <div class="box box-primary">
  194.                                 <!-- /.box-header -->
  195.                                 <div class="box-body">
  196.                                     <div>
  197.                                         <strong><i class="fa icon-profile fa-users margin-r-5" aria-hidden="true"></i>
  198.                                             Associated Experts</strong>
  199.                                     </div>
  200.                                     <span class="col-md-3 search-display">
  201.                                     Displaying {{ members.getPaginationData.firstItemNumber }}
  202.                                         – {{ members.getPaginationData.lastItemNumber }}
  203.                                         results of {{ members.getTotalItemCount }}.
  204.                              </span>
  205.                                     <div class="row">
  206.                                         <div class="col-md-12 tblhdrs">
  207.                                             <div class=" selectContainer">
  208.                                                 Show <select name="mlimit" id="mlimit" data-id="mlimit" class="maxresults">
  209.                                                     {% for key,option in limits.memberlimit.options %}
  210.                                                         {% if limits.memberlimit.selected == key %}
  211.                                                             <option id="{{ key }}" selected>{{ option }}</option>
  212.                                                         {% else %}
  213.                                                             <option id="{{ key }}">{{ option }}</option>
  214.                                                         {% endif %}
  215.                                                     {% endfor %}
  216.                                                 </select> Records
  217.                                             </div>
  218.                                         
  219.                                             <span class=" pagination-sm">
  220.                                             {{ knp_pagination_render(members) }}
  221.                                         </span>
  222.                                         </div>
  223.                                     </div>
  224.                                     
  225.                                     
  226.                                     <div class="row list-group">
  227.                                         <div class="col-md-12">
  228.                                             {% for item in members %}
  229.                                                 <div class="item  col-xs-4 col-lg-4 list-group-item">
  230.                                                     <div class="thumbnail-institution">
  231.                                                         <a href="{{ path('view_profile', {'user': item.idInd}) }}"
  232.                                                            class="profile-url">
  233.                                                             <img class="group list-group-image lazy img-thumbnail img-responsive"
  234.                                                                  data-original="{% if file_exists(web_path~asset('uploads/profile/profile_'~item.idInd~'.png')) %}{{ asset('uploads/profile/profile_'~item.idInd~'.png') }}{% endif %}"
  235.                                                                  src="{{ asset('assets/uploads/default.png') }}"
  236.                                                                  onError="this.src='{{ asset('assets/uploads/default.png') }}';"></a>
  237.                                                         <div class="caption">
  238.                                                             <p class="group inner list-group-item-text">
  239.                                                                 <strong><a href="{{ path('view_profile', {'user': item.idInd}) }}"
  240.                                                                            class="profile-url">{{ item.fname | raw | title }} {{ item.sname | raw | upper }}</a></strong>{% if item.qualityChecked == 1 %}
  241.                                                                 <i class="green fa fa-check-circle tipso"
  242.                                                                    title="User has been verified."></i>{% endif %}
  243.                                                                 {% if item.retired == 1 %} <span
  244.                                                                         class="label label-success">Retired</span></span>{% endif %}
  245.                                                                 {% if item.deceased == 1 %} <span
  246.                                                                         class="label label-danger">Deceased</span>{% endif %}
  247.                                                                 <br/>{% if item.jobtitle != "" %}{{ item.jobtitle }}{% endif %}
  248.                                                             </p>
  249.                                                         </div>
  250.                                                     </div>
  251.                                                 </div>
  252.                                             {% endfor %}
  253.                                         </div>
  254.                                     </div>
  255.                                     <hr class="caption blue"/>
  256.                                     <span class="col-md-12">
  257.                                     <div class=" pagination-sm pull-right">
  258.                                         {{ knp_pagination_render(members) }}
  259.                                     </div>
  260.                             </span>
  261.                                 </div>
  262.                             </div>
  263.                         {% endif %}
  264.                         <!-- child institutes -->
  265.                         {% if childinstitutes.getTotalItemCount > 0 %}
  266.                         <div class="box box-primary">
  267.                             <!-- /.box-header -->
  268.                             <div class="box-body">
  269.                                 <div>
  270.                                     <strong><i class="fa icon-profile fa-university margin-r-5" aria-hidden="true"></i>
  271.                                         Child Institutes</strong>
  272.                                 </div>
  273.                                 <span class="col-md-3 search-display">
  274.                                 Displaying {{ childinstitutes.getPaginationData.firstItemNumber }}
  275.                                     – {{ childinstitutes.getPaginationData.lastItemNumber }}
  276.                                     results of {{ childinstitutes.getTotalItemCount }}.
  277.                                 </span>
  278.                                 <div class="row">
  279.                                     <div class="col-md-12 tblhdrs">
  280.                                         <div class=" selectContainer">
  281.                                             Show <select name="cilimit" id="cilimit" data-id="cilimit" class="maxresults">
  282.                                                 {% for key,option in limits.childinstitutelimit.options %}
  283.                                                     {% if limits.childinstitutelimit.selected == key %}
  284.                                                         <option id="{{ key }}" selected>{{ option }}</option>
  285.                                                     {% else %}
  286.                                                         <option id="{{ key }}">{{ option }}</option>
  287.                                                     {% endif %}
  288.                                                 {% endfor %}
  289.                                             </select> Records
  290.                                         </div>
  291.                                     
  292.                                         <span class=" pagination-sm">
  293.                                         {{ knp_pagination_render(childinstitutes) }}
  294.                                     </span>
  295.                                     </div>
  296.                                 </div>
  297.                                     
  298.                                 <div class="row list-group">
  299.                                     <div class="col-md-12">
  300.                                         {% for item in childinstitutes %}
  301.                                             {% if item.instLogo is defined and item.instLogo != "" %}
  302.                                                 {% set instUrl = asset('uploads/institutes/'~item.idInst~'/'~item.instLogo) %}
  303.                                             {% else %}
  304.                                                 {% set instUrl = asset('assets/uploads/institute.png') %}
  305.                                             {% endif %}
  306.                                             <div class="item col-xs-4 col-lg-4 list-group-item">
  307.                                                 <div class="thumbnail-institution">
  308.                                                     <a href="{{ path('view_institution', {'instId': item.idInst}) }}"
  309.                                                        class="profile-url">
  310.                                                         <img class="group list-group-image lazy img-thumbnail img-responsive"
  311.                                                              data-original="{{ instUrl }}"></a>
  312.                                                     <div class="caption">
  313.                                                         <p class="group inner list-group-item-text">
  314.                                                             <strong><a href="{{ path('view_institution', {'instId': item.idInst}) }}"
  315.                                                                        class="profile-url">{{ item.instName }}</a></strong>
  316.                                                             <br/><strong>{{ item.acronym }}</strong>
  317.                                                             <br/>({{ item.instNameEng }})
  318.                                                         </p>
  319.                                                     </div>
  320.                                                 </div>
  321.                                             </div>
  322.                                         {% endfor %}
  323.                                     </div>
  324.                                 </div>
  325.                                 <hr class="caption blue"/>
  326.                                 <span class="col-md-12">
  327.                                     <div class=" pagination-sm pull-right">
  328.                                         {{ knp_pagination_render(childinstitutes) }}
  329.                                     </div>
  330.                                 </span>
  331.                             </div>
  332.                         </div> 
  333.                         {% endif %}
  334.                         <!-- experts from child institutes --> 
  335.                         {% if childmembers.getTotalItemCount > 0 %}
  336.                             <div class="box box-primary">
  337.                                 <!-- /.box-header -->
  338.                                 <div class="box-body">
  339.                                     <div>
  340.                                         <strong><i class="fa icon-profile fa-users margin-r-5" aria-hidden="true"></i>
  341.                                             Associated Experts from Child Institutes</strong>
  342.                                     </div>
  343.                                     <span class="col-md-3 search-display">
  344.                                     Displaying {{ childmembers.getPaginationData.firstItemNumber }}
  345.                                         – {{ childmembers.getPaginationData.lastItemNumber }}
  346.                                         results of {{ childmembers.getTotalItemCount }}.
  347.                              </span>
  348.                                     <div class="row">
  349.                                         <div class="col-md-12 tblhdrs">
  350.                                             <div class=" selectContainer">
  351.                                                 Show <select name="cmlimit" id="cmlimit" data-id="cmlimit" class="maxresults">
  352.                                                     {% for key,option in limits.childmemberlimit.options %}
  353.                                                         {% if limits.childmemberlimit.selected == key %}
  354.                                                             <option id="{{ key }}" selected>{{ option }}</option>
  355.                                                         {% else %}
  356.                                                             <option id="{{ key }}">{{ option }}</option>
  357.                                                         {% endif %}
  358.                                                     {% endfor %}
  359.                                                 </select> Records
  360.                                             </div>
  361.                                         
  362.                                             <span class=" pagination-sm">
  363.                                             {{ knp_pagination_render(childmembers) }}
  364.                                         </span>
  365.                                         </div>
  366.                                     </div>
  367.                                     
  368.                                     
  369.                                     <div class="row list-group">
  370.                                         <div class="col-md-12">
  371.                                             {% for item in childmembers %}
  372.                                                 <div class="item  col-xs-4 col-lg-4 list-group-item">
  373.                                                     <div class="thumbnail-institution">
  374.                                                         <a href="{{ path('view_profile', {'user': item.idInd}) }}"
  375.                                                            class="profile-url">
  376.                                                             <img class="group list-group-image lazy img-thumbnail img-responsive"
  377.                                                                  data-original="{% if file_exists(web_path~asset('uploads/profile/profile_'~item.idInd~'.png')) %}{{ asset('uploads/profile/profile_'~item.idInd~'.png') }}{% endif %}"
  378.                                                                  src="{{ asset('assets/uploads/default.png') }}"
  379.                                                                  onError="this.src='{{ asset('assets/uploads/default.png') }}';"></a>
  380.                                                         <div class="caption">
  381.                                                             <p class="group inner list-group-item-text">
  382.                                                                 <strong><a href="{{ path('view_profile', {'user': item.idInd}) }}"
  383.                                                                            class="profile-url">{{ item.fname | raw | title }} {{ item.sname | raw | upper }}</a></strong>{% if item.qualityChecked == 1 %}
  384.                                                                 <i class="green fa fa-check-circle tipso"
  385.                                                                    title="User has been verified."></i>{% endif %}
  386.                                                                 {% if item.retired == 1 %} <span
  387.                                                                         class="label label-success">Retired</span></span>{% endif %}
  388.                                                                 {% if item.deceased == 1 %} <span
  389.                                                                         class="label label-danger">Deceased</span>{% endif %}
  390.                                                                 <br/>{% if item.jobtitle != "" %}{{ item.jobtitle }}<br/>{% endif %}
  391.                                                                 {{ item.instName }}
  392.                                                             </p>
  393.                                                         </div>
  394.                                                     </div>
  395.                                                 </div>
  396.                                             {% endfor %}
  397.                                         </div>
  398.                                     </div>
  399.                                     <hr class="caption blue"/>
  400.                                     <span class="col-md-12">
  401.                                     <div class=" pagination-sm pull-right">
  402.                                         {{ knp_pagination_render(childmembers) }}
  403.                                     </div>
  404.                             </span>
  405.                                 </div>
  406.                             </div>
  407.                         {% endif %}
  408.                     </div>
  409.                     <!-- /.col -->
  410.                 </div>
  411.             </section>
  412.         </div>
  413.         <em id='edited-by'
  414.             class="pull-right italics">{% if institute.fDateEntered is defined and institute.fDateEntered != "" %}Created: {{ institute.fDateEntered|date('Y-m-d') }} {% if institute.createdBy is defined and  institute.createdBy != "" %} by {{ institute.createdBy }}{% endif %} | {% endif %}{% if institute.lDateUpdated is defined and institute.lDateUpdated != "" %}Last Updated: {{ institute.lDateUpdated|date('Y-m-d') }}{% endif %} {% if institute.lastEditBy is defined and  institute.lastEditBy != "" %} by {{ institute.lastEditBy }}{% endif %}</em>
  415.     </div>
  416.     {% include('footer.html.twig') %}
  417.     <script src="{{ asset('js/jquery.noty.packaged.min.js') }}" type="text/javascript"></script>
  418.     <script src="{{ asset('js/tipped.js') }}" type="text/javascript"></script>
  419.     <script type="text/javascript">
  420.         $(function () {
  421.             Tipped.create('.tipso', {maxWidth: 250});
  422.             function notify(type, text) {
  423.                 var n = noty({
  424.                     text: text,
  425.                     layout: 'top',
  426.                     theme: 'relax', // or 'relax'
  427.                     type: type,
  428.                     timeout: 5000,
  429.                 });
  430.             }
  431.             {% for flashMessage in app.session.flashbag.get('record_updated') %}
  432.             notify('success', '{{ flashMessage }}');
  433.             {% endfor %}
  434.             
  435.             {% if is_granted('ROLE_GLOBAL_EDITOR') %}
  436.             $(document).delegate(".activate", "click", function () {
  437.                 $(this).html('<i class="fa fa-cog fa-spin" aria-hidden="true"></i> Activate')
  438.                 $.ajax({
  439.                     url: "{{ path('activate_institute',{'instituteId': institute.idInst}) }}",
  440.                     type: 'POST',
  441.                 })
  442.                         .done(function (response) {
  443.                             if (response.status === true) {
  444.                                 $(".statusBtn").html('<button class="btn btn-danger ban" id="ban"><i class="fa fa-ban" aria-hidden="true"></i> Deactivate</button>');
  445.                             } else {
  446.                                 $(".statusBtn").html('<button class="btn btn-success activate" id="activate"><i class="fa fa-check" aria-hidden="true"></i> Activate</button>');
  447.                             }
  448.                         });
  449.             });
  450.             $(document).delegate(".ban", "click", function () {
  451.                 $(this).html('<i class="fa fa-cog fa-spin" aria-hidden="true"></i> Deactivate')
  452.                 $.ajax({
  453.                     url: "{{ path('deactivate_institute',{'instituteId': institute.idInst}) }}",
  454.                     type: 'POST',
  455.                 })
  456.                         .done(function (response) {
  457.                             if (response.status === true) {
  458.                                 $(".statusBtn").html('<button class="btn btn-success activate" id="activate"><i class="fa fa-check" aria-hidden="true"></i> Activate</button>');
  459.                             } else {
  460.                                 $(".statusBtn").html('<button class="btn btn-danger ban" id="ban"><i class="fa fa-ban" aria-hidden="true"></i> Deactivate</button>');
  461.                             }
  462.                         });
  463.             });
  464.             {% endif %}
  465. //on select change, you navigate to indexAction and send the parameter maxItemPerPage
  466.                 $('.maxresults').change(function(){
  467.                     $this = $(this);
  468.                     var key = $this.data("id");
  469.                     var url = '{{ path('view_institution',{'instId':institute.idInst}) }}';
  470.                     var item = $this.find(":selected").text();
  471.                     window.location.href = updateURL(key,item);
  472.                     // window.location.href = updateQueryStringParameter(url,key,item);
  473.                 })
  474.         });
  475.         function updateURL(key,val){
  476.             var url = window.location.href;
  477.             var reExp = new RegExp("[\?|\&]"+key + "=[0-9a-zA-Z\_\+\-\|\.\,\;]*");
  478.             if(reExp.test(url)) {
  479.                 // update
  480.                 var reExp = new RegExp("[\?&]" + key + "=([^&#]*)");
  481.                 var delimiter = reExp.exec(url)[0].charAt(0);
  482.                 url = url.replace(reExp, delimiter + key + "=" + val);
  483.             } else {
  484.                 // add
  485.                 var newParam = key + "=" + val;
  486.                 if(url.indexOf('?') === -1){url += '?';}
  487.                 if(url.indexOf('#') > -1){
  488.                     var urlparts = url.split('#');
  489.                     url = urlparts[0] +  "&" + newParam +  (urlparts[1] ?  "#" +urlparts[1] : '');
  490.                 } else {
  491.                     url += "&" + newParam;
  492.                 }
  493.             }
  494.             url = url.replace('?&', '?');
  495.             return url;
  496.         }
  497.         
  498.         // function updateQueryStringParameter(uri, key, value) {
  499.         //     var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
  500.         //     var separator = uri.indexOf('?') !== -1 ? "&" : "?";
  501.         //     if (uri.match(re)) {
  502.         //         return uri.replace(re, '$1' + key + "=" + value + '$2');
  503.         //     }
  504.         //     else {
  505.         //         return uri + separator + key + "=" + value;
  506.         //     }
  507.         // }
  508.     </script>
  509. {% endblock %}