예제 #1
0
 public static function ___translate($formname, array $array)
 {
     if (isset($array["@attributes"]["account_access_type"])) {
         self::$ACCOUNT[$formname]["access_type"] = $array["@attributes"]["account_access_type"];
     }
     foreach ($array as $key => $value) {
         if (self::startswith(strtolower($key), "field:")) {
             if (CONFIG::has_attribute($value, "name", true)) {
                 $field = $value["@attributes"]["name"];
                 $label = isset($value["@attributes"]["label"]) ? $value["@attributes"]["label"] : $field;
                 $databasefield = isset($value["@attributes"]["databasefield"]) ? $value["@attributes"]["databasefield"] : null;
                 if (preg_match('/:/', $databasefield)) {
                     $databasefield = explode(":", $databasefield);
                     self::$COLUMN[$formname][$field]["table"] = $databasefield[0];
                     self::$COLUMN[$formname][$field]["column"] = $databasefield[1];
                 }
                 self::$LABEL[$formname][$field] = $label;
                 self::$FIELDS[$formname][$field]["name"] = $field;
                 if (isset($value["required:0"])) {
                     self::$REQUIRED["label"][$formname][$field] = $label;
                     foreach ($value["required:0"] as $req_key => $req_value) {
                         if (self::startswith(strtolower($req_key), "is_email:")) {
                             self::$REQUIRED['is_email'][$formname][$field] = true;
                         }
                         if (self::startswith(strtolower($req_key), "length:")) {
                             if (isset($req_value["@attributes"])) {
                                 if (isset($req_value["@attributes"]["min"])) {
                                     self::$REQUIRED['min_length'][$formname][$field] = $req_value["@attributes"]["min"];
                                 }
                                 if (isset($req_value["@attributes"]["max"])) {
                                     self::$REQUIRED['max_length'][$formname][$field] = $req_value["@attributes"]["max"];
                                 }
                             }
                         }
                         if (self::startswith(strtolower($req_key), "must_have:")) {
                             if (isset($req_value["@attributes"])) {
                                 if (isset($req_value["@attributes"]["uppercase"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['uppercase'] = $req_value["@attributes"]["uppercase"];
                                 }
                                 if (isset($req_value["@attributes"]["lowercase"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['lowercase'] = $req_value["@attributes"]["lowercase"];
                                 }
                                 if (isset($req_value["@attributes"]["number"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['number'] = $req_value["@attributes"]["number"];
                                 }
                                 if (isset($req_value["@attributes"]["space"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['space'] = $req_value["@attributes"]["space"];
                                 }
                                 if (isset($req_value["@attributes"]["non_alpha_numeric"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['non_alpha_numeric'] = $req_value["@attributes"]["non_alpha_numeric"];
                                 }
                             }
                         }
                         if (self::startswith(strtolower($req_key), "specialcharacters:")) {
                             if (isset($req_value["@attributes"])) {
                                 if (isset($req_value["@attributes"]["can"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['special']['can'] = $req_value["@attributes"]["can"];
                                 }
                                 if (isset($req_value["@attributes"]["cant"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['special']['cant'] = $req_value["@attributes"]["cant"];
                                 }
                                 if (isset($req_value["@attributes"]["must"])) {
                                     self::$REQUIRED['must_have'][$formname][$field]['special']['must'] = $req_value["@attributes"]["must"];
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
예제 #2
0
 private static function has_redirect($value, $subview = false)
 {
     if (CONFIG::has_attribute($value, "redirect")) {
         if (!$subview) {
             self::$allowed_in_view = false;
         } else {
             self::$allowed_in_subview = false;
         }
         REQUEST::$REDIRECT_URI = trim($value["@attributes"]["redirect"], "/");
     }
 }