root/trunk/src/includes/editam/helpers/layout_helper.php

Revision 43, 3.9 kB (checked in by bermi, 2 years ago)

Added settings for currently enabled languages. Closes #7, #9, #5 and #2

Line 
1 <?php
2
3 // +----------------------------------------------------------------------+
4 // Editam is a content management platform developed by Akelos Media, S.L.|
5 // Copyright (C) 2006 - 2007 Akelos Media, S.L.                           |
6 //                                                                        |
7 // This program is free software; you can redistribute it and/or modify   |
8 // it under the terms of the GNU General Public License version 3 as      |
9 // published by the Free Software Foundation.                             |
10 //                                                                        |
11 // This program is distributed in the hope that it will be useful, but    |
12 // WITHOUT ANY WARRANTY; without even the implied warranty of             |
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                   |
14 // See the GNU General Public License for more details.                   |
15 //                                                                        |
16 // You should have received a copy of the GNU General Public License      |
17 // along with this program; if not, see http://www.gnu.org/licenses or    |
18 // write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth |
19 // Floor, Boston, MA 02110-1301 USA.                                      |
20 //                                                                        |
21 // You can contact Akelos Media, S.L. headquarters at                     |
22 // C/ Pasodoble Amparito Roca, 6, 46240 - Carlet (Valencia) - Spain       |
23 // or at email address contact@akelos.com.                                |
24 //                                                                        |
25 // The interactive user interfaces in modified source and object code     |
26 // versions of this program must display Appropriate Legal Notices, as    |
27 // required under Section 5 of the GNU General Public License version 3.  |
28 //                                                                        |
29 // In accordance with Section 7(b) of the GNU General Public License      |
30 // version 3, these Appropriate Legal Notices must retain the display of  |
31 // the "Powered by Editam" logo. If the display of the logo is not        |
32 // reasonably feasible for technical reasons, the Appropriate Legal       |
33 // Notices must display the words "Powered by Editam".                    |
34 // +----------------------------------------------------------------------+
35
36 class LayoutHelper extends AkActionViewHelper
37 {
38
39     function language_switch_links($langs = array())
40     {
41         $langs = empty($langs) ? Ak::langs() : $langs;
42
43         $links = array();
44         foreach ($langs as $lang){
45             if($lang != Ak::lang()){
46                 $links[] = $this->url_for_language_switch(Ak::locale('description', $lang), $lang);
47             }
48         }
49         return $links;
50     }
51     
52     function language_switch_list($langs = array(), $list_html_options = array(), $list_item_html_options = array())
53     {
54         $default_list_html_options = array('class'=>'language_switch user_actions');
55         $list_html_options = array_merge($default_list_html_options, $list_html_options);
56         
57         $links = $this->language_switch_links($langs);
58         $list = '';
59         if(!empty($links)){
60             $list_items = '';
61             foreach ($links as $link){
62             $list_items .= $this->_controller->tag_helper->content_tag('li',$link,$list_item_html_options);
63             }
64             $list = $this->_controller->tag_helper->content_tag('ul',$list_items,$list_html_options);
65             
66         }
67         return $list;
68     }
69
70     function url_for_language_switch($description, $language, $html_options = array())
71     {
72         return $this->_controller->url_helper->link_to($description,
73         $this->_controller->url_helper->modify_current_url(array('lang'=>$language), array('ak',AK_SESSION_NAME,'AK_SESSID','PHPSESSID','is_first'), false),
74         $html_options);
75     }
76
77 }
78
79 ?>
Note: See TracBrowser for help on using the browser.