Project

General

Profile

« Previous | Next » 

Revision 317

Added by stefan over 18 years ago

Changed all line endings to Unix stlye

View differences:

modify.php
28 28
for his contributions to this module - adding extra field types
29 29
*/
30 30

  
31
// Must include code to stop this file being access directly

32
if(!defined('WB_PATH')) { exit("Cannot access this file directly"); }

33

  
34
?>

35
<table cellpadding="0" cellspacing="0" border="0" width="100%">

36
<tr>

37
	<td align="left" width="33%">

38
		<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['FIELD']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/form/add_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>';" style="width: 100%;" />

39
	</td>

40
	<td align="right" width="33%">

41
		<input type="button" value="<?php echo $TEXT['SETTINGS']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/form/modify_settings.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>';" style="width: 100%;" />

42
	</td>

43
</tr>

44
</table>

45

  
46
<br />

47

  
48
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['FIELD']; ?></h2>

49
<?php

50

  
51
// Loop through existing fields

52
$query_fields = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_form_fields` WHERE section_id = '$section_id' ORDER BY position ASC");

53
if($query_fields->numRows() > 0) {

54
	$num_fields = $query_fields->numRows();

55
	$row = 'a';

56
	?>

57
	<table cellpadding="2" cellspacing="0" border="0" width="100%">

58
	<?php

59
	while($field = $query_fields->fetchRow()) {

60
		?>

61
		<tr class="row_<?php echo $row; ?>" height="20">

62
			<td width="20" style="padding-left: 5px;">

63
				<a href="<?php echo WB_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">

64
					<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="^" />

65
				</a>

66
			</td>		

67
			<td>

68
				<a href="<?php echo WB_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>">

69
					<?php echo $field['title']; ?>

70
				</a>

71
			</td>

72
			<td width="175">

31
// Must include code to stop this file being access directly
32
if(!defined('WB_PATH')) { exit("Cannot access this file directly"); }
33

  
34
?>
35
<table cellpadding="0" cellspacing="0" border="0" width="100%">
36
<tr>
37
	<td align="left" width="33%">
38
		<input type="button" value="<?php echo $TEXT['ADD'].' '.$TEXT['FIELD']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/form/add_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
39
	</td>
40
	<td align="right" width="33%">
41
		<input type="button" value="<?php echo $TEXT['SETTINGS']; ?>" onclick="javascript: window.location = '<?php echo WB_URL; ?>/modules/form/modify_settings.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>';" style="width: 100%;" />
42
	</td>
43
</tr>
44
</table>
45

  
46
<br />
47

  
48
<h2><?php echo $TEXT['MODIFY'].'/'.$TEXT['DELETE'].' '.$TEXT['FIELD']; ?></h2>
49
<?php
50

  
51
// Loop through existing fields
52
$query_fields = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_form_fields` WHERE section_id = '$section_id' ORDER BY position ASC");
53
if($query_fields->numRows() > 0) {
54
	$num_fields = $query_fields->numRows();
55
	$row = 'a';
56
	?>
57
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
58
	<?php
59
	while($field = $query_fields->fetchRow()) {
60
		?>
61
		<tr class="row_<?php echo $row; ?>" height="20">
62
			<td width="20" style="padding-left: 5px;">
63
				<a href="<?php echo WB_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>">
64
					<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="^" />
65
				</a>
66
			</td>		
67
			<td>
68
				<a href="<?php echo WB_URL; ?>/modules/form/modify_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>">
69
					<?php echo $field['title']; ?>
70
				</a>
71
			</td>
72
			<td width="175">
73 73
				<?php
74 74
				echo $TEXT['TYPE'].':';
75 75
				if($field['type'] == 'textfield') {
......
87 87
				} elseif($field['type'] == 'email') {
88 88
					echo $TEXT['EMAIL_ADDRESS'];
89 89
				}
90
				?>

90
				?>
91 91
			</td>
92
			<td width="95">		
-			<?php 
93
			if ($field['type'] != 'group_begin') {
94
				echo $TEXT['REQUIRED'].': '; if($field['required'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; }
92
			<td width="95">		
93
			<?php 
94
			if ($field['type'] != 'group_begin') {
95
				echo $TEXT['REQUIRED'].': '; if($field['required'] == 1) { echo $TEXT['YES']; } else { echo $TEXT['NO']; }
95 96
			}
96 97
			?>
97 98
			</td>
98 99
			<td width="110">
99
			<?php

100
			if ($field['type'] == 'select') {

101
				$field['extra'] = explode(',',$field['extra']);

102
				echo $TEXT['MULTISELECT'].': '; if($field['extra'][1] == 'multiple') { echo $TEXT['YES']; } else { echo $TEXT['NO']; }

103
			}

100
			<?php
101
			if ($field['type'] == 'select') {
102
				$field['extra'] = explode(',',$field['extra']);
103
				echo $TEXT['MULTISELECT'].': '; if($field['extra'][1] == 'multiple') { echo $TEXT['YES']; } else { echo $TEXT['NO']; }
104
			}
104 105
			?>
105
			</td>

106
			<td width="20">

107
			<?php if($field['position'] != 1) { ?>

108
				<a href="<?php echo WB_URL; ?>/modules/form/move_up.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">

109
					<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" border="0" alt="^" />

110
				</a>

111
			<?php } ?>

112
			</td>

113
			<td width="20">

114
			<?php if($field['position'] != $num_fields) { ?>

115
				<a href="<?php echo WB_URL; ?>/modules/form/move_down.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">

116
					<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" border="0" alt="v" />

117
				</a>

118
			<?php } ?>

119
			</td>

120
			<td width="20">

121
				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/form/delete_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">

122
					<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />

123
				</a>

124
			</td>

125
		</tr>

126
		<?php

127
		// Alternate row color

128
		if($row == 'a') {

129
			$row = 'b';

130
		} else {

131
			$row = 'a';

132
		}

133
	}

134
	?>

135
	</table>

136
	<?php

137
} else {

138
	echo $TEXT['NONE_FOUND'];

139
}

140

  
106
			</td>
107
			<td width="20">
108
			<?php if($field['position'] != 1) { ?>
109
				<a href="<?php echo WB_URL; ?>/modules/form/move_up.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>">
110
					<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" border="0" alt="^" />
111
				</a>
112
			<?php } ?>
113
			</td>
114
			<td width="20">
115
			<?php if($field['position'] != $num_fields) { ?>
116
				<a href="<?php echo WB_URL; ?>/modules/form/move_down.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>">
117
					<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" border="0" alt="v" />
118
				</a>
119
			<?php } ?>
120
			</td>
121
			<td width="20">
122
				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/form/delete_field.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&field_id=<?php echo $field['field_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
123
					<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
124
				</a>
125
			</td>
126
		</tr>
127
		<?php
128
		// Alternate row color
129
		if($row == 'a') {
130
			$row = 'b';
131
		} else {
132
			$row = 'a';
133
		}
134
	}
135
	?>
136
	</table>
137
	<?php
138
} else {
139
	echo $TEXT['NONE_FOUND'];
140
}
141

  
141 142
?>
142

  
143

  
143 144
<br /><br />
144 145

  
145
<h2><?php echo $TEXT['SUBMISSIONS']; ?></h2>

146
<h2><?php echo $TEXT['SUBMISSIONS']; ?></h2>
146 147

  
147 148
<?php
148 149

  
149 150
// Query submissions table
150
$query_submissions = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_form_submissions` WHERE section_id = '$section_id' ORDER BY submitted_when ASC");

151
$query_submissions = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_form_submissions` WHERE section_id = '$section_id' ORDER BY submitted_when ASC");
151 152
if($query_submissions->numRows() > 0) {
152 153
	?>
153 154
	<table cellpadding="2" cellspacing="0" border="0" width="100%">
......
165 165
			</td>
166 166
			<td width="237"><?php echo $TEXT['SUBMISSION_ID'].': '.$submission['submission_id']; ?></td>
167 167
			<td><?php echo $TEXT['SUBMITTED'].': '.gmdate(TIME_FORMAT.', '.DATE_FORMAT, $submission['submitted_when']+TIMEZONE); ?></td>
168
			<td width="20">

169
				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/form/delete_submission.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&submission_id=<?php echo $submission['submission_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">

170
					<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />

171
				</a>

168
			<td width="20">
169
				<a href="javascript: confirm_link('<?php echo $TEXT['ARE_YOU_SURE']; ?>', '<?php echo WB_URL; ?>/modules/form/delete_submission.php?page_id=<?php echo $page_id; ?>&section_id=<?php echo $section_id; ?>&submission_id=<?php echo $submission['submission_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
170
					<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" />
171
				</a>
172 172
			</td>
173 173
		</tr>
174 174
		<?php
175 175
		// Alternate row color
176
		if($row == 'a') {

177
			$row = 'b';

178
		} else {

179
			$row = 'a';

176
		if($row == 'a') {
177
			$row = 'b';
178
		} else {
179
			$row = 'a';
180 180
		}
181 181
	}
182 182
	?>
......
187 187
}
188 188

  
189 189
?>
190

  
190

  
191 191
<br />

Also available in: Unified diff