Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 public function getFields()
 {
     if ($this->fields) {
         return $this->fields;
     } else {
         $db = Loader::db();
         $fieldsData = $db->getAll("SELECT ffID FROM " . TABLE_FORMIFY_FIELDS . " WHERE fID = ? AND isDeleted != 1 ORDER by sortPriority ASC, ffID", array($this->fID));
         $fields = array();
         foreach ($fieldsData as $fieldData) {
             $fields[] = \Concrete\Package\Formify\Src\FormifyField::getByID($fieldData['ffID']);
         }
         $this->fields = $fields;
         return $fields;
     }
 }