diff --git a/components/RoCrateModal.php b/components/RoCrateModal.php index 92d2c5e..dee80d8 100644 --- a/components/RoCrateModal.php +++ b/components/RoCrateModal.php @@ -11,6 +11,7 @@ use app\models\SoftwareMpi; use app\models\Workflow; use app\models\SoftwareInput; +use app\models\WorkflowInput; use app\models\RoCrate; use yii\widgets\ActiveForm; @@ -25,18 +26,40 @@ public static function addModal($jobid) $download_icon=''; $edit_icon=''; $download_icon=''; - $required='*'; + $history=RunHistory::find()->where(['jobid'=>$jobid])->one(); $software_id=$history->software_id; - $software=Software::find()->where(['id'=>$software_id])->one(); + + $public_url=''; + $image_url=''; + + if($history->type=='job') + { + $software=Software::find()->where(['id'=>$software_id])->one(); + $soft_type='Software'; + $fields=SoftwareInput::find()->where(['softwareid'=>$software_id])->orderBy(['position'=> SORT_ASC])->all(); + $fields=Software::getRerunFieldValues($jobid,$fields); + } + elseif ($history->type=='workflow') + { + $workflow=Workflow::find()->where(['id'=>$software_id])->one(); + $soft_type='Workflow'; + $fields=WorkflowInput::find()->where(['workflow_id'=>$software_id])->orderBy(['position'=> SORT_ASC])->all(); + $fields=Workflow::getRerunFieldValues($jobid,$fields); + + } + + $model=RoCrate::find()->where(['jobid'=>$jobid])->one(); + + //print_r($history->jobid); $disabled_fields=false; if(!empty($model)) { $disabled_fields=true; } - $image_url=''; + $disabled=false; if ((!empty($software)) && (empty($model->software_url))) { @@ -46,16 +69,19 @@ public static function addModal($jobid) $disabled=true; $image=$software->original_image; $image_url='https://hub.docker.com/r/'.$image; + + } } - elseif ((!empty($software)) && (!empty($model->software_url))) + elseif ((!empty($software) || (!empty($workflow))) && (!empty($model->software_url))) { $image_url=$model->software_url; } - $fields=SoftwareInput::find()->where(['softwareid'=>$software_id])->orderBy(['position'=> SORT_ASC])->all(); - $fields=Software::getRerunFieldValues($jobid,$fields); + + + $field_to_url=[]; if(empty($model)) @@ -92,19 +118,32 @@ public static function addModal($jobid) echo Html::hiddenInput('softname',$history->softname); echo Html::hiddenInput('softversion',$history->softversion); - + + echo "