public function resort() { $json = Loader::helper('json'); $fieldsJSON = $json->decode(file_get_contents("php://input")); $i = 1; foreach ($fieldsJSON as $ffJSON) { $log .= $ffJSON->label . ' '; $ff = \Concrete\Package\Formify\Src\FormifyField::get($ffJSON->ffID); $ff->set('sortPriority', $i); $i++; } }
function getDateFormat() { $field = \Concrete\Package\Formify\Src\FormifyField::getByID($this->getSortFieldID()); if ($field->dateFormat != '') { $inputFormat = $field->dateFormat; } else { $inputFormat = 'mm/dd/yy'; } $pattern = array('dd', 'd', 'oo', 'o', 'DD', 'D', 'mm', 'm', 'MM', 'M', 'yy', 'y'); $tmpReplace = array('%1', '%2', '%3', '%4', '%5', '%6', '%7', '%8', '%9', '%0', '%x', '%z'); $replace = array('%d', '%e', '%j', '%j', '%W', '%a', '%m', '%c', '%M', '%b', '%Y', '%y'); foreach ($pattern as &$p) { $p = '/' . $p . '/'; } $tmpFormat = preg_replace($pattern, $tmpReplace, $inputFormat); foreach ($tmpReplace as &$p) { $p = '/' . $p . '/'; } $outputFormat = preg_replace($tmpReplace, $replace, $tmpFormat); return $outputFormat; }
public function getFriendlyAnswerValue($id, $index = 0) { $a = $this->getAnswer($id); $value = $this->getAnswer($id)->value[$index]; $field = \Concrete\Package\Formify\Src\FormifyField::get($a->ffID); if ($field->type == 'attachment' || $field->type == 'file') { $file = File::getByID($value); if ($file && is_numeric($value)) { $fv = $file->getApprovedVersion(); $value = '<a href="' . $fv->getRelativePath() . '">' . $fv->getFileName() . '</a>'; } else { $value = ''; } } return $value; }
public function getField($id) { return \Concrete\Package\Formify\Src\FormifyField::get($id, $this->fID); }