Changeset 155

Show
Ignore:
Timestamp:
05/03/07 06:38:22
Author:
danfreak
Message:

"FAL: loginAnchor() abstraction--> now it is possible to specify custom controllers names for handling login/logout actions "

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • FreakAuth/trunk/www/system/application/helpers/freakauth_light_helper.php

    r154 r155  
    125125 * and 
    126126 * $obj->config->item('FAL_template_dir').content/login_anchor_user 
    127  * 
     127 *  
     128 * If you use a controller not named "auth" to handle login and logout actions 
     129 * you must specify the controller/method that handles them when colling this function 
     130 * ------------------------------------------------------ 
     131 * usage examples in a view: 
     132 * ------------------------------------------------------ 
     133 * <?=loginAnchor('auth/login', 'auth/logout');?> 
     134 * 
     135 * @param string $login_uri the controller/method that handles the login action 
     136 * @param string $logout_uri the controller/method that handles the logout action 
    128137 * @param unknown_type $logout_attributes 
    129138 * @param unknown_type $login_attributes 
    130139 * @return the message in a view 
    131140 */ 
    132 function loginAnchor($logout_attributes = null, $login_attributes = null) 
     141function loginAnchor($login_uri = null, $logout_uri = null, $logout_attributes = null, $login_attributes = null) 
    133142{ 
    134143    $obj =& get_instance(); 
     
    141150                $data['logout_label'] = $obj->lang->line('FAL_logout_label'); 
    142151                $data['logout_attributes'] = $logout_attributes; 
     152                $data['logout_uri'] = $logout_uri!=null ? $logout_uri : 'auth/logout'; 
    143153                return $obj->load->view($tpl_dir.'content/login_anchor_user', $data, true); 
    144154        } 
     
    148158                $data['login_label'] = $obj->lang->line('FAL_login_label'); 
    149159                $data['login_attributes'] = $login_attributes; 
     160                $data['login_uri'] = $login_uri!=null ? $login_uri : 'auth/index'; 
    150161                return $obj->load->view($tpl_dir.'content/login_anchor_guest', $data, true); 
    151162        } 
  • FreakAuth/trunk/www/system/application/views/FreakAuth_light/content/login_anchor_guest.php

    r77 r155  
    1 <?=$welcome?>! / <?=anchor('auth/index', $login_label, $login_attributes)?> 
     1<?=$welcome?>! / <?=anchor($login_uri, $login_label, $login_attributes)?> 
  • FreakAuth/trunk/www/system/application/views/FreakAuth_light/content/login_anchor_user.php

    r77 r155  
    1 <?=$welcome?> <?=getUserName()?> / <?=anchor('auth/logout', $logout_label, $logout_attributes)?> 
     1<?=$welcome?> <?=getUserName()?> / <?=anchor($logout_uri, $logout_label, $logout_attributes)?> 
  • FreakAuth/trunk/www/system/application/views/FreakAuth_light/template/content.php

    r126 r155  
    11        <div id="browse_crag"> 
    22                <div class="login"> 
    3                         <?=loginAnchor();?> 
     3                        <?=loginAnchor('auth/login', 'auth/logout');?> 
    44                </div> 
    55        </div>