@@ -29,31 +29,31 @@ |
||
29 | 29 | $course_info = api_get_course_info(); |
30 | 30 | |
31 | 31 | if (empty($course_info)) { |
32 | - api_not_allowed(true); |
|
32 | + api_not_allowed(true); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | $tbl_student_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION); |
36 | 36 | |
37 | 37 | if (!empty($course_info['real_id'])) { |
38 | - $sql = 'SELECT * FROM '.$tbl_student_publication.' WHERE c_id = '.$course_info['real_id'].' AND id = "'.$id.'"'; |
|
39 | - $result = Database::query($sql); |
|
40 | - if ($result && Database::num_rows($result)) { |
|
41 | - $row = Database::fetch_array($result, 'ASSOC'); |
|
38 | + $sql = 'SELECT * FROM '.$tbl_student_publication.' WHERE c_id = '.$course_info['real_id'].' AND id = "'.$id.'"'; |
|
39 | + $result = Database::query($sql); |
|
40 | + if ($result && Database::num_rows($result)) { |
|
41 | + $row = Database::fetch_array($result, 'ASSOC'); |
|
42 | 42 | $full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.$row['url']; |
43 | 43 | |
44 | 44 | $item_info = api_get_item_property_info(api_get_course_int_id(), 'work', $row['id']); |
45 | 45 | if (empty($item_info)) { |
46 | 46 | exit; |
47 | 47 | } |
48 | - if ($course_info['show_score'] == 0 || $item_info['visibility'] == 1 && $row['accepted'] == 1 && ($row['user_id'] == api_get_user_id() || api_is_allowed_to_edit())) { |
|
49 | - $title = str_replace(' ', '_', $row['title']); |
|
48 | + if ($course_info['show_score'] == 0 || $item_info['visibility'] == 1 && $row['accepted'] == 1 && ($row['user_id'] == api_get_user_id() || api_is_allowed_to_edit())) { |
|
49 | + $title = str_replace(' ', '_', $row['title']); |
|
50 | 50 | event_download($title); |
51 | - if (Security::check_abs_path($full_file_name, api_get_path(SYS_COURSE_PATH).api_get_course_path().'/')) { |
|
52 | - DocumentManager::file_send_for_download($full_file_name, true, $title); |
|
53 | - } |
|
54 | - } else { |
|
51 | + if (Security::check_abs_path($full_file_name, api_get_path(SYS_COURSE_PATH).api_get_course_path().'/')) { |
|
52 | + DocumentManager::file_send_for_download($full_file_name, true, $title); |
|
53 | + } |
|
54 | + } else { |
|
55 | 55 | api_not_allowed(); |
56 | 56 | } |
57 | - } |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | exit; |
60 | 60 | \ No newline at end of file |
@@ -1,62 +1,62 @@ discard block |
||
1 | 1 | <?php |
2 | - /* |
|
2 | + /* |
|
3 | 3 | Module Compilatio v0.9 pour Dokeos |
4 | 4 | */ |
5 | - /* |
|
5 | + /* |
|
6 | 6 | * admin's section: allow to see the credit's quota and do a SOAP's connection test |
7 | 7 | * Partie admin: permet de voir le quotas de cr?dit et de faire un test de connexion SOAP |
8 | 8 | */ |
9 | - ini_set('soap.wsdl_cache_enabled', 0); |
|
10 | - ini_set('default_socket_timeout', '1000'); |
|
9 | + ini_set('soap.wsdl_cache_enabled', 0); |
|
10 | + ini_set('default_socket_timeout', '1000'); |
|
11 | 11 | |
12 | - require_once '../../inc/lib/api.lib.php'; |
|
13 | - require_once '../compilatio/compilatio.class.php'; |
|
14 | - require_once '../compilatio/config.php'; |
|
12 | + require_once '../../inc/lib/api.lib.php'; |
|
13 | + require_once '../compilatio/compilatio.class.php'; |
|
14 | + require_once '../compilatio/config.php'; |
|
15 | 15 | |
16 | - $compilatio = new compilatio( |
|
17 | - $compilatioParameter['key'], |
|
18 | - $compilatioParameter['$urlsoap'], |
|
19 | - $compilatioParameter['proxy_host'], |
|
20 | - $compilatioParameter['proxy_port'] |
|
21 | - ); |
|
22 | - $use_space = number_format($quotas->usedSpace/1000000, 2); |
|
23 | - $total_space=$quotas->space/1000000; |
|
16 | + $compilatio = new compilatio( |
|
17 | + $compilatioParameter['key'], |
|
18 | + $compilatioParameter['$urlsoap'], |
|
19 | + $compilatioParameter['proxy_host'], |
|
20 | + $compilatioParameter['proxy_port'] |
|
21 | + ); |
|
22 | + $use_space = number_format($quotas->usedSpace/1000000, 2); |
|
23 | + $total_space=$quotas->space/1000000; |
|
24 | 24 | |
25 | - echo "<h3>" . get_lang('compilatioDescription') . "</h3>"; |
|
25 | + echo "<h3>" . get_lang('compilatioDescription') . "</h3>"; |
|
26 | 26 | |
27 | - echo "<b>" |
|
28 | - . get_lang('compilatioQuota') |
|
29 | - . ":" |
|
30 | - . " </b><br>" |
|
31 | - . get_lang('compilatioCredit') |
|
32 | - . ": " |
|
33 | - . $quotas->usedCredits |
|
34 | - . get_lang('compilatioOn') |
|
35 | - . $quotas->credits; |
|
27 | + echo "<b>" |
|
28 | + . get_lang('compilatioQuota') |
|
29 | + . ":" |
|
30 | + . " </b><br>" |
|
31 | + . get_lang('compilatioCredit') |
|
32 | + . ": " |
|
33 | + . $quotas->usedCredits |
|
34 | + . get_lang('compilatioOn') |
|
35 | + . $quotas->credits; |
|
36 | 36 | |
37 | 37 | ?> |
38 | 38 | <br><br> |
39 | 39 | <? |
40 | - if(!isset($_GET['action'])) |
|
41 | - { |
|
40 | + if(!isset($_GET['action'])) |
|
41 | + { |
|
42 | 42 | ?> |
43 | 43 | <body style="margin:0px;padding:0px"> |
44 | 44 | <form style="margin:0px;" method="GET"> |
45 | 45 | <input type="submit" name="action" value="Test de Connexion SOAP"> |
46 | 46 | </form> |
47 | 47 | <? |
48 | - } else { |
|
49 | - echo get_lang('compilatioConnectionTestSoap')."<br>"; |
|
50 | - echo "1) ".get_lang('compilatioServerConnection')."<br>"; |
|
51 | - $compilatio = new compilatio( |
|
52 | - $compilatioParameter['key'], |
|
53 | - $compilatioParameter['$urlsoap'], |
|
54 | - $compilatioParameter['proxy_host'], |
|
55 | - $compilatioParameter['proxy_port'] |
|
56 | - ); |
|
48 | + } else { |
|
49 | + echo get_lang('compilatioConnectionTestSoap')."<br>"; |
|
50 | + echo "1) ".get_lang('compilatioServerConnection')."<br>"; |
|
51 | + $compilatio = new compilatio( |
|
52 | + $compilatioParameter['key'], |
|
53 | + $compilatioParameter['$urlsoap'], |
|
54 | + $compilatioParameter['proxy_host'], |
|
55 | + $compilatioParameter['proxy_port'] |
|
56 | + ); |
|
57 | 57 | |
58 | - if ($compilatio) |
|
59 | - { |
|
58 | + if ($compilatio) |
|
59 | + { |
|
60 | 60 | echo get_lang('compilatioConnectionAccomplished')."<br>"; |
61 | 61 | echo "2) ".get_lang('compilatioSendTextToServer')."<br>"; |
62 | 62 | $text = get_lang('compilatioTestSendText'). $compilatioParameter['key']; |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | $text |
69 | 69 | ); |
70 | 70 | if (isMd5($id_compi)) { |
71 | - echo get_lang('compilatioSuccessfulTransfer')."<br>"; |
|
71 | + echo get_lang('compilatioSuccessfulTransfer')."<br>"; |
|
72 | 72 | } else { |
73 | - echo get_lang('compilatioFailedTransfer')."<br>"; |
|
73 | + echo get_lang('compilatioFailedTransfer')."<br>"; |
|
74 | 74 | } |
75 | - } else { |
|
75 | + } else { |
|
76 | 76 | echo get_lang('compilatioNotConnection')."<br>"; |
77 | 77 | echo get_lang('compilatioParamVerification')."<br>"; |
78 | - } |
|
78 | + } |
|
79 | 79 | } |
80 | 80 | ?> |
81 | 81 | </body> |
@@ -1,19 +1,19 @@ discard block |
||
1 | 1 | <?php |
2 | - /** |
|
3 | - * Description: |
|
4 | - * build the comunication with the SOAP server Compilatio.net |
|
5 | - * call severals methods for the file management in Compilatio.net |
|
6 | - * |
|
7 | - * Date: 26/05/16 |
|
8 | - * @version:1.0 |
|
9 | - */ |
|
2 | + /** |
|
3 | + * Description: |
|
4 | + * build the comunication with the SOAP server Compilatio.net |
|
5 | + * call severals methods for the file management in Compilatio.net |
|
6 | + * |
|
7 | + * Date: 26/05/16 |
|
8 | + * @version:1.0 |
|
9 | + */ |
|
10 | 10 | |
11 | - class compilatio |
|
12 | - { |
|
13 | - /*Identification key for the Compilatio account*/ |
|
14 | - var $key = null; |
|
15 | - /*Webservice connection*/ |
|
16 | - var $soapcli; |
|
11 | + class compilatio |
|
12 | + { |
|
13 | + /*Identification key for the Compilatio account*/ |
|
14 | + var $key = null; |
|
15 | + /*Webservice connection*/ |
|
16 | + var $soapcli; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * compilatio constructor. |
@@ -22,338 +22,338 @@ discard block |
||
22 | 22 | * @param $proxyHost |
23 | 23 | * @param $proxyPort |
24 | 24 | */ |
25 | - function compilatio($key, $urlsoap, $proxyHost, $proxyPort) |
|
26 | - { |
|
27 | - try |
|
28 | - { |
|
29 | - if(!empty($key)){ |
|
30 | - $this->key = $key; |
|
31 | - if(!empty($urlsoap)){ |
|
32 | - if(!empty($proxyHost)) { |
|
33 | - $param = array('trace' => false, |
|
34 | - 'soap_version' => SOAP_1_2, |
|
35 | - 'exceptions' => true, |
|
36 | - 'proxy_host' => '"' . $proxyHost . '"', |
|
37 | - 'proxy_port' => $proxyPort); |
|
38 | - } else { |
|
39 | - $param = array('trace' => false, |
|
40 | - 'soap_version' => SOAP_1_2, |
|
41 | - 'exceptions' => true); |
|
42 | - } |
|
43 | - $this->soapcli = new SoapClient($urlsoap,$param); |
|
44 | - }else{ |
|
45 | - $this->soapcli = 'WS urlsoap not available' ; |
|
46 | - } |
|
47 | - }else{ |
|
48 | - $this->soapcli ='API key not available'; |
|
49 | - } |
|
50 | - } |
|
51 | - catch (SoapFault $fault) |
|
52 | - { |
|
53 | - $this->soapcli = "Error constructor compilatio " . $fault->faultcode ." " .$fault->faultstring ; |
|
54 | - } |
|
55 | - catch (Exception $e) { |
|
56 | - $this->soapcli = "Error constructor compilatio with urlsoap" . $urlsoap; |
|
57 | - } |
|
58 | - } |
|
25 | + function compilatio($key, $urlsoap, $proxyHost, $proxyPort) |
|
26 | + { |
|
27 | + try |
|
28 | + { |
|
29 | + if(!empty($key)){ |
|
30 | + $this->key = $key; |
|
31 | + if(!empty($urlsoap)){ |
|
32 | + if(!empty($proxyHost)) { |
|
33 | + $param = array('trace' => false, |
|
34 | + 'soap_version' => SOAP_1_2, |
|
35 | + 'exceptions' => true, |
|
36 | + 'proxy_host' => '"' . $proxyHost . '"', |
|
37 | + 'proxy_port' => $proxyPort); |
|
38 | + } else { |
|
39 | + $param = array('trace' => false, |
|
40 | + 'soap_version' => SOAP_1_2, |
|
41 | + 'exceptions' => true); |
|
42 | + } |
|
43 | + $this->soapcli = new SoapClient($urlsoap,$param); |
|
44 | + }else{ |
|
45 | + $this->soapcli = 'WS urlsoap not available' ; |
|
46 | + } |
|
47 | + }else{ |
|
48 | + $this->soapcli ='API key not available'; |
|
49 | + } |
|
50 | + } |
|
51 | + catch (SoapFault $fault) |
|
52 | + { |
|
53 | + $this->soapcli = "Error constructor compilatio " . $fault->faultcode ." " .$fault->faultstring ; |
|
54 | + } |
|
55 | + catch (Exception $e) { |
|
56 | + $this->soapcli = "Error constructor compilatio with urlsoap" . $urlsoap; |
|
57 | + } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | |
61 | - /** |
|
62 | - * Method for the file load |
|
63 | - * |
|
64 | - * @param $title |
|
65 | - * @param $description |
|
66 | - * @param $filename |
|
61 | + /** |
|
62 | + * Method for the file load |
|
63 | + * |
|
64 | + * @param $title |
|
65 | + * @param $description |
|
66 | + * @param $filename |
|
67 | 67 | * @param $mimeType |
68 | - * @param $content |
|
69 | - * @return string |
|
70 | - */ |
|
68 | + * @param $content |
|
69 | + * @return string |
|
70 | + */ |
|
71 | 71 | function sendDoc($title, $description, $filename, $mimeType, $content) |
72 | - { |
|
73 | - try |
|
74 | - { |
|
75 | - if (!is_object($this->soapcli)) |
|
76 | - return("Error in constructor compilatio() " . $this->soapcli); |
|
77 | - $idDocument = $this->soapcli->__call('addDocumentBase64', |
|
78 | - array( |
|
79 | - $this->key, |
|
80 | - utf8_encode(urlencode($title)), |
|
81 | - utf8_encode(urlencode($description)), |
|
82 | - utf8_encode(urlencode($filename)), |
|
72 | + { |
|
73 | + try |
|
74 | + { |
|
75 | + if (!is_object($this->soapcli)) |
|
76 | + return("Error in constructor compilatio() " . $this->soapcli); |
|
77 | + $idDocument = $this->soapcli->__call('addDocumentBase64', |
|
78 | + array( |
|
79 | + $this->key, |
|
80 | + utf8_encode(urlencode($title)), |
|
81 | + utf8_encode(urlencode($description)), |
|
82 | + utf8_encode(urlencode($filename)), |
|
83 | 83 | utf8_encode($mimeType), |
84 | - base64_encode($content) |
|
85 | - ) |
|
86 | - ); |
|
87 | - return $idDocument; |
|
88 | - } |
|
89 | - catch (SoapFault $fault) |
|
90 | - { |
|
84 | + base64_encode($content) |
|
85 | + ) |
|
86 | + ); |
|
87 | + return $idDocument; |
|
88 | + } |
|
89 | + catch (SoapFault $fault) |
|
90 | + { |
|
91 | 91 | return("Erreur sendDoc()" . $fault->faultcode ." " .$fault->faultstring); |
92 | - } |
|
93 | - } |
|
92 | + } |
|
93 | + } |
|
94 | 94 | |
95 | 95 | |
96 | - /** |
|
97 | - * Method for recover a document's information |
|
98 | - * @param $compiHash |
|
99 | - * @return string |
|
100 | - */ |
|
96 | + /** |
|
97 | + * Method for recover a document's information |
|
98 | + * @param $compiHash |
|
99 | + * @return string |
|
100 | + */ |
|
101 | 101 | function getDoc($compiHash) |
102 | - { |
|
103 | - try |
|
104 | - { |
|
105 | - if (!is_object($this->soapcli)){ |
|
106 | - return("Error in constructor compilatio() " . $this->soapcli); |
|
107 | - } |
|
108 | - $param = array($this->key, $compiHash); |
|
109 | - $idDocument = $this->soapcli->__call('getDocument', $param); |
|
110 | - return $idDocument; |
|
111 | - } |
|
112 | - catch (SoapFault $fault) |
|
113 | - { |
|
102 | + { |
|
103 | + try |
|
104 | + { |
|
105 | + if (!is_object($this->soapcli)){ |
|
106 | + return("Error in constructor compilatio() " . $this->soapcli); |
|
107 | + } |
|
108 | + $param = array($this->key, $compiHash); |
|
109 | + $idDocument = $this->soapcli->__call('getDocument', $param); |
|
110 | + return $idDocument; |
|
111 | + } |
|
112 | + catch (SoapFault $fault) |
|
113 | + { |
|
114 | 114 | return("Erreur getDoc()" . $fault->faultcode . " " .$fault->faultstring); |
115 | - } |
|
116 | - } |
|
115 | + } |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * method for recover an url document's report |
|
120 | - * @param $compiHash |
|
121 | - * @return string |
|
122 | - */ |
|
118 | + /** |
|
119 | + * method for recover an url document's report |
|
120 | + * @param $compiHash |
|
121 | + * @return string |
|
122 | + */ |
|
123 | 123 | function getReportUrl($compiHash) |
124 | - { |
|
125 | - try |
|
126 | - { |
|
127 | - if (!is_object($this->soapcli)){ |
|
128 | - return("Error in constructor compilatio() " . $this->soapcli); |
|
129 | - } |
|
130 | - $param = array($this->key,$compiHash); |
|
131 | - $idDocument = $this->soapcli->__call('getDocumentReportUrl', $param); |
|
132 | - return $idDocument; |
|
133 | - } |
|
134 | - catch (SoapFault $fault) |
|
135 | - { |
|
124 | + { |
|
125 | + try |
|
126 | + { |
|
127 | + if (!is_object($this->soapcli)){ |
|
128 | + return("Error in constructor compilatio() " . $this->soapcli); |
|
129 | + } |
|
130 | + $param = array($this->key,$compiHash); |
|
131 | + $idDocument = $this->soapcli->__call('getDocumentReportUrl', $param); |
|
132 | + return $idDocument; |
|
133 | + } |
|
134 | + catch (SoapFault $fault) |
|
135 | + { |
|
136 | 136 | return("Erreur getReportUrl()" . $fault->faultcode ." " .$fault->faultstring); |
137 | - } |
|
138 | - } |
|
137 | + } |
|
138 | + } |
|
139 | 139 | |
140 | - /** |
|
141 | - * Method for deleting a Compialtio's account document |
|
142 | - * @param $compiHash |
|
143 | - * @return string |
|
144 | - */ |
|
140 | + /** |
|
141 | + * Method for deleting a Compialtio's account document |
|
142 | + * @param $compiHash |
|
143 | + * @return string |
|
144 | + */ |
|
145 | 145 | function deldoc($compiHash) |
146 | - { |
|
147 | - try |
|
148 | - { |
|
149 | - if (!is_object($this->soapcli)){ |
|
150 | - return("Error in constructor compilatio() " . $this->soapcli); |
|
151 | - } |
|
152 | - $param = array($this->key,$compiHash); |
|
153 | - $this->soapcli->__call('deleteDocument', $param); |
|
154 | - } |
|
155 | - catch (SoapFault $fault) |
|
156 | - { |
|
146 | + { |
|
147 | + try |
|
148 | + { |
|
149 | + if (!is_object($this->soapcli)){ |
|
150 | + return("Error in constructor compilatio() " . $this->soapcli); |
|
151 | + } |
|
152 | + $param = array($this->key,$compiHash); |
|
153 | + $this->soapcli->__call('deleteDocument', $param); |
|
154 | + } |
|
155 | + catch (SoapFault $fault) |
|
156 | + { |
|
157 | 157 | return("Erreur deldoc()" . $fault->faultcode . " " .$fault->faultstring); |
158 | - } |
|
159 | - } |
|
158 | + } |
|
159 | + } |
|
160 | 160 | |
161 | - /** |
|
162 | - * Method for start the analysis for a document |
|
163 | - * @param $compiHash |
|
164 | - * @return string |
|
165 | - */ |
|
161 | + /** |
|
162 | + * Method for start the analysis for a document |
|
163 | + * @param $compiHash |
|
164 | + * @return string |
|
165 | + */ |
|
166 | 166 | function startAnalyse($compiHash) |
167 | - { |
|
168 | - try |
|
169 | - { |
|
170 | - if (!is_object($this->soapcli)){ |
|
171 | - return("Error in constructor compilatio() " . $this->soapcli); |
|
172 | - } |
|
173 | - $param = array($this->key,$compiHash); |
|
167 | + { |
|
168 | + try |
|
169 | + { |
|
170 | + if (!is_object($this->soapcli)){ |
|
171 | + return("Error in constructor compilatio() " . $this->soapcli); |
|
172 | + } |
|
173 | + $param = array($this->key,$compiHash); |
|
174 | 174 | $this->soapcli->__call('startDocumentAnalyse', $param); |
175 | - } |
|
176 | - catch (SoapFault $fault) |
|
177 | - { |
|
175 | + } |
|
176 | + catch (SoapFault $fault) |
|
177 | + { |
|
178 | 178 | return("Erreur startAnalyse()" . $fault->faultcode ." " .$fault->faultstring); |
179 | - } |
|
180 | - } |
|
179 | + } |
|
180 | + } |
|
181 | 181 | |
182 | - /** |
|
183 | - * Method for recover the account's quota |
|
184 | - * @return string |
|
185 | - */ |
|
182 | + /** |
|
183 | + * Method for recover the account's quota |
|
184 | + * @return string |
|
185 | + */ |
|
186 | 186 | function getQuotas() |
187 | - { |
|
188 | - try |
|
189 | - { |
|
190 | - if (!is_object($this->soapcli)){ |
|
191 | - return("Error in constructor compilatio() " . $this->soapcli); |
|
192 | - } |
|
193 | - $param=array($this->key); |
|
187 | + { |
|
188 | + try |
|
189 | + { |
|
190 | + if (!is_object($this->soapcli)){ |
|
191 | + return("Error in constructor compilatio() " . $this->soapcli); |
|
192 | + } |
|
193 | + $param=array($this->key); |
|
194 | 194 | $resultat=$this->soapcli->__call('getAccountQuotas', $param); |
195 | - return $resultat; |
|
196 | - } |
|
197 | - catch (SoapFault $fault) |
|
198 | - { |
|
195 | + return $resultat; |
|
196 | + } |
|
197 | + catch (SoapFault $fault) |
|
198 | + { |
|
199 | 199 | return("Erreur getQuotas()" . $fault->faultcode ." " .$fault->faultstring); |
200 | - } |
|
201 | - } |
|
200 | + } |
|
201 | + } |
|
202 | 202 | |
203 | - } |
|
203 | + } |
|
204 | 204 | |
205 | - /** |
|
206 | - * Method for identify a file extension and the possibility that the document can be managed by Compilatio |
|
207 | - * @param $filename |
|
208 | - * @return bool |
|
209 | - */ |
|
205 | + /** |
|
206 | + * Method for identify a file extension and the possibility that the document can be managed by Compilatio |
|
207 | + * @param $filename |
|
208 | + * @return bool |
|
209 | + */ |
|
210 | 210 | function verifiFileType($filename) |
211 | - { |
|
212 | - $types = array("doc","docx", "rtf", "xls", "xlsx", "ppt", "pptx", "odt", "pdf", "txt", "htm", "html"); |
|
213 | - $extension = substr($filename, strrpos($filename, ".")+1); |
|
214 | - $extension = strtolower($extension); |
|
215 | - if (in_array($extension, $types)) { |
|
216 | - return true; |
|
217 | - } else { |
|
218 | - return false; |
|
219 | - } |
|
220 | - } |
|
211 | + { |
|
212 | + $types = array("doc","docx", "rtf", "xls", "xlsx", "ppt", "pptx", "odt", "pdf", "txt", "htm", "html"); |
|
213 | + $extension = substr($filename, strrpos($filename, ".")+1); |
|
214 | + $extension = strtolower($extension); |
|
215 | + if (in_array($extension, $types)) { |
|
216 | + return true; |
|
217 | + } else { |
|
218 | + return false; |
|
219 | + } |
|
220 | + } |
|
221 | 221 | |
222 | - /** |
|
223 | - * Fonction affichage de la barre de progression d'analyse version 3.1 |
|
224 | - * |
|
225 | - * @param $statut From the document |
|
226 | - * @param $pour |
|
227 | - * @param $imagesPath |
|
228 | - * @param $text Array includes the extract from the text |
|
229 | - * @return unknown_type |
|
230 | - */ |
|
231 | - function getProgressionAnalyseDocv31($status, $pour = 0, $imagesPath = '', $text = '') |
|
232 | - { |
|
222 | + /** |
|
223 | + * Fonction affichage de la barre de progression d'analyse version 3.1 |
|
224 | + * |
|
225 | + * @param $statut From the document |
|
226 | + * @param $pour |
|
227 | + * @param $imagesPath |
|
228 | + * @param $text Array includes the extract from the text |
|
229 | + * @return unknown_type |
|
230 | + */ |
|
231 | + function getProgressionAnalyseDocv31($status, $pour = 0, $imagesPath = '', $text = '') |
|
232 | + { |
|
233 | 233 | |
234 | - $refreshReturn = "<a href='javascript:window.location.reload(false);'><img src='" |
|
235 | - .$imagesPath |
|
236 | - ."ajax-loader_green.gif' title='" |
|
237 | - . $text['refresh'] |
|
238 | - . "' alt='" |
|
239 | - . $text['refresh'] |
|
240 | - . "'/></a> "; |
|
234 | + $refreshReturn = "<a href='javascript:window.location.reload(false);'><img src='" |
|
235 | + .$imagesPath |
|
236 | + ."ajax-loader_green.gif' title='" |
|
237 | + . $text['refresh'] |
|
238 | + . "' alt='" |
|
239 | + . $text['refresh'] |
|
240 | + . "'/></a> "; |
|
241 | 241 | $startReturn = "<table cellpadding='0' cellspacing='0' style='border:0;margin:0;padding:0;'><tr>"; |
242 | 242 | $startReturn .= "<td width='25' style='border:0;margin:0;padding:0;'> </td>"; |
243 | 243 | $startReturn .= "<td valign='middle' align='right' style='border:0;margin:0;padding-right:10px;'>" |
244 | - .$refreshReturn |
|
245 | - ."</td>"; |
|
244 | + .$refreshReturn |
|
245 | + ."</td>"; |
|
246 | 246 | $startReturn .= "<td style='border:0;margin:0;padding:0;'>"; |
247 | 247 | $startReturnLittleWidth = "<table cellpadding='0' cellspacing='0' style='border:0;margin:0;padding:0;'><tr>"; |
248 | 248 | $startReturnLittleWidth .= "<td width='25' valign='middle' align='right' style='border:0;margin:0;padding:0;'>" |
249 | - .$refreshReturn |
|
250 | - ."</td>"; |
|
251 | - $finretour = "</td></tr></table>"; |
|
252 | - if($status == "ANALYSE_IN_QUEUE" ){ |
|
253 | - return $startReturn . "<span style='font-size:11px'>" . $text['analysisinqueue'] . "</span>" . $finretour; |
|
254 | - } |
|
255 | - if($status == "ANALYSE_PROCESSING" ){ |
|
256 | - if($pour == 100){ |
|
257 | - return $startReturn |
|
258 | - . "<span style='font-size:11px'>" |
|
259 | - . $text['analysisinfinalization'] |
|
260 | - . "</span>" |
|
261 | - . $finretour; |
|
262 | - } else { |
|
263 | - return $startReturnLittleWidth |
|
249 | + .$refreshReturn |
|
250 | + ."</td>"; |
|
251 | + $finretour = "</td></tr></table>"; |
|
252 | + if($status == "ANALYSE_IN_QUEUE" ){ |
|
253 | + return $startReturn . "<span style='font-size:11px'>" . $text['analysisinqueue'] . "</span>" . $finretour; |
|
254 | + } |
|
255 | + if($status == "ANALYSE_PROCESSING" ){ |
|
256 | + if($pour == 100){ |
|
257 | + return $startReturn |
|
258 | + . "<span style='font-size:11px'>" |
|
259 | + . $text['analysisinfinalization'] |
|
260 | + . "</span>" |
|
261 | + . $finretour; |
|
262 | + } else { |
|
263 | + return $startReturnLittleWidth |
|
264 | 264 | . "<td align=\"right\" style=\"border:0;margin:0;padding-right:10px;\">" |
265 | - . $pour |
|
265 | + . $pour |
|
266 | 266 | . "%</td><td style=\"border:0;margin:0;padding:0;\"><div style=\"background" |
267 | - . ":transparent url(" |
|
268 | - . $imagesPath |
|
269 | - . "mini-jauge_fond.png) no-repeat scroll 0;height:12px;padding:0 0 0 2px;width:55px;\"><div style=\"" |
|
270 | - . "background:transparent url(" |
|
271 | - . $imagesPath |
|
272 | - . "mini-jauge_gris.png) no-repeat scroll 0;height:12px;width:" |
|
273 | - . $pour/2 |
|
274 | - . "px;\"></div></div>" |
|
275 | - . $finretour; |
|
276 | - } |
|
277 | - } |
|
278 | - } |
|
267 | + . ":transparent url(" |
|
268 | + . $imagesPath |
|
269 | + . "mini-jauge_fond.png) no-repeat scroll 0;height:12px;padding:0 0 0 2px;width:55px;\"><div style=\"" |
|
270 | + . "background:transparent url(" |
|
271 | + . $imagesPath |
|
272 | + . "mini-jauge_gris.png) no-repeat scroll 0;height:12px;width:" |
|
273 | + . $pour/2 |
|
274 | + . "px;\"></div></div>" |
|
275 | + . $finretour; |
|
276 | + } |
|
277 | + } |
|
278 | + } |
|
279 | 279 | |
280 | - /** |
|
281 | - * Method for display the PomprseuilmankBar (% de plagiat) |
|
282 | - * |
|
283 | - * @param $percentagePumping |
|
284 | - * @param $weakThreshold |
|
285 | - * @param $highThreshold |
|
286 | - * @param $imagesPath |
|
287 | - * @param $text : array includes the extract from the text |
|
288 | - * @return unknown_type |
|
289 | - */ |
|
290 | - function getPomprankBarv31($pourcentagePompage, $weakThreshold, $highThreshold, $chemin_images='',$texte='') { |
|
280 | + /** |
|
281 | + * Method for display the PomprseuilmankBar (% de plagiat) |
|
282 | + * |
|
283 | + * @param $percentagePumping |
|
284 | + * @param $weakThreshold |
|
285 | + * @param $highThreshold |
|
286 | + * @param $imagesPath |
|
287 | + * @param $text : array includes the extract from the text |
|
288 | + * @return unknown_type |
|
289 | + */ |
|
290 | + function getPomprankBarv31($pourcentagePompage, $weakThreshold, $highThreshold, $chemin_images='',$texte='') { |
|
291 | 291 | |
292 | - $pourcentagePompage = round($pourcentagePompage); |
|
293 | - $pour = round((50*$pourcentagePompage)/100); |
|
294 | - $return = ""; |
|
295 | - $couleur = ""; |
|
296 | - if($pourcentagePompage < $weakThreshold) { |
|
297 | - $couleur = "vert"; |
|
298 | - } else if($pourcentagePompage >= $weakThreshold && $pourcentagePompage < $highThreshold) { |
|
299 | - $couleur = "orange"; |
|
300 | - } else { |
|
301 | - $couleur = "rouge"; |
|
302 | - } |
|
303 | - $return .= "<div style='float:left;margin-right:2px;'><img src='" |
|
304 | - . $chemin_images."mini-drapeau_$couleur.png' title='" |
|
305 | - . $texte['result'] |
|
306 | - . "' alt='faible' width='15' height='15' /></div>"; |
|
307 | - $return .= "<div style='float:left; margin-right:5px;width:45px;text-align:right;'>" |
|
308 | - . $pourcentagePompage |
|
309 | - . " %</div>"; |
|
310 | - $return .= "<div style='float:left;background:transparent url(" |
|
311 | - . $chemin_images |
|
312 | - . "mini-jauge_fond.png) no-repeat scroll 0;height:12px;margin-top:5px;padding:0 0 0 2px;width:55px;'>"; |
|
313 | - $return .= "<div style='float:left;background:transparent url(" |
|
314 | - . $chemin_images |
|
315 | - . "mini-jauge_" |
|
316 | - . $couleur |
|
317 | - . ".png) no-repeat scroll 0;height:12px;width:" |
|
318 | - . $pour |
|
319 | - . "px'></div></div>"; |
|
292 | + $pourcentagePompage = round($pourcentagePompage); |
|
293 | + $pour = round((50*$pourcentagePompage)/100); |
|
294 | + $return = ""; |
|
295 | + $couleur = ""; |
|
296 | + if($pourcentagePompage < $weakThreshold) { |
|
297 | + $couleur = "vert"; |
|
298 | + } else if($pourcentagePompage >= $weakThreshold && $pourcentagePompage < $highThreshold) { |
|
299 | + $couleur = "orange"; |
|
300 | + } else { |
|
301 | + $couleur = "rouge"; |
|
302 | + } |
|
303 | + $return .= "<div style='float:left;margin-right:2px;'><img src='" |
|
304 | + . $chemin_images."mini-drapeau_$couleur.png' title='" |
|
305 | + . $texte['result'] |
|
306 | + . "' alt='faible' width='15' height='15' /></div>"; |
|
307 | + $return .= "<div style='float:left; margin-right:5px;width:45px;text-align:right;'>" |
|
308 | + . $pourcentagePompage |
|
309 | + . " %</div>"; |
|
310 | + $return .= "<div style='float:left;background:transparent url(" |
|
311 | + . $chemin_images |
|
312 | + . "mini-jauge_fond.png) no-repeat scroll 0;height:12px;margin-top:5px;padding:0 0 0 2px;width:55px;'>"; |
|
313 | + $return .= "<div style='float:left;background:transparent url(" |
|
314 | + . $chemin_images |
|
315 | + . "mini-jauge_" |
|
316 | + . $couleur |
|
317 | + . ".png) no-repeat scroll 0;height:12px;width:" |
|
318 | + . $pour |
|
319 | + . "px'></div></div>"; |
|
320 | 320 | |
321 | - return $return; |
|
322 | - } |
|
323 | - /* |
|
321 | + return $return; |
|
322 | + } |
|
323 | + /* |
|
324 | 324 | * Method for validation of hash |
325 | 325 | * @param $hash |
326 | 326 | * @return bool |
327 | 327 | * |
328 | 328 | */ |
329 | - function isMd5($hash) |
|
330 | - { |
|
331 | - if(preg_match('`^[a-f0-9]{32}$`', $hash)) { |
|
332 | - return true; |
|
333 | - } else { |
|
334 | - return false; |
|
335 | - } |
|
336 | - } |
|
337 | - /* |
|
329 | + function isMd5($hash) |
|
330 | + { |
|
331 | + if(preg_match('`^[a-f0-9]{32}$`', $hash)) { |
|
332 | + return true; |
|
333 | + } else { |
|
334 | + return false; |
|
335 | + } |
|
336 | + } |
|
337 | + /* |
|
338 | 338 | * Method for identify Internet media type |
339 | 339 | * @param $filename |
340 | 340 | */ |
341 | - function typeMime($filename) |
|
342 | - { |
|
343 | - if (preg_match("@Opera(/| )([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)){ |
|
344 | - $navigateur = "Opera"; |
|
345 | - } elseif (preg_match("@MSIE ([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)){ |
|
346 | - $navigateur = "Internet Explorer"; |
|
347 | - } else { |
|
348 | - $navigateur = "Mozilla"; |
|
349 | - $mime = parse_ini_file("mime.ini"); |
|
350 | - $extension = substr($filename, strrpos($filename, ".")+1); |
|
351 | - } |
|
352 | - if(array_key_exists($extension, $mime)) { |
|
353 | - $type = $mime[$extension]; |
|
354 | - } else { |
|
355 | - $type = ($navigateur!="Mozilla") ? 'application/octetstream' : 'application/octet-stream'; |
|
356 | - } |
|
357 | - return $type; |
|
358 | - } |
|
341 | + function typeMime($filename) |
|
342 | + { |
|
343 | + if (preg_match("@Opera(/| )([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)){ |
|
344 | + $navigateur = "Opera"; |
|
345 | + } elseif (preg_match("@MSIE ([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)){ |
|
346 | + $navigateur = "Internet Explorer"; |
|
347 | + } else { |
|
348 | + $navigateur = "Mozilla"; |
|
349 | + $mime = parse_ini_file("mime.ini"); |
|
350 | + $extension = substr($filename, strrpos($filename, ".")+1); |
|
351 | + } |
|
352 | + if(array_key_exists($extension, $mime)) { |
|
353 | + $type = $mime[$extension]; |
|
354 | + } else { |
|
355 | + $type = ($navigateur!="Mozilla") ? 'application/octetstream' : 'application/octet-stream'; |
|
356 | + } |
|
357 | + return $type; |
|
358 | + } |
|
359 | 359 | ?> |
360 | 360 | \ No newline at end of file |
@@ -151,28 +151,28 @@ discard block |
||
151 | 151 | } else { |
152 | 152 | //non multiple |
153 | 153 | |
154 | - $documentId = $_GET['doc']; |
|
155 | - compilatioUpdateWorkDocument($documentId, $coursId); |
|
156 | - $workTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION); |
|
157 | - $query = "SELECT * FROM " |
|
154 | + $documentId = $_GET['doc']; |
|
155 | + compilatioUpdateWorkDocument($documentId, $coursId); |
|
156 | + $workTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION); |
|
157 | + $query = "SELECT * FROM " |
|
158 | 158 | . $workTable |
159 | 159 | . " WHERE id='" |
160 | 160 | . $documentId |
161 | 161 | . "' AND c_id=" |
162 | 162 | . $coursId; |
163 | - $sqlResult = Database::query($query); |
|
164 | - $doc = Database::fetch_object($sqlResult); |
|
165 | - $currentCourseRepositoryWeb = api_get_path(WEB_COURSE_PATH) . $_course["path"] . "/"; |
|
166 | - $WrkUrl = $currentCourseRepositoryWeb . $doc->url; |
|
167 | - $WrkTitle = $doc->title; |
|
168 | - $LocalWrkUrl = api_get_path(SYS_COURSE_PATH).$_course["path"] . "/" . $doc->url; |
|
169 | - $mime = typeMime($WrkTitle); |
|
170 | - $compilatio = new compilatio( |
|
163 | + $sqlResult = Database::query($query); |
|
164 | + $doc = Database::fetch_object($sqlResult); |
|
165 | + $currentCourseRepositoryWeb = api_get_path(WEB_COURSE_PATH) . $_course["path"] . "/"; |
|
166 | + $WrkUrl = $currentCourseRepositoryWeb . $doc->url; |
|
167 | + $WrkTitle = $doc->title; |
|
168 | + $LocalWrkUrl = api_get_path(SYS_COURSE_PATH).$_course["path"] . "/" . $doc->url; |
|
169 | + $mime = typeMime($WrkTitle); |
|
170 | + $compilatio = new compilatio( |
|
171 | 171 | $compilatioParameter['key'], |
172 | 172 | $compilatioParameter['$urlsoap'], |
173 | 173 | $compilatioParameter['proxy_host'], |
174 | 174 | $compilatioParameter['proxy_port']); |
175 | - if ($compilatioParameter['mode_transport'] == 'wget') { |
|
175 | + if ($compilatioParameter['mode_transport'] == 'wget') { |
|
176 | 176 | |
177 | 177 | if (strlen($compilatioParameter['wget_uri']) > 2) { |
178 | 178 | $filename = ereg_replace("/$", |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | $mime = "text/plain"; |
196 | 196 | $compilatioId = $compilatio->sendDoc($doc->title, '', $filename, $mime, 'get_url'); |
197 | 197 | } else { |
198 | - $pieces = explode("/", $doc->url); |
|
199 | - $nbPieces = count($pieces); |
|
200 | - $filename = $pieces[$nbPieces-1]; |
|
198 | + $pieces = explode("/", $doc->url); |
|
199 | + $nbPieces = count($pieces); |
|
200 | + $filename = $pieces[$nbPieces-1]; |
|
201 | 201 | $compilatioId = $compilatio->sendDoc($doc->title, '', $filename, $mime, file_get_contents($LocalWrkUrl)); |
202 | 202 | } |
203 | - $compTable = Database::get_course_table("plagiarism_compilatio_docs"); |
|
203 | + $compTable = Database::get_course_table("plagiarism_compilatio_docs"); |
|
204 | 204 | |
205 | - $sql4 = "INSERT INTO " |
|
205 | + $sql4 = "INSERT INTO " |
|
206 | 206 | . $compTable |
207 | 207 | . "(c_id, id_doc, compilatio_id) VALUES (" |
208 | 208 | . $coursId |
@@ -211,10 +211,10 @@ discard block |
||
211 | 211 | . "','" |
212 | 212 | . $compilatioId |
213 | 213 | . "')"; |
214 | - if (isMd5($compilatioId)) { |
|
214 | + if (isMd5($compilatioId)) { |
|
215 | 215 | Database::query($sql4); |
216 | - } else { |
|
217 | - $sql5 = "INSERT INTO " |
|
216 | + } else { |
|
217 | + $sql5 = "INSERT INTO " |
|
218 | 218 | . $compTable |
219 | 219 | . " (c_id, id_doc,compilatio_id) VALUES (" |
220 | 220 | . $coursId |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | ."','error')"; |
224 | 224 | Database::query($sql5); |
225 | 225 | |
226 | - } |
|
227 | - if (isMd5($compilatioId)) { |
|
226 | + } |
|
227 | + if (isMd5($compilatioId)) { |
|
228 | 228 | $soapRes = $compilatio->startAnalyse($compilatioId); |
229 | 229 | } else { |
230 | 230 | $typeMessage = 2; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | }else{ |
240 | 240 | $message = $msgWait; |
241 | 241 | Display::display_confirmation_message($message); |
242 | - } |
|
242 | + } |
|
243 | 243 | |
244 | 244 | } |
245 | 245 |