コード例 #1
0
 /**
  * Return the open referral choices for the patient.
  *
  * @return Referral[]
  */
 public function getReferralChoices($element = null)
 {
     $criteria = new CdbCriteria();
     $criteria->addCondition('patient_id = :pid');
     $criteria->addCondition('closed_date is null');
     $criteria->params = array('pid' => $this->patient->id);
     // if the referral has been closed but is the selected referral for the event, needs to be part of the list
     if ($element && $element->referral_id) {
         $criteria->addCondition('id = :crid', 'OR');
         $criteria->params[':crid'] = $element->referral_id;
     }
     $criteria->order = 'received_date DESC';
     return Referral::model()->findAll($criteria);
 }
コード例 #2
0
ファイル: Conditions.php プロジェクト: rawaludin/LimeSurvey
 public function insertRecords($data, $update = FALSE, $condition = FALSE)
 {
     $record = new self();
     foreach ($data as $k => $v) {
         $v = str_replace(array("'", '"'), '', $v);
         $record->{$k} = $v;
     }
     if ($update) {
         $criteria = new CdbCriteria();
         if (is_array($condition)) {
             foreach ($condition as $column => $value) {
                 $criteria->addCondition("{$column}='{$value}'");
             }
         } else {
             $criteria->where = $condition;
         }
         return $record->updateAll($data, $criteria);
     } else {
         return $record->save();
     }
 }
コード例 #3
0
ファイル: Dataset.php プロジェクト: jessesiu/GigaDBV3
 public function getAllSamples()
 {
     $criteria = new CdbCriteria();
     $criteria->join = "join dataset_sample ds on ds.sample_id = t.id";
     $criteria->addCondition("ds.dataset_id = " . $this->id);
     return Sample::model()->findAll($criteria);
 }