<?php
/*
jobTitle.php
Ideally, the model layer is used to access database data
More directly generate the desired result array to be returned with loadColumn():
public function getOptions() {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('jobtitle')->from('#__jobs');
return $db->setQuery($query)->loadColumn();
}
Ideally, collecting submitted data should be done in the controller layer.
Ideally, generating html markup should be done in the view layer.
---
technologies.php
Use loadResult():
$backend = $db->setQuery($query)->loadResult();
The foreach body can be simplified:
foreach ($backend as $line) {
$result[] = [$line, in_array($line, $currentBackend)];
}
You don't need to increment your own counter.
Employ D.R.Y. coding regarding the if block.
sprintf() spares interpolation/concatenation.
Again, I would rather this mark up be generated in the view layer.
$html = '<fieldset id="jform_technologies" class="list checkboxes">';
foreach ($this->getOptions() as $i => [$line, $checked]) {
$html .= sprintf(
'<label for="%1$s" class="checkbox">
<input type="checkbox" id="%1$s" name="jform[technologies][]" value="%2$s"%3$s>%2$s
</label>',
'jform_backend' . $i,
$line,
$checked ? ' checked' : ''
);
}
$html .= '</fieldset>';
return $html;
*/
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0