study_visit::setVisitValidation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 0
nc 1
nop 0
dl 0
loc 1
c 0
b 0
f 0
cc 1
rs 10
1
<?php
2
/**
3
 Copyright (C) 2018-2020 KANOUN Salim
4
 This program is free software; you can redistribute it and/or modify
5
 it under the terms of the Affero GNU General Public v.3 License as published by
6
 the Free Software Foundation;
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
 Affero GNU General Public Public for more details.
11
 You should have received a copy of the Affero GNU General Public Public along
12
 with this program; if not, write to the Free Software Foundation, Inc.,
13
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
14
 */
15
16
/**
17
 * Specific object for study_visit, which extend the abstract class Form_Processor
18
 *
19
 */
20
class study_visit extends Form_Processor {
21
	
22
	public function __construct($idVisit, $local, $username, $linkpdo) {
23
		parent::__construct($idVisit, $local, $username, $linkpdo);
24
	}
25
	
26
	/**
27
	 * Fill the specific table
28
	 * @param $data
29
	 * @param $id_Review
30
	 * @param $specificTable
31
	 */
32
	protected function saveSpecificForm($inputData, $id_review, $update) {
33
		// Draft exist, we update the draft
34
		if ($update) {
35
			$req_update=$this->linkpdo->prepare('UPDATE '.$this->specificTable.'
36
                              SET item = :value,
37
                                  item2 = :value2
38
                                WHERE id_review = :id_review');
39
			
40
			$req_update->execute(array(
41
					'value' => '',
42
					'value2' =>'',
43
					'id_review' => $id_review ));
44
			
45
		} else {
46
			//Draft doesn't exist we create a new entry in the specific table
47
			$insertion=$this->linkpdo->prepare('INSERT INTO '.$this->specificTable.' (id_review, item, item2)
48
                                        VALUES (:id_review, :value, :value2)');
49
			
50
			$insertion->execute(array(
51
								'id_review' => $id_review,
52
								'value' => '',
53
								'value2' =>''
54
								));
55
		}
56
		
57
	}
58
	
59
	/**
60
	 * Define Review validation rule
61
	 * Should also define status "Not Done" as default answer as this method will be called at review delete as well
62
	 * {@inheritDoc}
63
	 * @see Form_Processor::setVisitValidation()
64
	 */
65
	public function setVisitValidation() {
66
		/*
67
	     * Possible to get all saved form with $datas=$this->getAllValidatedFormsOfVisit();
68
	     * then need to set each rule for Not Done, Ongoing, Wait Adjudication, Done with $this->changeVisitValidationStatus(Visit::REVIEW_DONE);
69
	    */
70
		
71
		
72
	}
73
	
74
	
75
	
76
	
77
}