customer_id); } public function getProcessingFilePath($file) { if(!$this->folder) throw new Exception("Template processing folder not set."); $folder_path = ROOT_DIR . "/template_processing/" . $this->folder; if(!file_exists($folder_path)) throw new Exception("Template processing folder does not exist."); $file_path = $folder_path . "/" . $file; if(!file_exists($file_path)) throw new Exception("Template processing file \"$file\" does not exist."); return $file_path; } public function getURL() { return "/account/templates/" . $this->id; } public function getFields() { $fields = []; $json = json_decode($this->json); $before_fields = $json->beforeTest; $during_fields = $json->duringTest; $all_fields = array_merge($before_fields, $during_fields); foreach($all_fields as $field) { if(empty($field->name)) continue; $fields[$field->name] = $field; } return $fields; } public function setOverrides($overrides) { $this->overrides = $overrides; } public function applyOverridesToField($field) { foreach($this->overrides as $override) { if(empty($field->name)) continue; if($override->field == $field->name) { switch($override->element) { case "label": $field->label = $override->value; break; } } } return $field; } public function renderBeforeTestForm() { $json = json_decode($this->json); $fields = $json->beforeTest; ?>
json); $fields = $json->duringTest; ?>