templates/Search/advancedSearch.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/font-awesome.min.css') }}">
  5.     <link rel="stylesheet" type="text/css" href="{{ asset('css/ionicons.min.css') }}">
  6.     <link rel="stylesheet" type="text/css" href="{{ asset('css/square/blue.css') }}">
  7.     <link rel="stylesheet" type="text/css" href="{{ asset('css/bootstrap.min.css') }}">
  8.     <link rel="stylesheet" type="text/css" href="{{ asset('css/select2.min.css') }}">
  9.     <link rel="stylesheet" type="text/css" href="{{ asset('css/select2-bootstrap.css') }}">
  10.     <link rel="stylesheet" type="text/css" href="{{ asset('css/AdminLTE.min.css') }}">
  11.     <link rel="stylesheet" type="text/css" href="{{ asset('css/autocomplete.min.css') }}">
  12.     <link rel="stylesheet" type="text/css" href="{{ asset('css/register.css') }}">
  13.     <link rel="stylesheet" type="text/css" href="{{ asset('css/tipped.css') }}">
  14.     <link rel="stylesheet" type="text/css" href="{{ asset('css/navbar-login.css') }}">
  15.     <link rel="stylesheet" type="text/css" href="{{ asset('css/bootstrap3-wysihtml5.min.css') }}">
  16.     <link rel="stylesheet" type="text/css" href="{{ asset('css/jquery-ui.min.css') }}">
  17.     <link rel="stylesheet" type="text/css" href="{{ asset('css/profile.css') }}">
  18.     <link rel="stylesheet" type="text/css" href="{{ asset('css/advancedSearch.css') }}">
  19.     <link rel="stylesheet" type="text/css" href="{{ asset('css/bootstrap-datepicker.min.css') }}">
  20.     <link rel="stylesheet" type="text/css" href="{{ asset('css/dropzone.css') }}">
  21.     <style media="screen">
  22.         .send-mail {
  23.             float: right;
  24.             margin: 10px 0;
  25.         }
  26.         .showLess {
  27.             display: none;
  28.         }
  29.     </style>
  30. {% endblock %}
  31. {% block body %}
  32.     {% include 'navbarlogin.html.twig' %}
  33.     <div class="container-fluid">
  34.         <div class="content">
  35.             <h3 class="heading">Advanced Search</h3>
  36.             <p>
  37.                 <i class="fa fa-info-circle fa-fw" aria-hidden="true"></i>
  38.                 Advanced search allows you to add the search categories using "<strong>SEARCH IN</strong>"
  39.                 and various filters based on categories using "<strong>FILTERS</strong>".<br />
  40.                 You can nest queries using "<i class="fa fa-plus fa-fw" aria-hidden="true"></i>" for more refined results.
  41.             </p>
  42.             <form action="" method="GET" class="advSearch">
  43.                 <div class="row" id="searchBox">
  44.                     {% if app.request.get('type')|length > 0 %}
  45.                         {% set increment = 0 %}
  46.                         {% for key,field in searchConditions %}
  47.                             <div class="formContent">
  48.                                 <div class="form-group">
  49.                                     <div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
  50.                                         <label
  51.                                                 for="type[{{ key }}]"
  52.                                                 class="col-sm-12">
  53.                                             SEARCH IN:
  54.                                         </label>
  55.                                         <select
  56.                                                 name="type[{{ key }}]"
  57.                                                 id="type[{{ key }}]"
  58.                                                 class="form-control searchType">
  59.                                             <option
  60.                                                     value="all"
  61.                                                     {% if field.type =="all" %}
  62.                                                 selected=""
  63.                                                     {% endif %}>
  64.                                                 All
  65.                                             </option>
  66.                                             <option
  67.                                                     value="experts"
  68.                                                     {% if field.type =="experts" %}
  69.                                                 selected=""
  70.                                                     {% endif %}>
  71.                                                 Experts
  72.                                             </option>
  73.                                             <option
  74.                                                     value="institutions"
  75.                                                     {% if field.type =="institutions" %}
  76.                                                 selected=""
  77.                                                     {% endif %}>
  78.                                                 Institutions
  79.                                             </option>
  80.                                             <option
  81.                                                     value="events"
  82.                                                     {% if field.type =="events" %}
  83.                                                 selected=""
  84.                                                     {% endif %}>
  85.                                                 Events
  86.                                             </option>
  87.                                             <option
  88.                                                     value="documents"
  89.                                                     {% if field.type =="documents" %}
  90.                                                 selected=""
  91.                                                     {% endif %}>
  92.                                                 Documents
  93.                                             </option>
  94.                                         </select>
  95.                                     </div>
  96.                                     <div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
  97.                                         <label for="filter[{{ key }}]" class="col-sm-12">FILTERS:</label>
  98.                                         <select name="filter[{{ key }}]" id="filter[{{ key }}]"
  99.                                                 class="form-control filters">
  100.                                             <option value="{{ field.filter }}" selected>{{ field.filter }}</option>
  101.                                             {% if field.type =="experts" %}
  102.                                                 <option value="Activities include">Activities include</option>
  103.                                                 <option value="Country is">Country is</option>
  104.                                                 <option value="In multiple countries">In multiple countries</option>
  105.                                                 <option value="Created">Created between (dates included)</option>
  106.                                                 <option value="Current address contains">Current address contains
  107.                                                 </option>
  108.                                                 <option value="Current/Previous addresses contain">Current/Previous
  109.                                                     addresses contain
  110.                                                 </option>
  111.                                                 <option value="Degree contains">Degree contains</option>
  112.                                                 <option value="Department contains">Department contains</option>
  113.                                                 <option value="Email contains">Email contains</option>
  114.                                                 <option value="First name contains">First name contains</option>
  115.                                                 <option value="Institution name contains">Institution name
  116.                                                     contains
  117.                                                 </option>
  118.                                                 <option value="Is deceased">Is deceased</option>
  119.                                                 <option value="Is quality checked">Is quality checked</option>
  120.                                                 <option value="Is retired">Is retired</option>
  121.                                                 <option value="Job title contains">Job title contains</option>
  122.                                                 <option value="Job type is">Job type is</option>
  123.                                                 <option value="Last name contains">Last name contains</option>
  124.                                                 <option value="Member of group or sub-group">Member of group or
  125.                                                     sub-group
  126.                                                 </option>
  127.                                                 <option value="Name contains">Name contains</option>
  128.                                                 <option value="Phone/Fax contains">Phone/Fax contains</option>
  129.                                                 <option value="Quality last checked">Quality last checked</option>
  130.                                                 <option value="Sea regions of study is">Sea regions of study is
  131.                                                 </option>
  132.                                                 <option value="Subject Area is">Subject Area is</option>
  133.                                                 <option value="Unique Identifier">Unique Identifier is</option>
  134.                                                 <option value="Updated">Updated between (dates included)</option>
  135.                                                 <option value="Website URL contains">Website URL contains</option>
  136.                                                 <option value="Working languages includes">Working languages
  137.                                                     includes
  138.                                                 </option>
  139.                                                 {% if is_granted('ROLE_GLOBAL_EDITOR') %}
  140.                                                     <option value="Comment contains">Comment contains</option>
  141.                                                     <option value="Do Not Invite">Do Not Invite</option>
  142.                                                     <option value="Gender is">Gender is</option>
  143.                                                     <option value="Is Active">Is Active</option>
  144.                                                 {% endif %}
  145.                                             {% elseif field.type =="institutions" %}
  146.                                                 <option value="Activities contains">Activities contains</option>
  147.                                                 <option value="Country is">Country is</option>
  148.                                                 <option value="Created">Created between (dates included)</option>
  149.                                                 <option value="Current address contains">Current address contains
  150.                                                 </option>
  151.                                                 <option value="Current/Previous addresses contain">Current/Previous
  152.                                                     addresses contain
  153.                                                 </option>
  154.                                                 <option value="EDMO Code is">EDMO Code is</option>
  155.                                                 <option value="Name contains">Name contains</option>
  156.                                                 <option value="Sea regions of study is">Sea regions of study is
  157.                                                 </option>
  158.                                                 <option value="Tel/Fax contains">Tel/Fax contains</option>
  159.                                                 <option value="Type is">Type is</option>
  160.                                                 <option value="Updated">Updated between (dates included)</option>
  161.                                                 <option value="Website URL contains">Website URL contains</option>
  162.                                             {% elseif field.type =="events" %}
  163.                                                 <option value="Title contains">Title contains</option>
  164.                                                 <option value="Type is">Type is</option>
  165.                                                 <option value="Summary contains">Summary contains</option>
  166.                                                 <option value="Address contains">Address contains</option>
  167.                                                 <option value="Country is">Country is</option>
  168.                                                 <option value="In Group">Country is</option>
  169.                                                 <option value="Starts">Starts</option>
  170.                                                 <option value="Ends">Ends</option>
  171.                                                 <option value="Updated">Updated between (dates included)</option>
  172.                                                 <option value="Created">Created between (dates included)</option>
  173.                                             {% elseif field.type =="documents" %}
  174.                                                 <option value="Title contains">Title contains</option>
  175.                                                 <option value="Type is">Type is</option>
  176.                                                 <option value="Summary contains">Summary contains</option>
  177.                                                 <option value="Created">Created between (dates included)</option>
  178.                                             {% endif %}
  179.                                         </select>
  180.                                     </div>
  181.                                     <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
  182.                                         <label for="keywords[{{ key }}]" class="col-sm-12">KEYWORDS:</label>
  183.                                         <div class="input-group">
  184.                                             <input type="text" name="keywords[{{ key }}]" id="keywords[{{ key }}]"
  185.                                                    class="form-control"
  186.                                                    value="{% if field.keywords is not iterable %}{{ field.keywords|convert_encoding('UTF-8', 'iso-2022-jp') }}{% endif %}"
  187.                                                    required="required" title="keywords"
  188.                                                    placeholder="Enter your search keyword(s)">
  189.                                             {% if loop.last %}
  190.                                                 <span class="input-group-addon btn btn-primary btn-remove"><span
  191.                                                             class="glyphicon glyphicon-minus"></span></span><span
  192.                                                     class="input-group-addon btn btn-primary btn-add"><span
  193.                                                         class="glyphicon glyphicon-plus"></span></span>
  194.                                             {% else %}
  195.                                                 <span class="input-group-addon btn btn-primary btn-remove"><span
  196.                                                             class="glyphicon glyphicon-minus"></span></span>
  197.                                             {% endif %}
  198.                                         </div>
  199.                                     </div>
  200.                                 </div>
  201.                                 <div
  202.                                         class="col-xs-12 col-sm-12 col-md-12 col-lg-12 operation"
  203.                                         {% if loop.last %}
  204.                                     style="display:none;"
  205.                                         {% endif %}>
  206.                                     <div class="no-checkedselector spacer">
  207.                                         <div class="toggle-container">
  208.                                             <input
  209.                                                     id="toggle-OR[{{ key }}]"
  210.                                                     class="toggle toggle-left"
  211.                                                     name="toggle[{{ key }}]"
  212.                                                     value="OR"
  213.                                                     type="radio"
  214.                                                     {% if field.toggle=="OR" %}
  215.                                                 checked=""
  216.                                                     {% endif %}>
  217.                                             <label
  218.                                                     for="toggle-OR[{{ key }}]"
  219.                                                     class="btn btn-default">
  220.                                                 OR
  221.                                             </label>
  222.                                             <input
  223.                                                     id="toggle-AND[{{ key }}]"
  224.                                                     class="toggle toggle-right"
  225.                                                     name="toggle[{{ key }}]"
  226.                                                     value="AND"
  227.                                                     type="radio"
  228.                                                     {% if field.toggle=="AND" %}
  229.                                                 checked=""
  230.                                                     {% endif %}>
  231.                                             <label
  232.                                                     for="toggle-AND[{{ key }}]"
  233.                                                     class="btn btn-default">
  234.                                                 AND
  235.                                             </label>
  236.                                         </div>
  237.                                     </div>
  238.                                 </div>
  239.                             </div>
  240.                             {% set increment = key %}
  241.                         {% endfor %}
  242.                         <div class="incremeter">{{ increment + 1 }}</div>
  243.                     {% else %}
  244.                         <div class="incremeter">1</div>
  245.                         <div class="formContent">
  246.                             <div class="form-group">
  247.                                 <div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
  248.                                     <label for="type[0]" class="col-sm-12">SEARCH IN:</label>
  249.                                     <select
  250.                                             name="type[0]"
  251.                                             id="type[0]"
  252.                                             class="form-control searchType">
  253.                                         <option
  254.                                                 value="all"
  255.                                                 selected="selected">
  256.                                             All
  257.                                         </option>
  258.                                         <option
  259.                                                 value="experts">
  260.                                             Experts
  261.                                         </option>
  262.                                         <option
  263.                                                 value="events">
  264.                                             Events
  265.                                         </option>
  266.                                         <option
  267.                                                 value="institutions">
  268.                                             Institutions
  269.                                         </option>
  270.                                         <option
  271.                                                 value="documents">
  272.                                             Documents
  273.                                         </option>
  274.                                     </select>
  275.                                 </div>
  276.                                 <div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
  277.                                     <label for="filter[0]" class="col-sm-12">FILTERS:</label>
  278.                                     <select name="filter[0]" id="filter[0]" class="form-control  filters">
  279.                                         <option value="" disabled selected>Select your option</option>
  280.                                     </select>
  281.                                 </div>
  282.                                 <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
  283.                                     <label for="keywords[0]" class="col-sm-12">KEYWORDS:</label>
  284.                                     <div class="input-group">
  285.                                         <input
  286.                                                 type="text"
  287.                                                 name="keywords[0]"
  288.                                                 id="keywords[0]"
  289.                                                 class="form-control"
  290.                                                 value=""
  291.                                                 required="required"
  292.                                                 title="keywords"
  293.                                                 placeholder="Enter your search keyword(s)"/>
  294.                                         <span
  295.                                                 class="input-group-addon btn btn-primary btn-add">
  296.                                         <span
  297.                                                 class="glyphicon glyphicon-plus">
  298.                                         </span>
  299.                                     </span>
  300.                                     </div>
  301.                                 </div>
  302.                             </div>
  303.                             <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 operation" style="display:none;">
  304.                                 <div class="no-checkedselector spacer">
  305.                                     <div class="toggle-container">
  306.                                         <input
  307.                                                 id="toggle-OR[0]"
  308.                                                 class="toggle toggle-left"
  309.                                                 name="toggle[0]"
  310.                                                 value="OR"
  311.                                                 type="radio"/>
  312.                                         <label
  313.                                                 for="toggle-OR[0]"
  314.                                                 class="btn btn-default">
  315.                                             OR
  316.                                         </label>
  317.                                         <input
  318.                                                 id="toggle-AND[0]"
  319.                                                 class="toggle toggle-right"
  320.                                                 name="toggle[0]"
  321.                                                 value="AND"
  322.                                                 type="radio">
  323.                                         <label
  324.                                                 for="toggle-AND[0]"
  325.                                                 class="btn btn-default">
  326.                                             AND
  327.                                         </label>
  328.                                     </div>
  329.                                 </div>
  330.                             </div>
  331.                         </div>
  332.                     {% endif %}
  333.                 </div>
  334.                 <div class="row">
  335.                     <div class="col-sm-6">
  336.                         <input
  337.                                 type="hidden"
  338.                                 name="action"
  339.                                 value="advSearch"/>
  340.                         <button
  341.                                 type="submit"
  342.                                 class="btn btn-primary btn-search spacer ">
  343.                             Search <span class="glyphicon glyphicon-search"></span>
  344.                         </button>
  345.                     </div>
  346.                 </div>
  347.             </form>
  348.             <div class="heading"></div>
  349.             {% if data is defined %}
  350.                 {% if app.request.get('filterType') is defined %}
  351.                     {% set filterType = app.request.get('filterType')|split(',') %}
  352.                 {% endif %}
  353.                 {% if data.getParams is defined and data.getParams is not empty %}
  354.                     <div class="row">
  355.                         <div class="col-md-2 col-lg-2">
  356.                             <div class="heading top-buffer10">
  357.                                 <strong>
  358.                                     Categories
  359.                                 </strong>
  360.                                 <small class="hide-content hide-categories">
  361.                                     hide
  362.                                 </small>
  363.                             </div>
  364.                             {% for catKey, category in filters.type %}
  365.                                 {% if category is defined and category > 0 %}
  366.                                     <div class="checkbox categories">
  367.                                         <label>
  368.                                             {% if (filters.type|length > 1)
  369.                                                 and (
  370.                                                         (data.getParams.action is defined
  371.                                                             and data.getParams.action != "browse"
  372.                                                         )
  373.                                                         or (
  374.                                                             data.getParams.type is defined
  375.                                                                 and data.getParams.type == "all"
  376.                                                         )
  377.                                                 )
  378.                                             %}
  379.                                                 <input
  380.                                                         type="checkbox"
  381.                                                         class="icheck"
  382.                                                         value="{{ catKey }}"
  383.                                                         {% if catKey in filterType %}
  384.                                                             checked="checked"
  385.                                                         {% endif %}
  386.                                                 />
  387.                                                 <span class="cr">
  388.                                                     <i class="cr-icon glyphicon glyphicon-ok"></i>
  389.                                                 </span>
  390.                                             {% endif %}
  391.                                             {{ catKey|capitalize }}
  392.                                             ({% if category is defined %}
  393.                                             {{ category }}
  394.                                         {% else %}
  395.                                             0
  396.                                         {% endif %})
  397.                                         </label>
  398.                                     </div>
  399.                                 {% endif %}
  400.                             {% endfor %}
  401.                             {% if filters.country is defined and filters.country is not empty %}
  402.                                 <div class="heading top-buffer10">
  403.                                     <strong>
  404.                                         Countries
  405.                                     </strong>
  406.                                     <small class="hide-content hide-countries">
  407.                                         hide
  408.                                     </small>
  409.                                 </div>
  410.                                 <ul class="searchCat countries">
  411.                                     {% for country, count in filters.country %}
  412.                                         <li>
  413.                                             <a
  414.                                                     href="{{ path(app.request.attributes.get('_route'),app.request.query.all|merge({'filterCountry': country,'page':1})) }}">
  415.                                                 {{ country }}
  416.                                             </a>
  417.                                             ({{ count }})
  418.                                         </li>
  419.                                     {% endfor %}
  420.                                     {% if filters.country|length >20 %}
  421.                                         {% if filters.country|length == 21 %}
  422.                                             <div class="loadMore" onclick="loadMorefilters('countries');">[ +1 More
  423.                                                 country ]
  424.                                             </div>
  425.                                         {% else %}
  426.                                             <div class="loadMore" onclick="loadMorefilters('countries');">[
  427.                                                 +{{ filters.country|length - 20 }} More countries ]
  428.                                             </div>
  429.                                         {% endif %}
  430.                                         <div class="showLess" onclick="showLessfilters('countries')">[ Less countries
  431.                                             ]
  432.                                         </div>
  433.                                     {% endif %}
  434.                                 </ul>
  435.                             {% endif %}
  436.                         </div>
  437.                         <div class="col-xs-12 col-sm-12 col-md-10 col-lg-10 ">
  438.                             <div class="row">
  439.                                 <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
  440.                                     <h3 class="heading">{{ searchResultType }}</h3>
  441.                                 </div>
  442.                                 <div class="col-xs-12 col-sm-8 col-md-8 col-lg-8">
  443.                                     {% if data.getParams is defined %}
  444.                                         {% if searchResultText is defined %}
  445.                                             <div class="top-padding10">{{ searchResultText | raw }}</div>
  446.                                         {% endif %}
  447.                                     {% endif %}
  448.                                 </div>
  449.                                     <div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 top-buffer">
  450.                                         Applied Filters:
  451.                                         {% if appliedFilters | length > 0 %}
  452.                                             {% for key,searchfilter in appliedFilters %}
  453.                                                 <label href="#" class="label label-primary filter-label" data-index="1"
  454.                                                        data-value="{{ searchfilter }}">{{ searchfilter }} Ã—</label>
  455.                                             {% endfor %}
  456.                                         {% endif %}
  457.                                         {% if appliedCountryFilters | length > 0 %}
  458.                                             {% for key,searchfilter in appliedCountryFilters %}
  459.                                                 <label href="#" class="label label-primary countryfilter-label" data-index="1"
  460.                                                        data-value="{{ searchfilter }}">{{ searchfilter }} Ã—</label>
  461.                                             {% endfor %}
  462.                                         {% endif %}
  463.                                         {% if appliedCountryFilters | length == 0 and appliedFilters | length == 0%}
  464.                                             no filters applied
  465.                                         {% endif %}
  466.                                     </div>
  467.                                 <div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
  468.                                     {% if data.getTotalItemCount > 1 %}
  469.                                         {% if sortfields is defined and sortfields|length > 0 %}
  470.                                             <div class="pull-right form-inline">
  471.                                                 Sort Result by:
  472.                                                 <select id="sortby" class="form-control ">
  473.                                                     {% for key, sort in sortfields|sort %}
  474.                                                         {% if key == sortby %}
  475.                                                             {% if app.request.get('sortby') != "" %}
  476.                                                                 <option value="{{ key }}">{{ sort }}</option>
  477.                                                             {% else %}
  478.                                                                 <option value="{{ key }}"
  479.                                                                         selected="selected">{{ sort }}</option>
  480.                                                             {% endif %}
  481.                                                         {% else %}
  482.                                                             <option value="{{ key }}">{{ sort }}</option>
  483.                                                         {% endif %}
  484.                                                     {% endfor %}
  485.                                                 </select>
  486.                                             </div>
  487.                                         {% endif %}
  488.                                     {% endif %}
  489.                                 </div>
  490.                             </div>
  491.                             {% if data.getTotalItemCount is defined and data.getTotalItemCount > 0 %}
  492.                                 <div class="row spacer">
  493.                                     {# <div class="col-md-12"> #}
  494.                                     <div class="col-md-3 search-display">
  495.                                         Displaying {{ data.getPaginationData.firstItemNumber }}
  496.                                         â€“ {{ data.getPaginationData.lastItemNumber }} results
  497.                                         of {{ data.getTotalItemCount }}.
  498.                                     </div>
  499.                                     <div class="form-inline col-md-3">
  500.                                         {% if data.getTotalItemCount >10 %}
  501.                                             <select name="resultCnt" class="form-control  resultCnt">
  502.                                                 <option value="10">10</option>
  503.                                                 <option value="20">20</option>
  504.                                                 <option value="50">50</option>
  505.                                                 <option value="100">100</option>
  506.                                             </select> results per page.
  507.                                         {% endif %}
  508.                                     </div>
  509.                                     <div class="col-md-6">
  510.                                         <div class="navigation pagination-sm pull-right">
  511.                                             {{ knp_pagination_render(data) }}
  512.                                         </div>
  513.                                     </div>
  514.                                 </div>
  515.                                 <div class="row list-group">
  516.                                     <div class="col-md-12">
  517.                                         {% for item in data %}
  518.                                             <div class="item  col-xs-4 col-lg-4 list-group-item">
  519.                                                 <div class="thumbnail">
  520.                                                     {% if item.type == "experts" %}
  521.                                                         <a
  522.                                                                 href="{{ path('view_profile', {'user': item.id_ind}) }}"
  523.                                                                 class="profile-url">
  524.                                                             <img
  525.                                                                     class="group list-group-image lazy img-thumbnail img-responsive"
  526.                                                                     data-original="{% if file_exists(web_path~asset('uploads/profile/profile_'~item.id_ind~'.png')) %}{{ asset('uploads/profile/profile_'~item.id_ind~'.png') }}{% endif %}"
  527.                                                                     src="{{ asset('assets/uploads/default.png') }}"
  528.                                                                     onError="this.src='{{ asset('assets/uploads/default.png') }}';"
  529.                                                                     alt="profile image"/>
  530.                                                         </a>
  531.                                                         <div class="caption">
  532.                                                             <p
  533.                                                                     class="group inner list-group-item-text">
  534.                                                                 <strong>
  535.                                                                     <a
  536.                                                                             href="{{ path('view_profile', {'user': item.id_ind}) }}"
  537.                                                                             {% if item.status == 2 %}
  538.                                                                                 class="profile-url text-danger tipso"
  539.                                                                                 title="Deleted record"
  540.                                                                                 data-tipped-options="skin: 'red'"
  541.                                                                             {% elseif item.status == 0 %}
  542.                                                                                 class="profile-url text-warning tipso"
  543.                                                                                 title="Deactivated record"
  544.                                                                                 data-tipped-options="skin: 'red'"
  545.                                                                             {% elseif item.status == 3 %}
  546.                                                                                 class="profile-url text-warning tipso"
  547.                                                                                 title="Deactivated record"
  548.                                                                                 data-tipped-options="skin: 'red'"
  549.                                                                             {% endif %}
  550.                                                                     >{{ item.sname | raw | upper }} {{ item.mname | raw }} {{ item.fname | raw }}
  551.                                                                     </a>
  552.                                                                 </strong>
  553.                                                                 {% if item.quality_checked == 1 %}
  554.                                                                     <i
  555.                                                                             class="green fa fa-check-circle tipso"
  556.                                                                             title="User has been verified."></i>
  557.                                                                 {% endif %}
  558.                                                                 {{ item.jobtitle }}
  559.                                                                 {% if item.retired == 1 %}
  560.                                                                     <span class="label label-success">Retired</span>
  561.                                                                 {% endif %}
  562.                                                                 {% if item.deceased == 1 %}
  563.                                                                     <span class="label label-danger">Deceased</span>
  564.                                                                 {% endif %}
  565.                                                                 <br/>
  566.                                                                 {% if item.use_inst_addr == 1 %}
  567.                                                                     {% if item.inst_address !="" %}
  568.                                                                         {{ item.inst_address }},
  569.                                                                     {% endif %}
  570.                                                                     {% if item.instCity !="" %}
  571.                                                                         {{ item.instCity }},
  572.                                                                     {% endif %}
  573.                                                                     {% if item.country !="" %}
  574.                                                                         <strong>{{ item.country }}</strong>
  575.                                                                     {% endif %}
  576.                                                                 {% else %}
  577.                                                                     {% if item.addr_1 !="" %}
  578.                                                                         {{ item.addr_1 }},
  579.                                                                     {% endif %}
  580.                                                                     {% if item.addr_2 !="" %}
  581.                                                                         {{ item.addr_2 }},
  582.                                                                     {% endif %}
  583.                                                                     {% if item.city !="" %}
  584.                                                                         {{ item.city }},
  585.                                                                     {% endif %}
  586.                                                                     {% if item.state !="" %}
  587.                                                                         {{ item.state }},
  588.                                                                     {% endif %}
  589.                                                                     {% if item.postcode !="" %}
  590.                                                                         {{ item.postcode }},
  591.                                                                     {% endif %}
  592.                                                                     {% if item.country !="" %}
  593.                                                                         <strong>{{ item.country }}</strong>
  594.                                                                     {% endif %}
  595.                                                                 {% endif %}
  596.                                                             </p>
  597.                                                             {% if is_granted('ROLE_GLOBAL_EDITOR') %}
  598.                                                                 {% if item.events is defined and item.events > 0 %}
  599.                                                                     <a
  600.                                                                             href="#"
  601.                                                                             class="bold">
  602.                                                                         [Event(s): {{ item.events }} ]
  603.                                                                     </a>
  604.                                                                 {% endif %}
  605.                                                             {% endif %}
  606.                                                         </div>
  607.                                                     {% elseif item.type=="institutions" %}
  608.                                                         {% if item.inst_logo is defined and  item.inst_logo != "" %}
  609.                                                             {% set instUrl = asset('uploads/institutes/'~item.id_inst~'/'~item.inst_logo) %}
  610.                                                         {% else %}
  611.                                                             {% set instUrl = asset('assets/uploads/institute.png') %}
  612.                                                         {% endif %}
  613.                                                         <img
  614.                                                                 class="group list-group-image lazy  img-thumbnail img-responsive"
  615.                                                                 src="{{ instUrl }}"
  616.                                                                 data-original="{{ instUrl }}"
  617.                                                                 alt=""/>
  618.                                                         <div class="caption">
  619.                                                             <p class="group inner list-group-item-text">
  620.                                                                 <strong>
  621.                                                                     <a
  622.                                                                             href="{{ path('view_institution', {'instId': item.id_inst}) }}"
  623.                                                                             {% if item.activated == 0 %}
  624.                                                                                 class="profile-url text-warning tipso"
  625.                                                                                 title="Deactivated record"
  626.                                                                             {% elseif item.activated == 2 %}
  627.                                                                                 class="profile-url text-danger tipso"
  628.                                                                                 title="Deleted record"
  629.                                                                             {% elseif item.activated == 3 %}
  630.                                                                                 class="profile-url text-danger tipso"
  631.                                                                                 title="Deleted record"
  632.                                                                             {% else %}
  633.                                                                                 class="profile-url"
  634.                                                                             {% endif %}
  635.                                                                     >
  636.                                                                         {{ item.inst_name | raw }}
  637.                                                                     </a>
  638.                                                                 </strong>
  639.                                                                 <span class="label label-primary">{{ item.instType }}</span>
  640.                                                                 {% if item.inst_address|trim !="" %}
  641.                                                                     <br/>{{ item.inst_address | raw }}
  642.                                                                 {% endif %}
  643.                                                                 {% if item.instCity|trim !="" %}
  644.                                                                     <br/>{{ item.instCity | raw }}
  645.                                                                 {% endif %}
  646.                                                                 {% if item.instState|trim !="" %}
  647.                                                                     {{ item.instState | raw }}
  648.                                                                 {% endif %}
  649.                                                                 {% if item.country|trim !="" %}
  650.                                                                     <br/>
  651.                                                                     <strong>{{ item.country | raw }}</strong>
  652.                                                                 {% endif %}
  653.                                                             </p>
  654.                                                         </div>
  655.                                                     {% elseif item.type=="events" %}
  656.                                                         <img
  657.                                                                 class="group list-group-image lazy  img-thumbnail img-responsive"
  658.                                                                 src="{{ asset('assets/uploads/event.png') }}"
  659.                                                                 data-original="{{ asset('assets/uploads/event.png') }}"
  660.                                                                 alt=""/>
  661.                                                         <div class="caption">
  662.                                                             <p class="group inner list-group-item-text">
  663.                                                                 <strong>
  664.                                                                     <a
  665.                                                                             href="{{ path('view_event', {'event': item.id_event}) }}"
  666.                                                                             {% if item.activated == 2 %}
  667.                                                                                 class="profile-url text-danger tipso"
  668.                                                                                 title="Deleted record"
  669.                                                                                 data-tipped-options="skin: 'red'"
  670.                                                                             {% elseif item.activated == 0 %}
  671.                                                                                 class="profile-url text-warning tipso"
  672.                                                                                 title="Deactivated record"
  673.                                                                                 data-tipped-options="skin: 'red'"
  674.                                                                             {% endif %}
  675.                                                                     >
  676.                                                                         {{ item.name }}
  677.                                                                     </a>
  678.                                                                 </strong>
  679.                                                                 <span class="label label-warning">{{ item.eventtype }}</span>
  680.                                                                 <br/>
  681.                                                                 {% if item.start_on is defined and  item.start_on !="" %}
  682.                                                                     {{ item.start_on|date("d/m/Y") }} -
  683.                                                                 {% endif %}
  684.                                                                 {% if item.end_on is defined and item.end_on !="" %}
  685.                                                                     {{ item.end_on|date("d/m/Y") }}
  686.                                                                     <br/>
  687.                                                                 {% endif %}
  688.                                                                 {% if item.addr_1 !="" %}
  689.                                                                     {{ item.addr_1 | raw }},
  690.                                                                     <br/>
  691.                                                                 {% endif %}
  692.                                                                 {% if item.city !="" %}
  693.                                                                     {{ item.city | raw }},
  694.                                                                 {% endif %}
  695.                                                                 {% if item.state !="" %}
  696.                                                                     {{ item.state | raw }},
  697.                                                                 {% endif %}
  698.                                                                 {% if item.country !="" %}
  699.                                                                     <strong>{{ item.country | raw }}</strong>
  700.                                                                 {% endif %}
  701.                                                             </p>
  702.                                                         </div>
  703.                                                     {% elseif item.type=="documents" %}
  704.                                                         <img
  705.                                                                 class="group list-group-image lazy  img-thumbnail img-responsive"
  706.                                                                 src="{{ asset('assets/uploads/documents.png') }}"
  707.                                                                 data-original="{{ asset('assets/uploads/documents.png') }}"
  708.                                                                 alt="documents"/>
  709.                                                         <div class="caption">
  710.                                                             <p class="group inner list-group-item-text">
  711.                                                                 <strong>
  712.                                                                     <a
  713.                                                                             href="{{ path('view_document', {'idDoc': item.id_doc}) }}">
  714.                                                                         {{ item.title }}
  715.                                                                         {% if item.doc_code is defined and item.doc_code !="" %}
  716.                                                                             &nbsp;(doc code: {{ item.doc_code | raw }})
  717.                                                                         {% endif %}
  718.                                                                     </a>
  719.                                                                 </strong>
  720.                                                                 <span class="label label-warning">{{ item.documenttype }}</span>
  721.                                                                 <br/>
  722.                                                             </p>
  723.                                                         </div>
  724.                                                     {% endif %}
  725.                                                 </div>
  726.                                             </div>
  727.                                         {% endfor %}
  728.                                     </div>
  729.                                 </div>
  730.                                 <div class="row">
  731.                                     <div class="col-md-3 search-display">
  732.                                         Displaying {{ data.getPaginationData.firstItemNumber }}
  733.                                         â€“ {{ data.getPaginationData.lastItemNumber }} results
  734.                                         of {{ data.getTotalItemCount }}.
  735.                                     </div>
  736.                                     <div class="form-inline col-md-3">
  737.                                         {% if data.getTotalItemCount >10 %}
  738.                                             <select name="resultCnt" class="form-control resultCnt">
  739.                                                 <option value="10">10</option>
  740.                                                 <option value="20">20</option>
  741.                                                 <option value="50">50</option>
  742.                                                 <option value="100">100</option>
  743.                                             </select> results per page.
  744.                                         {% endif %}
  745.                                     </div>
  746.                                     <div class="col-md-6">
  747.                                         <div class="navigation pagination-sm pull-right">
  748.                                             {{ knp_pagination_render(data) }}
  749.                                         </div>
  750.                                     </div>
  751.                                 </div>
  752.                             {% endif %}
  753.                             <div class="heading"></div>
  754.                             {% if is_granted('ROLE_GLOBAL_EDITOR') %}
  755.                                 <button
  756.                                         href="#compose-mail"
  757.                                         data-toggle="modal"
  758.                                         class="btn btn-primary send-mail"><i class="fa fa-envelope-o fa-fw"></i>
  759.                                     Send an email to all experts in these search results
  760.                                 </button>
  761.                             {% endif %}
  762.                         </div>
  763.                     </div>
  764.                 {% endif %}
  765.             {% endif %}
  766.         </div>
  767.         {% if is_granted('ROLE_GLOBAL_EDITOR') %}
  768.             <div
  769.                     aria-hidden="true"
  770.                     aria-labelledby="compose-mail"
  771.                     role="dialog"
  772.                     tabindex="-1"
  773.                     id="compose-mail"
  774.                     class="modal fade"
  775.                     style="display: none;">
  776.                 <div class="modal-dialog modal-lg">
  777.                     <div class="modal-content">
  778.                         <div class="modal-header">
  779.                             <button
  780.                                     aria-hidden="true"
  781.                                     data-dismiss="modal"
  782.                                     class="close"
  783.                                     type="button">
  784.                                 Ã—
  785.                             </button>
  786.                             <h4 class="modal-title">Compose Email</h4>
  787.                         </div>
  788.                         <div class="modal-body">
  789.                             <div role="form" class="form-horizontal">
  790.                                 <div class="form-group">
  791.                                     <label class="col-lg-2 control-label">Sender</label>
  792.                                     <div class="col-lg-10">
  793.                                         {% if file_exists(web_path~asset('uploads/profile/profile_'~app.user.id~'.png')) %}
  794.                                             <img
  795.                                                     src="{{ asset('uploads/profile/profile_'~app.user.id~'.png') }}"
  796.                                                     class="profile-img-sm img-circle"
  797.                                                     alt="profile image"/>
  798.                                         {% endif %}
  799.                                         <label class="control-label">{{ user.fname~' '~ user.sname }}
  800.                                             &lt;{{ app.user.email }}&gt;
  801.                                             <br/>
  802.                                             <div class="checkbox">
  803.                                                 <label class="no-padding" for="selfEmail">
  804.                                                     <input type="checkbox" value="" id="selfEmail">
  805.                                                     <span class="cr"><i
  806.                                                                 class="cr-icon glyphicon glyphicon-ok"></i></span>
  807.                                                     Send a copy of this message to me too
  808.                                                 </label>
  809.                                             </div>
  810.                                         </label>
  811.                                     </div>
  812.                                 </div>
  813.                                 <div class="form-group">
  814.                                     <label class="col-lg-2 control-label">Recipients</label>
  815.                                     <div class="col-lg-10">
  816.                                         <label class="control-label">All people in the search result</label>
  817.                                     </div>
  818.                                 </div>
  819.                                 <div class="form-group">
  820.                                     <label class="col-lg-2 control-label" for="subject">Subject</label>
  821.                                     <div class="col-lg-10">
  822.                                         <input type="text" placeholder="" id="subject" name="subject"
  823.                                                class="form-control">
  824.                                     </div>
  825.                                 </div>
  826.                                 <div class="form-group">
  827.                                     <label class="col-lg-2 control-label" for="message">Message</label>
  828.                                     <div class="col-lg-10">
  829.                                         <textarea rows="10" cols="30" class="form-control textarea" id="message"
  830.                                                   name="message"></textarea>
  831.                                     </div>
  832.                                 </div>
  833.                                 <div class="form-group">
  834.                                     <label class="col-lg-2 control-label" for="info"></label>
  835.                                     <div class="col-lg-10">
  836.                                         <div style="margin-top:5px">
  837.                                             <div class="infoHidden">
  838.                                                 <a class="showInfo" href="javascript:void(0)">[Info on inserting
  839.                                                     names]</a>
  840.                                             </div>
  841.                                             <div class="infoShown">
  842.                                                 <a class="hideInfo" href="javascript:void(0)" style="float:right;">[Hide]</a>
  843.                                                 If you include these special words in your message, they will be
  844.                                                 replaced:
  845.                                                 <br/>
  846.                                                 <br/>
  847.                                                 <div class="table-responsive">
  848.                                                     <table class="table table-condensed">
  849.                                                         <tbody>
  850.                                                         <tr>
  851.                                                             <td>_FULLNAME_</td>
  852.                                                             <td>Recipient name (first name &amp; surname)</td>
  853.                                                         </tr>
  854.                                                         <tr>
  855.                                                             <td>_FNAME_</td>
  856.                                                             <td>Recipient first name</td>
  857.                                                         </tr>
  858.                                                         <tr>
  859.                                                             <td>_SNAME_</td>
  860.                                                             <td>Recipient surname</td>
  861.                                                         </tr>
  862.                                                         <tr>
  863.                                                             <td>_TITLE_</td>
  864.                                                             <td>Recipient title</td>
  865.                                                         </tr>
  866.                                                         </tbody>
  867.                                                     </table>
  868.                                                 </div>
  869.                                             </div>
  870.                                         </div>
  871.                                     </div>
  872.                                 </div>
  873.                                 <div class="form-group">
  874.                                     <div class="col-lg-offset-2 col-lg-10">
  875.                                         <div class="fileUpload">
  876.                                             <form
  877.                                                     action="{{ path('upload_email_attachments') }}"
  878.                                                     class="dropzone"
  879.                                                     id="myAwesomeDropzone">
  880.                                             </form>
  881.                                         </div>
  882.                                     </div>
  883.                                 </div>
  884.                                 <div class="form-group">
  885.                                     <div class="col-lg-offset-2 col-lg-10">
  886.                                         <div class="btn-toolbar pull-right ">
  887.                                             <button
  888.                                                     class="btn btn-send btn-danger"
  889.                                                     id="closeModal"
  890.                                                     data-dismiss="modal"><i class="fa fa-times-circle"></i>
  891.                                                 Close
  892.                                             </button>
  893.                                             <button
  894.                                                     class="btn btn-send btn-primary"
  895.                                                     id="sendmail">
  896.                                                 Send <i class="fa fa-envelope-o"></i>
  897.                                             </button>
  898.                                         </div>
  899.                                     </div>
  900.                                 </div>
  901.                             </div>
  902.                         </div>
  903.                     </div><!-- /.modal-content -->
  904.                 </div><!-- /.modal-dialog -->
  905.             </div><!-- /.modal -->
  906.         {% endif %}
  907.     </div>
  908.     {% include 'footer.html.twig' %}
  909.     <script src="{{ asset('js/bootstrap-datepicker.js') }}" type="text/javascript"></script>
  910.     <script src="{{ asset('js/tipped.js') }}" type="text/javascript"></script>
  911.     <script src="{{ asset('js/dropzone.js') }}"></script>
  912.     <script src="{{ asset('js/wysihtml5-0.3.0.min.js') }}" type="text/javascript"></script>
  913.     <script src="{{ asset('js/handlebars.runtime.min.js') }}" type="text/javascript"></script>
  914.     <script src="{{ asset('js/handlebars.min.js') }}" type="text/javascript"></script>
  915.     <script src="{{ asset('js/bootstrap3-wysihtml5.min.js') }}" type="text/javascript"></script>
  916.     <script src="{{ asset('js/bootstrap-dialog.js') }}" type="text/javascript"></script>
  917.     <script src="{{ asset('js/tinymce.min.js') }}" type="text/javascript"></script>
  918.     <script type="text/javascript">
  919.         var removeEmailAttachments = '{{ path('remove_email_attachments') }}';
  920.         $(function ()
  921.         {
  922.             tinymce.init({
  923.                 selector: 'textarea',
  924.                 plugins: [
  925.                     "advlist autolink lists link image charmap print preview anchor",
  926.                     "searchreplace visualblocks code fullscreen",
  927.                     "insertdatetime media table contextmenu paste imagetools powerpaste"
  928.                 ],
  929.                 toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
  930.                 powerpaste_allow_local_images: true,
  931.                 powerpaste_word_import: 'prompt',
  932.                 powerpaste_html_import: 'prompt',
  933.                 branding: false,
  934.                 relative_urls: false,
  935.                 convert_urls: false,
  936.                 forced_root_block: false
  937.             });
  938.             $(document).on('focusin', function (e) {
  939.                 if ($(e.target).closest(".mce-window").length) {
  940.                     e.stopImmediatePropagation();
  941.                 }
  942.             });
  943.             Tipped.create('.tipso', {maxWidth: 250});
  944.             $.ajax({
  945.                 url: "{{ path('get_countries') }}",
  946.             })
  947.                 .done(function (response) {
  948.                     window.countries = response;
  949.                 });
  950.             $.ajax({
  951.                 url: "{{ path('get_sea_regions') }}",
  952.             })
  953.                 .done(function (response) {
  954.                     window.seaRegions = response;
  955.                 });
  956.             $(".search").addClass('navactive');
  957.             var i = $(".incremeter").text();
  958.             $(document).on('click', '.btn-add', function (e) {
  959.                 e.preventDefault();
  960.                 var existingDate = false;
  961.                 var controlForm = $('#searchBox:first'),
  962.                     currentEntry = $(this).closest('.formContent');
  963.                 var newEntry = $(currentEntry.clone(true)).appendTo(controlForm);
  964.                 newEntry.find('.select2-container').remove();
  965.                 newEntry.find('[id]').each(function () {
  966.                     var getid = this.id.split('[')[0];
  967.                     this.id = getid + '[' + i + ']';
  968.                 });
  969.                 newEntry.find('[name]').each(function () {
  970.                     var getid = this.name.split('[')[0];
  971.                     this.name = getid + '[' + i + ']';
  972.                 });
  973.                 newEntry.find('[for]').each(function () {
  974.                     var label = $(this).attr('for').split('[')[0];
  975.                     $(this).attr('for', label + '[' + i + ']');
  976.                 });
  977.                 $("#type\\[" + i + "\\]").val('all');
  978.                 $("#type\\[" + i + "\\]").change();
  979.                 $("#filter\\[" + i + "\\]").change();
  980.                 newEntry.find('.revert').replaceWith('<input id="keywords[' + i + ']" name="keywords[' + i + ']" class="form-control " required="required" >');
  981.                 $(newEntry).find('.incremeter').html(++i);
  982.                 newEntry.find('input:not(:radio)').val('');
  983.                 currentEntry.find('.operation').css('display', 'block');
  984.                 currentEntry.find('.btn-remove').remove();
  985.                 newEntry.find('.btn-remove').remove();
  986.                 controlForm.find('.formContent:not(:last) .btn-add')
  987.                     .removeClass('btn-add').addClass('btn-remove')
  988.                     .removeClass('btn-success').addClass('btn-danger')
  989.                     .html('<span class="glyphicon glyphicon-minus"></span>');
  990.                 controlForm.find('.formContent:last .btn-add')
  991.                     .replaceWith('<span ' +
  992.                         'class="input-group-addon btn btn-primary btn-remove btn-danger">' +
  993.                         '<span ' +
  994.                         'class="glyphicon glyphicon-minus">' +
  995.                         '</span>' +
  996.                         '</span>' +
  997.                         '<span ' +
  998.                         'class="input-group-addon btn btn-primary btn-add btn-success">' +
  999.                         '<span class="glyphicon glyphicon-plus">' +
  1000.                         '</span>' +
  1001.                         '</span>'
  1002.                     );
  1003.             }).on('click', '.btn-remove', function (e) {
  1004.                 if ($('.formContent').length == 1) {
  1005.                     $('.formContent:first').find(".btn-remove").remove();
  1006.                     return false;
  1007.                 }
  1008.                 e.preventDefault();
  1009.                 $(this).parent().nextAll('.formContent').each(function () {
  1010.                     $(this).find('.incremeter').html($(this).find('.incremeter').html() - 1);
  1011.                 });
  1012.                 if ($(this).siblings('.btn-add').length) {
  1013.                     var myParent = $(this).parents(".formContent");
  1014.                     myParent.siblings(".formContent:last").find(".btn-remove")
  1015.                         .replaceWith('<span ' +
  1016.                             'class="input-group-addon btn btn-primary btn-remove btn-danger">' +
  1017.                             '<span ' +
  1018.                             'class="glyphicon glyphicon-minus">' +
  1019.                             '</span>' +
  1020.                             '</span>' +
  1021.                             '<span ' +
  1022.                             'class="input-group-addon btn btn-primary btn-add btn-success">' +
  1023.                             '<span ' +
  1024.                             'class="glyphicon glyphicon-plus">' +
  1025.                             '</span>' +
  1026.                             '</span>'
  1027.                         );
  1028.                 }
  1029.                 $(this).parents('.formContent').remove();
  1030.                 return false;
  1031.             });
  1032.             $('.no-checkedselector').on('change', 'input[type="radio"].toggle', function () {
  1033.                 if (this.checked) {
  1034.                     $('input[name="' + this.name + '"].checked').removeClass('checked');
  1035.                     $(this).addClass('checked');
  1036.                     $('.toggle-container').addClass('force-update').removeClass('force-update');
  1037.                 }
  1038.             });
  1039.             $('.no-checkedselector input[type="radio"].toggle:checked').addClass('checked');
  1040.             $(".resultCnt").change(function (e) {
  1041.                 e.preventDefault();
  1042.                 var url = " {{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'limit': null,'page':1})) }}";
  1043.                 url = url + '&limit=' + $(this).val();
  1044.                 window.location.href = url.replace(/&amp;/g, '&');
  1045.             });
  1046.             {% if data.getPaginationData.numItemsPerPage is defined %}
  1047.                 $('.resultCnt').val("{{ data.getPaginationData.numItemsPerPage }}");
  1048.             {% endif %}
  1049.             $("#sortby").change(function (e) {
  1050.                 e.preventDefault();
  1051.                 var uri = $(location).attr('href');
  1052.                 var re = new RegExp("([?&])sortby=.*?(&|$)", "i");
  1053.                 var separator = uri.indexOf('?') !== -1 ? "&" : "?";
  1054.                 if (uri.match(re)) {
  1055.                     window.location.href = uri.replace(re, '$1' + "sortby=" + $(this).val() + '$2');
  1056.                 } else {
  1057.                     window.location.href = uri + separator + "sortby=" + $(this).val();
  1058.                 }
  1059.             });
  1060.             {% if data.getParams.sortby is defined %}
  1061.                 $('#sortby').val("{{ data.getParams.sortby }}");
  1062.             {% endif %}
  1063.             $("body").on('change', '.searchType', function (event) {
  1064.                 var id = $(this).attr('id').match(/\[(.*?)\]/)[1];
  1065.                 var options = $("#filter\\[" + id + "\\]");
  1066.                 options.find('option').remove();
  1067.                 if ($(this).val() == 'all') {
  1068.                     $(this).parents('.formContent')
  1069.                         .find(".revert")
  1070.                         .replaceWith('<input ' +
  1071.                             'id="keywords[' + id + ']" ' +
  1072.                             'name="keywords[' + id + ']" ' +
  1073.                             'class="form-control" ' +
  1074.                             'required="required" ' +
  1075.                             'placeholder="Enter your search keywords">'
  1076.                         );
  1077.                 } else if ($(this).val() == 'experts') {
  1078.                     var expertOptions = {
  1079.                         "First name contains": "First name contains",
  1080.                         "Last name contains": "Last name contains",
  1081.                         "Current address contains": "Current address contains",
  1082.                         "Current/Previous addresses contain": "Current/Previous addresses contain",
  1083.                         "Phone/Fax contains": "Phone/Fax contains",
  1084.                         "Email contains": "Email contains",
  1085.                         "Website URL contains": "Website URL contains",
  1086.                         "Country is": "Country is",
  1087.                         "In multiple countries": "In multiple countries",
  1088.                         "Sea regions of study is": "Sea regions of study is",
  1089.                         "Member of group or sub-group": "Member of group or sub-group",
  1090.                         "Job type is": "Job type is",
  1091.                         "Job title contains": "Job title contains",
  1092.                         "Department contains": "Department contains",
  1093.                         "Institution name contains": "Institution name contains",
  1094.                         "Subject Area is": "Subject Area is",
  1095.                         "Activities include": "Detailed Activities include",
  1096.                         "Working languages includes": "Working languages includes",
  1097.                         "Degree contains": "Degree contains",
  1098.                         "Is retired": "Is retired",
  1099.                         "Is deceased": "Is deceased",
  1100.                         "Is quality checked": "Is quality checked",
  1101.                         "Unique Identifier": "Unique Identifier is",
  1102.                         "Quality last checked": "Quality last checked",
  1103.                         "Updated": "Updated between (dates included)",
  1104.                         "Created": "Created between (dates included)"
  1105.                     };
  1106.                     {% if is_granted('ROLE_GLOBAL_EDITOR') %}
  1107.                         $.extend(expertOptions, {
  1108.                             "Gender is": "Gender is",
  1109.                             "Is Active": "Is Active",
  1110.                             "Do Not Invite": "Do Not Invite",
  1111.                             "Comment contains": "Comment contains"
  1112.                         });
  1113.                     {% endif %}
  1114.                     expertOptions = sortObject(expertOptions);
  1115.                     options.append("<option value='Name contains' selected>Name contains</option>");
  1116.                     $.each(expertOptions, function (index, val) {
  1117.                         options.append($("<option/>", {
  1118.                             value: index,
  1119.                             text: val
  1120.                         }));
  1121.                     });
  1122.                 } else if ($(this).val() == 'institutions') {
  1123.                     options.find('option').remove();
  1124.                     var institutionOptions = {
  1125.                         "Current address contains": "Current address contains",
  1126.                         "Current/Previous addresses contain": "Current/Previous addresses contain",
  1127.                         "Country is": "Country is",
  1128.                         "Sea regions of study is": "Sea regions of study is",
  1129.                         "Type is": "Type is",
  1130.                         "Activities contains": "Activities contains",
  1131.                         "Tel/Fax contains": "Tel/Fax contains",
  1132.                         "Website URL contains": "Website URL contains",
  1133.                         "EDMO Code is": "EDMO Code is",
  1134.                         "Updated": "Updated between (dates included)",
  1135.                         "Created": "Created between (dates included)",
  1136.                     };
  1137.                     institutionOptions = sortObject(institutionOptions);
  1138.                     options.append("<option value='Name contains' selected>Name contains</option>");
  1139.                     $.each(institutionOptions, function (index, val) {
  1140.                         options.append($("<option/>", {
  1141.                             value: index,
  1142.                             text: val
  1143.                         }));
  1144.                     });
  1145.                 } else if ($(this).val() == 'events') {
  1146.                     options.find('option').remove();
  1147.                     var eventOptions = {
  1148.                         "Title contains": "Title contains",
  1149.                         "eType is": "Type is",
  1150.                         "Summary contains": "Summary contains",
  1151.                         "Keywords contain": "Keywords contain",
  1152.                         "Address contains": "Address contains",
  1153.                         "Country is": "Country is",
  1154.                         "Date between": "Date between",
  1155.                         "Updated": "Updated between (dates included)",
  1156.                         "Created": "Created between (dates included)"
  1157.                     };
  1158.                     sortObject(eventOptions);
  1159.                     $.each(eventOptions, function (index, val) {
  1160.                         options.append($("<option/>", {
  1161.                             value: index,
  1162.                             text: val
  1163.                         }));
  1164.                     });
  1165.                 } else if ($(this).val() == 'documents') {
  1166.                     options.find('option').remove();
  1167.                     var documentOptions = {
  1168.                         "Title contains": "Title contains",
  1169.                         "Document type is": "Document Type is",
  1170.                         "Document code is": "Document code is",
  1171.                         "Summary contains": "Summary contains",
  1172.                         "Keywords contain": "Keywords contain",
  1173.                         "Updated": "Updated between (dates included)",
  1174.                         "Created": "Created between (dates included)"
  1175.                     };
  1176.                     sortObject(documentOptions);
  1177.                     $.each(documentOptions, function (index, val) {
  1178.                         options.append($("<option/>", {
  1179.                             value: index,
  1180.                             text: val
  1181.                         }));
  1182.                     });
  1183.                 } else if ($(this).val() == 'jobs') {
  1184.                     options.find('option').remove();
  1185.                     var jobOptions = {
  1186.                         "Title contains": "Title contains",
  1187.                         "Type is": "Type is",
  1188.                         "Description contains": "Description contains",
  1189.                         "Country is": "Country is",
  1190.                         "Sea regions of study is": "Sea regions of study is"
  1191.                     };
  1192.                     $.each(jobOptions, function (index, val) {
  1193.                         options.append($("<option/>", {
  1194.                             value: index,
  1195.                             text: val
  1196.                         }));
  1197.                     });
  1198.                 }
  1199.                 $(this).parents(".formContent").find(".filters").change();
  1200.             });
  1201.             var filterData = {
  1202.                 'Job type is': "{{ path('get_job_types') }}",
  1203.                 'Sea regions of study is': "{{ path('get_sea_regions') }}",
  1204.                 'Member of group or sub-group': "{{ path('get_member_groups') }}",
  1205.                 'Country is': "{{ path('get_countries') }}",
  1206.                 'Subject Area is': "{{ path('get_subject_area') }}",
  1207.                 'Type is': "{{ path('get_institution_types') }}",
  1208.                 'eType is': "{{ path('get_event_types') }}",
  1209.                 'Document type is': "{{ path('get_document_types') }}",
  1210.             };
  1211.             var multipleOptions = {
  1212.                 'In multiple countries': "{{ path('get_countries') }}",
  1213.             }
  1214.             var dateFilter = {
  1215.                 'Updated': 'Updated between (dates included)',
  1216.                 'Created': 'Created between (dates included)',
  1217.                 'Date between': 'Date between',
  1218.                 'Quality last checked': 'Quality last checked'
  1219.             }
  1220.             $(".filters").change(function(event) {
  1221.                 var id = $(this).attr('id').match(/\[(.*?)\]/)[1];
  1222.                 var oldOption = $("#revert\\[" + id + "\\]");
  1223.                 if (oldOption.length == 1) {
  1224.                     oldOption.replaceWith('<input ' +
  1225.                         'id="keywords[' + id + ']" ' +
  1226.                         'name="keywords[' + id + ']" ' +
  1227.                         'class="form-control " ' +
  1228.                         'required="required" ' +
  1229.                         'placeholder="Enter your search keyword(s)">'
  1230.                     );
  1231.                 }
  1232.                 var options = $("#keywords\\[" + id + "\\]");
  1233.                 if (($(this).val() in filterData)) {
  1234.                     options.replaceWith('<select ' +
  1235.                         'id="keywords[' + id + ']" ' +
  1236.                         'name="keywords[' + id + ']" ' +
  1237.                         'class="form-control  revert" ' +
  1238.                         'required="required">' +
  1239.                         '</select>'
  1240.                     );
  1241.                     var newOption = $("#keywords\\[" + id + "\\]");
  1242.                     if (($(this).val() == "Country is")
  1243.                         && (typeof countries !== 'undefined')
  1244.                     ) {
  1245.                         $.each(countries, function (index, val) {
  1246.                             newOption.append($("<option/>", {
  1247.                                 value: val.id,
  1248.                                 text: val.name
  1249.                             }));
  1250.                         });
  1251.                     } else if (($(this).val() == "Sea regions of study is")
  1252.                         && (typeof seaRegions !== 'undefined')
  1253.                     ) {
  1254.                         $.each(seaRegions, function (index, val) {
  1255.                             newOption.append($("<option/>", {
  1256.                                 value: val.id,
  1257.                                 text: val.name
  1258.                             }));
  1259.                         });
  1260.                     } else {
  1261.                         $.ajax({
  1262.                             url: filterData[$(this).val()],
  1263.                         })
  1264.                             .done(function (response) {
  1265.                                 $.each(response, function (index, val) {
  1266.                                     newOption.append($("<option/>", {
  1267.                                         value: val.id,
  1268.                                         text: val.name
  1269.                                     }));
  1270.                                 });
  1271.                             });
  1272.                     }
  1273.                 } else if (($(this).val() in multipleOptions)) {
  1274.                     options.replaceWith('<select ' +
  1275.                         'id="keywords[' + id + ']" ' +
  1276.                         'name="keywords[' + id + '][]" ' +
  1277.                         'class="form-control revert select2" ' +
  1278.                         'required="required" ' +
  1279.                         'multiple>' +
  1280.                         '</select>'
  1281.                     );
  1282.                     var newOption = $("#keywords\\[" + id + "\\]");
  1283.                     if (($(this).val() === "In multiple countries")
  1284.                         && (typeof countries !== 'undefined')
  1285.                     ) {
  1286.                         $.each(countries, function (index, val) {
  1287.                             newOption.append($("<option/>", {
  1288.                                 value: val.id,
  1289.                                 text: val.name
  1290.                             }));
  1291.                         });
  1292.                     }
  1293.                     if (!$(".select2").hasClass("select2-hidden-accessible")) {
  1294.                         $(".select2").select2({width: null});
  1295.                     }
  1296.                 } else if ($(this).val() === 'Is retired'
  1297.                     || $(this).val() === 'Is deceased'
  1298.                     || $(this).val() === "Is quality checked"
  1299.                     || $(this).val() == "Is Active"
  1300.                 ) {
  1301.                     options.replaceWith('<select ' +
  1302.                         'id="keywords[' + id + ']" ' +
  1303.                         'name="keywords[' + id + ']" ' +
  1304.                         'class="form-control revert" ' +
  1305.                         'required="required">' +
  1306.                         '<option value="1">' +
  1307.                         'Yes' +
  1308.                         '</option>' +
  1309.                         '<option value="0">' +
  1310.                         'No' +
  1311.                         '</option>' +
  1312.                         '</select>'
  1313.                     );
  1314.                 } else if ($(this).val() === 'Gender is') {
  1315.                     options.replaceWith('<select id="keywords[' + id + ']" name="keywords[' + id + ']" class="form-control  revert" required="required"><option value="male">Male</option><option value="female">Female</option><option value="na">NA</option><option value="">(blank)</option></select>');
  1316.                 } else if ($(this).val() === 'Do Not Invite') {
  1317.                     options.replaceWith('<input id="keywords[' + id + ']" name="keywords[' + id + ']" class="form-control " readonly>');
  1318.                 } else if ($(this).val() === 'Updated'
  1319.                     || $(this).val() === 'Created'
  1320.                     || $(this).val() === 'Quality last checked'
  1321.                     || $(this).val() == 'Date between'
  1322.                 ) {
  1323.                     var oldOption = $("#revert\\[" + id + "\\]");
  1324.                     if (oldOption.length == 1) {
  1325.                         oldOption.replaceWith('<input id="keywords[' + id + ']" name="keywords[' + id + ']" class="form-control " required="required">');
  1326.                         options = $("#keywords\\[" + id + "\\]");
  1327.                     }
  1328.                     options.replaceWith(
  1329.                         '<span id="revert[' + id + ']">' +
  1330.                         '<span class="col-xs-6">' +
  1331.                         '<input type="text" name="startDate[' + id + ']" id="keywords[' + id + ']" class="form-control datepicker" value="" required="required" title="keywords" placeholder="From date">' +
  1332.                         '</span>' +
  1333.                         '<span class="col-xs-6">' +
  1334.                         '<input type="text" name="endDate[' + id + ']" id="keywords2[' + id + ']" class="form-control datepicker" value="" required="required" title="keywords" placeholder="To date">' +
  1335.                         '<input type="hidden" id="" name="keywords[' + id + ']" class="form-control " value="">' +
  1336.                         '</span>' +
  1337.                         '</span>'
  1338.                     );
  1339.                     $('.datepicker').datepicker({
  1340.                         format: "dd/mm/yyyy",
  1341.                         autoclose: true,
  1342.                         todayHighlight: true,
  1343.                         maxDate: '0'
  1344.                     });
  1345.                 } else {
  1346.                     options.replaceWith('<input ' +
  1347.                         'id="keywords[' + id + ']" ' +
  1348.                         'name="keywords[' + id + ']" ' +
  1349.                         'class="form-control " ' +
  1350.                         'required="required" ' +
  1351.                         'placeholder="Enter your search keyword(s)">'
  1352.                     );
  1353.                 }
  1354.             });
  1355.             /**
  1356.              * one of the filter for a category (left menu on search results) has been clicked
  1357.              */
  1358.             $('.icheck').change(function () {
  1359.                 if ($(this).is(":checked")) {
  1360.                     if ($(this).val() == 'experts') {
  1361.                         var url = "{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'filterType': 'experts,' ~ app.request.get('filterType')})) }}";
  1362.                     }
  1363.                     if ($(this).val() == 'institutions') {
  1364.                         var url = "{{ path(app.request.attributes.get('_route'),app.request.query.all|merge({'filterType': 'institutions,' ~ app.request.get('filterType')})) }}";
  1365.                     }
  1366.                     if ($(this).val() == 'events') {
  1367.                         var url = "{{ path(app.request.attributes.get('_route'),app.request.query.all|merge({'filterType': 'events,' ~ app.request.get('filterType')})) }}";
  1368.                     }
  1369.                     if ($(this).val() == 'documents') {
  1370.                         var url = "{{ path(app.request.attributes.get('_route'),app.request.query.all|merge({'filterType': 'documents,' ~ app.request.get('filterType')})) }}";
  1371.                     }
  1372.                     //get rid of that ugly trailing comma
  1373.                     url = url.replace(/,$/, "");
  1374.                 } else {
  1375.                     if ($(this).val() == 'experts') {
  1376.                         var url = "{{ path(app.request.attributes.get('_route'),app.request.query.all|merge({'filterType': app.request.get('filterType')|replace({ ('experts'): '' }) })) }}";
  1377.                     }
  1378.                     if ($(this).val() == 'institutions') {
  1379.                         var url = "{{ path(app.request.attributes.get('_route'),app.request.query.all|merge({'filterType': app.request.get('filterType')|replace({ ('institutions'): '' }) })) }}";
  1380.                     }
  1381.                     if ($(this).val() == 'events') {
  1382.                         var url = "{{ path(app.request.attributes.get('_route'),app.request.query.all|merge({'filterType': app.request.get('filterType')|replace({ ('events'): '' }) })) }}";
  1383.                     }
  1384.                     if ($(this).val() == 'documents') {
  1385.                         var url = "{{ path(app.request.attributes.get('_route'),app.request.query.all|merge({'filterType': app.request.get('filterType')|replace({ ('documents'): '' }) })) }}";
  1386.                     }
  1387.                 }
  1388.                 url = url.replace(/%2C\s*$/, "");
  1389.                 window.location.href = url.replace(/&amp;/g, '&');
  1390.             });
  1391.             $(".hide-categories").click(function (event) {
  1392.                 event.preventDefault();
  1393.                 $(".categories").toggle("slow");
  1394.             });
  1395.             $(".hide-countries").click(function (event) {
  1396.                 event.preventDefault();
  1397.                 $(".countries").toggle("slow");
  1398.             });
  1399.             $(".filter-label").click(function (e) {
  1400.                 e.preventDefault();
  1401.                 var data = $(this).data();
  1402.                 var url = " {{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'filterType': null,'page':1})) }}";
  1403.                 window.location.href = url.replace(/&amp;/g, '&');
  1404.             });
  1405.             $(".countryfilter-label").click(function (e) {
  1406.                 e.preventDefault();
  1407.                 var data = $(this).data();
  1408.                 var url = " {{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'filterCountry': null,'page':1})) }}";
  1409.                 window.location.href = url.replace(/&amp;/g, '&');
  1410.             });
  1411.             {% if app.request.get('type')|length > 0 %}
  1412.             {% for key,field in searchConditions %}
  1413.             if (($("#filter\\[{{ key }}\\]").val() in multipleOptions)) {
  1414.                 $("#type\\[{{ key }}\\]").change();
  1415.                 $("#type\\[{{ key }}\\]").val("{{ field.type }}");
  1416.                 $("#filter\\[{{ key }}\\]").val("{{ field.filter }}");
  1417.                 setTimeout(function () {
  1418.                     $("#filter\\[{{ key }}\\]").change();
  1419.                     var selectedCountries = "{{ field.keywords|join(',') }}";
  1420.                     if (!$("#keywords\\[{{ key }}\\]").hasClass("select2-hidden-accessible")) {
  1421.                         $("#keywords\\[{{ key }}\\]").select({width: null});
  1422.                     }
  1423.                     $("#keywords\\[{{ key }}\\]").select2("val", selectedCountries.split(','));
  1424.                 }, 2000);
  1425.             } else if (($("#filter\\[{{ key }}\\]").val() in filterData)) {
  1426.                 $("#type\\[{{ key }}\\]").change();
  1427.                 $("#type\\[{{ key }}\\]").val("{{ field.type }}");
  1428.                 $("#filter\\[{{ key }}\\]").val("{{ field.filter }}");
  1429.                 $("#filter\\[{{ key }}\\]").change();
  1430.                 $(document).ajaxComplete(function () {
  1431.                     {% if field.keywords is not iterable %}
  1432.                     $("#keywords\\[{{ key }}\\]").val(decodeHtml("{{ field.keywords }}"));
  1433.                     {% endif %}
  1434.                 });
  1435.             } else {
  1436.                 $("#type\\[{{ key }}\\]").change();
  1437.                 $("#filter\\[{{ key }}\\]").val("{{ field.filter }}");
  1438.                 $("#filter\\[{{ key }}\\]").change();
  1439.                 {% if field.keywords is not iterable %}
  1440.                 $("#keywords\\[{{ key }}\\]").val(decodeHtml("{{ field.keywords }}"));
  1441.                 {% endif %}
  1442.             }
  1443.             var options = $("#keywords\\[{{ key }}\\]");
  1444.             if (($("#filter\\[{{ key }}\\]").val() in dateFilter)) {
  1445.                 var oldOption = $("#revert\\[{{ key }}\\]");
  1446.                 if (oldOption.length == 1) {
  1447.                     oldOption.replaceWith('<input id="keywords[{{ key }}]" name="keywords[{{ key }}]" class="form-control ">');
  1448.                     options = $("#keywords\\[{{ key }}\\]");
  1449.                 }
  1450.                 options.replaceWith(
  1451.                     '<span id="revert[{{ key }}]">' +
  1452.                     '<span class="col-xs-6">' +
  1453.                     '<input type="text" name="startDate[{{ key }}]" id="keywords[{{ key }}]" class="form-control datepicker" value="{{ field.startDate }}" required="required" title="keywords" placeholder="From date">' +
  1454.                     '</span>' +
  1455.                     '<span class="col-xs-6">' +
  1456.                     '<input type="text" name="endDate[{{ key }}]" id="keywords2[{{ key }}]" class="form-control datepicker" value="{{ field.endDate }}" required="required" title="keywords" placeholder="To date">' +
  1457.                     '<input type="hidden" id="" name="keywords[{{ key }}]" class="form-control " value="">' +
  1458.                     '</span>' +
  1459.                     '</span>'
  1460.                 );
  1461.                 $('.datepicker').datepicker({
  1462.                     format: "dd/mm/yyyy",
  1463.                     autoclose: true,
  1464.                     todayHighlight: true,
  1465.                     maxDate: '0'
  1466.                 });
  1467.             }
  1468.             {% endfor %}
  1469.             {% endif %}
  1470.         });
  1471.         $('.countries li:lt(20)').show();
  1472.         $('.showLess').hide();
  1473.         function loadMorefilters(className) {
  1474.             var size_li = $("." + className + " li").size();
  1475.             var x = 20;
  1476.             var remaining = size_li - 20;
  1477.             x = (x + remaining <= size_li) ? x + remaining : size_li;
  1478.             $('.' + className + ' li:lt(' + x + ')').show('slow');
  1479.             $('.' + className).find('.loadMore').hide();
  1480.             $('.' + className).find('.showLess').show();
  1481.         }
  1482.         function showLessfilters(className) {
  1483.             $('.' + className + ' li').not(':lt(20)').hide('slow');
  1484.             $('.' + className).find('.showLess').hide();
  1485.             $('.' + className).find('.loadMore').show();
  1486.         }
  1487.         jQuery.fn.extend({
  1488.             toggleText: function (a, b) {
  1489.                 var isClicked = false;
  1490.                 var that = this;
  1491.                 this.click(function () {
  1492.                     if (isClicked) {
  1493.                         that.text(a);
  1494.                         isClicked = false;
  1495.                     } else {
  1496.                         that.text(b);
  1497.                         isClicked = true;
  1498.                     }
  1499.                 });
  1500.                 return this;
  1501.             }
  1502.         });
  1503.         $(".hide-categories").toggleText("hide", "show");
  1504.         $(".hide-countries").toggleText("hide", "show");
  1505.         function sortObject(o) {
  1506.             var sorted = {},
  1507.                 key, a = [];
  1508.             for (key in o) {
  1509.                 if (o.hasOwnProperty(key)) {
  1510.                     a.push(key);
  1511.                 }
  1512.             }
  1513.             a.sort();
  1514.             for (key = 0; key < a.length; key++) {
  1515.                 sorted[a[key]] = o[a[key]];
  1516.             }
  1517.             return sorted;
  1518.         }
  1519.         function decodeHtml(html) {
  1520.             var txt = document.createElement("textarea");
  1521.             txt.innerHTML = html;
  1522.             return txt.value;
  1523.         }
  1524.         Dropzone.options.myAwesomeDropzone = {
  1525.             init: function () {
  1526.                 this.on('success', function (file, response) {
  1527.                     $("#message").after($('<input type="hidden" name="file[]" class="file" value="' + response + '">'));
  1528.                 });
  1529.                 this.on('queuecomplete', function () {
  1530.                     // Invoked when all files finished uploading
  1531.                     // Now just submit the form. It will send the filenames along since
  1532.                     // they are added as hidden input fields.
  1533.                 });
  1534.                 this.on('removedfile', function (file, response) {
  1535.                     $('.file:input[value="' + file.fid + '"]').remove();
  1536.                 });
  1537.             },
  1538.             maxFilesize: 10,
  1539.             maxFiles: 15,
  1540.             autoDiscover: true,
  1541.             accept: function (file, done) {
  1542.                 var thumbnail = $('.dropzone').find(".dz-preview:last");
  1543.                 thumbnail.removeClass('dz-file-preview').addClass('dz-image-preview');
  1544.                 switch (file.type) {
  1545.                     case 'application/pdf':
  1546.                         thumbnail.find('img').attr('src', '{{ asset("img/pdf-icon.png") }}');
  1547.                         break;
  1548.                     case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
  1549.                         thumbnail.find('img').attr('src', '{{ asset("img/word-icon.png") }}');
  1550.                         break;
  1551.                     case 'application/msword':
  1552.                         thumbnail.find('img').attr('src', '{{ asset("img/word-icon.png") }}');
  1553.                         break;
  1554.                     case 'application/vnd.ms-excel':
  1555.                         thumbnail.find('img').attr('src', '{{ asset("img/excel-icon.png") }}');
  1556.                         break;
  1557.                     case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
  1558.                         thumbnail.find('img').attr('src', '{{ asset("img/excel-icon.png") }}');
  1559.                         break;
  1560.                     case 'application/vnd.ms-powerpoint':
  1561.                         thumbnail.find('img').attr('src', '{{ asset("img/PowerPoint-icon.png") }}');
  1562.                         break;
  1563.                     case 'application/application/zip, application/octet-stream':
  1564.                         thumbnail.find('img').attr('src', '{{ asset("img/zip-icon.jpg") }}');
  1565.                         break;
  1566.                     case 'text/csv':
  1567.                         thumbnail.find('img').attr('src', '{{ asset("img/csv-icon.jpg") }}');
  1568.                         break;
  1569.                     case 'text/plain':
  1570.                         thumbnail.find('img').attr('src', '{{ asset("img/txt-icon.png") }}');
  1571.                         break;
  1572.                     case 'application/zip':
  1573.                         thumbnail.find('img').attr('src', '{{ asset("img/zip-icon.jpg") }}');
  1574.                         break;
  1575.                 }
  1576.                 done();
  1577.             },
  1578.         };
  1579.         $('[class=showInfo]').on('click', function () {
  1580.             $(document).find('[class=infoHidden]').hide();
  1581.             $(document).find('[class=infoShown]').show();
  1582.             return false;
  1583.         });
  1584.         $('[class=hideInfo]').on('click', function () {
  1585.             $(document).find('[class=infoHidden]').show();
  1586.             $(document).find('[class=infoShown]').hide();
  1587.             return false;
  1588.         });
  1589.         {% if is_granted('ROLE_GLOBAL_EDITOR') %}
  1590.         $("#sendmail").click(function () {
  1591.             $this = $(this);
  1592.             var subject = $("#subject").val();
  1593.             var message = tinyMCE.get('message').getContent();
  1594.             selfEmail = $("#selfEmail").is(":checked");
  1595.             var file = $('input:hidden.file').serialize();
  1596.             var error = false;
  1597.             if ($.trim(subject) == "") {
  1598.                 $("#subject").parents('.form-group').addClass('has-error');
  1599.                 errorsubject = true;
  1600.             } else {
  1601.                 $("#subject").parents('.form-group').removeClass('has-error');
  1602.                 errorsubject = false;
  1603.             }
  1604.             if ($.trim(message) == "") {
  1605.                 $("#message").parents('.form-group').addClass('has-error');
  1606.                 $("#message").siblings(".mce-tinymce").css('border-color', 'red');
  1607.                 errormessage = true;
  1608.             } else {
  1609.                 $("#message").parents('.form-group').removeClass('has-error');
  1610.                 $("#message").siblings(".mce-tinymce").css('border-color', 'rgb(210, 214, 222)');
  1611.                 errormessage = false;
  1612.             }
  1613.             if (!errormessage && !errorsubject) {
  1614.                 $this.prop("disabled", true);
  1615.                 $this.html("<i class='fa fa-spin fa-cog'></i> Sending</button>");
  1616.                 $.ajax({
  1617.                     url: "{{ path('email_queue') }}",
  1618.                     data: {
  1619.                         userid: "{{ app.user.id }}",
  1620.                         emailUsers: "{{ emailUsers|join(', ') }}",
  1621.                         email: "{{ app.user.email }}",
  1622.                         selfmail: selfEmail,
  1623.                         subject: subject,
  1624.                         message: message,
  1625.                         file: file,
  1626.                         searchstring: window.location.href
  1627.                     },
  1628.                     type: "POST",
  1629.                     success: function (response) {
  1630.                         $this.html("Send <i class='fa fa-envelope-o'></i>");
  1631.                         $(".dz-default.dz-message").css("opacity", 1);
  1632.                         $("#selfEmail").prop("checked", false);
  1633.                         $("#subject").val("");
  1634.                         tinymce.get("message").setContent('');
  1635.                         $('div.dz-success').remove();
  1636.                         $("#message").siblings(".file").remove();
  1637.                         $this.prop("disabled", false);
  1638.                         $("#compose-mail").modal("hide");
  1639.                         BootstrapDialog.alert({
  1640.                             title: 'Email Received Successfully.',
  1641.                             message: 'Your email is successfully received. It will now be queued and sent out to the recipients shortly.',
  1642.                             type: BootstrapDialog.TYPE_SUCCESS,
  1643.                             closable: false,
  1644.                             draggable: false,
  1645.                             buttonLabel: 'OK',
  1646.                         });
  1647.                     }
  1648.                 });
  1649.             }
  1650.         });
  1651.         {% endif %}
  1652.     </script>
  1653. {% endblock %}