Пример #1
0
 /**
  * Method to load the target object of thesaurus target
  *
  * @return CActeNGAP|CCodeCCAM|CCodeCIM10
  */
 function loadRefTarget()
 {
     if ($this->object_class && $this->object_id) {
         switch ($this->object_class) {
             case "CCodeCIM10":
                 $object = new CCodeCIM10();
                 $object->code = $this->object_id;
                 $object->loadLite();
                 $this->_ref_target = $object;
                 break;
             case "CCodeCCAM":
                 $object = new CCodeCCAM($this->object_id);
                 $object->load();
                 $this->_ref_target = $object;
                 break;
             case "CActeNGAP":
                 $object = new CActeNGAP();
                 $object->code = $this->object_id;
                 $object->loadMatchingObject();
                 $this->_ref_target = $object;
                 break;
             case "CMedicamentClasseATC":
                 $object = new CMedicamentClasseATC();
                 $niveau = $object->getNiveau($this->object_id);
                 $object->loadClasseATC($niveau, $this->object_id);
                 $this->_ref_target = $object;
                 break;
             default:
                 // nothing to do
                 break;
         }
     }
     return $this->_ref_target;
 }
Пример #2
0
 /**
  * Chargement optimisé des codes
  */
 static function get($code, $niv = self::LITE, $lang = self::LANG_FR)
 {
     $cache = new Cache(__METHOD__, func_get_args(), self::$cache_layers);
     if ($cache->exists()) {
         return $cache->get();
     }
     // Chargement
     $code_cim = new CCodeCIM10($code, $niv === self::LITE);
     switch ($niv) {
         case self::LITE:
             $code_cim->loadLite();
             break;
         case self::MEDIUM:
             $code_cim->load();
             break;
         case self::FULL:
             $code_cim->load();
             $code_cim->loadRefs();
     }
     return $cache->put($code_cim, true);
 }