ontarget
Active Member
Hi I was reading this thread and the wiki http://fabrikar.com/forums/index.php?wiki/common-php-tasks/#update and I believe I have the same issue but wanted to confirm if it was due to code deprecation
http://fabrikar.com/forums/index.php?threads/list-plugin-erros.46427/
Im using F3.7 and J3.8
http://fabrikar.com/forums/index.php?threads/list-plugin-erros.46427/
Im using F3.7 and J3.8
Code:
// Adds a Attended button for list
$item = $model->getTable();
$app = JFactory::getApplication();
$ids = $app->input->get('ids', array(), 'array');
$db = FabrikWorker::getDbo();
$tr_table = $db->quoteName('course_registrants');
$c_id = $db->quoteName('id');
$claim_approved = $db->quoteName('claim_approved');
$timestamp = $db->quoteName('approved_timestamp');
$date=new DateTime(); //this returns the current date time
$time = $date->format('d/m/Y');
foreach ($ids AS $myid)
{
$row = $model->getRow($myid);
$complete = $row->course_registrants___complete;
$comp = explode('"',$complete);
$compV = $comp[1];
if ($compV == 1) {
$db =& JFactory::getDBO();
$query = "SELECT cr.teacher_email, cr.team_leader_email, cs.full_course_name
FROM course_registrants AS cr
INNER JOIN courses AS cs
ON cr.course = cs.id
WHERE cr.id = $myid
";
$db->setQuery($query);
$result = $db->loadObject();
$tl_email = $result->team_leader_email;
$headers = "From: $tl_email";
$email = $result->teacher_email;
$subject = "Claim Approved";
$msg = "Your claim has been approved by your Team Leader for course $result->full_course_name.\n
Regards,\n
\n
----------------------\n
Login to to view your claims";
mail($email,$subject,$msg,$headers);
$q = "UPDATE $tr_table SET $claim_approved = 1, $timestamp = \"$time\" WHERE $c_id = $myid";
$db->setQuery($q);
$db->execute();
}
}