getSubspecialtyID() public method

get the id for the subspecialty for the firm - null if one not set (support service firm).
public getSubspecialtyID ( ) : integer | null
return integer | null
Ejemplo n.º 1
0
 /**
  * @param Firm      $firm
  * @param Episode   $episode
  * @param EventType $event_type
  *
  * @return bool
  */
 public function canCreateEvent(Firm $firm = null, Episode $episode = null, EventType $event_type = null)
 {
     if ($event_type) {
         if ($event_type->disabled) {
             return false;
         }
         if (!$event_type->support_services && !$firm->getSubspecialtyID()) {
             // Can't create a non-support service event for a support-service firm
             return false;
         }
     }
     if ($firm && $episode) {
         return $this->canEditEpisode($firm, $episode);
     }
     return true;
 }
 /**
  * @param Firm $firm
  * @return array
  * @throws CException
  */
 public static function getListWithSecondaryTo(Firm $firm)
 {
     if (empty($firm)) {
         throw new CException('Firm is required');
     }
     $disorders = array();
     $secondary_to = array();
     if ($ss_id = $firm->getSubspecialtyID()) {
         $cods = self::model()->with(array('disorder', 'secondary_to_disorders'))->findAllByAttributes(array('subspecialty_id' => $ss_id), array('order' => 'disorder.term'));
         foreach ($cods as $cod) {
             $disorders[] = $cod->disorder;
             if ($secondary_tos = $cod->secondary_to_disorders) {
                 $secondary_to[$cod->disorder_id] = CHtml::listData($secondary_tos, 'id', 'term');
             }
         }
     }
     return array(CHtml::listData($disorders, 'id', 'term'), $secondary_to);
 }
 /**
  * Fetch array of disorders and associated secondary to disorders (and optionally findings)
  * @param Firm $firm
  * @return array
  * @throws CException
  */
 public static function getListByGroupWithSecondaryTo(Firm $firm)
 {
     if (empty($firm)) {
         throw new CException('Firm is required');
     }
     $disorders = array();
     if ($ss_id = $firm->getSubspecialtyID()) {
         $cods = self::model()->with(array('finding' => array('joinType' => 'LEFT JOIN'), 'disorder' => array('joinType' => 'LEFT JOIN'), 'group'))->findAll(array('condition' => 't.subspecialty_id = :subspecialty_id', 'params' => array(':subspecialty_id' => $ss_id)));
         foreach ($cods as $cod) {
             if ($cod->type) {
                 $disorder = array();
                 $group = $cod->group ? $cod->group->name : '';
                 $disorder['type'] = $cod->type;
                 $disorder['id'] = $cod->disorderOrFinding ? $cod->disorderOrFinding->id : null;
                 $disorder['label'] = $cod->disorderOrFinding ? $cod->disorderOrFinding->term : 'None';
                 $disorder['group'] = $group;
                 $disorder['alternate'] = $cod->alternate_disorder_id ? array('id' => $cod->alternate_disorder_id, 'label' => $cod->alternate_disorder->term, 'selection_label' => $cod->alternate_disorder_label, 'type' => 'disorder') : null;
                 $disorder['secondary'] = $cod->getSecondaryToList();
                 $disorders[] = $disorder;
             }
         }
     }
     return $disorders;
 }