function submitview_submit(Pieform $form, $values) { global $SESSION, $USER, $view, $collection, $group; if (!empty($collection)) { $collection->submit($group, $USER); $SESSION->add_ok_msg(get_string('collectionsubmitted', 'view')); } else { if (!empty($view)) { $view->submit($group, $USER); $SESSION->add_ok_msg(get_string('viewsubmitted', 'view')); } } redirect('/' . returnto()); }
function submitview_submit(Pieform $form, $values) { global $SESSION, $USER, $viewid, $groupid, $group; db_begin(); update_record('view', array('submittedgroup' => $groupid, 'submittedtime' => db_format_timestamp(time())), array('id' => $viewid)); $roles = get_column('grouptype_roles', 'role', 'grouptype', $group->grouptype, 'see_submitted_views', 1); foreach ($roles as $role) { $accessrecord = (object) array('view' => $viewid, 'group' => $groupid, 'role' => $role, 'visible' => 0, 'allowcomments' => 1, 'approvecomments' => 0); ensure_record_exists('view_access', $accessrecord, $accessrecord); } ArtefactType::update_locked($USER->get('id')); activity_occurred('groupmessage', array('subject' => get_string('viewsubmitted', 'view'), 'message' => get_string('viewsubmitted', 'view'), 'submittedview' => $viewid, 'viewowner' => $USER->get('id'), 'group' => $groupid, 'roles' => $roles, 'strings' => (object) array('urltext' => (object) array('key' => 'view')))); db_commit(); $SESSION->add_ok_msg(get_string('viewsubmitted', 'view')); redirect('/' . returnto()); }