source: branches/2.2.0.1/calendar/inc/class.bocustom_fields.inc.php @ 3968

Revision 3968, 2.8 KB checked in by rafaelraymundo, 13 years ago (diff)

Ticket #1596 - Colocar campo que identifique o ultimo usuário que alterou agenda compartilhada

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2  /**************************************************************************\
3  * eGroupWare - Calendar - Custom fields and sorting                        *
4  * http://www.egroupware.org                                                *
5  * Written by Ralf Becker <RalfBecker@outdoor-training.de>                  *
6  * --------------------------------------------                             *
7  *  This program is free software; you can redistribute it and/or modify it *
8  *  under the terms of the GNU General Public License as published by the   *
9  *  Free Software Foundation; either version 2 of the License, or (at your  *
10  *  option) any later version.                                              *
11  \**************************************************************************/
12
13
14        class bocustom_fields
15        {
16                var $stock_fields = array(
17                        'title' => array(
18                                'label' => 'Title',
19                                'title' => True
20                        ),
21                        'description' => 'Description',
22                        'category'    => 'Category',
23                        'location'    => 'Location',
24                        'startdate'   => 'Start Date/Time',
25                        'enddate'     => 'End Date/Time',
26                        'priority'    => 'Priority',
27                        'access'      => 'Access',
28                        'participants'=> 'Participants',
29                        'ex_participants'=> 'External Participants',
30                        'owner'       => 'Created By',
31                        'updated'     => 'Updated',
32                        'alarm'       => 'Alarm',
33                        'recure_type' => 'Repetition',
34                        'alter_by'   =>  'Alter by',
35                        'attachment' => 'attachment'
36                );
37
38                function bocustom_fields()
39                {
40                        $this->config = CreateObject('phpgwapi.config','calendar');
41                        $this->config->read_repository();
42
43                        $this->fields = &$this->config->config_data['fields'];
44
45                        if (!is_array($this->fields)) {
46                                $this->fields = array();
47                        }
48
49                        foreach ($this->fields as $field => $data)      // this can be removed after a while
50                        {
51                                if (!isset($this->stock_fields[$field]) && $field[0] != '#')
52                                {
53                                        unset($this->fields[$field]);
54                                        $this->fields['#'.$field] = $data;
55                                }
56                        }
57
58                        foreach($this->stock_fields as $field => $data)
59                        {
60                                if (!is_array($data))
61                                {
62                                        $data = array('label' => $data);
63                                }
64                                if (!isset($this->fields[$field]))
65                                {
66                                        $this->fields[$field] = array(
67                                                'name'     => $field,
68                                                'title'    => $data['title'],
69                                                'disabled' => $data['disabled']
70                                        );
71                                }
72                                $this->fields[$field]['label']  = $data['label'];
73                                $this->fields[$field]['length'] = $data['length'];
74                                $this->fields[$field]['shown']  = $data['shown'];
75                        }
76                }
77
78                function set($data)
79                {
80                        if (is_array($data) && strlen($data['name']) > 0)
81                        {
82                                if (!isset($this->stock_fields[$name = $data['name']]))
83                                {
84                                        $name = '#'.$name;
85                                }
86                                $this->fields[$name] = $data;
87                        }
88                }
89
90                function save($fields=False)
91                {
92                        if ($fields)
93                        {
94                                $this->fields = $fields;
95                        }
96                        //echo "<pre>"; print_r($this->config->config_data); echo "</pre>\n";
97                        $this->config->save_repository();
98                }
99        }
Note: See TracBrowser for help on using the repository browser.