/**
  * @param $factor_id
  * @param $element_id
  * @return comments for each factor to the clerical element
  */
 public function getComments($factor_id, $element_id)
 {
     $criteria = new \CDbCriteria();
     $criteria->select = 'comments';
     $criteria->condition = "element_id=:element_id";
     $criteria->addCondition("patient_factor_id=:patient_factor_id");
     $criteria->params = array(':element_id' => $element_id, ':patient_factor_id' => $factor_id);
     $item = OphCoCvi_ClericalInfo_PatientFactor_Answer::model()->find($criteria);
     return $item['comments'];
 }
 /**
  * Retrieves a list of patient factor
  *
  * @param $element_id
  * @return array
  */
 public function patientFactorList($element_id)
 {
     $factors = array();
     $patient_factor = OphCoCvi_ClericalInfo_PatientFactor::model()->findAll('`active` = ?', array(1));
     foreach ($patient_factor as $key => $factor) {
         $factors[$key]['id'] = $factor->id;
         $factors[$key]['name'] = $factor->name;
         $factors[$key]['is_comments'] = $factor->require_comments;
         $factors[$key]['label'] = $factor->comments_label;
         $factors[$key]['is_factor'] = OphCoCvi_ClericalInfo_PatientFactor_Answer::model()->getFactorAnswer($factor->id, $element_id);
         $factors[$key]['comments'] = OphCoCvi_ClericalInfo_PatientFactor_Answer::model()->getComments($factor->id, $element_id);
     }
     return $factors;
 }