Exemple #1
0
 public static function fetchAllRoutings()
 {
     if (!self::$_schemesFetched) {
         $schemeNames = One::meta('schemes');
         foreach ($schemeNames as $schemeName) {
             One_Repository::getScheme($schemeName);
         }
         self::$_schemesFetched = true;
     }
 }
Exemple #2
0
 public function getScheme($schemeName)
 {
     return One::meta("schemes/{$schemeName}");
 }
Exemple #3
0
 /**
  * Validate whether the form has been submitted correctly
  *
  * @param boolean $root
  * @param One_Form_Container_Abstract $container
  * @return boolean
  */
 public function validate($root = true, $container = NULL)
 {
     $checksOut = true;
     $oc = new One_Context();
     $scheme = $oc->get('scheme');
     $schemes = One::meta('schemes');
     if (in_array($scheme, $schemes)) {
         $scheme = One_Repository::getScheme($scheme);
         $use = $root ? $this : $container;
         foreach ($use->getContent() as $widget) {
             if ($widget instanceof One_Form_Widget_Abstract) {
                 $attr = $scheme->getAttribute($widget->getName());
                 if ($attr instanceof One_Scheme_Attribute) {
                     $type = strtolower(str_replace('One_Scheme_Attribute_Type', '', get_class($attr->getType())));
                     $widget->setCfg('type', $type);
                 }
                 if (!$widget->validate()) {
                     $checksOut = false;
                     $this->_errors[$widget->getName()]['error'] = $widget->getErrors();
                     $this->_errors[$widget->getName()]['label'] = $widget->getLabel();
                 }
             } else {
                 if ($widget instanceof One_Form_Container_Abstract) {
                     if (!self::validate(false, $widget)) {
                         $checksOut = false;
                     }
                 }
             }
         }
         return $checksOut;
     } else {
         return false;
     }
 }