| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:ui_table="https://biuro.biall-net.pl/SE/version-git/schema/gui/table.gui.xsd"
- xmlns:ogc="http://www.opengis.net/ogc"
- >
- <!-- xmlns:p5_36_TEST_PERMS="https://biuro.biall-net.pl/api/36/TEST_PERMS" -->
- <!-- import namespaces from xsd xmlns:p5_36_TEST_PERMS="https://biuro.biall-net.pl/api/36/TEST_PERMS" -->
- <xsl:output method="xml" omit-xml-declaration="yes" indent="no"/>
- <!-- from Data_Source
- sf_Problemy
- $fltrs['Problemy'] = new stdClass();
- $fltrs['Problemy']->icon = 'glyphicon glyphicon-warning-sign';
- $fltrs['Problemy']->btns = array();
- $fltrs['Problemy']->btns['PROBLEMY'] = (object)array('value'=>'PROBLEM');
- $fltrs['Problemy']->btns['OSTRZEZENIA'] = (object)array('value'=>'WARNING');
- $fltrs['Problemy']->btns['BEZ_PROBLEM.'] = (object)array('value'=>'NORMAL');
- sf_Status
- $fltrs['Status'] = new stdClass();
- $fltrs['Status']->icon = 'glyphicon glyphicon-question-sign';
- $fltrs['Status']->btns = array();
- $fltrs['Status']->btns['OCZEKUJACY'] = (object)array('value'=>'WAITING');
- $fltrs['Status']->btns['AKTYWNI'] = (object)array('value'=>'AKTYWNI');
- sf_Spotkania
- $fltrs['Spotkania'] = new stdClass();
- $fltrs['Spotkania']->icon = 'glyphicon glyphicon-calendar';
- $fltrs['Spotkania']->btns = array();
- $fltrs['Spotkania']->btns['STARE'] = (object)array('value'=>'OLD');
- $fltrs['Spotkania']->btns['ZARAZ'] = (object)array('value'=>'NOW');
- $fltrs['Spotkania']->btns['DZISIAJ'] = (object)array('value'=>'TODAY');
- $fltrs['Spotkania']->btns['BRAK'] = (object)array('value'=>'BRAK');
- sf_Access
- $fltrs['Access'] = new stdClass();
- $fltrs['Access']->icon = 'glyphicon glyphicon-lock';
- $fltrs['Access']->btns = array();
- $fltrs['Access']->btns['Pokaż'] = (object)array('value'=>'SHOW');
- -->
- <!-- from Data_Source
- sf_Problemy
- case 'Problemy':
- if (array_key_exists('A_PROBLEM', $this->_cols)) {
- switch ($value) {
- case 'PROBLEM':
- $sqlFltr = " t.`A_PROBLEM`!='' ";
- break;
- case 'WARNING':
- $sqlFltr = " t.`A_PROBLEM`='WARNING' ";
- break;
- case 'NORMAL':
- $sqlFltr = " t.`A_PROBLEM`='' ";
- break;
- }
- }
- break;
- case 'Status':
- if (array_key_exists('A_STATUS', $this->_cols)) {
- switch ($value) {
- case 'WAITING':
- $sqlFltr = " t.`A_STATUS`='WAITING' ";
- break;
- case 'AKTYWNI':
- $sqlFltr = " t.`A_STATUS` in('NORMAL', 'WARNING') ";
- // TODO: $_SESSION['USERS_FILTER_STATUS_SQL']="and (( $thiss->DETECT_TABLE_NAME.A_STATUS='NORMAL' or $thiss->DETECT_TABLE_NAME.A_STATUS='WARNING' ) or ( $thiss->DETECT_TABLE_NAME.A_STATUS='OFF_SOFT' and $thiss->DETECT_TABLE_NAME.A_PROBLEM_DESC not like '%odla%fizy%' and $thiss->DETECT_TABLE_NAME.A_PROBLEM!='' ) or ( $thiss->DETECT_TABLE_NAME.A_STATUS='OFF_SOFT' and $thiss->DETECT_TABLE_NAME.A_PROBLEM='' )) ";
- // if ($thiss->DETECT_TABLE_NAME == 'KSIEG_DOKUMENTY') $_SESSION['USERS_FILTER_STATUS_SQL']="and ( $thiss->DETECT_TABLE_NAME.A_STATUS='NORMAL' or $thiss->DETECT_TABLE_NAME.A_STATUS='WARNING' ) ";
- break;
- }
- }
- break;
- case 'Spotkania':
- if (array_key_exists('L_APPOITMENT_DATE', $this->_cols)) {
- switch ($value) {
- case 'OLD':
- $sqlFltr = " UNIX_TIMESTAMP(t.`L_APPOITMENT_DATE`)<UNIX_TIMESTAMP(now()) and t.`L_APPOITMENT_DATE`!='' ";
- break;
- case 'NOW':
- $sqlFltr = " UNIX_TIMESTAMP(t.`L_APPOITMENT_DATE`)<UNIX_TIMESTAMP(now())+3600 and UNIX_TIMESTAMP(t.`L_APPOITMENT_DATE`)>UNIX_TIMESTAMP(now())-3600 ";
- break;
- case 'TODAY':
- $start = mktime(0,0,0, date("m"), date("d"), date("Y"));
- $end = mktime(0,0,0, date("m"), date("d") + 1, date("Y"));
- $sqlFltr = " UNIX_TIMESTAMP(t.`L_APPOITMENT_DATE`)>'{$start}' and UNIX_TIMESTAMP(t.`L_APPOITMENT_DATE`)<'{$end}' ";
- break;
- case 'TOMORROW':
- $start = mktime(0,0,0, date("m"), date("d") + 1, date("Y"));
- $end = mktime(0,0,0, date("m"), date("d") + 2, date("Y"));
- $sqlFltr = " UNIX_TIMESTAMP(t.`L_APPOITMENT_DATE`)>'{$start}' and UNIX_TIMESTAMP(t.`L_APPOITMENT_DATE`)<'{$end}' ";
- break;
- case 'YESTERDAY':
- $start = mktime(0,0,0, date("m"), date("d") - 1, date("Y"));
- $end = mktime(0,0,0, date("m"), date("d") - 2, date("Y"));
- $sqlFltr = " UNIX_TIMESTAMP(t.`L_APPOITMENT_DATE`)>'{$start}' and UNIX_TIMESTAMP(t.`L_APPOITMENT_DATE`)<'{$end}' ";
- break;
- case 'BRAK':
- $start = mktime(0,0,0, date("m"), date("d") - 1, date("Y"));
- $end = mktime(0,0,0, date("m"), date("d") - 2, date("Y"));
- $sqlFltr = " t.`L_APPOITMENT_DATE`='' ";
- break;
- }
- }
- break;
- case 'Access':
- if ('SHOW' != $value && $this->isAccessFltrAllowed()) {
- $userLogin = User::getLogin();
- $usrAclGroups = User::getLdapGroupsNames();
- $usrAclGroups[] = '';// TODO: allow empty for everyone?
- $sqlUsrAclGroups = "'" . implode("','", $usrAclGroups) . "'";
- $sqlFltr = "
- t.`{$this->_fieldGroupWrite}` in({$sqlUsrAclGroups})
- and t.`{$this->_fieldGroupRead}` in({$sqlUsrAclGroups})
- ";
- if (array_key_exists('L_APPOITMENT_USER', $this->_cols)) {
- $sqlFltr = "
- (
- ({$sqlFltr})
- or t.`L_APPOITMENT_USER`='{$userLogin}'
- )
- ";
- }
- }
- -->
- <!-- $sqlFltr = " t.`A_STATUS`='WAITING' "; -->
- <!-- $sqlFltr = " t.`A_STATUS` in('NORMAL', 'WARNING') "; -->
- <!-- $sqlFltr = " (t.`A_STATUS`='NORMAL' or t.`A_STATUS`='WARNING') "; -->
- <!-- in('NORMAL', 'WARNING') -->
- <!-- ogc:Filter example:
- <ogc:Filter>
- <ogc:And>
- <ogc:Or>
- <ogc:PropertyIsEqualTo>
- <ogc:PropertyName>ID</ogc:PropertyName>
- <ogc:Literal>98400005701</ogc:Literal>
- </ogc:PropertyIsEqualTo>
- <ogc:PropertyIsEqualTo>
- <ogc:PropertyName>ID</ogc:PropertyName>
- <ogc:Literal>-1</ogc:Literal>
- </ogc:PropertyIsEqualTo>
- </ogc:Or>
- <ogc:And>
- <ogc:PropertyIsLessThanOrEqualTo>
- <ogc:PropertyName>MH_DATUM_INGANG</ogc:PropertyName>
- <ogc:Literal>2015-02-27T00:00:00Z</ogc:Literal>
- </ogc:PropertyIsLessThanOrEqualTo>
- <ogc:Or>
- <ogc:PropertyIsGreaterThanOrEqualTo>
- <ogc:PropertyName>MH_DATUM_EINDE</ogc:PropertyName>
- <ogc:Literal>2015-02-27T00:00:00Z</ogc:Literal>
- </ogc:PropertyIsGreaterThanOrEqualTo>
- <ogc:PropertyIsNull>
- <ogc:PropertyName>MH_DATUM_EINDE</ogc:PropertyName>
- </ogc:PropertyIsNull>
- </ogc:Or>
- </ogc:And>
- </ogc:And>
- </ogc:Filter>
- -->
- <xsl:template match="/">
- <xsl:apply-templates select="ui_table:ui_table/ui_table:filters"/>
- </xsl:template>
- <xsl:template match="ui_table:filters">
- <xsl:apply-templates select="ui_table:filter"/>
- </xsl:template>
- <!--
- <filters>
- <filter>
- <label>Status</label>
- <icon>question-sign</icon>
- <name>sf_Status</name>
- <filter_buttons>
- <filter_button>
- <name>OCZEKUJACY</name>
- <value>WAITING</value>
- <ogc:Filter>
- <ogc:PropertyIsEqualTo>
- <ogc:PropertyName>A_STATUS</ogc:PropertyName>
- <ogc:Literal>WAITING</ogc:Literal>
- </ogc:PropertyIsEqualTo>
- </ogc:Filter>
- </filter_button>
- <filter_button>
- <name>AKTYWNI</name>
- <value>AKTYWNI</value>
- <ogc:Filter>
- <ogc:Or>
- <ogc:PropertyIsEqualTo>
- <ogc:PropertyName>A_STATUS</ogc:PropertyName>
- <ogc:Literal>NORMAL</ogc:Literal>
- </ogc:PropertyIsEqualTo>
- </ogc:Or>
- <ogc:Or>
- <ogc:PropertyIsEqualTo>
- <ogc:PropertyName>A_STATUS</ogc:PropertyName>
- <ogc:Literal>WARNING</ogc:Literal>
- </ogc:PropertyIsEqualTo>
- </ogc:Or>
- </ogc:Filter>
- -->
- <xsl:template match="ui_table:filter">
- <xsl:element name="ui_filter">
- <xsl:attribute name="name"><xsl:value-of select="ui_table:name" /></xsl:attribute>
- <xsl:attribute name="label"><xsl:value-of select="ui_table:label" /></xsl:attribute>
- <xsl:attribute name="icon"><xsl:value-of select="ui_table:icon" /></xsl:attribute>
- <xsl:apply-templates select="ui_table:filter_buttons/ui_table:filter_button"/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="ui_table:filter_button">
- <xsl:element name="ui_filter_button">
- <xsl:attribute name="value"><xsl:value-of select="ui_table:value" /></xsl:attribute>
- <xsl:attribute name="label"><xsl:value-of select="ui_table:name" /></xsl:attribute>
- <xsl:apply-templates select="ogc:Filter"/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="ogc:Filter">
- <xsl:apply-templates/>
- </xsl:template>
- <xsl:template match="ogc:Or">
- <xsl:element name="sql_filter_openBlock">
- <xsl:attribute name="type"><xsl:value-of select="'or'" /></xsl:attribute>
- </xsl:element>
- <xsl:apply-templates/>
- <xsl:element name="sql_filter_closeBlock">
- <xsl:attribute name="type"><xsl:value-of select="'or'" /></xsl:attribute>
- </xsl:element>
- </xsl:template>
- <xsl:template match="ogc:And">
- <xsl:element name="sql_filter_openBlock">
- <xsl:attribute name="type"><xsl:value-of select="'and'" /></xsl:attribute>
- </xsl:element>
- <xsl:apply-templates/>
- <xsl:element name="sql_filter_closeBlock">
- <xsl:attribute name="type"><xsl:value-of select="'and'" /></xsl:attribute>
- </xsl:element>
- </xsl:template>
- <!--
- <ogc:PropertyIsEqualTo>
- <ogc:PropertyName>A_STATUS</ogc:PropertyName>
- <ogc:Literal>NORMAL</ogc:Literal>
- </ogc:PropertyIsEqualTo>
- -->
- <!-- TODO: sql variable for table prefix (t) -->
- <xsl:template match="ogc:PropertyIsEqualTo">
- <xsl:element name="sql_filter_comparisonFieldToValue">
- <xsl:attribute name="fieldName"><xsl:value-of select="ogc:PropertyName" /></xsl:attribute>
- <xsl:attribute name="comparisonSign"><xsl:value-of select="'='" /></xsl:attribute>
- <xsl:attribute name="value"><xsl:value-of select="ogc:Literal" /></xsl:attribute>
- </xsl:element>
- </xsl:template>
- </xsl:stylesheet>
|