getGUID(); $all_quality_marks = getAllQualityMarks($rid); $all_marks = $all_quality_marks['all_quality_marks']; $res_marks = $all_quality_marks['resource_quality_marks']; global $CONFIG; foreach ($all_marks as $qmark_title => $qmark_id) { // check does already have this quality mark $old_data = get_data("SELECT * FROM {$CONFIG->dbprefix}koolielu_resources_quality_marks WHERE waramu_id = '$rid' AND quality_mark_id = $qmark_id;"); if (in_array($qmark_id, $chosen_quality_marks)) { // if adding quality mark if (!(is_array($old_data) && count($old_data) > 0)) { // and doesn't already have it // insert data into resource_quality_marks insert_data("INSERT INTO {$CONFIG->dbprefix}koolielu_resources_quality_marks (waramu_id, quality_mark_id, moderator_guid) VALUES ('$rid', $qmark_id, $user_guid);"); } } else { // remove quality mark if necessary if (is_array($old_data) && count($old_data) > 0) { // if is, then remove it delete_data("DELETE FROM {$CONFIG->dbprefix}koolielu_resources_quality_marks WHERE waramu_id = '$rid' AND quality_mark_id = $qmark_id;"); } } } if (count($chosen_quality_marks)>0 && $chosen_quality_marks[0]) { $val = '1'; } else { $val = '0'; } $w = waramu_get(); $obj = waramu_getResource('', $rid); $obj_subjects = $obj->getCurriculumSubjects(); $acl = buildACL($obj_subjects); $au = buildAppUser(get_loggedin_user()); $w->createOrUpdateAnnotation($au, $rid, array('name'=>'keeq', 'value'=>$val), $acl); forward($CONFIG->wwwroot.'pg/waramu/view/'.$rid); ?>