| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613 |
- <?php
- require_once dirname(__FILE__) . '/' . 'Lib.php';
- Lib::loadClass('V');
- Lib::loadClass('User');
- Lib::loadClass('ProcesTestyHelper');
- Lib::loadClass('TypespecialVariable');
- Lib::loadClass('UsersHelper');
- Lib::loadClass('DB');
- Lib::loadClass('UserBookmarks');
- Lib::loadClass('FilterFactory');
- class ProcesMenu {
- var $MENU_SELECT_PROCES;
- var $_wynik_testu;
- var $_wynik_testu_unactual;
- var $error;// errory niedopuszczajace do uruchomienia
- var $warning;// uwagi
- var $CRM_PROCES_USERA_UZYTY;
- var $_user_id;
- var $_acl;
- function __construct() {
- $this->_user_id = User::getID();
- if (User::isAdmin()) {
- $this->_user_id = V::get('_user_id', 0, $_REQUEST, 'int');
- if (!$this->_user_id) {
- $this->_user_id = User::getID();
- $this->_acl = User::getAcl();
- } else {
- $this->_acl = UsersHelper::getUserAcl($this->_user_id);
- }
- } else {
- $this->_acl = User::getAcl();
- }
- if (!$this->_acl) {
- die('Error Acl');
- }
- if ('1' == V::get('_CLEAN_CACHE', '', $_REQUEST)) {
- $this->_cleanTestsCache();
- }
- $this->_generateTestResults();
- }
- static function getInstance() {
- static $_instance = null;
- if (!$_instance) {
- $_instance = new ProcesMenu();
- }
- return $_instance;
- }
- function show() {
- static $_menu_showed = false;
- if (!$_menu_showed) {
- $actionName = V::get('_action', 'menu', $_REQUEST);
- // podglad testów pracownika
- if (User::isAdmin() && $this->_user_id != User::getID()) {
- $actionName = 'showMyTests';
- }
- $actionName .= 'Action';
- if (method_exists($this, $actionName)) {
- $this->{$actionName}();
- }
- //$this->show_menu_with_process();
- $_menu_showed = true;
- }
- }
- /**
- * @return Array
- */
- function getUserTests() {
- if ($this->_user_id <= 0) {
- throw new Exception("User id not set");
- }
- $testy_arr = array();
- $ses_cache_key = 'CRM_PROCES_USERA_WYKONANE_TESTY-' . $this->_user_id;
- if (!$this->_isTestsInCache()) {
- $usedProcesInitIds = $this->_acl->getUserProcesInitIds();
- DBG::_('DBG_PM', '1', "usedProcesInitIds", $usedProcesInitIds, __CLASS__, __FUNCTION__, __LINE__ );
- if (!empty($usedProcesInitIds)) {
- $testy_arr = ProcesTestyHelper::get_tetsy_stats($this->_user_id, 0, $usedProcesInitIds);
- // check if tests are actual - proces steps may change
- if (!empty($testy_arr)) {
- foreach ($usedProcesInitIds as $k_proces_id) {
- $last_test = null;
- foreach ($testy_arr as $k_ind => $v_test) {
- if ($v_test->ID_PROCES_INIT == $k_proces_id) {
- $last_test = $v_test;
- $last_test->test_ind = $k_ind;
- break;
- }
- }
- if (!$last_test || $last_test->TEST_END == '0000-00-00') {
- continue;
- }
- $max_update_date = $this->_acl->getProcesMaxUpdateDate($k_proces_id);
- if ($max_update_date) {
- $max_update_date = substr($max_update_date, 0, 10);
- $test_end = substr($last_test->TEST_END, 0, 10);
- DBG::_('DBG_PM', '1', "P_INIT({$k_proces_id}) max_update_date({$max_update_date}) TEST_END({$last_test->TEST_END}) not actual(" . ($max_update_date > $last_test->TEST_END) . ")", $last_test, __CLASS__, __FUNCTION__, __LINE__ );
- if ($max_update_date > $test_end) {
- $testy_arr[$last_test->test_ind]->unactual = $max_update_date;
- $testy_arr[$last_test->test_ind]->unactualId = $last_test->ID;
- }
- }
- }
- }
- }
- $this->_setTestsCache($testy_arr);
- }
- return $this->_getTestsFromCache();
- }
- private function _cleanTestsCache() {
- $ses_cache_key = "CRM_PROCES_USERA_WYKONANE_TESTY-{$this->_user_id}";
- unset($_SESSION[$ses_cache_key]);
- }
- private function _isTestsInCache() {
- $ses_cache_key = "CRM_PROCES_USERA_WYKONANE_TESTY-{$this->_user_id}";
- return isset($_SESSION[$ses_cache_key]);
- }
- private function _getTestsFromCache() {
- $ses_cache_key = "CRM_PROCES_USERA_WYKONANE_TESTY-{$this->_user_id}";
- return $_SESSION[$ses_cache_key];
- }
- private function _setTestsCache($tests) {
- $ses_cache_key = "CRM_PROCES_USERA_WYKONANE_TESTY-{$this->_user_id}";
- $_SESSION[$ses_cache_key] = $tests;
- }
- function setError($error) {
- $this->error[] = $error;
- }
- function ifError() {// TODO: RMME
- if (!empty($this->error)) {
- return true;
- }
- else {
- DEBUG_S(-1,'Wydarzyły się błędy uniemożliwiające kontynuacje pracy modułu',$this->error,__FILE__,__FUNCTION__,__LINE__);
- die();
- return false;
- }
- }
- function showMyTestsAction() {
- $this->menuAction();
- $userAcl = User::getAcl();
- $procesyInitGroup = $this->getUsedProcesInitGroupedList();
- if (empty($procesyInitGroup)) {
- echo '<p>' . "Brak przypisanych procesów." . '</p>';
- return;
- }
- ?>
- <style type="text/css">
- .tbl-wyniki-testow {}
- .tbl-wyniki-testow td {vertical-align:top;font-size:small;}
- .tbl-wyniki-testow .proces-box {padding:0 6px;background:#f00;color:#fff;font-weight:bold;font-family:arial;text-decoration:none}
- .tbl-wyniki-testow .proces-title {padding:0 3px;}
- .tbl-wyniki-testow .wynik-cell .wyniki-cell-header {height:56px;overflow:hidden;}
- .tbl-wyniki-testow .wynik-cell {padding:0 3px;}
- .tbl-wyniki-testow .wynik-BRAK_TESTU .proces-box {background-color:silver;}
- .tbl-wyniki-testow .wynik-BRAK_PYTAN .proces-box {background-color:#51B7D5;}
- .tbl-wyniki-testow .wynik-DOBRY .proces-box {background-color:lightgreen;}
- .tbl-wyniki-testow .wynik-DOSTATECZNY .proces-box {background-color:#FFFFB1; color:#777;}
- .tbl-wyniki-testow .wynik-NIEDOSTATECZNY .proces-box {background-color:#FC5151;}
- .tbl-wyniki-testow .wynik-IDEALNY .proces-box {background-color:gold;}
- .tbl-wyniki-testow .wynik-NIEAKTUALNY .proces-box {background-color:silver;}
- </style>
- <div class="container" style="margin-top:10px;">
- <form action="" method="post" class="inline-form">
- <input type="hidden" name="_CLEAN_CACHE" value="1">
- <button type="submit" class="btn btn-xs btn-warning pull-right">odśwież</button>
- </form>
- </div>
- <?php foreach ($procesyInitGroup as $vProcesGroup) : ?>
- <div class="container tbl-wyniki-testow page-header">
- <h3>
- <?php echo $vProcesGroup->label; ?>
- <?php if ($vProcesGroup->nr > 0) : ?>
- <small><a href="procesy5.php?task=CRM_PROCES&filtr_id=<?php echo $vProcesGroup->nr; ?>">{<?php echo $vProcesGroup->nr; ?>}</a></small>
- <?php endif; ?>
- </h3>
- </div>
- <div class="container tbl-wyniki-testow">
- <div class="row">
- <?php $i = 0; foreach ($vProcesGroup->sub as $proces_id => $proces_desc) : ?>
- <?php
- $wynik_teoretyczny = $this->get_ocena_testu($proces_id, 'TEORETYCZNY');
- $wynik_teoretyczny_value = $this->get_ocena_testu_value($proces_id, 'TEORETYCZNY');
- if ($wynik_teoretyczny == 'BRAK_PYTAN') {
- $wynik_teoretyczny_value = '';
- }
- $wynik_praktyczny = $this->get_ocena_testu($proces_id, 'PRAKTYCZNY');
- $wynik_unactual = $this->isTestUnactual($proces_id, 'TEORETYCZNY');
- ?>
- <div class="col-md-3 wynik-cell wynik-<?php echo $wynik_teoretyczny; ?>">
- <div class="panel panel-default">
- <div class="panel-heading">
- <span data-toggle="tooltip" title="<?php echo $proces_desc; ?>"><?php echo V::strShortUtf8($proces_desc, 80); ?></span>
- <a href="procesy5.php?task=PROCES_VIEW&id_proces=<?php echo $proces_id; ?>" title="zobacz instrukcję do procesu <?php echo $proces_id; ?>" target="_blank">{<?php echo $proces_id; ?>}</a>
- </div>
- <div class="panel-body">
- <li>
- <?php if ($userAcl->getPermsFiltrProcesId() == $proces_id) : ?>
- <b><a href="index.php?FUNCTION_INIT=MENU_SELECT_PROCES&_action=setPermsAll"> Wyłącz filtr uprawnien dla </a></b>
- <?php else : ?>
- <a href="index.php?FUNCTION_INIT=MENU_SELECT_PROCES&_action=setPermsByProces&id_proces=<?php echo $proces_id; ?>"> Uruchom filtr uprawnien dla </a>
- <?php endif; ?>
- <?php echo $proces_id; ?>
- </li>
- <?php if (!in_array($wynik_teoretyczny, array('DOBRY', 'IDEALNY')) || $wynik_unactual) : ?>
- <li>
- <a href="procesy5.php?task=CRM_TESTY__ADD_TEST&proces_id=<?php echo $proces_id; ?>&test_type=TEORETYCZNY"> Wykonaj test teoretyczny dla </a>
- <?php echo $proces_id; ?>
- </li>
- <?php endif; ?>
- <li>Test teoretyczny: <span class="proces-box"><?php echo $wynik_teoretyczny; ?>
- <?php if ($wynik_teoretyczny_value) : ?> <em>(<?php echo $wynik_teoretyczny_value; ?>)</em><?php endif; ?>
- </span>
- </li>
- <li class="wynik-<?php echo $wynik_praktyczny; ?>">Test praktyczny: <?php echo $wynik_praktyczny; ?></li>
- <?php if ($wynik_unactual) : ?>
- <div class="alert alert-danger">
- <b>Uwaga! Test nieaktualny:</b>
- <?php if ($wynik_unactual->unactualId) : ?>
- <a class="btn btn-xs btn-primary" href="procesy5.php?task=CRM_TESTY__ADD_TEST&function_init=fun_CRM_TESTY__ADD_FIX&test_id=<?php echo $wynik_unactual->unactualId; ?>">popraw</a>
- <?php endif; ?>
- <br /><?php echo $wynik_unactual->TEST_END; ?> - zakończenie testu
- <br /><?php echo $wynik_unactual->unactual; ?> - ostatnia zmiana w procesie
- </div>
- <?php endif; ?>
- </div>
- </div>
- </div>
- <?php if (++$i >= 4) : $i = 0; ?>
- </div><div class="row">
- <?php endif; ?>
- <?php endforeach; ?>
- </div>
- </div>
- <?php endforeach; ?>
- <script>
- jQuery(document).ready(function() {
- jQuery('[data-toggle="tooltip"]').tooltip();
- });
- </script>
- <?php
- SE_Layout::dol();
- exit;
- }
- private function getUsedProcesInitGroupedList() {
- $procesyInitGroup = array();
- $procesyInitList = $this->_acl->getUserProcesInitList();
- if (empty($procesyInitList)) {
- return;
- }
- $sqlProcesyInitIds = implode(",", array_keys($procesyInitList));
- $sql = "select p.`ID`, p.`PARENT_ID`, pp.`DESC` as pp__DESC
- from `CRM_PROCES` as p
- join `CRM_PROCES` as pp on(pp.`ID`=p.`PARENT_ID`)
- where p.`ID` in({$sqlProcesyInitIds})
- ";
- $groupedProcesyInit = array();
- $db = DB::getDB();
- $res = $db->query($sql);
- while ($r = $db->fetch($res)) {
- if (!array_key_exists($r->PARENT_ID, $procesyInitGroup)) {
- $procesyInitGroup[$r->PARENT_ID] = (object)array('nr'=>$r->PARENT_ID, 'label'=>$r->pp__DESC, 'sub'=>array());
- }
- $procesyInitGroup[$r->PARENT_ID]->sub[$r->ID] = $procesyInitList[$r->ID];
- $groupedProcesyInit[] = $r->ID;
- }
- $ungroupedProcesyInit = array_diff(array_keys($procesyInitList), $groupedProcesyInit);
- if (!empty($ungroupedProcesyInit)) {
- $procesyInitGroup[$r->PARENT_ID] = (object)array('nr'=>null, 'label'=>"Pozostałe", 'sub'=>array());
- foreach ($ungroupedProcesyInit as $nr) {
- $procesyInitGroup[$r->PARENT_ID]->sub[$nr] = $procesyInitList[$nr];
- }
- }
- return $procesyInitGroup;
- }
- function menuAction() {
- $testy_teoretyczne = $this->get_actual_tests_count('TEORETYCZNY');
- $testy_praktyczne = $this->get_actual_tests_count('PRAKTYCZNY');
- $procesy_init_arr = $this->_acl->getUserProcesInitIds();
- $proces_cnt = count($procesy_init_arr);
- $testy_ok = $this->get_actual_tests_count();
- $MojeTestyTitle = "Ilość Procesów: {$proces_cnt}, Aktualnych testów: {$testy_ok}, Teoretycznych: {$testy_teoretyczne}, Praktycznych: {$testy_praktyczne}";
- $userAcl = User::getAcl();
- $tbls = [];
- $urls = [];
- $outUrls = array();
- $outMenus = array();// typeName => label (order by label)
- $typeNameToIdZasob = array();// $typeName => $idZasob
- if ($userAcl->getPermsFiltrProcesId()) { // TODO: fetch menu from ajax - fix menuStore
- $tbls = $userAcl->getTablesAcl();
- $urls = $userAcl->getUrls();
- if (!empty($urls)) {
- foreach ($urls as $kZasobID => $vTitle) {
- $outUrls[$kZasobID] = $vTitle;
- }
- }
- asort($outUrls);
- $rawOutMenus = array();
- $labelsOutMenus = array();
- $outBtnsMenus = array();
- // DBG::nicePrint($tbls, '$tbls');
- if (!empty($tbls)) {
- foreach ($tbls as $kZasobID => $vTblAcl) {
- if (null == $vTblAcl) continue;
- $tblName = $vTblAcl->getName();
- $typeName = "p5_default_db:{$tblName}";
- $labelsOutMenus[$typeName] = $vTblAcl->getLongLabel(); // TODO: legacy
- $rawOutMenus[$typeName] = strtolower($vTblAcl->getLongRawLabel());
- $typeNameToIdZasob[$typeName] = $kZasobID;
- // if ($userAcl->getPermsFiltrProcesId()) {
- $outBtnsMenus[$typeName] = $vTblAcl->getRawLabel();
- // }
- }
- }
- asort($rawOutMenus);
- foreach ($rawOutMenus as $typeName => $rawLongLabel) $outMenus[$typeName] = $labelsOutMenus[$typeName]; // TODO: mv to localStorage
- if ($userAcl->getPermsFiltrProcesId()) {
- asort($outBtnsMenus);
- }
- }
- $active = '';
- $script_name = V::get('SCRIPT_NAME', '', $_SERVER);
- if (false !== strpos($script_name, 'index.php')) {
- $route = V::get('_route', '', $_GET);
- if (!empty($route)) {
- if ('p5_default_db:KONTAKTY_view' == V::get('typeName', '', $_GET)) $active = 'kontakty';
- else if ('default_db/KONTAKTY_view' == V::get('namespace', '', $_GET)) $active = 'kontakty';
- } else {
- $menu_init = V::get('MENU_INIT', '', $_GET);
- switch ($menu_init) {
- case 'VIEWTABLE_AJAX': $active = 'menu'; break;
- default: {
- $fun_init = V::get('FUNCTION_INIT', '', $_GET);
- switch ($fun_init) {
- case 'MENU_SELECT_PROCES': $active = 'testy'; break;
- case 'PRZYPOMNIJ_FUNC': $active = 'przypomnij'; break;
- case 'PRZYPOMNIJ': $active = 'przypomnij'; break;
- default:
- }
- }
- }
- }
- }
- else if (false !== strpos($script_name, 'procesy5.php')) {
- $task = V::get('task', '', $_GET);
- switch ($task) {
- case 'CRM_PROCES': $active = 'procesy'; break;
- case 'CRM_LISTA_ZASOBOW': $active = 'zasoby'; break;
- case 'CRM_WYSWIETL_OBOWIAZKI': $active = 'obowiazki'; break;
- case 'CRM_TESTY': $active = 'testy'; break;
- case 'CRM_TESTY_WYNIKI': $active = 'testy'; break;
- case 'CRM_TESTY__LIST': $active = 'testy'; break;
- case 'CRM_TESTY__ADD_TEST': $active = 'testy'; break;
- case 'CRM_TESTY__ADD_KANDYDAT': $active = 'testy'; break;
- case 'CRM_SEARCH': $active = 'search'; break;
- default:
- // testy_moje ?FUNCTION_INIT=MENU_SELECT_PROCES&MENU_SELECT_PROCES=show_menu_with_process => _action=showMyTests
- }
- }
- /*
- * $_SESSION['USER_PROFILE'][section][key] = val;
- */
- $userGroupIdsCSV = User::getGroupsIds();
- $userGroupIdsCSV = implode(',', $userGroupIdsCSV);
- $typeSpecialZasob = TypespecialVariable::getInstance(-1, '__ZASOB');
- $treeZasobyFilter = FilterFactory::build('CRM_LISTA_ZASOBOW');
- $lastZasobyFiltrIds = $treeZasobyFilter->get_arg('filtr_id');
- $typeSpecialProces = TypespecialVariable::getInstance(-1, '__PROCES');
- $treeProcesyFilter = FilterFactory::build('CRM_PROCES');
- $lastProcesyFiltrIds = $treeProcesyFilter->get_arg('filtr_id');
- $menuProcesViewedTblId = 0;
- $menuProcesViewedAclIsObject = false;
- if ('ViewTableAjax' == V::get('_route', '', $_REQUEST)) {
- $namespace = V::get('namespace', '', $_REQUEST, 'word');
- if (!$namespace) {
- $typeName = V::get('typeName', '', $_REQUEST, 'word');
- if ($typeName) {
- $namespace = str_replace(['__x3A__', ':'], '/', $typeName);
- }
- }
- if ($namespace) {
- $menuProcesViewedAclIsObject = (
- 'default_db/' === substr($namespace, 0, strlen('default_db/'))
- && strpos(substr($namespace, strlen('default_db/')), '/') > 0
- );
- $zasobTableName = (
- 'default_db/' === substr($namespace, 0, strlen('default_db/'))
- && false === strpos(substr($namespace, strlen('default_db/')), '/')
- )
- ? substr($namespace, strlen('default_db/'))
- : $namespace;
- if ($zasobTableName) {
- $dbID = DB::getPDO()->getZasobId();
- $menuProcesViewedTblId = DB::getPDO()->fetchValue("
- select z.ID
- from CRM_LISTA_ZASOBOW z
- where z.`DESC` = '{$zasobTableName}'
- and z.A_STATUS not in ('DELETED')
- and z.`TYPE` = 'TABELA'
- and z.PARENT_ID = '{$dbID}'
- ");
- }
- }
- }
- else if ('VIEWTABLE_AJAX' == V::get('MENU_INIT', '', $_REQUEST)) {
- $menuProcesViewedTblId = V::get('ZASOB_ID', 0, $_REQUEST, 'int');
- }
- UI::loadTemplate('menuMain', [
- 'active' => $active,
- 'outMenus' => $outMenus,
- 'outBtnsMenus' => $outBtnsMenus,
- 'outUrls' => $outUrls,
- 'typeNameToIdZasob' => $typeNameToIdZasob,
- 'lastProcesyFiltrIds' => $lastProcesyFiltrIds,
- 'menuProcesViewedTblId' => $menuProcesViewedTblId,
- 'userAcl__getPermsFiltrProcesId' => $userAcl->getPermsFiltrProcesId(),
- 'typeSpecialProces' => $typeSpecialProces,
- 'lastZasobyFiltrIds' => $lastZasobyFiltrIds,
- 'userGroupIdsCSV' => $userGroupIdsCSV,
- 'menuProcesViewedAclIsObject' => $menuProcesViewedAclIsObject,
- 'namespace' => $namespace,
- 'typeSpecialZasob' => $typeSpecialZasob,
- 'MojeTestyTitle' => $MojeTestyTitle,
- 'testy_ok' => $testy_ok,
- 'proces_cnt' => $proces_cnt,
- 'testy_teoretyczne' => $testy_teoretyczne,
- 'testy_praktyczne' => $testy_praktyczne,
- 'typeSpecialUserId' => (User::isAdmin()) ? TypespecialVariable::getInstance(-1, '__USER_ID') : null,
- 'idFiltrProcesID' => $userAcl->getPermsFiltrProcesId(),
- ]);
- }
- /**
- * Generates wyniki
- */
- private function _generateTestResults() {
- $this->_wynik_testu = array();// WYNIK_TESTU_PROCESU
- $this->_wynik_testu_unactual = array();
- $this_CRM_PROCES_USERA_WYKONANE_TESTY = $this->getUserTests();
- foreach ($this_CRM_PROCES_USERA_WYKONANE_TESTY as $v_test) {
- if (isset($this->_wynik_testu[$v_test->ID_PROCES_INIT][$v_test->TEST_TYPE])) {
- continue;// only first
- }
- $this->_wynik_testu[$v_test->ID_PROCES_INIT][$v_test->TEST_TYPE] = $v_test->OCENA;
- if (!empty($v_test->unactual)) {
- $x_test = new stdClass();
- $x_test->TEST_END = substr($v_test->TEST_END, 0, 10);
- $x_test->unactual = substr($v_test->unactual, 0, 10);
- $x_test->unactualId = $v_test->unactualId;
- $this->_wynik_testu_unactual[$v_test->ID_PROCES_INIT][$v_test->TEST_TYPE] = $x_test;
- }
- }
- }
- function get_ocena_testu($proces_id, $typ) {
- $ocena = $this->get_ocena_testu_value($proces_id, $typ);
- if (!$ocena) {
- return 'BRAK_TESTU';
- }
- else if ($ocena == -1) {
- return 'BRAK_PYTAN';
- }
- else if ($ocena == 3) {
- return 'IDEALNY';
- }
- else if ($ocena < 2) {
- return 'NIEDOSTATECZNY';
- }
- else if($ocena < 2.5) {
- return 'DOSTATECZNY';
- }
- else {
- return 'DOBRY';
- }
- }
- function get_ocena_testu_value($proces_id, $typ) {
- if (isset($this->_wynik_testu[$proces_id][$typ])) {
- return $this->_wynik_testu[$proces_id][$typ];
- }
- return null;
- }
- function isTestUnactual($proces_id, $typ) {
- if (isset($this->_wynik_testu_unactual[$proces_id][$typ])) {
- return $this->_wynik_testu_unactual[$proces_id][$typ];
- }
- return false;
- }
- function get_actual_tests_count($type = null) {
- $this_CRM_PROCES_USERA_WYKONANE_TESTY = $this->getUserTests();
- if ($type == 'TEORETYCZNY') {
- $testy_teoretyczne = 0;
- foreach ($this_CRM_PROCES_USERA_WYKONANE_TESTY as $int => $v_test) {
- if ($v_test->TEST_TYPE=='TEORETYCZNY') {
- if ($v_test->OCENA > 2.5) $testy_teoretyczne++;
- }
- }
- return $testy_teoretyczne;
- }
- else if ($type == 'PRAKTYCZNY') {
- $testy_praktyczne = 0;
- foreach ($this_CRM_PROCES_USERA_WYKONANE_TESTY as $int => $v_test) {
- if ($v_test->TEST_TYPE=='PRAKTYCZNY') {
- if ($v_test->OCENA > 2.5) $testy_praktyczne++;
- }
- }
- return $testy_praktyczne;
- }
- else if ($type == null) {
- return count($this_CRM_PROCES_USERA_WYKONANE_TESTY);
- }
- return 0;
- }
- /**
- * URL: _action=setPermsAll
- */
- function setPermsAllAction() {
- $userAcl = User::getAcl();
- $userAcl->fetchAllPerms(true);
- $this->menuAction();
- }
- /**
- * URL: _action=setPermsByProces
- */
- function setPermsByProcesAction() {
- $procesID = V::get('id_proces', 0, $_GET, 'int');
- if ($procesID <= 0) {
- echo '<div class="alert alert-danger">' . "Brak ID Procesu" . '</div>';
- return;
- }
- $userAcl = User::getAcl();
- if ($userAcl->getPermsFiltrProcesId() == $procesID) {
- $this->menuAction();
- echo '<div class="alert alert-info">' . "Filtr procesu nr {$procesID} jest już uruchomiony" . '</div>';
- return;
- }
- $userAcl = User::getAcl();
- if (!$userAcl->canExecuteProcesInit($procesID)) {
- $this->menuAction();
- echo '<div class="alert alert-danger">' . "Brak uprawnień do uruchomienia filtra procesu" . '</div>';
- SE_Layout::dol();
- exit;
- }
- $userAcl->fetchProcesPerms($procesID, true);
- $this->menuAction();
- }
- function move_test_from_kandydat_to_pracownik($id_kanydata, $id_pracownika) {
- //4673->4680
- //$sql='update CRM_TESTY set A_RECORD_CREATE_AUTHOR='smagielm' where A_RECORD_CREATE_AUTHOR='Kandydat.4673';
- //$sql='update CRM_TESTY set A_RECORD_UPDATE_AUTHOR='smagielm' where A_RECORD_UPDATE_AUTHOR='Kandydat.4673';
- //$sql="update CRM_TESTY set ID_TESTER='4680' where ID_TESTER='4673'";
- }
- }
|