MINOR: fixed notices and tidied up code

This commit is contained in:
Will Rossiter 2009-04-28 02:03:13 +00:00
parent ecdb0e009a
commit f19924d92f
3 changed files with 33 additions and 35 deletions

View File

@ -347,7 +347,6 @@ JS
* @return Redirection
*/
function process($data, $form) {
// submitted form object
$submittedForm = new SubmittedForm();
$submittedForm->SubmittedBy = Member::currentUser();
@ -380,9 +379,11 @@ JS
$submittedFields->push($submittedField);
if(!empty($data[$field->Name])){
switch($field->ClassName){
case "EditableFileField" :
/**
* @todo this should be on the EditableFile class. Just need to sort out
* attachments array
*/
if($field->ClassName == "EditableFileField"){
if(isset($_FILES[$field->Name])) {
// create the file from post data
@ -404,17 +405,13 @@ JS
} else {
$submittedField->Value = "";
}
}
}
}
// make sure we save
$submittedField->write();
}
break;
}
}
elseif($field->hasMethod('getValueFromData')) {
$values[$field->Title] = Convert::linkIfMatch($field->getValueFromData($data));
} else {
if(isset($data[$field->Name])) $values[$field->Title] = Convert::linkIfMatch($data[$field->Name]);
}
}
$emailData = array(
"Sender" => Member::currentUser(),
"Fields" => $submittedFields,

View File

@ -23,12 +23,12 @@ class EditableCheckboxGroupField extends EditableMultipleOptionField {
function getValueFromData($data) {
$result = '';
$entries = $data[$this->Name];
$entries = (isset($data[$this->Name])) ? $data[$this->Name] : false;
if($entries) {
if(!is_array($data[$this->Name])) {
$entries = array($data[$this->Name]);
}
if($entries) {
foreach($entries as $selected => $value) {
if(!$result) {
$result = $value;

View File

@ -30,5 +30,6 @@ class EditableFileField extends EditableFormField {
public function getFormField() {
return new FileField($this->Name, $this->Title);
}
}
?>