copyright and version fixes
[civicrm-core.git] / CRM / Activity / Import / Field.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
232624b1 4 | CiviCRM version 4.4 |
6a488035
TO
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26*/
27
28/**
29 *
30 * @package CRM
31 * @copyright CiviCRM LLC (c) 2004-2013
32 * $Id$
33 *
34 */
35class CRM_Activity_Import_Field {
36
37 /**#@+
38 * @access protected
39 * @var string
40 */
41
42 /**
43 * name of the field
44 */
45 public $_name;
46
47 /**
48 * title of the field to be used in display
49 */
50 public $_title;
51
52 /**
53 * type of field
54 * @var enum
55 */
56 public $_type;
57
58 /**
59 * is this field required
60 * @var boolean
61 */
62 public $_required;
63
64 /**
65 * data to be carried for use by a derived class
66 * @var object
67 */
68 public $_payload;
69
70 /**
71 * regexp to match the CSV header of this column/field
72 * @var string
73 */
74 public $_headerPattern;
75
76 /**
77 * regexp to match the pattern of data from various column/fields
78 * @var string
79 */
80 public $_dataPattern;
81
82 /**
83 * value of this field
84 * @var object
85 */
86 public $_value;
87 function __construct($name, $title, $type = CRM_Utils_Type::T_INT, $headerPattern = '//', $dataPattern = '//') {
88 $this->_name = $name;
89 $this->_title = $title;
90 $this->_type = $type;
91 $this->_headerPattern = $headerPattern;
92 $this->_dataPattern = $dataPattern;
93
94 $this->_value = NULL;
95 }
96
97 function resetValue() {
98 $this->_value = NULL;
99 }
100
101 /**
102 * the value is in string format. convert the value to the type of this field
103 * and set the field value with the appropriate type
104 */
105 function setValue($value) {
106 $this->_value = $value;
107 }
108
109 function validate() {
110
111 if (CRM_Utils_System::isNull($this->_value)) {
112 return TRUE;
113 }
114 return TRUE;
115 }
116}
117