Browse Source

Moving code to template

Julio Montoya 9 years ago
parent
commit
24b5bafc9d
2 changed files with 11 additions and 16 deletions
  1. 0 15
      main/inc/lib/userportal.lib.php
  2. 11 1
      main/template/default/layout/login_form.tpl

+ 0 - 15
main/inc/lib/userportal.lib.php

@@ -34,9 +34,6 @@ class IndexManager
     function set_login_form($setLoginForm = true)
     {
         global $loginFailed;
-
-        $login_form = '';
-
         if (!($this->user_id) || api_is_anonymous($this->user_id)) {
 
             // Only display if the user isn't logged in.
@@ -47,18 +44,6 @@ class IndexManager
                 if ($loginFailed) {
                     $this->tpl->assign('login_failed',  self::handle_login_failed());
                 }
-
-                if (api_get_setting('allow_lostpassword') == 'true' || api_get_setting('allow_registration') == 'true') {
-                    $login_form .= '<ul class="nav nav-pills nav-stacked">';
-                    if (api_get_setting('allow_registration') != 'false') {
-                        $login_form .= '<li><a href="main/auth/inscription.php">'.get_lang('SignUp').'</a></li>';
-                    }
-                    if (api_get_setting('allow_lostpassword') == 'true') {
-                        $login_form .= '<li><a href="main/auth/lostPassword.php">'.get_lang('LostPassword').'</a></li>';
-                    }
-                    $login_form .= '</ul>';
-                }
-                $this->tpl->assign('login_options',  $login_form);
             }
         }
     }

+ 11 - 1
main/template/default/layout/login_form.tpl

@@ -13,7 +13,17 @@
 
         {{ login_form }}
 
-        {{ login_options }}
+        {% if "allow_lostpassword" | get_setting == 'true' and "allow_registration" | get_setting == 'true' %}
+            <ul class="nav nav-pills nav-stacked">
+                {% if "allow_registration" | get_setting != 'false' %}
+                    <li><a href="main/auth/inscription.php"> {{ 'SignUp' | get_lang }} </a></li>
+                {% endif %}
+
+                {% if "allow_lostpassword" | get_setting == 'true' %}
+                    <li><a href="main/auth/lostPassword.php"> {{ 'LostPassword' | get_lang }} </a></li>
+                {% endif %}
+            </ul>
+        {% endif %}
 
         {% if plugin_login_bottom is not null %}
             <div id="plugin_login_bottom">