Ga naar hoofdinhoud

Gebruik van Interface Builder

Inhoudsopgave

  1. Vragen
  2. Application Flow
  3. Wijzigen van versie via de database

1. Vragen

'$jn_store_user' is niet gedefinieerd.

List Views toont twee pagination dropdowns => Nu weggehaald met display: none;

1.1 Wijzigingsideeën

Naamgeving variabelen

list => jn_list_...

2. Application Flow

Application Flow

Analyse $arrtype

add.php

foreach ($showfields as $key => $value) {
// AH: uitgeremde regels. Vooralsnog laten staan.
// AH: $jn_pk moet hier niet worden gebruikt. In plaats daarvan zou 'jn_from_key_0' ($jn_from_key_0 = $params->get('jn_from_key_0') moeten worden gebruikt.
// AH: Bovenstaande werkt alleen voor groep 0. Is dat voldoende?
if ($value != $jn_pk) {
$arrtype = searchar($jn_data_arr, 'jn_val_column', $value);
include 'main_fields_add.php';
}
}

$jn_pk

In variables.php:

$jn_pk = $params->get('jn_pk','id')

Primary Key Name of the primary key of the list. Zou alleen moeten worden gebruikt in List functies

'jn_val_column'

is Field Name

searchar

// Search array function
//*********************************************************** */
if (!function_exists('searchar')) {
function searchar($array, $key, $value) {
// Create array for results
$results = array();

// Check if requirements are fulfilled.
if (is_array($array)) {

// AH: Wat doe je als isset is false? => foreach binnen the if-then gebracht.
if (isset($array[$key]) && $array[$key] == $value) {
$results[] = $array;
}

// AH: Wat doe je hier?
foreach ($array as $subarray) {
$results = array_merge($results, searchar($subarray, $key, $value));
}
}

return $results;
}
}

$showfields

$jn_select_edit = rtrim($jn_select_edit, ',');
// Explode on comma
$showfields = explode(',', $jn_select_edit);

$jn_select_edit

if ($jn_grouped_add == 0) {
// only get the group_id=0 from the array
// **************************************
$jn_select_edit = '';
$keys = array_keys($jn_data_arr);
for ($i = 0; $i < count($jn_data_arr); $i++) {

foreach ($jn_data_arr[$keys[$i]] as $key => $value) {
if ($key == 'jn_db_group_id') {
$jn_db_group_id = $value;
if ($jn_db_group_id == '0') {
foreach ($jn_data_arr[$keys[$i]] as $key => $value) {
if ($key == 'jn_val_column') {
$jn_select_edit .= $value . ',';
}
}
}
}
}
}
}

3. Wijzigen van versie via de database

Ga naar table jnxt_module

Cascading dropdowns

Elements

Dropdown1 Dit is de dropdown met de selectie-waarde

JSDOM events and action onchange="window.location='/procesacties-dv?add_id=1&process_id='+this.value+'&pos='+this.selectedIndex;"

Toelichting: onchange= // Type hook "window.location='/procesacties-dv // Pagina waar de gebruiker zich bevindt: menu-verwijzing ?add_id=1 // Type actie: ?add of ?edit &process_id='+this.value+' // id van de gekozen waarde. Veldnaam: process_id. Join pk: id. Gekozen waarde: this.value &pos='+this.selectedIndex;" // Positie van de gekozen waarde in de combobox.

Dropdown2 afhankelijk van de gekozen waarde in Dropdown1

SQL where: process_id={$process_id}

Toelichting: process_id= Foreign key {$process_id} Value of variable got via PHP script

PHP script

OnShowAddForm

$process_id = $_GET['process_id']; // Get process_id from url
if (!$process_id){$process_id=1;} // Set Default value

OnShowEditForm

use Joomla\CMS\Factory; // Create query
$the_id=$_GET['edit_id'];
$setquery="select process_id from jnxt_jne_wfm_process_actions where id='$the_id'";
$db = Factory::getDBO();
$db->setQuery($setquery);
$process_id = $db->loadResult();

Javescripts

Javascript for Add form Bedoeld om de geselecteerde waarde vast te houden.

const params = new URLSearchParams(window.location.search)
params.has('pos')

var myselect = document.getElementById("process_id");
myselect.options.selectedIndex = params.get('pos')

Javascript for Edit form

item_process_state_id

onchange="window.location='/mijn-portaal/mijn-gesprekken.html?add_id=1&item_process_state_id='+this.value+'&pos='+this.selectedIndex;"
process_state_before_id={$item_process_state_id}

$item_process_state_id = $_GET['item_process_state_id'];
if (!$item_process_state_id){$item_process_state_id=1;}

$the_id=$_GET['edit_id'];
$setquery="SELECT process_action_option_id FROM wfm_v02_process_actions WHERE process_state_before_id='$the_id'";
$db = Factory::getDBO();
$db->setQuery($setquery);
$process_state_id = $db->loadResult();
const params = new URLSearchParams(window.location.search)
params.has('pos')

var myselect = document.getElementById("item_process_state_id");
myselect.options.selectedIndex = params.get('pos')

Toepassing Mijn gesprekken

onchange="window.location='/mijn-portaal/mijn-gesprekken.html?add_id=1&process_state_id='+this.value+'&pos='+this.selectedIndex;"

Default values

Huidige gebruiker

echo $user->id;

Een waarde

echo "4";

Datum (van vandaag)

$fulldate=date("Y-m-d");
$fulldate.="T";
$fulldate.=date("H:i");
echo $fulldate;

Waarde voor Pulldown database join

Verschillende varianten

Get state

PHP scripts: 'OnShowEditForm':

use Joomla\CMS\Factory;
$the_id=$_GET['edit_id'];
$setquery="SELECT item_process_state_id FROM jnxt_jne_wfm_items WHERE id='$the_id'";
$db = Factory::getDBO();
$db->setQuery($setquery);
$process_state_id = $db->loadResult();

In het veld: 'SQL where':

process_state_before_id={$process_state_id}

Filter op 'Mijn organisatie'

PHP scripts: 'OnShowEditForm':

use Joomla\CMS\Factory;
$the_id=$my->id;
$setquery="SELECT organisation_id FROM org_v01_employees_list WHERE id='$the_id'";
$db = Factory::getDBO();
$db->setQuery($setquery);
$organisation_id = $db->loadResult()

In het veld: 'SQL where':

organisation_id = {$organisation_id}
use Joomla\CMS\Factory;
//$the_id=$my->id;
$the_id = 2;
// $setquery = "SELECT organisation_id FROM org_v01_employees_list WHERE id='$the_id'";
$setquery = "SELECT organisation_id FROM org_v01_employees_list WHERE id='2'";
$db = Factory::getDBO();
$db->setQuery($setquery);
$organisation_id = $db->loadResult();

KNIP & PLAK

use Joomla\CMS\Factory;
$the_id = $user->id;
$setquery = "SELECT id, organisation_id FROM org_v01_employees_list WHERE id='$the_id'";
$db = Factory::getDBO();
$db->setQuery($setquery);
$results = $db->loadObjectList();

foreach ($results as $item) {
$user_id = $item->id;
$organisation_id = $item->organisation_id;
}

if (!$user_id){$user_id='1';}
if (!$organisation_id){$organisation_id='1';}
use Joomla\CMS\Factory;
$the_id = $user->id;
$setquery = "SELECT id, organisation_id FROM org_v01_employees_list WHERE id='$the_id'";
$db = Factory::getDBO();
$db->setQuery($setquery);
$results = $db->loadObjectList();

foreach ($results as $item) {
$user_id = $item->id;
$organisation_id = $item->organisation_id;
}

if (!$user_id){$user_id='1';}
if (!$organisation_id){$organisation_id='1';}

Workflow code

MMR

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

// Get current item_subtype
$subtype_id = $formModel->getElementData('v_jne_items___item_subtype_id', true);
$subtype_id = is_array($subtype_id) ? $subtype_id[0] : $subtype_id;

// Get current state
$state_before = $formModel->getElementData('v_jne_items___item_process_state_id', true);
$state_before = is_array($state_before) ? $state_before[0] : $state_before;

// Get action
$action_id = $formModel->getElementData('v_jne_items___item_process_action_id', true);
$action_id = is_array($action_id) ? $action_id[0] : $action_id;

// Get the state_after from the database
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('process_state_after_id')->from('josme_jne_process_actions')->where('process_state_before_id=' .$state_before .' AND id=' .$action_id );
$db->setQuery($query);
$state_after = $db->loadResult();
// Process the work: change relevant values
// Option 1: opslaan
// changes:

// Option 2: insturen
// changes:
// - addressee => Dorine van Kampen (920) Test: 623 (AH)

// Process option 1
$opslaan = array(14,16);
if (in_array($action_id, $opslaan)) {

// Change Addressee
// $formModel->updateFormData('v_jne_items___item_addressee', 623, true);

// Update station and state
$formModel->updateFormData('v_jne_items___item_process_state_id', $state_after, true);
$formModel->updateFormData('v_jne_items___item_process_station_id', $state_after, true);
}

// Process option 2
// Values from table process_actions
$insturen = array(15,17);
if (in_array($action_id, $insturen)) {

// Change Addressee
if ($subtype_id == 2 ) {
// Intranet => Arend-Henk
$formModel->updateFormData('v_jne_items___item_addressee', 623, true);
} else if ($subtype_id == 7 ){
// ICT => Leo Beerden
$formModel->updateFormData('v_jne_items___item_addressee', 867, true);
} else if ($subtype_id == 3 ){
// Schoonmaak => Patrick Loots
$formModel->updateFormData('v_jne_items___item_addressee', 877, true);
} else if ($subtype_id == 8 ){
// Arbo => arbo@maritiemmuseum.nl
$formModel->updateFormData('v_jne_items___item_addressee', 894, true);
}else {
// Storing. TD-verzoek => Erwin Wolf
$formModel->updateFormData('v_jne_items___item_addressee', 920, true);
}

// Update station and state
$formModel->updateFormData('v_jne_items___item_process_state_id', $state_after, true);
$formModel->updateFormData('v_jne_items___item_process_station_id', $state_after, true);
}

Moubis

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

// ACTIONS OF SCHOLARSHIP REQUEST HANDLING

// GET CURRENT STATE
// Get current state (= state before)
$state_before_id = $formModel->getElementData('jnxt_jne_wfm_items___item_process_states_id', true);
$state_before_id = is_array($state_before_id) ? $state_before_id[0] : $state_before_id;

// Get action
$action_id = $formModel->getElementData('jnxt_jne_wfm_items___item_process_actions_id', true);
$action_id = is_array($action_id) ? $action_id[0] : $action_id;

// Get the process from the database
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('process_id')->from('jnxt_jne_wfm_process_actions')->where('process_state_before_id=' .$state_before_id .' AND id=' .$action_id );
$db->setQuery($query);
$process_id = $db->loadResult();

// SET STATE AFTER
// Get the state_after from the database
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('process_state_after_id')->from('jnxt_jne_wfm_process_actions')->where('process_id=' .$process_id .' AND process_state_before_id=' .$state_before_id .' AND id=' .$action_id );
$db->setQuery($query);
$state_after = $db->loadResult();

// Set the state_after
$formModel->updateFormData('jnxt_jne_wfm_items___item_process_states_id', $state_after, true);

Jobmanager

use Joomla\CMS\Factory;

$update_id = $_POST['update_id'];
// echo "item_id: ";
// echo $update_id;
// echo "<br />";

// echo "item process action id: ";
echo $_POST ['item_process_action_id'];
$action_id=$_POST ['item_process_action_id'];
echo "<br /> item process state id: ";
echo $_POST ['item_process_state_id'];
$state_before_id = $_POST ['item_process_state_id'];
echo "<br />";
// Get the process from the database
$db = Factory::getDBO();
$query = $db->getQuery(true);
$query->select('process_id')->from('wfm_v02_process_actions')->where('process_state_before_id=' .$state_before_id .' AND id=' .$action_id );
$db->setQuery($query);
$process_id = $db->loadResult();

// echo "process id: ";
// echo $process_id;
// echo "<br />";

// SET STATE AFTER
// Get the state_after_id from the database
$db = Factory::getDBO();
$query = $db->getQuery(true);
$query->select('process_state_after_id')->from('wfm_v02_process_actions')->where('process_id=' .$process_id .' AND process_state_before_id=' .$state_before_id .' AND id=' .$action_id );
$db->setQuery($query);
$state_after_id = $db->loadResult();

// echo "state after id: ";
// echo $state_after_id;
// echo "<br />";

// Set the item_process_state_id from the database
$db = Factory::getDBO();
$query = "UPDATE jnxt_jne_wfm_items SET item_process_state_id =". $state_after_id." WHERE id=".$update_id ;
echo"$query";
$db->setQuery( $query );
$db->execute();

CSS

/* --- Oranje actie button --- */
.fc_item_process_action_id {
background-color: coral;
}

/* --- Beautify reset button column search --- */
.btn-group > .btn:last-child:not(:first-child), .btn-group > .dropdown-toggle:not(:first-child){
color: #ffffff;
background-color: #f56927 !important;
border-radius: 5px !important;
}
.btn-group > .btn:last-child:hover {
/* background-color: #203a8e !important; */
font-weight: 700;
}

/* --- Modify search box --- */
#dbtable_151_filter {
display:none;
}
.zoekvenster {
background-color: #ffffff;
border-top: none;
border-bottom: none;
}

.zoekvenster {display:none;}
.maincontent .dropdown-toggle {display:none;}
.table>thead>tr>th {border-bottom: 0px solid #ddd !important;}

table#dbtable_123 td:first-child(1) {width: 40px !important;}
table#dbtable_123 th:first-child(1) {width: 40px !important;}

table#dbtable_123 td:nth-child(2), table#dbtable_123 th:nth-child(2) {width: 100px !important;}
table#dbtable_123 td:nth-child(3), table#dbtable_123 th:nth-child(3) {width: 200px !important;}

td > .field_162_5 {
text-align: right;
}
.fc_item_process_action_id {
background-color: coral;
}
.form-control.fc_item_content {
margin-bottom: 30px;
}
.form-group.fg_item_content::after {
font-weight:700;
font-size: 20px;
content: "Procesinformatie";
}

Kleuren

Achtergrond form

#ededed