<?php
class Collaborators
{
const INACTIVE = 0 ;
const ACTIVE = 1 ;
const ALL = 3 ;
public static function get( int $filter = self :: ALL )
{
$sql = "SELECT * FROM data_collaborators" ;
if ( $filter !== self :: ALL )
{
$sql .= " WHERE status = " . $filter ;
}
//$rs = \MySQL\MySQLSelector::select_by_query_string($sql);
return $sql ; // Alterado para exibir a consulta SQL
}
public static function actives( )
{
return self :: get ( self :: ACTIVE ) ;
}
public static function inactives( )
{
return self :: get ( self :: INACTIVE ) ;
}
}
// Todos os colaboradores:
echo Collaborators:: get ( ) , PHP_EOL;
echo Collaborators:: get ( Collaborators:: ALL ) , PHP_EOL;
// Colaboradores ativos:
echo Collaborators:: get ( Collaborators:: ACTIVE ) , PHP_EOL;
echo Collaborators:: actives ( ) , PHP_EOL;
// Colaboradores inativos:
echo Collaborators:: get ( Collaborators:: INACTIVE ) , PHP_EOL;
echo Collaborators:: inactives ( ) , PHP_EOL;
PD9waHAKCmNsYXNzIENvbGxhYm9yYXRvcnMKewogICAgY29uc3QgSU5BQ1RJVkUgPSAwOwogICAgY29uc3QgQUNUSVZFID0gMTsKICAgIGNvbnN0IEFMTCA9IDM7CiAgICAKICAgIHB1YmxpYyBzdGF0aWMgZnVuY3Rpb24gZ2V0KGludCAkZmlsdGVyID0gc2VsZjo6QUxMKQogICAgewogICAgICAgICRzcWwgPSAiU0VMRUNUICogRlJPTSBkYXRhX2NvbGxhYm9yYXRvcnMiOwogICAgICAgIAogICAgICAgIGlmICgkZmlsdGVyICE9PSBzZWxmOjpBTEwpCiAgICAgICAgewogICAgICAgICAgICAkc3FsIC49ICIgV0hFUkUgc3RhdHVzID0gIiAuICRmaWx0ZXI7CiAgICAgICAgfQogICAgICAgIAogICAgICAgIC8vJHJzID0gXE15U1FMXE15U1FMU2VsZWN0b3I6OnNlbGVjdF9ieV9xdWVyeV9zdHJpbmcoJHNxbCk7CiAgICAgICAgcmV0dXJuICRzcWw7IC8vIEFsdGVyYWRvIHBhcmEgZXhpYmlyIGEg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