Posted in HTML, PHP, zebra_form

Zebra_form – viewing uploaded documents

$fileUpload = $form->getUploadDetails($uploadid); 

$myArray = json_decode(json_encode($fileUpload), True); 

$myArray = array_shift($myArray); 

$myEnv = “http://” . $myEnv;

foreach ($myArray as $key => $value) {

$myURL = substr($myArray[$key][‘path’], 5);

$mySafeURL = str_replace(‘ ‘, ‘%20’, $myURL);

$mysrc = $myEnv . $mySafeURL;

PDFandJPGandPNG

echo “<hr>”;

}

$form->render(‘inl_sev_065_T_ver.php’);

?>

Posted in PHP, zebra_form

Multiple dynamically filled zebra_form select boxes

$form->add(‘label’, ‘label_questionlist’, ”, “CESChooseaquestionfromthepool”);

for ($x = 0; $x <= 14; $x++) {

$obj = $form->add(‘select’, ‘_QUESTION_LIST’ . $x);

$obj->add_options($questionArray);

$obj->set_attributes(array(
‘class’ => ‘input-field control form-control’,
‘style’ => ‘width:500px’,
));

$obj->set_rule(array(

));

$obj->disable_spam_filter();

}

Posted in PHP, zebra_form

Multiple predefined zebra_form select boxes

$form->add(‘label’, ‘label_weight’, ”, “CESWeightin”);

for ($x = 0; $x <= 14; $x++) {

$obj = $form->add(‘select’, ‘_WEIGHT’ . $x);

$obj->add_options(array(
0 => ‘0’,
1 => ‘1’,
5 => ‘5’,
10 => ’10’,
15 => ’15’,
20 => ’20’,
25 => ’25’,
30 => ’30’,
35 => ’35’,
40 => ’40’,
45 => ’45’,
50 => ’50’,
60 => ’60’,
100 => ‘100’,
));

$obj->set_attributes(array(
‘class’ => ‘input-field control form-control’,
‘style’ => ‘width:150px’,
‘onChange’ => ‘calculatePercentage()’
));

$obj->set_rule(array(

));

$obj->disable_spam_filter();

}

Posted in PHP, SQL

Create an array from a SQL query in PHP

// — Retrieve the list of questions ——————————————

$sql = “SELECT _QUESTION FROM questions WHERE _DEPT = ‘$dept'”; 

$db = new MysqliDb(‘CES’);

$selectStatus = $db->rawQuery($sql);

$questionArray = [];

if ($selectStatus > 0) {

$tmp[‘message’] = ‘Central evaluation system – Questions loaded successfully’;
$tmp[‘success’] = ‘Y’;

foreach ($selectStatus as $row) {

$questionArray[] = $row[‘_QUESTION’]; 

}

}

Posted in EasyUI, Font awesome, PHP, SQL

EasyUI Datagrid JSON information

require_once($_SERVER[‘DOCUMENT_ROOT’].’/xyz/db/MysqliDb.php’);

// — Parameters input ——————————————————–

$questionnaire = (isset($_REQUEST[‘QUESTIONNAIRE’])) ? $_REQUEST[‘QUESTIONNAIRE’] : ”;
$version = (isset($_REQUEST[‘VERSION’])) ? $_REQUEST[‘VERSION’] : ”;
$tak = (isset($_REQUEST[‘TAK’])) ? $_REQUEST[‘TAK’] : ”;

// — Define containers ——————————————————-

$terugvoer = array();
$tmp = array();

// — Retrieve the list of UPLOADID’s by DEPARTMENT —————————

$sql = “SELECT upload_id, _UPLOADID FROM uploads
WHERE _TAK = ‘$tak’ AND _TEMPLATE = ‘$questionnaire’ AND _VERSION = ‘$version’ “;

$db = new MysqliDb(‘CES’);

$selectStatus = $db->rawQuery($sql);

if ($selectStatus > 0) {

foreach ($selectStatus as $row) {

$tmp[‘_UPLOADID’] = $row[‘_UPLOADID’];

$uploadid = $row[‘_UPLOADID’];
$isn = $row[‘upload_id’];

// — Add buttons with event parameters ———————————

$tmp[‘view’] = ‘<a onclick=”viewDoc (\”.$uploadid.’\’)”
<button class=”btn btn-info fa fa-info-circle”> </button></a>’;

// ———————————————————————–

$tmp[‘delete’] = ‘<a onclick=”Delete (\”.$uploadid.’\’)”
<button class=”btn btn-danger fa fa-trash”> </button></a>’;

// ———————————————————————–

$terugvoer[] = $tmp;

}

}

echo json_encode($terugvoer);

?>