|
|
@@ -9,7 +9,7 @@
|
|
|
class ProcesTestyHelper {
|
|
|
|
|
|
|
|
|
-function &get_kandydaci( $params = array() ) {
|
|
|
+public static function &get_kandydaci( $params = array() ) {
|
|
|
$ret = array();
|
|
|
$params['order by'] = V::get('order by', '', $params);
|
|
|
$allowed_order_by = array();
|
|
|
@@ -39,7 +39,7 @@ function &get_kandydaci( $params = array() ) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-function &get_testy_by_kandydat( $kandydat_id ) {
|
|
|
+public static function &get_testy_by_kandydat( $kandydat_id ) {
|
|
|
$params = array();
|
|
|
$params['id_tester'] = $kandydat_id;
|
|
|
$params['order_by'] = 'ID';
|
|
|
@@ -48,7 +48,7 @@ function &get_testy_by_kandydat( $kandydat_id ) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-function _get_testy_sql_where($params = array()) {
|
|
|
+public static function _get_testy_sql_where($params = array()) {
|
|
|
$sql_where = "1=1";
|
|
|
if (($id_tester = V::get('id_tester', 0, $params, 'int')) > 0) {
|
|
|
$sql_where .= " and t.`ID_TESTER`='{$id_tester}'";
|
|
|
@@ -59,7 +59,7 @@ function _get_testy_sql_where($params = array()) {
|
|
|
return $sql_where;
|
|
|
}
|
|
|
|
|
|
-function &get_testy_total( $params = array() ) {
|
|
|
+public static function &get_testy_total( $params = array() ) {
|
|
|
$ret = 0;
|
|
|
$sql_where = self::_get_testy_sql_where($params);
|
|
|
$db = DB::getDB();
|
|
|
@@ -77,7 +77,7 @@ function &get_testy_total( $params = array() ) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-function &get_testy( $params = array() ) {
|
|
|
+public static function &get_testy( $params = array() ) {
|
|
|
$ret = array();
|
|
|
$sql_select = array();
|
|
|
$sql_select []= "t.`ID`";
|
|
|
@@ -164,7 +164,7 @@ function &get_testy( $params = array() ) {
|
|
|
/**
|
|
|
* @return array( ID_PROCES => array( ID_PYTANIE => {ID,ODPOWIEDZ,ODP_0,ODP_1,ODP_2,ODP_3,ODP_4,OCENA} ) )
|
|
|
*/
|
|
|
-function &get_odpowiedzi( $test_id, $type = 'TEORETYCZNY' ) {
|
|
|
+public static function &get_odpowiedzi( $test_id, $type = 'TEORETYCZNY' ) {
|
|
|
$ret = array();
|
|
|
$sql_type = "";
|
|
|
$types_allowed = self::get_allowed_types();
|
|
|
@@ -198,29 +198,7 @@ function &get_odpowiedzi( $test_id, $type = 'TEORETYCZNY' ) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-// TODO: RMME @use get_odpowiedzi
|
|
|
-function &get_oceny( $test_id ) {
|
|
|
- $ret = array();
|
|
|
- $db = DB::getDB();
|
|
|
- $sql = "select
|
|
|
- odp.`ID_PYTANIE`
|
|
|
- , pyt.`ID_PROCES` as ID_PROCES
|
|
|
- , odp.`OCENA`
|
|
|
- from `CRM_TESTY_ODPOWIEDZI` as odp
|
|
|
- left join `CRM_TESTY_PYTANIA` as pyt on(pyt.`ID`=odp.`ID_PYTANIE`)
|
|
|
- where
|
|
|
- pyt.`ID` is not NULL
|
|
|
- and odp.`ID_TEST`='".$test_id."'
|
|
|
- ";
|
|
|
- $res = $db->query($sql);
|
|
|
- while ($r = $db->fetch($res)) {
|
|
|
- $ret[$r->ID_PROCES][$r->ID_PYTANIE] = $r->OCENA;
|
|
|
- }
|
|
|
- return $ret;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-function &get_pytania_by_proces_id( $proces_id, $type = 'TEORETYCZNY' ) {
|
|
|
+public static function &get_pytania_by_proces_id( $proces_id, $type = 'TEORETYCZNY' ) {
|
|
|
$ret = array();
|
|
|
$sql_type = "";
|
|
|
$types_allowed = self::get_allowed_types();
|
|
|
@@ -246,7 +224,7 @@ function &get_pytania_by_proces_id( $proces_id, $type = 'TEORETYCZNY' ) {
|
|
|
/**
|
|
|
* @param $pytania_id - array if int
|
|
|
*/
|
|
|
-function &get_pytania_by_id( $pytania_id ) {
|
|
|
+public static function &get_pytania_by_id( $pytania_id ) {
|
|
|
$ret = array();
|
|
|
if (empty($pytania_id)) return $ret;
|
|
|
// TODO: if int or array
|
|
|
@@ -269,7 +247,7 @@ function &get_pytania_by_id( $pytania_id ) {
|
|
|
/**
|
|
|
* Updates field TEST_PYTANIE in remote table.
|
|
|
*/
|
|
|
-function update_proces_stat($remote_id) {
|
|
|
+public static function update_proces_stat($remote_id) {
|
|
|
$db = DB::getDB();
|
|
|
$sql = "update `CRM_PROCES`
|
|
|
set `TEST_PYTANIE`=(
|
|
|
@@ -296,7 +274,7 @@ function update_proces_stat($remote_id) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-function delete_pytanie($id, $remote_id) {
|
|
|
+public static function delete_pytanie($id, $remote_id) {
|
|
|
$db = DB::getDB();
|
|
|
$sql = "delete from `CRM_TESTY_PYTANIA`
|
|
|
where
|
|
|
@@ -320,7 +298,7 @@ function delete_pytanie($id, $remote_id) {
|
|
|
* @param $selected_values - array of user selected values
|
|
|
* @returns null if pytanie is openm ale return integer value 0 - 3 (avg)
|
|
|
*/
|
|
|
-function ocen_pytanie(&$p, &$selected_values) {
|
|
|
+public static function ocen_pytanie(&$p, &$selected_values) {
|
|
|
$ret = null;
|
|
|
/**
|
|
|
* TODO: pokaz tylko odpowiedz udzielona przez kandydata i czy jest prawidlowa
|
|
|
@@ -352,7 +330,7 @@ function ocen_pytanie(&$p, &$selected_values) {
|
|
|
* CRM_TESTY_PYTANIA.TEST_TYPE
|
|
|
* CRM_TESTY.TEST_TYPE
|
|
|
*/
|
|
|
- function get_allowed_types() {
|
|
|
+ public static function get_allowed_types() {
|
|
|
$types_allowed = array('TEORETYCZNY'=>"Teoretyczny", 'PRAKTYCZNY'=>"Praktyczny");
|
|
|
return $types_allowed;
|
|
|
}
|
|
|
@@ -397,7 +375,7 @@ function ocen_pytanie(&$p, &$selected_values) {
|
|
|
* Remove tests which is unactual - proces or step has changed.
|
|
|
* @param $steps_ids
|
|
|
*/
|
|
|
- function get_max_update_date($steps_ids) {
|
|
|
+ public static function get_max_update_date($steps_ids) {
|
|
|
$max_update_date = null;
|
|
|
$db = DB::getDB();
|
|
|
$sql = "select max(p.`A_RECORD_UPDATE_DATE`) as max_update_date
|