| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183 |
- <?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);
- $typeSpecialUserId = null;
- if (User::isAdmin()) {
- $typeSpecialUserId = TypespecialVariable::getInstance(-1, '__USER_ID');
- }
- $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');
- }
- ?>
- <nav id="SE-menu" class="navbar-nav navbar-inverse" style="width:100%">
- <div class="container-fluid">
- <div class="collapse navbar-collapse">
- <ul class="nav navbar-nav">
- <?php
- echo UI::h('li', [ 'class' => "dropdown" . ($active == 'menu' ? ' active' : '') ], [
- UI::h('a',
- ($userAcl->getPermsFiltrProcesId())
- ? [
- 'href' => "#",
- 'class' => "dropdown-toggle",
- 'data-toggle' => "dropdown",
- ]
- : [
- 'href' => "#",
- 'class' => "dropdown-toggle",
- 'onClick' => "return initP5MainMenuDropdown(this, 'SE-menu-tables');",
- ],
- "Menu ". '<b class="caret"></b>'
- ),
- UI::h('ul', [
- 'class' => "dropdown-menu",
- 'id' => "SE-menu-tables",
- ], array_map(function ($vName, $typeName) use ($typeNameToIdZasob) {
- $kZasobID = $typeNameToIdZasob[$typeName];
- return UI::h('li', [], [
- UI::h('a', ['href'=>"index.php?_route=ViewTableAjax&typeName={$typeName}"], [
- UI::h('i', ['class'=>"bookmark-item-add glyphicon glyphicon-star-empty", 'title'=>"Add to favorites", 'data-zasobid'=>$kZasobID]),
- UI::h('i', ['class'=>"bookmark-item-rem glyphicon glyphicon-star", 'style'=>"display:none", 'title'=>"Remove from favorites", 'data-zasobid'=>$kZasobID]),
- " " . $vName
- ])
- ]);
- }, array_values($outMenus), array_keys($outMenus))),
- ]);
- echo UI::h('li', [ 'class' => "dropdown"], [
- UI::h('a',
- ($userAcl->getPermsFiltrProcesId())
- ? [
- 'href' => "#",
- 'class' => "dropdown-toggle",
- 'data-toggle' => "dropdown",
- ]
- : [
- 'href' => "#",
- 'class' => "dropdown-toggle",
- 'onClick' => "return initP5UrlsMenuDropdown(this, 'SE-menu-urls');",
- ],
- "Narzędzia " . '<b class="caret"></b>'
- ),
- UI::h('ul', [
- 'class' => "dropdown-menu",
- 'id' => "SE-menu-urls"
- ], array_map(function ($label, $idZasob) {
- return UI::h('li', [], [
- UI::h('a', [ 'href' => "index.php?FUNCTION_INIT=URL_INIT&ZASOB_ID={$idZasob}", 'target' => "_blank", 'title' => $label ], [
- UI::h('i', [ 'class' => "bookmark-item-add glyphicon glyphicon-star-empty", 'title' => "Add to favorites", 'data-zasobid' => $idZasob ]),
- UI::h('i', [ 'class' => "bookmark-item-rem glyphicon glyphicon-star", 'style' => "display:none", 'title' => "Remove from favorites", 'data-zasobid' => $idZasob ]),
- UI::h('code', [ 'style' => "margin-left:6px; margin-right:6px" ], (string)$idZasob),
- (mb_strlen($label, 'utf-8') > 100)? mb_substr($label, 0, 100, 'utf-8') . '...' : $label,
- ]),
- ]);
- }, array_values($outUrls), array_keys($outUrls))),
- ]);
- ?>
- <li class="dropdown <?php if ($active == 'procesy') echo "active"; ?>">
- <a id="ProcesMenuProcesDropdownLink" href="#" class="dropdown-toggle" data-toggle="dropdown">Procesy <b class="caret"></b></a>
- <ul class="dropdown-menu">
- <?php if (!empty($lastProcesyFiltrIds)) : ?>
- <li>
- <p class="text-muted" style="padding:3px 20px;"><nobr>Wróć do ostatniego wyszukiwania:</nobr></p>
- <a href="procesy5.php?task=CRM_PROCES<?php echo "&filtr_id={$lastProcesyFiltrIds}&filtr_ids=%2B&filtr_ob=%2B&filtr_img=%2B"; ?>"><?php
- //echo $lastProcesyFiltrIdsLabels;
- if (!empty($lastProcesyFiltrIds)) {
- $lastProcesyFiltrIds = explode(',', $lastProcesyFiltrIds);
- $labels = array();
- $labelsLimit = 4;
- $labelsInd = 0;
- foreach ($lastProcesyFiltrIds as $lastFltr) {
- $labels[] = '<span class="label label-info">' . $lastFltr . '</span>';
- if (++$labelsInd >= $labelsLimit) {
- $labels[] = '...';
- break;
- }
- }
- $lastProcesyFiltrIdsLabels = implode(' ', $labels);
- }
- echo $lastProcesyFiltrIdsLabels;
- ?></a>
- </li>
- <li class="divider"></li>
- <?php endif; ?>
- <li>
- <a href="index.php?FUNCTION_INIT=PROCES_MENU&HEADER_NOT_INIT=YES&_task=PROCES_FOR_USER" title="Moje Procesy">Moje Procesy</a>
- </li>
- <?php if ($menuProcesViewedTblId > 0) : ?>
- <li>
- <a href="index.php?FUNCTION_INIT=PROCES_MENU&HEADER_NOT_INIT=YES&_task=PROCES_FOR_TABLE&tblId=<?php echo $menuProcesViewedTblId; ?>">Procesy dla aktualnie przeglądanej tabeli</a>
- </li>
- <?php endif; ?>
- <li>
- <a href="procesy5.php?task=CRM_PROCES&filtr_id=" title="Wyświetlenie drzewa procesów">Wszystkie Procesy</a>
- </li>
- <?php if (0 == User::get('ADM_ADMIN_LEVEL')) : ?>
- <li>
- <a href="index.php?_route=UrlAction_ProcesView" title="Wyświetlenie drzewa procesów w formie panelowej i w formie drzewa">Procesy - <i style="color:red">NOWE</i> <i><small>(wersja testowa)</small></i></a>
- </li>
- <?php endif; ?>
- <li class="divider"></li>
- <?php if (!$typeSpecialProces) : ?>
- <li>
- <div class="alert alert-danger">Brak typespecial __PROCES</div>
- </li>
- <?php else : ?>
- <li>
- <p class="text-muted" style="padding:3px 20px;"><nobr>Wyszukaj:</nobr></p>
- <form id="ProcesMenuProcesFrm" action="procesy5.php" method="GET" style="padding:0 20px">
- <input type="hidden" name="task" value="CRM_PROCES">
- <?php
- $fldName = 'ProcesMenu__Proces_filtr_id';
- $fldParams = array();
- $fldParams['allowCreate'] = false;
- $fldParams['ajaxDataUrlBase'] = "index.php?FUNCTION_INIT=PROCES_MENU&HEADER_NOT_INIT=YES&_task=TYPESPECIAL&fld={$fldName}";
- $fldParams['placeholder'] = 'Szukaj...';
- $fldParams['formFieldName'] = 'filtr_id';
- //$fldParams['ajaxDataUrlBase'] .= "&DBG_TS=3";
- echo $typeSpecialProces->showFormItem($tblID = -1, $fldName, $selValue = '', $fldParams);
- ?>
- <input class="btn btn-xs btn-primary" type="submit" value="Wybierz" />
- <input class="pull-right btn btn-xs btn-default" type="submit" id="ProcesMenuProcesFltrAdd" value="Dodaj do filtra" />
- <script>
- jQuery(document).ready(function() {
- if ('procesy5.php' === window.location.pathname.substr(-12)
- && window.location.search.search('task=CRM_PROCES') > 0
- && window.location.search.search('&filtr_id=') > 0
- ) {
- jQuery('#ProcesMenuProcesFltrAdd').on('click', function(e) {
- var frm = jQuery(this).get(0).form;
- var fldNode = frm['<?php echo $fldParams['formFieldName']; ?>'],
- fltrId = '';
- if (fldNode && '' != fldNode.value) {
- fltrId = fldNode.value;
- } else {
- return;
- }
- var pos = 0, fltrIds = '';
- if ('procesy5.php' === window.location.pathname.substr(-12)
- && window.location.search.search('task=CRM_PROCES') > 0
- && (pos = window.location.search.search('&filtr_id=')) > 0
- ) {
- pos += 10;
- fltrIds = window.location.search.substr(pos);
- if ((pos = fltrIds.search('&')) > 0) {
- fltrIds = fltrIds.substr(0, pos);
- }
- if (fltrIds) {
- fltrIds = decodeURIComponent(fltrIds);
- fltrIds += ',' + fltrId;
- if (fldNode.selectize) {
- fldNode.selectize.addOption({id: fltrIds, name: fltrIds});
- fldNode.selectize.setValue(fltrIds, true);
- }
- }
- }
- });
- } else {
- jQuery('#ProcesMenuProcesFltrAdd').hide();
- }
- jQuery('#ProcesMenuProcesFrm').on('submit', function(e) {
- var frm = jQuery(this).get(0),
- fldNode = frm['<?php echo $fldParams['formFieldName']; ?>'];
- if (fldNode && '' != fldNode.value) {
- return true;
- } else {
- return false;
- }
- });
- jQuery('#ProcesMenuProcesDropdownLink').on('click', function(e) {
- setTimeout(function(){
- jQuery('#ts-<?php echo $fldName; ?>')
- .next('.selectize-control')
- .find('input:first')
- .focus();
- }, 200);
- });
- });
- </script>
- </form>
- </li>
- <?php endif; ?>
- </ul>
- </li>
- <li class="dropdown <?php if ($active == 'zasoby') echo "active"; ?>">
- <a id="ProcesMenuZasobDropdownLink" href="#" class="dropdown-toggle" data-toggle="dropdown">Zasoby <b class="caret"></b></a>
- <ul class="dropdown-menu">
- <?php if (!empty($lastZasobyFiltrIds)) : ?>
- <li>
- <p class="text-muted" style="padding:3px 20px;"><nobr>Wróć do ostatniego wyszukiwania:</nobr></p>
- <a href="procesy5.php?task=CRM_LISTA_ZASOBOW<?php echo "&filtr_id={$lastZasobyFiltrIds}&filtr_ids=%2B&filtr_ob=%2B&filtr_img=%2B"; ?>"><?php
- //echo $lastZasobyFiltrIdsLabels;
- if (!empty($lastZasobyFiltrIds)) {
- $lastZasobyFiltrIds = explode(',', $lastZasobyFiltrIds);
- $labels = array();
- $labelsLimit = 4;
- $labelsInd = 0;
- foreach ($lastZasobyFiltrIds as $lastFltr) {
- $labels[] = '<span class="badge badge-inverse">' . $lastFltr . '</span>';
- if (++$labelsInd >= $labelsLimit) {
- $labels[] = '...';
- break;
- }
- }
- $lastZasobyFiltrIdsLabels = implode(' ', $labels);
- }
- echo $lastZasobyFiltrIdsLabels;
- ?></a>
- </li>
- <li class="divider"></li>
- <?php endif; ?>
- <?php if (!empty($userGroupIdsCSV)) : ?>
- <li>
- <a href="procesy5.php?task=CRM_LISTA_ZASOBOW<?php echo "&filtr_id={$userGroupIdsCSV}&filtr_ids=%2B&filtr_ob=%2B&filtr_img=%2B"; ?>" title="Moje Zasoby">Moje Zasoby</a>
- </li>
- <?php endif; ?>
- <?php if ($menuProcesViewedTblId > 0) : ?>
- <li>
- <a href="procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id=<?= $menuProcesViewedTblId; ?>&filtr_ids=%2B&filtr_ob=%2B">Struktura aktualnie przeglądanej tabeli</a>
- </li>
- <?php endif; ?>
- <?php if ($menuProcesViewedTblId > 0 && User::get('ADM_ADMIN_LEVEL') < 2 && $menuProcesViewedAclIsObject) : ?>
- <li>
- <a href="index.php?_route=Storage_AclStruct&namespace=<?= $namespace; ?>">Struktura aktualnie przeglądanego obiektu (Storage)</a>
- </li>
- <?php endif; ?>
- <li>
- <a href="procesy5.php?task=CRM_LISTA_ZASOBOW&filtr_id=" title="Wyświetlenie drzewa zasobów">Wszystkie Zasoby</a>
- </li>
- <li class="divider"></li>
- <?php if (!$typeSpecialZasob) : ?>
- <li>
- <div class="alert alert-danger">Brak typespecial __ZASOB</div>
- </li>
- <?php else : ?>
- <li>
- <p class="text-muted" style="padding:3px 20px;"><nobr>Wyszukaj:</nobr></p>
- <form id="ProcesMenuZasobFrm" action="procesy5.php" method="GET" style="padding:0 20px">
- <input type="hidden" name="task" value="CRM_LISTA_ZASOBOW">
- <?php
- $fldName = 'ProcesMenu__Zasob_filtr_id';
- $fldParams = array();
- $fldParams['allowCreate'] = false;
- $fldParams['ajaxDataUrlBase'] = "index.php?FUNCTION_INIT=PROCES_MENU&HEADER_NOT_INIT=YES&_task=TYPESPECIAL&fld={$fldName}";
- $fldParams['placeholder'] = 'Szukaj...';
- $fldParams['formFieldName'] = 'filtr_id';
- //$fldParams['ajaxDataUrlBase'] .= "&DBG_TS=3";
- echo $typeSpecialZasob->showFormItem($tblID = -1, $fldName, $selValue = '', $fldParams);
- ?>
- <input class="btn btn-xs btn-primary" type="submit" value="Wybierz" />
- <input class="pull-right btn btn-xs btn-default" type="submit" id="ProcesMenuZasobFltrAdd" value="Dodaj do filtra" />
- <script>
- jQuery(document).ready(function() {
- if ('procesy5.php' === window.location.pathname.substr(-12)
- && window.location.search.search('task=CRM_LISTA_ZASOBOW') > 0
- && window.location.search.search('&filtr_id=') > 0
- ) {
- jQuery('#ProcesMenuZasobFltrAdd').on('click', function(e) {
- var frm = jQuery(this).get(0).form;
- var fldNode = frm['<?php echo $fldParams['formFieldName']; ?>'],
- fltrId = '';
- if (fldNode && '' != fldNode.value) {
- fltrId = fldNode.value;
- } else {
- return;
- }
- var pos = 0, fltrIds = '';
- if ('procesy5.php' === window.location.pathname.substr(-12)
- && window.location.search.search('task=CRM_LISTA_ZASOBOW') > 0
- && (pos = window.location.search.search('&filtr_id=')) > 0
- ) {
- pos += 10;
- fltrIds = window.location.search.substr(pos);
- if ((pos = fltrIds.search('&')) > 0) {
- fltrIds = fltrIds.substr(0, pos);
- }
- if (fltrIds) {
- fltrIds = decodeURIComponent(fltrIds);
- fltrIds += ',' + fltrId;
- if (fldNode.selectize) {
- fldNode.selectize.addOption({id: fltrIds, name: fltrIds});
- fldNode.selectize.setValue(fltrIds, true);
- }
- }
- }
- });
- } else {
- jQuery('#ProcesMenuZasobFltrAdd').hide();
- }
- jQuery('#ProcesMenuZasobFrm').on('submit', function(e) {
- var frm = jQuery(this).get(0),
- fldNode = frm['<?php echo $fldParams['formFieldName']; ?>'];
- if (fldNode && '' != fldNode.value) {
- return true;
- } else {
- return false;
- }
- });
- jQuery('#ProcesMenuZasobDropdownLink').on('click', function(e) {
- setTimeout(function(){
- jQuery('#ts-<?php echo $fldName; ?>')
- .next('.selectize-control')
- .find('input:first')
- .focus();
- }, 200);
- });
- });
- </script>
- </form>
- </li>
- <?php endif; ?>
- </ul>
- </li>
- <li<?php if ($active == 'obowiazki') echo ' class="active"'; ?>><a href="procesy5.php?task=CRM_WYSWIETL_OBOWIAZKI" title="Wyswietlenie OBOWIAZKOW">Obowiązki</a></li>
- <li class="dropdown <?php if ($active == 'testy') echo "active"; ?>">
- <a href="#" class="dropdown-toggle" data-toggle="dropdown">Testy (<?php echo "{$testy_ok} z {$proces_cnt}: T {$testy_teoretyczne}, P {$testy_praktyczne}"; ?>) <b class="caret"></b></a>
- <ul class="dropdown-menu">
- <li>
- <a href="index.php?_route=UserTest" title="<?php echo $MojeTestyTitle; ?>">Moje (<?php echo "{$testy_ok} z {$proces_cnt}: T {$testy_teoretyczne}, P {$testy_praktyczne}"; ?>)</a>
- </li>
- <?php if (User::hasAccess('testy')) : ?>
- <li>
- <a href="procesy5.php?task=CRM_TESTY__LIST">Lista testów</a>
- </li>
- <li>
- <a href="procesy5.php?task=CRM_TESTY__ADD_TEST">Uruchom nowy test</a>
- </li>
- <?php endif; ?>
- <?php if (User::hasAccess('procesy') || User::get('ADM_ADMIN_LEVEL') <= 2) : ?>
- <li class="divider"></li>
- <?php endif; ?>
- <?php if (User::hasAccess('procesy')) : ?>
- <li>
- <a href="procesy5.php?task=CRM_TESTY__ADD_KANDYDAT">Dodaj Kandydata i zaloguj się do testów</a>
- </li>
- <?php endif; ?>
- <?php if (User::get('ADM_ADMIN_LEVEL') <= 2) : ?>
- <li>
- <a href="procesy5.php?task=CRM_TESTY_WYNIKI" title="Wyswietlenie wyników testów">Wyniki</a>
- </li>
- <?php endif; ?>
- </ul>
- </li>
- <li<?= ('kontakty' == $active) ? ' class="active"' : ''; ?>><a href="index.php?_route=ViewTableAjax&namespace=default_db/KONTAKTY_view" title="Kontakty">Kontakty</a></li>
- <li<?= ('przypomnij' == $active) ? ' class="active"' : ''; ?>><a href="index.php?_route=Przypomnij&KTO=<?php echo User::getLogin(); ?>" title="Przypomnij">Przypomnij</a></li>
- </ul>
- <form class="navbar-form navbar-left" style="margin:3px 0;" role="search" action="procesy5.php?task=CRM_SEARCH" method="post">
- <div class="input-group">
- <input type="text" class="form-control input-sm" placeholder="Szukaj..." name="q">
- <span class="input-group-btn">
- <button class="btn btn-default btn-sm" type="submit"><i class="glyphicon glyphicon-search"></i></button>
- </span>
- </div><!-- /input-group -->
- </form>
- <div class="navbar-form navbar-right">
- <div class="btn-group">
- <button type="button" class="btn btn-link" style="margin:0; padding:6px 8px 4px 8px;"><?php S::show_session_timer(); ?></button>
- <a href="index.php?_route=UserMsgs" class="btn btn-link" style="margin:0; padding:6px 8px 0 8px; font-size:20px; line-height:24px;"><i class="glyphicon glyphicon-envelope"></i></a>
- <div class="btn-group">
- <button id="ProcesMenuLoginDropdownLink" type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><?php echo User::getName(); ?> <span class="caret"></span></button>
- <ul class="dropdown-menu" role="menu">
- <?php if (file_exists('/Library/Server/Web/Data/Sites/Default/')) : ?>
- <li><a href="/webcal" target="_blank"><i class="glyphicon glyphicon-calendar"></i> Kalendarz</a></li>
- <?php if (file_exists('/Library/Server/Web/Data/Sites/Default/webmail/loginFromSE.php')) : ?>
- <li>
- <a href="/webmail">
- <form action="https://<?php echo $_SERVER['SERVER_NAME']; ?>/webmail/loginFromSE.php" method="post" target="_blank">
- <input type="hidden" name="_timezone" value="Europe/Berlin">
- <input type="hidden" name="_token" value="">
- <input type="hidden" name="_action" value="login">
- <input type="hidden" name="_task" value="login">
- <input type="hidden" name="_url" value="">
- <input type="hidden" name="_user" value="<?php echo User::getName(); ?>">
- <input type="hidden" name="_pass" value="<?php echo User::get('ADM_PASS_HASH'); ?>">
- <input type="hidden" name="EMAIL_IMAP_IMPORT_USERNAME" value="<?php echo V::get('EMAIL_IMAP_IMPORT_USERNAME', '', $_SESSION); ?>">
- <input type="hidden" name="EMAIL_IMAP_IMPORT_HOST" value="<?php echo V::get('EMAIL_IMAP_IMPORT_HOST', '', $_SESSION); ?>">
- <input type="hidden" name="EMAIL_IMAP_IMPORT_PASSWD_HASH" value="<?php echo V::get('EMAIL_IMAP_IMPORT_PASSWD_HASH', '', $_SESSION); ?>">
- <input type="hidden" name="loginFromSE" value="1">
- <!-- <input type="submit" class="btn" value="P"> -->
- <button type="submit" class="btn btn-link" style="width:100%;padding:0;text-align:left;color:#333;"><i class="glyphicon glyphicon-envelope"></i> Poczta</button>
- </form>
- </a>
- </li>
- <?php elseif (file_exists('/Library/Server/Web/Data/Sites/Default/webmail')) : ?>
- <li><a href="/webmail" target="_blank"><i class="glyphicon glyphicon-envelope"></i> Poczta</a></li>
- <?php endif; ?>
- <li><a href="index.php?_route=ChangePassword"><i class="glyphicon glyphicon-lock"></i> Zmień hasło</a></li>
- <li><a href="/profilemanager" target="_blank"><i class="glyphicon glyphicon-user"></i> Apple Profile Manager</a></li>
- <li class="divider"></li>
- <?php else: ?>
- <li><a href="index.php?_route=ChangePassword">Zmień hasło</a></li>
- <?php endif; ?>
- <li><a href="procesy5.php?task=USER" title="<?php echo User::getName(); ?>"><i class="glyphicon glyphicon-user"></i> Profil</a></li>
- <li><a href="index.php?_route=UrlAction_Calendar"><i class="glyphicon glyphicon-calendar"></i> Grafik pracy</a></li>
- <li><a href="index.php?_route=UserMsgs" title="Wiadomości systemowe"><i class="glyphicon glyphicon-envelope"></i> Wiadomości</a></li>
- <li><a href="index.php?_route=Notify" title="Powiadomienia"><i class="glyphicon glyphicon-bell"></i> Powiadomienia</a></li>
- <li><a href="index.php?_route=Users&_task=reloadPerms" title="Przeładuj uprawnienia"><i class="glyphicon glyphicon-refresh"></i> Przeładuj uprawnienia</a></li>
- <li class="divider"></li>
- <?php if (User::isAdmin()) : ?>
- <li><a href="index.php?_route=Status" title="Status systemu"><i class="glyphicon glyphicon-cog"></i> Status systemu</a></li>
- <?php endif; ?>
- <?php if (User::isAdmin()) : ?>
- <?php if (!$typeSpecialUserId) : ?>
- <li>
- <div class="alert alert-danger">Brak typespecial __USERS_ID</div>
- </li>
- <?php else : ?>
- <li>
- <p class="text-muted" style="padding:3px 20px;"><nobr>Pokaż testy pracownika:</nobr></p>
- <form action="index.php" method="POST">
- <input type="hidden" name="FUNCTION_INIT" value="MENU_SELECT_PROCES">
- <input type="hidden" name="_action" value="showMyTests">
- <?php
- $fldName = '_user_id';
- $fldParams = array();
- $fldParams['allowCreate'] = false;
- $fldParams['ajaxDataUrlBase'] = "index.php?FUNCTION_INIT=PROCES_MENU&HEADER_NOT_INIT=YES&_task=TYPESPECIAL&fld={$fldName}";
- $fldParams['placeholder'] = 'Szukaj...';
- //$fldParams['ajaxDataUrlBase'] .= "&DBG_TS=3";
- echo $typeSpecialUserId->showFormItem($tblID = -1, $fldName, $selValue = '', $fldParams);
- ?>
- <input class="btn btn-xs btn-warning" type="submit" value="Wybierz" />
- <script>
- jQuery(document).ready(function() {
- jQuery('#ProcesMenuLoginDropdownLink')
- .next('.dropdown-menu')
- .find('.selectize-input')
- .on('click', function(e) {
- return false;
- });
- jQuery('#ProcesMenuLoginDropdownLink').on('click', function(e) {
- setTimeout(function(){
- jQuery('#ts-<?php echo $fldName; ?>')
- .next('.selectize-control')
- .find('input:first')
- .focus();
- }, 200);
- });
- });
- </script>
- </form>
- </li>
- <?php endif; ?>
- <li class="divider"></li>
- <?php endif; ?>
- <li><a href="index.php?LOGIN=LOGOUT"><i class="glyphicon glyphicon-off"></i> Wyloguj</a></li>
- </ul>
- </div>
- </div>
- </div>
- <!--
- <li<?php if ($active == 'search') echo ' class="active"'; ?>>
- <form action="procesy5.php?task=CRM_SEARCH" method="post" class="navbar-search">
- <input type="text" name="q" value="" class="q search-query span2">
- <input type="image" src="icon/search.png" class="s">
- </form>
- </li>
- -->
- </div><!-- /.navbar-collapse -->
- </nav>
- <?php
- $idFiltrProcesID = $userAcl->getPermsFiltrProcesId();
- if ($idFiltrProcesID > 0) {
- echo UI::h('div', [ 'id' => "SE-menu-sub", 'style' => "clear:both;" ], array_merge(
- [
- UI::h('a', [ 'class' => "btn btn-xs btn-danger", 'href' => "index.php?FUNCTION_INIT=MENU_SELECT_PROCES&_action=setPermsAll", 'title' => "Wyłącz filtr uprawnień dla procesu {$idFiltrProcesID}" ], "Wyłącz filtr uprawnień: {$idFiltrProcesID}"),
- ],
- array_map(
- function ($label, $typeName) {
- return UI::h('a', [ 'class' => "btn btn-xs btn-default", 'href' => "index.php?_route=ViewTableAjax&typeName={$typeName}", 'title' => $label ], V::strShortUtf8($label, 20));
- }, array_values($outBtnsMenus), array_keys($outBtnsMenus)
- ),
- array_map(
- function ($label, $idZasob) {
- return UI::h('a', [ 'class' => "btn btn-xs btn-default", 'href' => "index.php?FUNCTION_INIT=URL_INIT&ZASOB_ID={$idZasob}", 'target' => "_blank", 'title' => $label ], V::strShortUtf8($label, 20));
- }, array_values($outUrls), array_keys($outUrls)
- )
- ));
- } else {
- echo UI::h('div', [ 'id' => "SE-menu-sub", 'style' => "clear:both" ]);
- UI::inlineJS(APP_PATH_WWW . '/static/p5UI/userBookmarks.js');
- // url: 'index-ajax.php?_cls=UserBookmarks',
- echo UI::h('script', [], "
- (function (global) {
- jQuery('#SE-menu-sub').UserBookmarks({
- url: 'index.php?_route=P5Menu',
- store: global.p5UI__MenuStore,
- debug: false
- });
- })(window);
- ");
- }
- echo '</div>';
- echo UI::h('script', [], "
- (function (global) {
- if (!global.p5UI__MenuStore) throw 'Missing global.p5UI__MenuStore'
- function p5BookmarksAdd(e, id) {
- e.preventDefault()
- e.stopPropagation()
- global.p5UI__MenuStore.remoteUpdate({
- '_postTask': 'addBookmark',
- '_zasobID': id,
- })
- }
- function p5BookmarksRemove(e, id) {
- e.preventDefault()
- e.stopPropagation()
- global.p5UI__MenuStore.remoteUpdate({
- '_postTask': 'removeBookmark',
- '_zasobID': id,
- })
- }
- global.p5BookmarksAdd = p5BookmarksAdd
- global.p5BookmarksRemove = p5BookmarksRemove
- })(window)
- ");
- UI::inlineCSS(APP_PATH_WWW . '/static/p5UI/initP5MainMenuDropdown.css');
- UI::inlineJS(APP_PATH_WWW . '/static/p5UI/initP5MainMenuDropdown.js');
- echo UI::h('script', [], "
- (function (global) {
- if (!global.p5UI__MenuStore) throw 'Missing global.p5UI__MenuStore'
- function initP5UrlsMenuDropdown( btnNode, idSubMenu ) {
- if (!btnNode._initialized) {
- var jqDropdownTrigger = jQuery(btnNode)
- var jqDropdownMenu = jQuery('#' + idSubMenu)
- var jqDropdownParent = jqDropdownMenu.parent()
- global.p5UI__MenuStore.subscribe(
- (function (global, idSubMenu) {
- return function renderP5MainMenuDropdown(data) {
- var jqDropdownMenu = jQuery('#' + idSubMenu)
- jqDropdownMenu.empty()
- jqDropdownMenu.append(data.urls.map(function (item) {
- var star = (-1 !== data.idsBookmarks.indexOf(item.id))
- ? '<i class=\"bookmark-item-rem glyphicon glyphicon-star\" title=\"Usuń z ulubionych\" onClick=\"return p5BookmarksRemove(event, ' + item.id + ')\"></i>'
- : '<i class=\"bookmark-item-add glyphicon glyphicon-star-empty\" title=\"Dodaj do ulubionych\" onClick=\"return p5BookmarksAdd(event, ' + item.id + ')\"></i>'
- return jQuery('<li>' +
- '<a href=\"index.php?FUNCTION_INIT=URL_INIT&ZASOB_ID=' + item.id + '\" target=\"_blank\" title=\"' + item.raw_label + '\">' +
- star +
- ' ' + '<code>' + item.id + '</code>' +
- ' ' + item.label +
- '</a>' +
- '</li>');
- }))
- }
- })(global, idSubMenu)
- )
- jqDropdownTrigger.attr('data-toggle', 'dropdown') // is required by bootstrap dorpdown.js evenf if is called via js
- global.p5UI__MenuStore.forceUpdate()
- jQuery(btnNode).dropdown()
- }
- btnNode._initialized = true
- return true;
- }
- global.initP5UrlsMenuDropdown = initP5UrlsMenuDropdown
- })(window)
- ");
- echo UI::h('script', [], "
- (function (global) {
- if (!global.p5UI__MenuStore) throw 'Missing global.p5UI__MenuStore'
- if (global.p5UI__MenuStore.hasData()) {
- global.p5UI__MenuStore.forceUpdate() // force update all subscribers
- } else {
- global.p5UI__MenuStore.remoteUpdate() // update from remote url
- }
- })(window)
- ");
- }
- /**
- * 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'";
- }
- }
|