function process() { global $lr_session; $this->title = $this->field->fullname; $this->template_name = 'pages/field/view.tpl'; $ratings = field_rating_values(); $this->field->rating_description = $ratings[$this->field->rating]; $this->smarty->assign('field', $this->field); // list other fields at this site $sth = $this->field->find_others_at_site(); $other_fields = array(); while ($related = $sth->fetch(PDO::FETCH_OBJ)) { if ($related->fid != $this->field->fid) { $other_fields[] = $related; } } $this->smarty->assign('other_fields', $other_fields); return true; }
function isDataInvalid($edit) { $errors = ""; if (!validate_number($edit['num'])) { $errors .= "<li>Number of field must be provided"; } $rating = field_rating_values(); if (!array_key_exists($edit['rating'], $rating)) { $errors .= "<li>Rating must be provided"; } if ($edit['parent_fid'] > 0) { if (!validate_number($edit['parent_fid'])) { $errors .= "<li>Parent must be a valid value"; return $errors; } if ($edit['parent_fid'] == $this->field->fid) { $errors .= "<li>Field cannot be a parent of itself!"; return $errors; } return false; } if (!validate_nonhtml($edit['name'])) { $errors .= "<li>Name cannot be left blank, and cannot contain HTML"; } if (!validate_nonhtml($edit['code'])) { $errors .= "<li>Code cannot be left blank and cannot contain HTML"; } if (!validate_nonhtml($edit['region'])) { $errors .= "<li>Region cannot be left blank and cannot contain HTML"; } if (validate_nonblank($edit['location_url'])) { if (!validate_nonhtml($edit['location_url'])) { $errors .= "<li>If you provide a location URL, it must be valid."; } } if (validate_nonblank($edit['layout_url'])) { if (!validate_nonhtml($edit['layout_url'])) { $errors .= "<li>If you provide a site layout URL, it must be valid."; } } if (strlen($errors) > 0) { return $errors; } else { return false; } }
function check_input_errors($edit = array()) { $errors = array(); if (!validate_number($edit['num'])) { $errors[] = "Number of field must be provided"; } $rating = field_rating_values(); if (!array_key_exists($edit['rating'], $rating)) { $errors[] = "Rating must be provided"; } if ($edit['parent_fid'] > 0) { if (!validate_number($edit['parent_fid'])) { $errors[] = "Parent must be a valid value"; } return $errors; } if (!validate_nonhtml($edit['name'])) { $errors[] = "Name cannot be left blank, and cannot contain HTML"; } if (!validate_nonhtml($edit['code'])) { $errors[] = "Code cannot be left blank and cannot contain HTML"; } if (!validate_nonhtml($edit['region'])) { $errors[] = "Region cannot be left blank and cannot contain HTML"; } if (validate_nonblank($edit['location_url'])) { if (!validate_nonhtml($edit['location_url'])) { $errors[] = "If you provide a location URL, it must be valid."; } } if (validate_nonblank($edit['layout_url'])) { if (!validate_nonhtml($edit['layout_url'])) { $errors[] = "If you provide a site layout URL, it must be valid."; } } return $error; }