1 | <?php |
||
2 | /** |
||
3 | * Addressbook - Sitemgr display form |
||
4 | * |
||
5 | * @link http://www.egroupware.org |
||
6 | * @author Stefan Becker <stefanBecker-AT-outdoor-training.de> |
||
7 | * @package addressbook |
||
8 | * @copyright (c) 2008 by Stefan Becker <StefanBecker-AT-outdoor-training.de> |
||
9 | * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License |
||
10 | * @version $Id: class.addressbook_display.inc.php 24099 2008-02-18 16:29:06Z stefanbecker $ |
||
11 | */ |
||
12 | |||
13 | use EGroupware\Api; |
||
14 | |||
15 | /** |
||
16 | * SiteMgr Display form for the addressbook |
||
17 | * |
||
18 | */ |
||
19 | class addressbook_display extends addressbook_ui |
||
20 | { |
||
21 | function get_rows(&$query,&$rows,&$readonlys) |
||
22 | { |
||
23 | $query['sitemgr_display'] = ($readonlys['sitemgr_display'] ?$readonlys['sitemgr_display']:'addressbook.display'); |
||
24 | $total = parent::get_rows($query,$rows,$readonlys); |
||
25 | $query['template'] = $query['sitemgr_display'].'.rows'; |
||
26 | |||
27 | if (is_array($query['fields'])) foreach($query['fields'] as $name) |
||
28 | { |
||
29 | $rows['show'][$name]=true; |
||
30 | } |
||
31 | |||
32 | return $total; |
||
33 | |||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Shows the Addressbook Entry and stores the submitted data |
||
38 | * |
||
39 | * @param array $content =null submitted eTemplate content |
||
40 | * @param int $addressbook =null int owner-id of addressbook to save contacts too |
||
41 | * @param array $fields =null field-names to show |
||
42 | * @param string $msg =null message to show after submitting the form |
||
43 | * @param string $email =null comma-separated email addresses |
||
44 | * @param string $tpl_name =null custom etemplate to use |
||
45 | * @param string $subject =null subject for email |
||
46 | * @return string html content |
||
47 | */ |
||
48 | function display($content=null,$addressbook=null,$fields=null,$msg=null,$email=null,$tpl_name=null,$subject=null) |
||
49 | { |
||
50 | $tpl_name=($tpl_name ? $tpl_name : 'addressbook.display'); |
||
51 | $tpl = new etemplate($tpl_name); |
||
52 | |||
53 | $content = array( |
||
54 | 'msg' => $msg ? $msg : $_GET['msg'], |
||
55 | ); |
||
56 | $content['nm1'] = Api\Cache::getSession('addressbook', ($tpl_name ? $tpl_name : 'index')); |
||
57 | $readonlys['sitemgr_display']=$tpl_name; |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
58 | if (!is_array($content['nm1'])) |
||
59 | { |
||
60 | $content['nm1'] = array( |
||
61 | 'get_rows' => 'addressbook.addressbook_display.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
||
62 | 'bottom_too' => false, // I show the nextmatch-line (arrows, filters, search, ...) again after the rows |
||
63 | 'never_hide' => True, // I never hide the nextmatch-line if less then maxmatch entrie |
||
64 | 'start' => 0, // IO position in list |
||
65 | 'cat_id' => '', // IO category, if not 'no_cat' => True |
||
66 | 'no_cat' => 'True', |
||
67 | // 'options-cat_id' => array(lang('none')), |
||
68 | 'search' => '', // IO search pattern |
||
69 | 'order' => 'n_family', // IO name of the column to sort after (optional for the sortheaders) |
||
70 | 'sort' => 'ASC', // IO direction of the sort: 'ASC' or 'DESC' |
||
71 | // 'col_filter' => array(), // IO array of column-name value pairs (optional for the filterheaders) |
||
72 | // 'filter_label' => lang('Addressbook'), // I label for filter (optional) |
||
73 | 'filter' => $addressbook, // =All // IO filter, if not 'no_filter' => True |
||
74 | // 'filter_no_lang' => True, // I set no_lang for filter (=dont translate the options) |
||
75 | 'no_filter' => True, // I disable the 1. filter (params are the same as for filter) |
||
76 | 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
||
77 | // 'filter2_label' => lang('Distribution lists'), // IO filter2, if not 'no_filter2' => True |
||
78 | // 'filter2' => '', // IO filter2, if not 'no_filter2' => True |
||
79 | // 'filter2_no_lang'=> True, // I set no_lang for filter2 (=dont translate the options) |
||
80 | // 'filter2_onchange' => "if(this.value=='add') { add_new_list(document.getElementById(form::name('filter')).value); this.value='';} else this.form.submit();", |
||
81 | 'lettersearch' => true, |
||
82 | 'default_cols' => '!cat_id,contact_created_contact_modified', |
||
83 | 'no_columnselection' => True, |
||
84 | 'csv_fields' => false, |
||
85 | ); |
||
86 | |||
87 | $content['nm1']['fields'] = $fields; |
||
88 | } |
||
89 | |||
90 | return $tpl->exec('addressbook.addressbook_display.display',$content,$sel_options,$readonlys,$preserv); |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Comprehensibility
Best Practice
introduced
by
|
|||
91 | } |
||
92 | } |
||
93 |