getGUID();
$w = waramu_get();
$obj = waramu_getResource($au, $rid);
$ld = waramu_isInLocalQueue($rid);
$user = get_loggedin_user();
$gid = $user->getGUID();
$obj_subjects = $obj->getCurriculumSubjects();
// if resource is approved
if ($approve && (isModerator($obj_subjects))) {
$au = buildAppUser($user);
$resp = $w->addAnnotation($au, $rid, array('name'=>'koolielu', 'value'=>'1'));
if (!$ld) {
insert_data("INSERT INTO {$CONFIG->dbprefix}koolielu_waramu_queue (user_guid, waramu_id, moderator_guid, status, moderation_time) VALUES ($gid, '$rid', $gid, 1, now())");
} else {
update_data("UPDATE {$CONFIG->dbprefix}koolielu_waramu_queue SET status=1, moderation_time=now(), moderator_guid = $moderator_guid WHERE waramu_id='$ld->waramu_id'");
}
// send message to resource owner
/*translation:Your resource has been approved*/
$msg_title = elgg_echo("koolielu:resource_approved_msg_title");
$obj_url = $CONFIG->wwwroot . "pg/waramu/view/" . $rid;
/*translation:Your resource %s has been approved.*/
$msg_desc = sprintf(elgg_echo('koolielu:resource_approved_msg_body'), $obj_url, $obj->getTitle());
if ($comment) {
$msg_desc .= '
';
/*translation:Message from moderator: %s*/
$msg_desc .= sprintf(elgg_echo('koolielu:msg_from_mod'), $comment);
}
$message = array('title' => $msg_title, 'description' => $msg_desc);
send_system_message($ld->user_guid, $message);
forward('pg/waramu/moderate');
} else if ($disapprove && (isModerator($obj_subjects))) {
if (!$ld) {
insert_data("INSERT INTO {$CONFIG->dbprefix}koolielu_waramu_queue (user_guid, waramu_id, moderator_guid, status, moderation_time) VALUES ($gid, '$rid', $gid, 2, now())");
} else {
update_data("UPDATE {$CONFIG->dbprefix}koolielu_waramu_queue SET status=2, moderation_time=now(), moderator_guid = $moderator_guid WHERE waramu_id='$rid'");
}
// send message to resource owner
/*translation:Your resource has been disapproved*/
$msg_title = elgg_echo("koolielu:resource_disapproved_msg_title");
/*translation:Your resource %s has been disapproved.*/
$msg_desc = sprintf(elgg_echo('koolielu:resource_disapproved_msg_body'), $obj->getTitle());
if ($comment) {
$msg_desc .= '
';
/*translation:Message from moderator: %s*/
$msg_desc .= sprintf(elgg_echo('koolielu:msg_from_mod'), $comment);
}
$message = array('title' => $msg_title, 'description' => $msg_desc);
send_system_message($ld->user_guid, $message);
forward('pg/waramu/moderate');
}
} else {
print "err...";
}
?>