Untitled
unknown
plain_text
a year ago
58 kB
9
Indexable
<?php
use NoRiddle\Framework\Html\HtmlAccordion;
use NoRiddle\Framework\Html\HtmlClasses;
use NoRiddle\Framework\Html\HtmlDoc;
use NoRiddle\Framework\Html\HtmlElement;
use NoRiddle\Framework\Html\HtmlHead;
use NoRiddle\Framework\Html\HtmlList;
use NoRiddle\Framework\Html\HtmlPager;
use NoRiddle\Framework\Html\HtmlTable;
use NoRiddle\Framework\Html\JMenu;
use NoRiddle\Framework\Html\JQueryHelper;
use NoRiddle\Framework\Html\LookupHelper;
use NoRiddle\Framework\Html\Script;
use NoRiddle\Framework\Html\TableColumn;
use NoRiddle\Framework\Model\ModelDataCaches;
use NoRiddle\Framework\Model\WhereClause;
use NoRiddle\Framework\Util\Csv;
use NoRiddle\Framework\Util\DateUtil;
use NoRiddle\Framework\Util\EnumBase;
use NoRiddle\Framework\Util\Request;
use NoRiddle\Framework\Util\Server;
use NoRiddle\Framework\Util\ServerCodes;
use NoRiddle\Framework\Util\Session;
use NoRiddle\Framework\Util\SmartsearchHelper;
use NoRiddle\Framework\Util\SqlCriteria;
use NoRiddle\Framework\Util\Utility;
use NoRiddle\Gloculus\Config\PrivilegeCodes;
use NoRiddle\Gloculus\Controller\CommchannelController;
use NoRiddle\Gloculus\Controller\CompanyController;
use NoRiddle\Gloculus\Controller\CompanydepartmentController;
use NoRiddle\Gloculus\Controller\EmployeeController;
use NoRiddle\Gloculus\Controller\EmployeepositionController;
use NoRiddle\Gloculus\Controller\EmployeestatusController;
use NoRiddle\Gloculus\Controller\MemberController;
use NoRiddle\Gloculus\Controller\PersonController;
use NoRiddle\Gloculus\Html\HtmlLinks;
use NoRiddle\Gloculus\Html\HtmlTemplateViewParts;
use NoRiddle\Gloculus\Html\HtmlUtil;
use NoRiddle\Gloculus\Json\JsonHelper;
use NoRiddle\Gloculus\Model\CompanydepartmentModel;
use NoRiddle\Gloculus\Model\CompanyModel;
use NoRiddle\Gloculus\Model\EmployeepositionModel;
use NoRiddle\Gloculus\Model\EmployeestatusModel;
use NoRiddle\Gloculus\Model\MemberModel;
use NoRiddle\Gloculus\Model\PersonModel;
use NoRiddle\Gloculus\Model\QryEmployeeModel;
//select * from information_schema.columns where table_name = 'employee' and table_schema = 'gloculus'order by ordinal_position
require_once dirname(realpath(__FILE__)) . '\..\..\includes.php';
class F extends EnumBase {
const showsql = 'showsql';
const smartsearch = 'smartsearch';
const userdateformat = 'userdateformat';
const submit = 'submitFrm';
const member_id = 'member_id';
const sql_criteria = 'sql_criteria';
const PAGER = 'pager';
/**/
const id = 'id';
const lname = QryEmployeeModel::lname;
const fname = QryEmployeeModel::fname;
const company_id = QryEmployeeModel::company_id;
const companydepartment_id = QryEmployeeModel::companydepartment_id;
const employeeposition_id = QryEmployeeModel::employeeposition_id;
const user_member_id = QryEmployeeModel::user_member_id;
const supervisor_employee_id = QryEmployeeModel::supervisor_employee_id;
const employeestatus_id = QryEmployeeModel::employeestatus_id;
}
$modelName = ucfirst(QryEmployeeModel::M_NAME);
$modelNameLCase = strtolower($modelName);
$pageStartTime = microtime(true);
Session::sec_session_start();
if (!MemberController::login_check($pdo)) {
$uri = Server::v(ServerCodes::REQUEST_URI);
header("Location: ../../index.php?error=ERR_LOGIN_REQUIRED&redirecturl={$uri}");
exit();
}
Session::SessionWriteClose();
$cache = new ModelDataCaches();
$member_id = Session::GetMemberId();
$allow = JsonHelper::CheckPrivilege($pdo, $member_id, PrivilegeCodes::CAN_VIEW_EMPLOYEE);
if (!$allow) {
header("Location: ../../error.php?err=ERR_PRIVILEGE&descr=Need: . PrivilegeCodes::CAN_VIEW_EMPLOYEE");
exit();
}
$uri = Server::v(ServerCodes::REQUEST_URI);
$userDateformat = Session::GetMemberDateformat();
$submit = Request::PostOrGet_STRING(F::submit);
$isPost = Request::IsPost();
$pager = HtmlPager::CreateFromRequest($isPost ? $_POST : $_GET);
$showSql = Request::Get_INT(F::showsql, Session::GetDebugMode());
if ($isPost) {
unset($_GET);
}
// START Criteria Array
$criteria = array();
$criteria[F::showsql] = Request::PostOrGet_INT(F::showsql, $showSql);
$criteria[F::member_id] = Session::GetMemberId();
$criteria[F::smartsearch] = trim(Request::PostOrGet_STRING(F::smartsearch));
$criteria[F::userdateformat] = Session::GetMemberDateformat();
$criteria[F::PAGER] = $pager;
$str = Request::PostOrGet_SQLSTRING(F::sql_criteria);
$str = htmlspecialchars_decode($str, ENT_QUOTES);
$criteria[F::sql_criteria] = $str;
$criteria[F::id] = Request::PostOrGet_INT(F::id, '');
$criteria[F::lname] = Request::PostOrGet_STRING(F::lname);
$criteria[F::fname] = Request::PostOrGet_STRING(F::fname);
$criteria[F::company_id] = Request::PostOrGet_SHIPMANAGER_COMPANY_ID($pdo, F::company_id);
$criteria[F::companydepartment_id] = Request::PostOrGet_INT(F::companydepartment_id);
$criteria[F::employeeposition_id] = Request::PostOrGet_INT(F::employeeposition_id);
$criteria[F::user_member_id] = Request::PostOrGet_INT(F::user_member_id);
$criteria[F::supervisor_employee_id] = Request::PostOrGet_INT(F::supervisor_employee_id);
$criteria[F::employeestatus_id] = Request::PostOrGet_INT(F::employeestatus_id);
// END Criteria Array
$title = "Employees";
$newUrlParameters = new Csv('&');
$fld = F::employeeposition_id;
$fldValue = Utility::Nz($criteria, $fld);
if ($fldValue) {
$newUrlParameters->Add("{$fld}={$fldValue}");
}
$fld = F::companydepartment_id;
$fldValue = Utility::Nz($criteria, $fld);
if ($fldValue) {
$newUrlParameters->Add("{$fld}={$fldValue}");
}
$fld = F::company_id;
$fldValue = Utility::Nz($criteria, $fld);
if ($fldValue) {
$newUrlParameters->Add("{$fld}={$fldValue}");
}
$fld = F::employeestatus_id;
$fldValue = Utility::Nz($criteria, $fld);
if ($fldValue) {
$newUrlParameters->Add("{$fld}={$fldValue}");
}
$model = GetModel($pdo, $cache, $criteria);
function GetModel(PDO $pdo, ModelDataCaches $cache, $criteria) {
$member_id = $criteria[F::member_id];
$model = new QryEmployeeModel(null, $pdo);
$andClause = WhereClause::GetAndClause();
$fldId = F::sql_criteria;
$fldValue = $criteria[$fldId];
$andClause->AddCondition($fldValue);
$fldId = F::id;
$fldValue = $criteria[$fldId];
$andClause->AddCondition(SqlCriteria::FieldEqualInteger($fldId, $fldValue));
//moved next on criteria already
// $attachedShipmanagerCompanyId = Session::GetMembersAttachedShipmanagerCompanyId();
// if ($attachedShipmanagerCompanyId) {
// $fldId = F::company_id;
// $fldValue = $criteria[$fldId];
// $andClause->AddCondition(SqlCriteria::FieldEqualInteger($fldId, $attachedShipmanagerCompanyId));
// }
$fldId = F::employeestatus_id;
$fldValue = $criteria[$fldId];
$andClause->AddCondition(SqlCriteria::FieldEqualInteger($fldId, $fldValue));
$fldId = F::company_id;
$fldValue = $criteria[$fldId];
$andClause->AddCondition(SqlCriteria::FieldEqualInteger($fldId, $fldValue));
$fldId = F::companydepartment_id;
$fldValue = $criteria[$fldId];
$andClause->AddCondition(SqlCriteria::FieldEqualInteger($fldId, $fldValue));
$fldId = F::employeeposition_id;
$fldValue = $criteria[$fldId];
$andClause->AddCondition(SqlCriteria::FieldEqualInteger($fldId, $fldValue));
$fldId = F::user_member_id;
$fldValue = $criteria[$fldId];
$andClause->AddCondition(SqlCriteria::FieldEqualInteger($fldId, $fldValue));
$fldId = F::lname;
$fldValue = $criteria[$fldId];
$andClause->AddCondition(SqlCriteria::FieldLike($fldId, $fldValue));
$fldId = F::fname;
$fldValue = $criteria[$fldId];
$andClause->AddCondition(SqlCriteria::FieldLike($fldId, $fldValue));
$smartsearch = $criteria[F::smartsearch];
$userDateformat = $criteria[F::userdateformat];
if ($smartsearch) {
$model->ClearWhereClauses();
$csv = Csv::Parse($smartsearch, ',', true);
$data = $csv->GetData();
foreach ($data as $part) {
$andClause->AddCondition(Smartsearch_GetWhereClause($pdo, $cache, $part, $userDateformat, $member_id));
}
}
$model->AddWhereClause($andClause);
$pager = $criteria[F::PAGER];
if ($pager->order) {
$model->AddOrderClause($pager->order);
} else {
$initOrder = "{$model->A_lname()}, {$model->A_fname()}";
$model->AddOrderClause($initOrder);
}
$model->ResetLimitClause($pager->range);
$model->SetPage($pager->page);
return $model;
}
$data = array();
if ($isPost || $submit) {
$data = $model->GetData();
}
$dataFetchTime = $model->getDataFetchTime();
//echo $model->GetSelectSql();
/* * ************************************************************************** */
/* * ************************************************************************** */
/* HTML Display */
/* @var $doc HtmlDoc */
$frmCriteriaName = 'frmRefresh';
$doc = HtmlUtil::GetHtmlTemplate_DocView2($criteria, "{$title}", $uri, $pager, $frmCriteriaName, $member_id, $userDateformat, $pdo, $pageStartTime, $dataFetchTime);
/* @var $head HtmlHead */
$head = $doc->getHead();
$style = <<< EOT
EOT;
$head->addStyle($style);
$width = 800;
$height = 600;
Script::Add(JQueryHelper::DefaultOpenNewPopup($modelName, $newUrlParameters->ToCsv(), '', false, $width, $height));
Script::Add(JQueryHelper::DefaultOpenEditPopup($modelName, '', false, $width, $height));
Script::Add(JQueryHelper::DefaultOpenCopyPopup($modelName, false, $width, $height));
Script::Add(JQueryHelper::DefaultDeleteEntity($modelName));
Script::Add(JQueryHelper::GetRecordSelectorScript('recordSelector', 'id'));
//Script::Add(JQueryHelper::DefaultRunJsonProcessWithQueryData('PROCESSNAMEHER'));
//Script::Add(JQueryHelper::GetActionConfirmationDialog('FunctionNameHere'));
//Script::Add(JQueryHelper::GetFunction_PostMultiedit('frmRefresh'));
// load external Javascript File
$otherScript = file_get_contents(basename(__FILE__, '.php') . '_script.js');
Script::Add($otherScript);
$fields = array();
$fields = array();
$fields[] = F::id;
$fields[] = F::smartsearch;
$fields[] = F::company_id;
$fields[] = F::company_id . '_description';
$fields[] = F::employeeposition_id;
$fields[] = F::employeeposition_id . '_description';
$fields[] = F::companydepartment_id;
$fields[] = F::companydepartment_id . '_description';
$fields[] = F::employeestatus_id;
$fields[] = F::employeestatus_id . '_description';
$fields[] = F::lname;
$fields[] = F::fname;
$fields[] = F::user_member_id;
$fields[] = F::user_member_id . '_description';
Script::AddJQueryScript(JQueryHelper::GetJQueryElementVariables($fields));
Script::AddJQueryScript(JQueryHelper::GetJQueryAllFieldsAdd($fields));
/* $fldId = F::person_id;
Script::AddJQueryScript(JQueryHelper::SimpleAutocompleteAjaxFromIdField($fldId, LookupHelper::GetLookupUrl(PersonModel::M_NAME)));
Script::AddJQueryScript(JQueryHelper::AutoopenAutocomplete($fldId)); */
$fldId = F::company_id;
Script::AddJQueryScript(JQueryHelper::SimpleAutocompleteAjaxFromIdField($fldId, LookupHelper::GetLookupUrl(CompanyModel::M_NAME)));
Script::AddJQueryScript(JQueryHelper::AutoopenAutocomplete($fldId));
$fldId = F::companydepartment_id;
Script::AddJQueryScript(JQueryHelper::SimpleAutocompleteAjaxFromIdField($fldId, LookupHelper::GetLookupUrl(CompanydepartmentModel::M_NAME)));
Script::AddJQueryScript(JQueryHelper::AutoopenAutocomplete($fldId));
$fldId = F::employeeposition_id;
Script::AddJQueryScript(JQueryHelper::SimpleAutocompleteAjaxFromIdField($fldId, LookupHelper::GetLookupUrl(EmployeepositionModel::M_NAME)));
Script::AddJQueryScript(JQueryHelper::AutoopenAutocomplete($fldId));
$fldId = F::supervisor_employee_id;
Script::AddJQueryScript(JQueryHelper::SimpleAutocompleteAjaxFromIdField($fldId, LookupHelper::GetLookupUrl(QryEmployeeModel::M_NAME)));
Script::AddJQueryScript(JQueryHelper::AutoopenAutocomplete($fldId));
$fldId = F::user_member_id;
Script::AddJQueryScript(JQueryHelper::SimpleAutocompleteAjaxFromIdField($fldId, LookupHelper::GetLookupUrl(MemberModel::M_NAME)));
Script::AddJQueryScript(JQueryHelper::AutoopenAutocomplete($fldId));
/* $fldId = F::start_dt_from;
Script::AddJQueryScript(JQueryHelper::Datepicker_MakeSingle($fldId, '', '', DateUtil::UserDateFormatToJSDatepickerFormat($userDateformat), true, true));
$fldId = F::start_dt_to;
Script::AddJQueryScript(JQueryHelper::Datepicker_MakeSingle($fldId, '', '', DateUtil::UserDateFormatToJSDatepickerFormat($userDateformat), true, true));
$fldId = F::end_dt_from;
Script::AddJQueryScript(JQueryHelper::Datepicker_MakeSingle($fldId, '', '', DateUtil::UserDateFormatToJSDatepickerFormat($userDateformat), true, true));
$fldId = F::end_dt_to;
Script::AddJQueryScript(JQueryHelper::Datepicker_MakeSingle($fldId, '', '', DateUtil::UserDateFormatToJSDatepickerFormat($userDateformat), true, true));
$fldId = F::poeanotificationdate_dt_from;
Script::AddJQueryScript(JQueryHelper::Datepicker_MakeSingle($fldId, '', '', DateUtil::UserDateFormatToJSDatepickerFormat($userDateformat), true, true));
$fldId = F::poeanotificationdate_dt_to;
Script::AddJQueryScript(JQueryHelper::Datepicker_MakeSingle($fldId, '', '', DateUtil::UserDateFormatToJSDatepickerFormat($userDateformat), true, true));
$fldId = F::poeareporteddate_dt_from;
Script::AddJQueryScript(JQueryHelper::Datepicker_MakeSingle($fldId, '', '', DateUtil::UserDateFormatToJSDatepickerFormat($userDateformat), true, true));
$fldId = F::poeareporteddate_dt_to;
Script::AddJQueryScript(JQueryHelper::Datepicker_MakeSingle($fldId, '', '', DateUtil::UserDateFormatToJSDatepickerFormat($userDateformat), true, true));
$fldId = F::poeadelisteddate_dt_from;
Script::AddJQueryScript(JQueryHelper::Datepicker_MakeSingle($fldId, '', '', DateUtil::UserDateFormatToJSDatepickerFormat($userDateformat), true, true));
$fldId = F::poeadelisteddate_dt_to;
Script::AddJQueryScript(JQueryHelper::Datepicker_MakeSingle($fldId, '', '', DateUtil::UserDateFormatToJSDatepickerFormat($userDateformat), true, true)); */
$fldId = F::employeestatus_id;
Script::AddJQueryScript(JQueryHelper::SimpleAutocompleteAjaxFromIdField($fldId, LookupHelper::GetLookupUrl(EmployeestatusModel::M_NAME)));
Script::AddJQueryScript(JQueryHelper::AutoopenAutocomplete($fldId));
Script::AddJQueryScript("var tips = $('.validateTips');");
Script::AddJQueryScript("var dialogUtil = new DialogUtil(tips);");
Script::AddJQueryScript("$('#reset_fields').button().on('click', ResetCriteriaFields);");
Script::AddJQueryScript("$('.navigationDiv').show();");
Script::AddJQueryScript(JQueryHelper::GetDefaultJMenu('actionsMenu', Session::GetIsMobileClient()));
Script::AddJQueryScript("$('.jMenu').show();");
Script::AddJQueryScript(JQueryHelper::GetTooltipContent());
Script::AddJQueryScript(JQueryHelper::GetTooltipContent('centerTooltip'));
$jqueryScript = file_get_contents(basename(__FILE__, ".php") . "_jquery.js");
Script::AddJQueryScript($jqueryScript);
/* @var $toolbox HtmlElement */
$toolbox = $doc->GetChild(HtmlTemplateViewParts::MAIN_TOOLBOX, true);
$toolbox->AddValue(GetToolbox($pdo, $cache, $criteria));
/* @var $dataDiv HtmlElement */
$dataDiv = $doc->GetChild(HtmlTemplateViewParts::MAIN_DATA, true);
$tbl = HtmlUtil::GetHtmlTemplate_SelectSqlHint($model);
$dataDiv->AddValue($tbl);
$tbl = GetEmployeeTable($pdo, $cache, $criteria, "tbl_{$modelNameLCase}", $data, array('Pager' => $pager, 'Uri' => $uri, 'UserDateformat' => $userDateformat, 'Copy' => true, 'Copy_Function' => "OpenCopyEmployeePopup", 'Edit' => true, 'Edit_Function' => "OpenEditEmployeePopup", 'Delete' => true, 'Delete_Function' => "DeleteEmployee"));
$dataDiv->AddValue($tbl);
echo $doc->toHtml();
die();
function Smartsearch_GetWhereClause(PDO $pdo, ModelDataCaches $cache, $dataPart, $userDateformat) {
$csv = Csv::Parse($dataPart, ':', true);
$data = $csv->GetData();
$andClause = WhereClause::GetAndClause();
if (count($data) == 1) {
$filter = trim($data[0]);
if (is_numeric($filter)) {
$trimed = (int) $filter;
$andClause->AddCondition("id = {$trimed}");
} else {
}
} else if (count($data) == 2) {
$type = strtoupper(trim($data[0]));
$filterData = trim($data[1]);
$field = '';
switch ($type) {
case "I":
$field = QryEmployeeModel::id;
$andClause->AddCondition(SmartsearchHelper::GetWhereClause_NumericIn($field, $filterData));
break;
}
}
return $andClause;
}
function GetSmartSearchHelp() {
$span = HtmlElement::SPAN();
$span->SetClass('noPrint');
$span->SetStyle('display:none');
$tbl = HtmlTable::Create(4);
$row = $tbl->newRow(false, true);
$caption = "SmartSearch Flags";
$cell = $row->setCellValue($caption, 0);
$cell->setColspan(4);
$row = HtmlUtil::AddSmartSearchHelpRow($tbl, "Code", "Description", "Format", "Example");
$row = HtmlUtil::AddSmartSearchHelpRow($tbl, "I", "I:X|Y", "ID", "i:66|77");
$row = $tbl->newRow(false, true);
$caption = "No field will search by ID";
$cell = $row->setCellValue($caption, 0);
$cell->setColspan(4);
$tbl->InsertInto($span);
return $span;
}
function GetToolbox(PDO $pdo, ModelDataCaches $cache, $criteria) {
$table = HtmlTable::Create();
$member_id = $criteria[F::member_id];
$refresh = GetRefreshForm($pdo, $cache, $criteria);
$accordion = new HtmlAccordion('accordion', 'Criteria', $refresh, 0, true);
$actions = GetActionsMenu($pdo, $cache, $criteria);
$button1 = HtmlUtil::GetButtonJQuery('create_Employee', 'create_Employee', 'New', 'OpenNewEmployeePopup()');
$table->addColumn(TableColumn::Create('col1', false, '10%'));
$table->addColumn(TableColumn::Create('col2'));
$table->addColumn(TableColumn::Create('col3', false, '10%'));
// $table->addColumn(TableColumn::Create('col4', false, '10%'));
$row = $table->newRow(false, true);
$row->setCellValue($actions, 'col1');
$row->setCellValue($accordion, 'col2');
$row->setCellValue($button1, 'col3');
// $row->setCellValue($button2, 'col4');
$row->getCell(0)->SetVerticalAlignTop();
$row->getCell(1)->SetVerticalAlignTop();
$row->getCell(2)->SetVerticalAlignTop();
// $row->getCell(3)->SetVerticalAlignTop();
$table->update('tbl_toolbox');
return $table;
}
function GetActionsMenu(PDO $pdo, ModelDataCaches $cache, $criteria) {
$member_id = $criteria[F::member_id];
$tbl = HtmlTable::Create();
$jMenu = JMenu::CreateMenu('actionsMenu');
$jMenu->SetStyle('display:none');
//$jMenu->SetStyle('width:50px');
$actions = JMenu::AddGroupToMenu($jMenu, 'Actions');
$tbl->AppendStyle('width:100%');
$tbl->addRowData(array(
$jMenu,
));
return $tbl;
}
function GetRefreshForm(PDO $pdo, ModelDataCaches $cache, $criteria) {
$userDateformat = Session::GetMemberDateformat();
$uri = Server::v(ServerCodes::REQUEST_URI);
$form = HtmlUtil::GetForm('frmRefresh', 'post', Server::v(ServerCodes::PHP_SELF));
//
$form->AppendClass(HtmlClasses::NO_PRINT);
//$form->AppendStyle("width:500px");
$form->AddValue(HtmlElement::P()->SetClass('validateTips'));
$htmlInputClass = HtmlClasses::TEXT_AND_WIDGET_CONTENT_AND_UI_CORNER_ALL;
//$htmlInputClass = HtmlClasses::UI_WIDGET_AND_WIDGET_CONTENT;
$htmlTableClass = HtmlClasses::UI_WIDGET;
$tbl = HtmlTable::Create();
$tbl->SetClass($htmlTableClass);
$tbl->addColumn(TableColumn::Create('col1', false, '10%'));
//$tbl->addColumn(TableColumn::Create('col1'));
$tbl->addColumn(TableColumn::Create('col2'));
$tbl->InsertInto($form);
$row = $tbl->newRow(false, true);
$fldId = F::smartsearch;
$fldIdValue = $criteria[$fldId];
$caption = "Quick Search";
$row->setCellValue(HtmlUtil::GetLabel($caption), 'col1');
$txtbox = HtmlUtil::GetSimpleInputText($fldId, $criteria, false, $htmlInputClass);
$txtbox->AppendAttributeValue('placeholder', 'Filters: Click on textbox and press CTRL+ENTER');
$cell = $row->setCellValue($txtbox, 'col2');
$span = SmartSearch_GetHelp();
$cell->AddValue($span);
$cell->AppendClass('centerTooltip');
// $row = $tbl->newRow(false, true);
// $cell = $row->setCellValue(HtmlUtil::Getlabel('Filters: Click on textbox and press CTRL+ENTER', '', $htmlInputClass), 'col2');
// $cell->Style_SetFontsize('0.8em');
$tabsId = 'criteriaTabs';
$tabContainer = HtmlUtil::GetSimpleTab($tabsId);
$tabs = $tabContainer->GetChild($tabsId);
$tabList = new HtmlList();
$tabList->addItem(HtmlUtil::GetLink('', "#{$tabsId}_1", "Basic"));
$tabList->addItem(HtmlUtil::GetLink('', "#{$tabsId}_2", "Multiple"));
$tabs->AddValue($tabList);
$criteriaTabBasic = HtmlElement::DIV()->SetId("{$tabsId}_1")->InsertInto($tabs);
$criteriaTabMultiple = HtmlElement::DIV()->SetId("{$tabsId}_2")->InsertInto($tabs);
$tabContainer->InsertInto($form);
$filtersToUse = array();
// $filtersToUse['use_film'] = 'use_film';
//$filtersToUse['use_filv'] = 'use_filv';
// $filtersToUse['use_filr'] = 'use_filr';
// $filtersToUse['use_filn'] = 'use_filn';
// $filtersToUse['use_filn_e'] = 'use_filn_e';
//$filtersToUse['use_filc'] = 'use_filc';
//$filtersToUse['use_filci'] = 'use_filci';
$filteredCriteria = HtmlUtil::GetTable_FilteredCriteria($pdo, $criteria, $filtersToUse);
$filteredCriteria->InsertInto($criteriaTabMultiple);
$tbl = HtmlTable::Create();
$tbl->SetClass($htmlTableClass);
$tbl->addColumn(TableColumn::Create('col1', false, '10%'));
$tbl->addColumn(TableColumn::Create('col2'));
//$tbl->AppendStyle("width:500px");
$tbl->InsertInto($criteriaTabBasic);
if (Session::GetIsAdministrator()) {
$row = $tbl->newRow(false, true);
$fldId = F::sql_criteria;
$fldIdValue = $criteria[$fldId];
$fldDescr = $fldIdValue;
$fldDescrValue = $fldIdValue;
$row->setCellValue(HtmlUtil::GetLabel('(!) SQL Criteria', $fldId), 'col1');
$row->setCellValue(HtmlUtil::GetInputText($fldId, $fldId, $fldIdValue, false, $htmlInputClass), 'col2');
}
$row = $tbl->newRow(false, true);
$fldId = F::id;
$fldIdValue = $criteria[$fldId];
$row->setCellValue(HtmlUtil::GetLabel('ID', $fldId), 'col1');
$row->setCellValue(HtmlUtil::GetSimpleInputText($fldId, $criteria, false, $htmlInputClass), 'col2');
$row = $tbl->newRow(false, true);
$fldId = F::employeestatus_id;
$fldIdValue = $criteria[$fldId];
$fldDescr = $fldId . '_description';
$fldDescrValue = EmployeeController::GetDescriptionFromId($pdo, $fldIdValue, $cache, true);
$row->setCellValue(HtmlUtil::GetLabel('Status (%)', $fldId), 'col1');
$row->setCellValue(HtmlUtil::GetAutocompleteInput($fldId, $fldId, $fldIdValue, $fldDescr, $fldDescr, $fldDescrValue, false, $htmlInputClass), 'col2');
$row = $tbl->newRow(false, true);
$fldId = F::company_id;
$fldIdValue = $criteria[$fldId];
$fldDescr = $fldId . '_description';
$fldDescrValue = CompanyController::GetDescriptionFromId($pdo, $fldIdValue, $cache, true);
$row->setCellValue(HtmlUtil::GetLabel('Company (%)', $fldId), 'col1');
$row->setCellValue(HtmlUtil::GetAutocompleteInput($fldId, $fldId, $fldIdValue, $fldDescr, $fldDescr, $fldDescrValue, false, $htmlInputClass), 'col2');
$row = $tbl->newRow(false, true);
$fldId = F::lname;
$fldIdValue = $criteria[$fldId];
$row->setCellValue(HtmlUtil::GetLabel('Last Name', $fldId), 'col1');
$row->setCellValue(HtmlUtil::GetSimpleInputText($fldId, $criteria, false, $htmlInputClass), 'col2');
$row = $tbl->newRow(false, true);
$fldId = F::fname;
$fldIdValue = $criteria[$fldId];
$row->setCellValue(HtmlUtil::GetLabel('First Name', $fldId), 'col1');
$row->setCellValue(HtmlUtil::GetSimpleInputText($fldId, $criteria, false, $htmlInputClass), 'col2');
$row = $tbl->newRow(false, true);
$fldId = F::companydepartment_id;
$fldIdValue = $criteria[$fldId];
$fldDescr = $fldId . '_description';
$fldDescrValue = CompanydepartmentController::GetDescriptionFromId($pdo, $fldIdValue, $cache, true);
$row->setCellValue(HtmlUtil::GetLabel('Department (%)', $fldId), 'col1');
$row->setCellValue(HtmlUtil::GetAutocompleteInput($fldId, $fldId, $fldIdValue, $fldDescr, $fldDescr, $fldDescrValue, false, $htmlInputClass), 'col2');
$row = $tbl->newRow(false, true);
$fldId = F::employeeposition_id;
$fldIdValue = $criteria[$fldId];
$fldDescr = $fldId . '_description';
$fldDescrValue = EmployeepositionController::GetDescriptionFromId($pdo, $fldIdValue, $cache, true);
$row->setCellValue(HtmlUtil::GetLabel('Position (%)', $fldId), 'col1');
$row->setCellValue(HtmlUtil::GetAutocompleteInput($fldId, $fldId, $fldIdValue, $fldDescr, $fldDescr, $fldDescrValue, false, $htmlInputClass), 'col2');
$row = $tbl->newRow(false, true);
$fldId = F::user_member_id;
$fldIdValue = $criteria[$fldId];
$fldDescr = $fldId . '_description';
$fldDescrValue = MemberController::GetDescriptionFromId($pdo, $fldIdValue, $cache, true);
$row->setCellValue(HtmlUtil::GetLabel('Attached User (%)', $fldId), 'col1');
$row->setCellValue(HtmlUtil::GetAutocompleteInput($fldId, $fldId, $fldIdValue, $fldDescr, $fldDescr, $fldDescrValue, false, $htmlInputClass), 'col2');
//THE SHOW SQL
$fld = F::showsql;
$showSql = $criteria[$fld];
$h = HtmlUtil::GetInputHidden('', $fld, $showSql);
$h->InsertInto($form);
// THE PAGER
$fld = F::PAGER;
$pager = $criteria[$fld];
$h = HtmlUtil::GetInputHidden('', HtmlPager::PAGE, $pager->page);
$h->InsertInto($form);
$h = HtmlUtil::GetInputHidden('', HtmlPager::RANGE, $pager->range);
$h->InsertInto($form);
$h = HtmlUtil::GetInputHidden('', HtmlPager::ORDER, $pager->order);
$h->InsertInto($form);
//THE SUBMIT
//$h = HtmlUtil::GetInputHidden('', F::isformsubmit, 1)->InsertInto($form);
$tbl = HtmlTable::Create();
$tbl->SetClass($htmlTableClass);
$tbl->addColumn(TableColumn::Create('col1'));
$tbl->addColumn(TableColumn::Create('col2'));
//$tbl->AppendStyle("width:500px");
$tbl->InsertInto($form);
$row = $tbl->newRow(false, true);
$btn = HtmlUtil::GetButton('reset_fields', 'reset_fields', 'Reset Criteria')->SetClass($htmlInputClass);
// $btnName = 'reset_fields';
// $btn = HtmlUtil::GetButtonJQuery($btnName, $btnName, 'Reset Criteria', 'ResetCriteriaFields()')->SetClass($htmlInputClass);
$cell = $row->setCellValue($btn, 'col1');
$cell->SetHorizontalAlignCenter();
$btn = HtmlUtil::GetInputSubmit(F::submit, F::submit, 'Refresh')->SetClass(HtmlClasses::UI_BUTTON)->AppendClass($htmlInputClass);
$cell = $row->setCellValue($btn, 'col2');
$cell->SetHorizontalAlignCenter();
// $cell->setColspan(2);
$row = $tbl->newRow(false, true);
$lbl = HtmlUtil::GetLabel('CAUTION: Updates MAY NOT refresh the page. Press the Refresh Button of your browser to refresh');
$lbl->Style_SetColor('red');
$cell = $row->setCellValue($lbl, 'col1');
$cell->setColspan(2);
return $form;
}
function GetTable(PDO $pdo, ModelDataCaches $cache, $criteria, $id, $data, array $parameters) {
$uri = Utility::Nz($parameters, 'Uri', '');
$pager = Utility::Nz($parameters, 'Pager', HtmlPager::Create());
$order = $pager->order;
$userDateformat = Utility::Nz($parameters, 'UserDateformat', 'Y-m-d');
$tblClass = HtmlClasses::UI_WIDGET_AND_WIDGET_CONTENT;
$tbl = HtmlTable::Create()->SetId($id)->SetClass($tblClass)->AppendClass(HtmlClasses::LISTDATATABLE);
// The Columns
$defWidth = '1px';
$tbl->addColumn(TableColumn::Create('COL_SELECT', false, '5px')->setHorizontalAlign_Right()->AppendClass(HtmlClasses::NO_PRINT));
$tbl->addColumn(TableColumn::Create('COL_AA'));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::id)->setHorizontalAlign_Right());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::person_id)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::company_id)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::companydepartment_id)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::employeeposition_id)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::commchannel_group_uuid)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::custominfodata_group_uuid)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::remarks)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::supervisor_employee_id)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::attachment_group_uuid)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::user_member_id)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::start_dt));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::end_dt));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::poeanotificationdate_dt));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::poeareporteddate_dt));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::poeadelisteddate_dt));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::employeestatus_id)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::employeestatusdetail)->setHorizontalAlign_Left());
if (array_key_exists('Edit_Function', $parameters)) {
$tbl->addColumn(TableColumn::Create('COL_EDIT', false, '5px')->AppendClass(HtmlClasses::NO_PRINT)->AppendClass('edit'));
}
if (array_key_exists('Copy_Function', $parameters)) {
$tbl->addColumn(TableColumn::Create('COL_COPY', false, '5px')->AppendClass(HtmlClasses::NO_PRINT)->AppendClass('copy'));
}
if (array_key_exists('Delete_Function', $parameters)) {
$tbl->addColumn(TableColumn::Create('COL_DELETE', false, '5px')->AppendClass(HtmlClasses::NO_PRINT)->AppendClass('delete'));
}
//THE HEADERS
$row = $tbl->newRow(true, true);
$row->AppendClass(HtmlClasses::UI_WIDGET_HEADER);
$chkSelect = HtmlUtil::GetInputCheckbox('recordSelectorToggle', '', false, '1', false);
$chkSelect->AppendAttributeValue('onclick', 'javascript:recordSelector_ToggleSelection();');
$row->setCellValue($chkSelect, 'COL_SELECT'); //for selection
$row->setCellValue('#', 'COL_AA');
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'id', $uri, QryEmployeeModel::id, $order), QryEmployeeModel::id);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'person_id', $uri, QryEmployeeModel::person_id, $order), QryEmployeeModel::person_id);
//$row->setCellValue(HtmlUtil::GetOrderForm2('', 'person_id', $uri, QryEmployeeModel::person_id_description, $order), QryEmployeeModel::person_id_description);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'company_id', $uri, QryEmployeeModel::company_id, $order), QryEmployeeModel::company_id);
//$row->setCellValue(HtmlUtil::GetOrderForm2('', 'company_id', $uri, QryEmployeeModel::company_id_description, $order), QryEmployeeModel::company_id_description);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'companydepartment_id', $uri, QryEmployeeModel::companydepartment_id, $order), QryEmployeeModel::companydepartment_id);
//$row->setCellValue(HtmlUtil::GetOrderForm2('', 'companydepartment_id', $uri, QryEmployeeModel::companydepartment_id_description, $order), QryEmployeeModel::companydepartment_id_description);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'employeeposition_id', $uri, QryEmployeeModel::employeeposition_id, $order), QryEmployeeModel::employeeposition_id);
//$row->setCellValue(HtmlUtil::GetOrderForm2('', 'employeeposition_id', $uri, QryEmployeeModel::employeeposition_id_description, $order), QryEmployeeModel::employeeposition_id_description);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'commchannel_group_uuid', $uri, QryEmployeeModel::commchannel_group_uuid, $order), QryEmployeeModel::commchannel_group_uuid);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'custominfodata_group_uuid', $uri, QryEmployeeModel::custominfodata_group_uuid, $order), QryEmployeeModel::custominfodata_group_uuid);
$row->setCellValue('remarks', QryEmployeeModel::remarks);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'supervisor_employee_id', $uri, QryEmployeeModel::supervisor_employee_id, $order), QryEmployeeModel::supervisor_employee_id);
//$row->setCellValue(HtmlUtil::GetOrderForm2('', 'supervisor_employee_id', $uri, QryEmployeeModel::supervisor_employee_id_description, $order), QryEmployeeModel::supervisor_employee_id_description);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'attachment_group_uuid', $uri, QryEmployeeModel::attachment_group_uuid, $order), QryEmployeeModel::attachment_group_uuid);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'user_member_id', $uri, QryEmployeeModel::user_member_id, $order), QryEmployeeModel::user_member_id);
//$row->setCellValue(HtmlUtil::GetOrderForm2('', 'user_member_id', $uri, QryEmployeeModel::user_member_id_description, $order), QryEmployeeModel::user_member_id_description);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'start_dt', $uri, QryEmployeeModel::start_dt, $order), QryEmployeeModel::start_dt);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'end_dt', $uri, QryEmployeeModel::end_dt, $order), QryEmployeeModel::end_dt);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'poeanotificationdate_dt', $uri, QryEmployeeModel::poeanotificationdate_dt, $order), QryEmployeeModel::poeanotificationdate_dt);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'poeareporteddate_dt', $uri, QryEmployeeModel::poeareporteddate_dt, $order), QryEmployeeModel::poeareporteddate_dt);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'poeadelisteddate_dt', $uri, QryEmployeeModel::poeadelisteddate_dt, $order), QryEmployeeModel::poeadelisteddate_dt);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'employeestatus_id', $uri, QryEmployeeModel::employeestatus_id, $order), QryEmployeeModel::employeestatus_id);
//$row->setCellValue(HtmlUtil::GetOrderForm2('', 'employeestatus_id', $uri, QryEmployeeModel::employeestatus_id_description, $order), QryEmployeeModel::employeestatus_id_description);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'employeestatusdetail', $uri, QryEmployeeModel::employeestatusdetail, $order), QryEmployeeModel::employeestatusdetail);
if (array_key_exists('Edit_Function', $parameters)) {
$row->setCellValue('', 'COL_EDIT');
$row->getCell('COL_EDIT')->AppendClass(HtmlClasses::NO_PRINT);
}
if (array_key_exists('Copy_Function', $parameters)) {
$row->setCellValue('', 'COL_COPY');
$row->getCell('COL_COPY')->AppendClass(HtmlClasses::NO_PRINT);
}
if (array_key_exists('Delete_Function', $parameters)) {
$row->setCellValue('', 'COL_DELETE');
$row->getCell('COL_DELETE')->AppendClass(HtmlClasses::NO_PRINT);
}
// The Data
$pos = 1 + ($pager->page - 1 ) * $pager->range;
//$timer = Timer::Create(1);
foreach ($data as $rowData) {
$row = $tbl->newRow(false, true);
$row->SetData('db_id', $rowData['id']);
$chkSelect = HtmlUtil::GetInputCheckbox('', '', false, '1', false);
$chkSelect->AppendClass('recordSelector');
$chkSelect->SetData('id', $rowData[QryEmployeeModel::id]);
$row->setCellValue($chkSelect, 'COL_SELECT');
$info = HtmlUtil::GetCreationinfoSpan($pdo, "{$pos})", $cache, $userDateformat, $rowData[QryEmployeeModel::created_by]
, $rowData[QryEmployeeModel::created_dt]
, $rowData[QryEmployeeModel::modified_by]
, $rowData[QryEmployeeModel::modified_dt]
, Utility::Nz($criteria, 'export'));
$cell = $row->setCellValue($info, 'COL_AA');
// $cell->AppendClass(HtmlClasses::HAS_TOOLTIP);
$pos++;
$fldId = QryEmployeeModel::id;
$fldIdValue = $rowData[$fldId];
$lbl = HtmlElement::Label()->AddValue($fldIdValue);
$lbl->SetID("lblId_{$fldIdValue}");
$lbl->AppendAttributeValue('onclick', "CopyLabelToClipboard('lblId_{$fldIdValue}')");
$cell = $row->setCellValue($lbl, $fldId)->SetAttribute('data-field', $fldId);
$fldId = QryEmployeeModel::person_id;
$fldIdValue = Utility::Nz($rowData, $fldId);
if ($fldIdValue) {
$entity = PersonController::GetEntity($pdo, $fldIdValue, $cache);
$fldDescrValue = PersonController::GetDescriptionFromID($pdo, $entity->Val_id(), $cache, true);
$a = HtmlLinks::GetLink_Person('', $entity->Val_id(), $fldIdValue);
$cell = $row->setCellValue($a, $fldId)->SetData('field', $fldId);
HtmlUtil::AddTooltipInCell($fldDescrValue, $cell);
}
$fldId = QryEmployeeModel::company_id;
$fldIdValue = Utility::Nz($rowData, $fldId);
if ($fldIdValue) {
$entity = CompanyController::GetEntity($pdo, $fldIdValue, $cache);
$fldDescrValue = CompanyController::GetDescriptionFromID($pdo, $entity->Val_id(), $cache, true);
$a = HtmlLinks::GetLink_Company('', $entity->Val_id(), $fldIdValue);
$cell = $row->setCellValue($a, $fldId)->SetData('field', $fldId);
HtmlUtil::AddTooltipInCell($fldDescrValue, $cell);
}
$fldId = QryEmployeeModel::companydepartment_id;
$fldIdValue = Utility::Nz($rowData, $fldId);
if ($fldIdValue) {
$entity = CompanydepartmentController::GetEntity($pdo, $fldIdValue, $cache);
$fldDescrValue = CompanydepartmentController::GetDescriptionFromID($pdo, $entity->Val_id(), $cache, true);
$a = HtmlLinks::GetLink_Companydepartment('', $entity->Val_id(), $fldIdValue);
$cell = $row->setCellValue($a, $fldId)->SetData('field', $fldId);
HtmlUtil::AddTooltipInCell($fldDescrValue, $cell);
}
$fldId = QryEmployeeModel::employeeposition_id;
$fldIdValue = Utility::Nz($rowData, $fldId);
if ($fldIdValue) {
$entity = EmployeepositionController::GetEntity($pdo, $fldIdValue, $cache);
$fldDescrValue = EmployeepositionController::GetDescriptionFromID($pdo, $entity->Val_id(), $cache, true);
$a = HtmlLinks::GetLink_Employeeposition('', $entity->Val_id(), $fldIdValue);
$cell = $row->setCellValue($a, $fldId)->SetData('field', $fldId);
HtmlUtil::AddTooltipInCell($fldDescrValue, $cell);
}
$fldId = QryEmployeeModel::commchannel_group_uuid;
$fldIdValue = Utility::Nz($rowData, $fldId);
$cell = $row->setCellValue($fldIdValue, $fldId)->SetData('field', $fldId);
$fldId = QryEmployeeModel::custominfodata_group_uuid;
$fldIdValue = Utility::Nz($rowData, $fldId);
$cell = $row->setCellValue($fldIdValue, $fldId)->SetData('field', $fldId);
$fldId = QryEmployeeModel::remarks;
HtmlUtil::SetRemarksTooltipInCell(Utility::Nz($rowData, $fldId), 5, $row, $fldId, $fldId);
$fldId = QryEmployeeModel::supervisor_employee_id;
$fldIdValue = Utility::Nz($rowData, $fldId);
if ($fldIdValue) {
$entity = EmployeeController::GetEntity($pdo, $fldIdValue, $cache);
$fldDescrValue = EmployeeController::GetDescriptionFromID($pdo, $entity->Val_id(), $cache, true);
$a = HtmlLinks::GetLink_Employee('', $entity->Val_id(), $fldIdValue);
$cell = $row->setCellValue($a, $fldId)->SetData('field', $fldId);
HtmlUtil::AddTooltipInCell($fldDescrValue, $cell);
}
$fldId = QryEmployeeModel::attachment_group_uuid;
$fldIdValue = Utility::Nz($rowData, $fldId);
$cell = $row->setCellValue($fldIdValue, $fldId)->SetData('field', $fldId);
$fldId = QryEmployeeModel::user_member_id;
$fldIdValue = Utility::Nz($rowData, $fldId);
if ($fldIdValue) {
$entity = MemberController::GetEntity($pdo, $fldIdValue, $cache);
$fldDescrValue = MemberController::GetDescriptionFromID($pdo, $entity->Val_id(), $cache, true);
$a = HtmlLinks::GetLink_Member('', $entity->Val_id(), $fldIdValue);
$cell = $row->setCellValue($a, $fldId)->SetData('field', $fldId);
HtmlUtil::AddTooltipInCell($fldDescrValue, $cell);
}
$fldId = QryEmployeeModel::start_dt;
$fldIdValue = Utility::Nz($rowData, $fldId, '');
$fldDescrValue = DateUtil::SqlDateToUserDate($fldIdValue, $userDateformat);
$row->setCellValue($fldDescrValue, $fldId)->SetData('field', $fldId);
$fldId = QryEmployeeModel::end_dt;
$fldIdValue = Utility::Nz($rowData, $fldId, '');
$fldDescrValue = DateUtil::SqlDateToUserDate($fldIdValue, $userDateformat);
$row->setCellValue($fldDescrValue, $fldId)->SetData('field', $fldId);
$fldId = QryEmployeeModel::poeanotificationdate_dt;
$fldIdValue = Utility::Nz($rowData, $fldId, '');
$fldDescrValue = DateUtil::SqlDateToUserDate($fldIdValue, $userDateformat);
$row->setCellValue($fldDescrValue, $fldId)->SetData('field', $fldId);
$fldId = QryEmployeeModel::poeareporteddate_dt;
$fldIdValue = Utility::Nz($rowData, $fldId, '');
$fldDescrValue = DateUtil::SqlDateToUserDate($fldIdValue, $userDateformat);
$row->setCellValue($fldDescrValue, $fldId)->SetData('field', $fldId);
$fldId = QryEmployeeModel::poeadelisteddate_dt;
$fldIdValue = Utility::Nz($rowData, $fldId, '');
$fldDescrValue = DateUtil::SqlDateToUserDate($fldIdValue, $userDateformat);
$row->setCellValue($fldDescrValue, $fldId)->SetData('field', $fldId);
$fldId = QryEmployeeModel::employeestatus_id;
$fldIdValue = Utility::Nz($rowData, $fldId);
if ($fldIdValue) {
$entity = EmployeestatusController::GetEntity($pdo, $fldIdValue, $cache);
$fldDescrValue = EmployeestatusController::GetDescriptionFromID($pdo, $entity->Val_id(), $cache, true);
$a = HtmlLinks::GetLink_Employeestatus('', $entity->Val_id(), $fldIdValue);
$cell = $row->setCellValue($a, $fldId)->SetData('field', $fldId);
HtmlUtil::AddTooltipInCell($fldDescrValue, $cell);
}
$fldId = QryEmployeeModel::employeestatusdetail;
$fldIdValue = Utility::Nz($rowData, $fldId);
$cell = $row->setCellValue($fldIdValue, $fldId)->SetData('field', $fldId);
if (array_key_exists('Edit_Function', $parameters)) {
$url = "javascript:{$parameters['Edit_Function']}({$rowData['id']})";
$a = HtmlUtil::GetLink('', $url, '');
$row->setCellValue($a, 'COL_EDIT');
$row->getCell('COL_EDIT')->SetData('field', 'col_edit')->AppendClass(HtmlClasses::NO_PRINT);
}
if (array_key_exists('Copy_Function', $parameters)) {
$url = "javascript:{$parameters['Copy_Function']}({$rowData['id']})";
$a = HtmlUtil::GetLink('', $url, '');
$row->setCellValue($a, 'COL_COPY');
$row->getCell('COL_COPY')->SetData('field', 'col_copy')->AppendClass(HtmlClasses::NO_PRINT);
}
if (array_key_exists('Delete_Function', $parameters)) {
$url = "javascript:{$parameters['Delete_Function']}({$rowData['id']})";
$a = HtmlUtil::GetLink('', $url, '');
$row->setCellValue($a, 'COL_DELETE');
$row->getCell('COL_DELETE')->SetData('field', 'col_delete')->AppendClass(HtmlClasses::NO_PRINT);
}
}
$tbl->update();
return $tbl;
}
function GetEmployeeTable(PDO $pdo, ModelDataCaches $cache, $criteria, $id, $data, array $parameters) {
$member_id = Session::GetMemberId();
$uri = Utility::Nz($parameters, 'Uri', '');
$pager = Utility::Nz($parameters, 'Pager', HtmlPager::Create());
$order = $pager->order;
$userDateformat = Utility::Nz($parameters, 'UserDateformat', 'Y-m-d');
$tblClass = HtmlClasses::UI_WIDGET_AND_WIDGET_CONTENT;
$tbl = HtmlTable::Create()->SetId($id)->SetClass($tblClass)->AppendClass(HtmlClasses::LISTDATATABLE);
// The Columns
$defWidth = '';
$tbl->addColumn(TableColumn::Create('COL_SELECT', false, '5px')->AppendClass(HtmlClasses::NO_PRINT));
$tbl->addColumn(TableColumn::Create('COL_AA'));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::id, false, $defWidth));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::company_name, false, $defWidth));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::employeestatus_id, false, $defWidth));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::lname, false, $defWidth)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::employeeposition_description, false, $defWidth)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::companydepartment_description, false, $defWidth)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create('col_phone', false, $defWidth));
$tbl->addColumn(TableColumn::Create('col_mobile', false, $defWidth));
$tbl->addColumn(TableColumn::Create('col_email', false, $defWidth)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::start_dt, false, $defWidth));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::end_dt, false, $defWidth));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::employeestatusdetail, false, $defWidth));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::poeanotificationdate_dt, false, $defWidth));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::poeareporteddate_dt, false, $defWidth));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::poeadelisteddate_dt, false, $defWidth));
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::user_member_id, false, $defWidth)->setHorizontalAlign_Left());
$tbl->addColumn(TableColumn::Create(QryEmployeeModel::remarks, false, $defWidth)->setHorizontalAlign_Left());
if (array_key_exists('Edit_Function', $parameters)) {
$tbl->addColumn(TableColumn::Create('COL_EDIT', false, '5px')->AppendClass(HtmlClasses::NO_PRINT)->AppendClass('edit'));
}
if (array_key_exists('Copy_Function', $parameters)) {
$tbl->addColumn(TableColumn::Create('COL_COPY', false, '5px')->AppendClass(HtmlClasses::NO_PRINT)->AppendClass('copy'));
}
if (array_key_exists('Delete_Function', $parameters)) {
$tbl->addColumn(TableColumn::Create('COL_DELETE', false, '5px')->AppendClass(HtmlClasses::NO_PRINT)->AppendClass('delete'));
}
// The Headers
$row = $tbl->newRow(true, true);
$row->SetClass('ui-widget-header');
$chkSelect = HtmlUtil::GetInputCheckbox('recordSelectorToggle', '', false, '1', false);
$chkSelect->AppendAttributeValue('onclick', 'javascript:recordSelector_ToggleSelection();');
$row->setCellValue($chkSelect, 'COL_SELECT');
$row->setCellValue('#', 'COL_AA');
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'Id', $uri, QryEmployeeModel::id, $pager->order), QryEmployeeModel::id);
//$ths[] = HtmlElement::TH()->AddValue(HtmlUtil::GetOrderForm2('', 'Comp.Type', $uri, QryEmployeeModel::companytype_code, $order));
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'Status', $uri, QryEmployeeModel::employeestatus_id, $pager->order), QryEmployeeModel::employeestatus_id);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'Company', $uri, QryEmployeeModel::company_name, $pager->order), QryEmployeeModel::company_name);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'Name', $uri, QryEmployeeModel::lname, $pager->order), QryEmployeeModel::lname);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'Position', $uri, QryEmployeeModel::employeeposition_description, $pager->order), QryEmployeeModel::employeeposition_description);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'Department', $uri, QryEmployeeModel::companydepartment_description, $pager->order), QryEmployeeModel::companydepartment_description);
$row->setCellValue('Phone', 'col_phone');
$row->setCellValue('Mobile', 'col_mobile');
$row->setCellValue('Email', 'col_email');
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'Start', $uri, QryEmployeeModel::start_dt, $pager->order), QryEmployeeModel::start_dt);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'End', $uri, QryEmployeeModel::end_dt, $pager->order), QryEmployeeModel::end_dt);
$row->setCellValue('Status Details', QryEmployeeModel::employeestatusdetail);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'POEA<br>Notif. Date', $uri, QryEmployeeModel::poeanotificationdate_dt, $pager->order), QryEmployeeModel::poeanotificationdate_dt);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'POEA<br>Report. Date', $uri, QryEmployeeModel::poeareporteddate_dt, $pager->order), QryEmployeeModel::poeareporteddate_dt);
$row->setCellValue(HtmlUtil::GetOrderForm2('', 'POEA<br>Delist. Date', $uri, QryEmployeeModel::poeadelisteddate_dt, $pager->order), QryEmployeeModel::poeadelisteddate_dt);
$row->setCellValue('Assigned User', QryEmployeeModel::user_member_id);
$row->setCellValue('Remarks', QryEmployeeModel::remarks);
$pos = 1 + ($pager->page - 1 ) * $pager->range;
foreach ($data as $rowData) {
$row = $tbl->newRow(false, true);
SetTableRow($pdo, $cache, $row, $pos, $criteria, $rowData, $parameters);
$pos++;
}
$tbl->update();
return $tbl;
}
function SetTableRow(PDO $pdo, ModelDataCaches $cache, $row, $pos, $criteria, $rowData, array $parameters) {
$member_id = $criteria[F::member_id];
$userDateformat = $criteria[F::userdateformat];
$row->SetData('db_id', $rowData[QryEmployeeModel::id]);
$chkSelect = HtmlUtil::GetInputCheckbox('', '', false, '1', false);
$chkSelect->AppendClass('recordSelector');
$chkSelect->SetData('id', $rowData[QryEmployeeModel::id]);
$row->setCellValue($chkSelect, 'COL_SELECT');
$createdby_member_id = $rowData[QryEmployeeModel::created_by];
$createdby_dt = $rowData[QryEmployeeModel::created_dt];
$modifiedby_member_id = $rowData[QryEmployeeModel::modified_by];
$modifiedby_dt = $rowData[QryEmployeeModel::modified_dt];
HtmlUtil::SetModifiedByInCell($pdo, $cache, "{$pos})", $member_id, $modifiedby_member_id, $modifiedby_dt, $createdby_member_id, $createdby_dt, $userDateformat, $row, 'COL_AA');
$fldId = QryEmployeeModel::id;
$fldIdValue = Utility::Nz($rowData, $fldId);
$cell = $row->setCellValue($fldIdValue, $fldId)->SetData('field', $fldId);
$fldId = QryEmployeeModel::employeestatus_id;
$fldIdValue = Utility::Nz($rowData, $fldId);
$status = EmployeestatusController::GetEntity($pdo, $fldIdValue, $cache);
$fldDescr = EmployeestatusController::GetDescriptionFromId($pdo, $fldIdValue, $cache, true);
$cell = $row->setCellValue($status->Val_code(), $fldId);
HtmlUtil::AddTooltipInCell($fldDescr, $cell);
$fldId = QryEmployeeModel::company_id;
$fldIdValue = Utility::Nz($rowData, $fldId);
$fldDescr = CompanyController::GetDescriptionFromId($pdo, $fldIdValue, $cache, true);
$a = HtmlUtil::GetLinkCompany('', $rowData[QryEmployeeModel::company_code], $rowData[QryEmployeeModel::company_id]);
$cell = $row->setCellValue($a, QryEmployeeModel::company_name);
HtmlUtil::AddTooltipInCell($fldDescr, $cell);
$fldId = QryEmployeeModel::person_id;
$fldIdValue = Utility::Nz($rowData, $fldId);
$fldDescr = PersonController::GetDescriptionFromId($pdo, $fldIdValue, $cache, true);
$a = HtmlUtil::GetLinkEmployee('', $fldDescr, $rowData[QryEmployeeModel::id]);
$cell = $row->setCellValue($a, QryEmployeeModel::lname);
$fldId = QryEmployeeModel::employeeposition_description;
$fldIdValue = Utility::Nz($rowData, $fldId);
$cell = $row->setCellValue($fldIdValue, $fldId);
$fldId = QryEmployeeModel::companydepartment_description;
$fldIdValue = Utility::Nz($rowData, $fldId);
$cell = $row->setCellValue($fldIdValue, $fldId);
$uuid = $rowData[QryEmployeeModel::commchannel_group_uuid];
$fldId = 'col_phone';
$fldIdValue = CommchannelController::GetDefaultTelephoneByUUID($pdo, $cache, $uuid);
$cell = $row->setCellValue($fldIdValue, $fldId);
$fldId = 'col_mobile';
$fldIdValue = CommchannelController::GetDefaultMobileByUUID($pdo, $cache, $uuid);
$cell = $row->setCellValue($fldIdValue, $fldId);
$fldId = 'col_email';
$fldIdValue = CommchannelController::GetDefaultEmailByUUID($pdo, $cache, $uuid);
if ($fldIdValue) {
$a = HtmlUtil::GetLink('', "mailto:{$fldIdValue}", $fldIdValue);
$cell = $row->setCellValue($a, $fldId);
}
$fldId = QryEmployeeModel::start_dt;
$fldIdValue = DateUtil::SqlDateToUserDate($rowData[$fldId], $userDateformat);
$cell = $row->setCellValue($fldIdValue, $fldId);
$fldId = QryEmployeeModel::end_dt;
$fldIdValue = DateUtil::SqlDateToUserDate($rowData[$fldId], $userDateformat);
$cell = $row->setCellValue($fldIdValue, $fldId);
$fldId = QryEmployeeModel::employeestatusdetail;
$fldIdValue = Utility::Nz($rowData, $fldId);
$cell = $row->setCellValue($fldIdValue, $fldId)->SetData('field', $fldId);
$fldId = QryEmployeeModel::poeanotificationdate_dt;
$fldIdValue = DateUtil::SqlDateToUserDate($rowData[$fldId], $userDateformat);
$cell = $row->setCellValue($fldIdValue, $fldId);
$fldId = QryEmployeeModel::poeareporteddate_dt;
$fldIdValue = DateUtil::SqlDateToUserDate($rowData[$fldId], $userDateformat);
$cell = $row->setCellValue($fldIdValue, $fldId);
$fldId = QryEmployeeModel::poeadelisteddate_dt;
$fldIdValue = DateUtil::SqlDateToUserDate($rowData[$fldId], $userDateformat);
$cell = $row->setCellValue($fldIdValue, $fldId);
$fldId = QryEmployeeModel::user_member_id;
$fldIdValue = Utility::Nz($rowData, $fldId);
if ($fldIdValue) {
$userDescr = MemberController::GetDescriptionFromId($pdo, $fldIdValue, $cache, true);
$userDescrSimple = MemberController::GetDescriptionFromId($pdo, $fldIdValue, $cache);
$user = MemberController::GetEntity($pdo, $fldIdValue, $cache);
$a = HtmlUtil::GetLinkMember('', $userDescrSimple, $fldIdValue);
$cell = $row->setCellValue($a, $fldId);
if ($user->Val_isblocked()) {
$userDescr .= "<Br>BLOCKED (ID:{$fldIdValue})";
$cell->Style_SetBackgroundColor('red');
}
HtmlUtil::AddTooltipInCell($userDescr, $cell);
}
$fldId = QryEmployeeModel::remarks;
$fldIdValue = Utility::Nz($rowData, $fldId);
HtmlUtil::SetRemarksTooltipInCell($fldIdValue, 5, $row, $fldId, $fldId);
if (array_key_exists('Edit_Function', $parameters)) {
$url = "javascript:{$parameters['Edit_Function']}({$rowData['id']})";
$a = HtmlUtil::GetLink('', $url, '');
$row->setCellValue($a, 'COL_EDIT');
$row->getCell('COL_EDIT')->SetData('field', 'col_edit')->AppendClass(HtmlClasses::NO_PRINT);
}
if (array_key_exists('Copy_Function', $parameters)) {
$url = "javascript:{$parameters['Copy_Function']}({$rowData['id']})";
$a = HtmlUtil::GetLink('', $url, '');
$row->setCellValue($a, 'COL_COPY');
$row->getCell('COL_COPY')->SetData('field', 'col_copy')->AppendClass(HtmlClasses::NO_PRINT);
}
if (array_key_exists('Delete_Function', $parameters)) {
$url = "javascript:{$parameters['Delete_Function']}({$rowData['id']})";
$a = HtmlUtil::GetLink('', $url, '');
$row->setCellValue($a, 'COL_DELETE');
$row->getCell('COL_DELETE')->SetData('field', 'col_delete')->AppendClass(HtmlClasses::NO_PRINT);
}
return $row;
}
function SmartSearch_GetHelp() {
$span = HtmlElement::SPAN();
$span->SetClass('noPrint');
$span->SetStyle('display:none');
$tbl = HtmlTable::Create(4);
$row = $tbl->newRow(false, true);
$caption = "SmartSearch Flags";
$cell = $row->setCellValue($caption, 0);
$cell->setColspan(4);
$row = HtmlUtil::AddSmartSearchHelpRow($tbl, "Code", "Description", "Format", "Example");
$row = HtmlUtil::AddSmartSearchHelpRow($tbl, "I", "ID", " i:X|Y|... ", "i:66|77");
$row = $tbl->newRow(false, true);
$cell = $row->setCellValue("No field will search Last Name");
$cell->setColSpan(4);
$tbl->InsertInto($span);
return $span;
}
Editor is loading...
Leave a Comment