model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : the
return the static model class
 /**
  * @param $attribute
  * @param $params
  */
 public function checkSelectedLensFormula($attribute, $params)
 {
     if (count(OphInBiometry_Imported_Events::model()->findAllByAttributes(array('event_id' => $this->event_id))) > 0) {
         $lensCount = count(Element_OphInBiometry_IolRefValues::model()->findAll(array('select' => 'lens_id', 'condition' => 'event_id=' . $this->event_id, 'distinct' => 'true')));
         $formulaCount = count(Element_OphInBiometry_IolRefValues::model()->findAll(array('select' => 'formula_id', 'condition' => 'event_id=' . $this->event_id, 'distinct' => 'true')));
         if ($params['selectData'] == 'left_lens' && $formulaCount > 1 && $lensCount > 1) {
             if (empty($this->formula_id_left) && !empty($this->lens_id_left) || !empty($this->formula_id_left) && empty($this->lens_id_left)) {
                 if (empty($this->lens_id_left)) {
                     $this->addError('lens_id_left', 'Lens and Formula must be selected or left blank (Left side).');
                 }
             }
         } elseif ($params['selectData'] == 'left_formula' && $lensCount > 1 && $formulaCount > 1) {
             if (empty($this->formula_id_left) && !empty($this->lens_id_left) || !empty($this->formula_id_left) && empty($this->lens_id_left)) {
                 if (empty($this->formula_id_left)) {
                     $this->addError('formula_id_left', 'Lens and Formula must be selected or left blank (Left side).');
                 }
             }
         } elseif ($params['selectData'] == 'right_lens' && $formulaCount > 1 && $lensCount > 1) {
             if (empty($this->formula_id_right) && !empty($this->lens_id_right) || !empty($this->formula_id_right) && empty($this->lens_id_right)) {
                 if (empty($this->lens_id_right)) {
                     $this->addError('lens_id_right', 'Lens and Formula must be selected or left blank (Right side).');
                 }
             }
         } elseif ($params['selectData'] == 'right_formula' && $lensCount > 1 && $formulaCount > 1) {
             if (empty($this->formula_id_right) && !empty($this->lens_id_right) || !empty($this->formula_id_right) && empty($this->lens_id_right)) {
                 if (empty($this->lens_id_right)) {
                     $this->addError('formula_id_right', 'Lens and Formula must be selected or left blank (Right side).');
                 }
             }
         }
     }
 }
                $emmetropiadata['right'][$measurementData->{'lens_id'}][$measurementData->{'formula_id'}] = $measurementData->{'emmetropia_right'};
                $acon['right'][$measurementData->{'lens_id'}][$measurementData->{'formula_id'}] = $measurementData->{'constant'};
            }
        }
    }
    ?>
        <div class="row">
            <div class="large-12 column">
                <div class="row field-row">
                    <div class="large-4 column">
                        <span class="field-info">Surgeon:</span>
                    </div>
                    <div class="large-8 column">
                        <b><?php 
    if (isset(Element_OphInBiometry_IolRefValues::model()->findByAttributes(array('event_id' => $this->event->id))->surgeon_id)) {
        echo OphInBiometry_Surgeon::model()->findByAttributes(array('id' => Element_OphInBiometry_IolRefValues::model()->findByAttributes(array('event_id' => $this->event->id))->surgeon_id))->name;
    }
    ?>
</b>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="large-12 column">
                <?php 
    $criteria = new CDbCriteria();
    if (!empty(${'lens_' . $side})) {
        $numberOfLens = count(OphInBiometry_LensType_Lens::model()->findAll($criteria->condition = ' id in (' . implode(',', array_unique(${'lens_' . $side})) . ')'));
        if ($numberOfLens == 1) {
    ?>
&nbsp;</div>
            </div>
        </div>
        <div class="row field-row">
            <div class="large-6 column">
                <div class="field-info"><b>A constant</b>:</div>
            </div>
            <div class="large-6 column">
                <div class="field-info" id="acon_<?php 
    echo $side;
    ?>
">
                    <?php 
    if ($this->is_auto) {
        $iolrefValues = Element_OphInBiometry_IolRefValues::model()->findAllByAttributes(array('event_id' => $element->event->id));
        foreach ($iolrefValues as $iolrefData) {
            if (isset($data)) {
                if ($iolrefData->lens_id == $element->{'lens_' . $side}->id && $iolrefData->formula_id == $data[0]->id) {
                    echo $this->formatAconst($iolrefData->constant);
                }
            }
        }
    } else {
        echo $element->{'lens_' . $side} ? $this->formatAconst($element->{'lens_' . $side}->acon) : 'None';
    }
    ?>
</div>
            </div>
        </div>
        <div class="row data-row">