* * -------------------------------------------- * * 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( 'name' => 'name', 'category' => 'Category', 'location' => 'location', 'cantidad' => 'cantidad', 'administrador' => 'administrador', 'email' =>'email', 'description' => 'Description'//, //'enddate2' => 'End Date2/End Time2' ); 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(); } }