templates/includes/user-menu.html.twig line 1

Open in your IDE?
  1. <div class="dropdown">
  2.   <button 
  3.     {% if site_code is defined and site_code == constant("App\\Entity\\Content::SITE_AAR") %}
  4.         class="hdr-btn hdr-btn-3 dropdown-toggle"
  5.         style="padding:6px 15px 7px;border:0px;"
  6.     {% else %}
  7.         class="btn btn-secondary dropdown-toggle"
  8.     {% endif %}
  9.     type="button" 
  10.     {#id="dropdownMenuButton"#}
  11.     class="dropdownMenuButton"
  12.     data-toggle="dropdown" 
  13.     aria-haspopup="true" 
  14.     aria-expanded="false"
  15.   ><i class="fa fa-user"></i> {{ app.user.getUsername() }}</button>
  16.   <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" style="right: 0; left: auto;">
  17.     {% if app.user.isAdmin() %}
  18.         <a class="dropdown-item rcs-dropdown-item" href="/admin/"><i class="fa fa-cogs"></i> Admin</a>
  19.     {% endif %}
  20.     {% if content is defined %}
  21.         {% if content is not empty %} {# and content.getType() == 1  #}
  22.             {% if content.getType() == 1 %}
  23.                 {% set type = "page" %}
  24.             {% elseif content.getType() == 2 %}
  25.                 {% set type = "post" %}
  26.             {% elseif content.getType() == 3 %}
  27.                 {% set type = "classified" %}
  28.             {% elseif content.getType() == 4 %}
  29.                 {% set type = "directory" %}
  30.             {% elseif content.getType() == 5 %}
  31.                 {% set type = "gallery" %}
  32.                 {% set category = content.getCategory() %}
  33.                 {% if category is not null and category.getSlug() == "partner-galleries" %}
  34.                     {% set type = "partnergallery" %}
  35.                 {% endif %}
  36.             {% elseif content.getType() == 6 %}
  37.                 {% set type = "landingpage" %}
  38.             {% elseif content.getType() == 7 %}
  39.                 {% set type = "event" %}
  40.             {% elseif content.getType() == 8 %}
  41.                 {% set type = "webinar" %}
  42.                 {% set category = content.getCategory() %}
  43.                 {% if category is not null and category.getSlug() == "partner-webinar" %}
  44.                     {% set type = "partnerwebinar" %}
  45.                 {% endif %}
  46.             {% elseif content.getType() == 9 %}
  47.                 {% set type = "forum" %}
  48.             {% elseif content.getType() == 10 %}
  49.                 {% set type = "forumtopic" %}
  50.             {% elseif content.getType() == 11 %}
  51.                 {% set type = "forumreply" %}
  52.             {% elseif content.getType() == 14 %}
  53.                 {% set type = "promosrebates" %}
  54.             {% elseif content.getType() == 15 %}
  55.                 {% set type = "thehub" %}
  56.             {% elseif content.getType() == 18 %}
  57.                 {% set type = "podcast" %}
  58.                 {% set category = content.getCategory() %}
  59.                 {% if category is not null and category.getSlug() == "partner-podcast" %}
  60.                     {% set type = "partnerpodcast" %}
  61.                 {% endif %}
  62.             {% elseif content.getType() == 19 %}
  63.                 {% set type = "ebook" %}
  64.             {% elseif content.getType() == 20 %}
  65.                 {% set type = "contestsgames" %}
  66.             {% elseif content.getType() == 25 %}
  67.                 {% set type = "award" %}
  68.             {% elseif content.getType() == 26 %}
  69.                 {% set type = "video" %}
  70.             {% elseif content.getType() == 27 %}
  71.                 {% set type = "rclubperk" %}
  72.             {% elseif content.getType() == 28 %}
  73.                 {% set type = "scholarship" %}
  74.             {% else %}
  75.                 {% set type = "content" %}
  76.             {% endif %}
  77.             {% if app.user.isAdmin() %}
  78.                 {% if type == "directory" and customer is defined %}
  79.                     <a target="_blank" class="dropdown-item rcs-dropdown-item" href="/admin/app/customer/{{ customer.getId() }}/edit"><i class="fa fa-pencil"></i> Edit Content</a>
  80.                 {% elseif type == "forumtopic" or type == "forumreply" %}
  81.                     {# don't display a link #}
  82.                 {% else %}
  83.                                                                                                                         {# TODO: Handle switching sites when editing. #}
  84.                                                                                                                         {#   /edit?site={{content.getSite()}}   #}
  85.                     <a target="_blank" class="dropdown-item rcs-dropdown-item" href="/admin/{{ type }}/{{ content.getId() }}/edit"><i class="fa fa-pencil"></i> Edit Content</a>
  86.                 {% endif %}
  87.             {% endif %}
  88.         {% endif %}
  89.     {% endif %}
  90.     {% if site_code is not defined or site_code == constant("App\\Entity\\Content::SITE_RCS") or site_code == constant("App\\Entity\\Content::SITE_MCS") %}
  91.         <a class="dropdown-item rcs-dropdown-item" href="/account"><i class="fa fa-user"></i> Your Account</a>
  92.     {% endif %}
  93.     {% if site_code is not defined or site_code == constant("App\\Entity\\Content::SITE_RCS") %}
  94.         <a class="dropdown-item rcs-dropdown-item" href="/cart"><i class="fa fa-shopping-cart"></i> Your Cart</a>
  95.     {% endif %}
  96.     <a class="dropdown-item rcs-dropdown-item" href="/sign-out"><i class="fa fa-sign-out"></i> Sign Out</a>
  97.   </div>
  98. </div>
  99. {#
  100. <ul>
  101.     <li><a href="/account" class="display-inline-block mr-2"><i class="fa fa-user"></i> {{ app.user.getUsername() }}</a>
  102.     <ul>
  103.         
  104.         {# <li><a href="/admin/?entity=Content2&action=edit&id="><i class="fa fa-pencil"></i> Edit Page</a></li> # }
  105.         <li><a href="/sign-out"><i class="fa fa-sign-out"></i> Sign Out</a></li>
  106.         
  107.     </ul>
  108.     </li>
  109. </ul>
  110. #}