Piotr Labudda před 11 roky
rodič
revize
9b086a4694

+ 1 - 1
SE/VERSION

@@ -1 +1 @@
-3.9.6.2
+3.9.6.3

+ 2 - 1
SE/procesy/testy.php

@@ -59,7 +59,8 @@ function fun_CRM_TESTY_RELOGIN_AS_KANDYDAT() {
 		session_destroy();
 		session_start();
 
-		User::kandydatLogin($kandydat_id);
+		$errors = array();
+		User::kandydatLogin($kandydat_id, $errors);
 
 		if (User::logged()) {
 			// ok

+ 2 - 5
SE/se-lib/Column.php

@@ -377,10 +377,7 @@ public static function getInstance($table) {
 }
 
 
-/**
- * static
- */
-function saveColumn($table, $data) {
+public static function saveColumn($table, $data) {
 	// TODO: is_allowed
 	if (is_numeric($table)) {
 		// TODO: $_SESSION['PROCES_LOG'][$column_name] = $data;
@@ -392,7 +389,7 @@ function saveColumn($table, $data) {
 }
 
 
-function saveToAcl($table,$data) {
+public static function saveToAcl($table,$data) {
 	//wykrywamy czy ma dostepny proces do jakiejs komorki w tej tabeli
 		$userAcl = User::getAcl();
 		$tblAcl = $userAcl->getTableAcl(ProcesHelper::getZasobTableID($table));

+ 2 - 1
SE/se-lib/ProcesMenu.php

@@ -200,7 +200,8 @@ class ProcesMenu {
 		" . '</style>';
 
 		$userGroups = $this->_acl->fetchGroups();
-		$idZasobowUsera = reset(array_keys($userGroups));
+		$idZasobowUsera = array_keys($userGroups);
+		$idZasobowUsera = reset($idZasobowUsera);
 		?>
 <div class="container-fluid tbl-wyniki-testow">
 	<div class="row-fluid">

+ 13 - 35
SE/se-lib/ProcesTestyHelper.php

@@ -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

+ 2 - 2
SE/se-lib/User.php

@@ -257,8 +257,8 @@ class User {
 		}
 	}
 
-	public static function kandydatLogin($kandydatId, &$errors) {
-		$user = self::kandydatLoginByDB($kandydatId);
+	public static function kandydatLogin($kandydatId, &$errors = array()) {
+		$user = self::kandydatLoginByDB($kandydatId, $errors);
 		if ($user) {
 			$_SESSION['ADM_ID'] = $user->ID;
 			$_SESSION['AUTHORIZE_USER'] = $user->ADM_ACCOUNT;

binární
SE/superedit-software-640.jpg