* * -------------------------------------------- * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * \**************************************************************************/ class bocustom_fields { var $stock_fields = array( 'title' => array( 'label' => 'Title', 'title' => True ), 'description' => 'Description', 'category' => 'Category', 'location' => 'Location', 'startdate' => 'Start Date/Time', 'enddate' => 'End Date/Time', 'priority' => 'Priority', 'access' => 'Access', 'participants'=> 'Participants', 'ex_participants'=> 'External Participants', 'owner' => 'Created By', 'updated' => 'Updated', 'alarm' => 'Alarm', 'recure_type' => 'Repetition', 'observations' => 'Observations', 'alter_by' => 'Alter by', 'attachment' => 'attachment', 'notifications_owner' => 'notifications_owner' ); function bocustom_fields() { $this->config = CreateObject('phpgwapi.config','calendar'); $this->config->read_repository(); $this->fields = &$this->config->config_data['fields']; if (!is_array($this->fields)) { $this->fields = array(); } foreach ($this->fields as $field => $data) // this can be removed after a while { if (!isset($this->stock_fields[$field]) && $field[0] != '#') { unset($this->fields[$field]); $this->fields['#'.$field] = $data; } } foreach($this->stock_fields as $field => $data) { if (!is_array($data)) { $data = array('label' => $data); } if (!isset($this->fields[$field])) { $this->fields[$field] = array( 'name' => $field, 'title' => $data['title'], 'disabled' => $data['disabled'] ); } $this->fields[$field]['label'] = $data['label']; $this->fields[$field]['length'] = $data['length']; $this->fields[$field]['shown'] = $data['shown']; } } function set($data) { if (is_array($data) && strlen($data['name']) > 0) { if (!isset($this->stock_fields[$name = $data['name']])) { $name = '#'.$name; } $this->fields[$name] = $data; } } function save($fields=False) { if ($fields) { $this->fields = $fields; } //echo "
"; print_r($this->config->config_data); echo "\n"; $this->config->save_repository(); } }