Please Log in to join the conversation.
Please Log in to join the conversation.
// Prepare variables
$delegate = $_POST['form']['RSEProName'];
$courseTitle = $_POST['form']['courseName'];
$delegateId = $_POST['form']['membershipId'];
$date = date("Y-m-d H:i:s");
$fileTitle = $delegate."-".$courseTitle."-".$SubmissionId.".pdf";
$path_to_directory = 'images/comprofiler/plug_cbgallery/'.$delegateId.'/files/';
if (!file_exists($path_to_directory) && !is_dir($path_to_directory)) {
mkdir($path_to_directory, 0755, true);
}
// Set query for Comprofiler cbGallery plugin
$pdfName = $delegate.'-'.$courseTitle.'-'.$SubmissionId.'.pdf';
$jsonArray = [
'name' => $pdfName,
'extension' => 'pdf',
'mimetype' => 'application\/pdf',
'modified' => $date,
'filesize' => 289565,
'height' => 0,
'width' => 0,
'name_thumbnail' => $pdfName,
'extension_thumbnail' => 'pdf',
'mimetype_thumbnail' => 'application\/pdf',
'modified_thumbnail' => $date,
'filesize_thumbnail' => 289565,
'height_thumbnail' => 0,
'width_thumbnail' => 0
];
$jsonString = json_encode($jsonArray);
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$columns = array('user_id','asset','type','value','file','folder','title','description','published','date','params');
$values = array($db->quote($delegateId), $db->quote('profile.'.$delegateId), $db->quote('files'), $db->quote($pdfName), $db->quote($pdfName), $db->quote('0'), $db->quote($courseTitle), $db->quote('CPPD Certificate'), $db->quote('1'), $db->quote($date), $db->quote($jsonString));
// Prepare the insert query.
$query
->insert($db->quoteName('xho18_comprofiler_plugin_gallery_items'))
->columns($db->quoteName($columns))
->values(implode(',', $values));
$db->setQuery($query);
$db->execute();
Please Log in to join the conversation.