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

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

Ticket #189 - Funcionalidade de envio de anexos nas notificações de agendamento.

  • 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                        'attachment' => 'attachment'
35                );
36
37                function bocustom_fields()
38                {
39                        $this->config = CreateObject('phpgwapi.config','calendar');
40                        $this->config->read_repository();
41
42                        $this->fields = &$this->config->config_data['fields'];
43
44                        if (!is_array($this->fields)) {
45                                $this->fields = array();
46                        }
47
48                        foreach ($this->fields as $field => $data)      // this can be removed after a while
49                        {
50                                if (!isset($this->stock_fields[$field]) && $field[0] != '#')
51                                {
52                                        unset($this->fields[$field]);
53                                        $this->fields['#'.$field] = $data;
54                                }
55                        }
56
57                        foreach($this->stock_fields as $field => $data)
58                        {
59                                if (!is_array($data))
60                                {
61                                        $data = array('label' => $data);
62                                }
63                                if (!isset($this->fields[$field]))
64                                {
65                                        $this->fields[$field] = array(
66                                                'name'     => $field,
67                                                'title'    => $data['title'],
68                                                'disabled' => $data['disabled']
69                                        );
70                                }
71                                $this->fields[$field]['label']  = $data['label'];
72                                $this->fields[$field]['length'] = $data['length'];
73                                $this->fields[$field]['shown']  = $data['shown'];
74                        }
75                }
76
77                function set($data)
78                {
79                        if (is_array($data) && strlen($data['name']) > 0)
80                        {
81                                if (!isset($this->stock_fields[$name = $data['name']]))
82                                {
83                                        $name = '#'.$name;
84                                }
85                                $this->fields[$name] = $data;
86                        }
87                }
88
89                function save($fields=False)
90                {
91                        if ($fields)
92                        {
93                                $this->fields = $fields;
94                        }
95                        //echo "<pre>"; print_r($this->config->config_data); echo "</pre>\n";
96                        $this->config->save_repository();
97                }
98        }
Note: See TracBrowser for help on using the repository browser.