/** * @see parent::guessDataType() */ function guessDataType() { $data_types = array("<?xml" => "xml", "MSH|" => "er7"); foreach ($data_types as $check => $spec) { if (strpos($this->_message, $check) === 0) { $this->_props["_message"] = $spec; $this->_specs["_message"] = CMbFieldSpecFact::getSpec($this, "_message", $spec); } if (strpos($this->_acquittement, $check) === 0) { $this->_props["_acquittement"] = $spec; $this->_specs["_acquittement"] = CMbFieldSpecFact::getSpec($this, "_acquittement", $spec); } } }
/** * Get Spec object * * @return CMbFieldSpec */ function getSpecObject() { CBoolSpec::$_default_no = false; $this->_spec_object = @CMbFieldSpecFact::getSpecWithClassName("CExObject", $this->name, $this->prop); CBoolSpec::$_default_no = true; return $this->_spec_object; }
/** * Get "connected user" spec * * @return CMbFieldSpec */ static function getConnectedUserSpec() { static $spec; if (!isset($spec)) { $mediuser = new CMediusers(); $spec = CMbFieldSpecFact::getSpec($mediuser, "CONNECTED_USER", "ref class|CMediusers show|1"); } return $spec; }
/** * Fonction d'écriture des labels * @param array $params tableau des parametres * - object : Objet * - field : Nom du champ a afficher (le champs doit avoir des specs sinon "spec" non optionnel) * - defaultFor : {optionnel} Ajout d'une valeur à cibler pour "select" ou "radio" * - typeEnum : {optionnel} Type d'affichage des enums à cibler (values : "select", "radio") [default: "select"] */ function mb_label($params, &$smarty) { /** @var CMbObject $object */ if (null == ($object = CMbArray::extract($params, "object"))) { $class = CMbArray::extract($params, "class", null, true); $object = new $class(); } $field = CMbArray::extract($params, "field", null, true); if (!array_key_exists($field, $object->_specs)) { $object->_specs[$field] = CMbFieldSpecFact::getSpec($object, $field, ""); trigger_error("Spec missing for class '{$object->_class}' field '{$field}'", E_USER_WARNING); } return $object->_specs[$field]->getLabelElement($object, $params); }
/** * Converts properties string specifications to object specifications * Optimized version * * @return CMbFieldSpec[] */ function getSpecs() { $specs = array(); foreach ($this->_props as $name => $prop) { $specs[$name] = CMbFieldSpecFact::getSpec($this, $name, $prop); } return $specs; }
/** * Turn rercursive plan to flat plan * * @param string[] $props Parameters * * @return array */ function flatify($props) { if (!count($props)) { return array(array()); } // Spec for only first item $spec = null; foreach ($props as $_param => $_prop) { $spec = CMbFieldSpecFact::getSpecWithClassName("stdClass", $_param, $_prop); break; } // Shift this item and recurse plan array_shift($props); $subplan = self::flatify($props); // Complete with own values $plan = array(); foreach ($subplan as $_subparts) { foreach ($spec->regressionSamples() as $_sample) { $parts = $_subparts; $parts[$spec->fieldName] = $_sample; $plan[] = $parts; } } return $plan; }
/** * @see parent::check() */ function check() { if ($msg = parent::check()) { return $msg; } // Check unique item $other = new CPrescriptionLaboExamen(); $clone = null; if ($this->_id) { $clone = new CPrescriptionLaboExamen(); $clone->load($this->_id); } else { $clone = $this; } $other->prescription_labo_id = $clone->prescription_labo_id; $other->examen_labo_id = $clone->examen_labo_id; $other->loadMatchingObject(); if ($other->_id && $other->_id != $this->_id) { return "{$this->_class}-unique-conflict"; } // Check prescription status $clone->loadRefPrescription(); $clone->_ref_prescription_labo->loadRefsBack(); if ($clone->_ref_prescription_labo->_status >= CPrescriptionLabo::VALIDEE) { return "Prescription déjà validée"; } // Get the analysis to check resultat if (!$this->examen_labo_id) { if (!$clone) { $clone = new CPrescriptionLaboExamen(); $clone->load($this->_id); } $this->examen_labo_id = $clone->examen_labo_id; } // Check resultat according to type $this->loadRefExamen(); $resultTest = CMbFieldSpecFact::getSpec($this, "resultat", $this->_ref_examen_labo->type); return $resultTest->checkPropertyValue($this); }
/** * @param string $prop * * @return CMbFieldSpec */ static function getConceptSpec($prop) { if ($prop == "mbField") { $prop = ""; } $field = "dummy"; $object = new CMbObject(); $object->{$field} = null; $object->_props[$field] = $prop; @($object->_specs = $object->getSpecs()); $spec = @CMbFieldSpecFact::getSpec($object, $field, $prop); $options = $spec->getOptions(); $invalid = array("moreThan", "moreEquals", "sameAs", "notContaining", "notNear", "dependsOn", "helped", "aidesaisie"); foreach ($invalid as $_invalid) { unset($options[$_invalid]); } self::orderSpecs($options); $spec->_options = $options; return $spec; }