/** * Инициализация типов участия на кафедре сотрудников * для всех сотрудников, находящихся в кеше * * @static */ public static function initPersonTypes() { foreach (CActiveRecordProvider::getAllFromTable("kadri_in_ptypes")->getItems() as $item) { if (self::getCachePerson()->hasElement($item->getItemValue("kadri_id"))) { $person = self::getCachePerson()->getItem($item->getItemValue("kadri_id")); $person->initTypes(); $term = CTaxonomyManager::getTypeById($item->getItemValue("person_type_id")); if (!is_null($term)) { $person->getTypes()->add($term->getId(), $term); } } } }
/** * Тип участия на кафедре * * @return CArrayList */ public function getTypes() { if (is_null($this->_types)) { $this->_types = new CArrayList(); if (!is_null($this->getId())) { $tList = CActiveRecordProvider::getWithCondition("kadri_in_ptypes", "kadri_id=" . $this->getId()); foreach ($tList->getItems() as $item) { $term = CTaxonomyManager::getTypeById($item->getItemValue("person_type_id")); if (!is_null($term)) { $this->_types->add($term->getId(), $term); } } } } return $this->_types; }