Skip to content

Commit

Permalink
hpoints review working (Fixes #23)
Browse files Browse the repository at this point in the history
Review functionality is not complete, see issues #43 #44 and #45
for outstanding issues
  • Loading branch information
regdoug committed Mar 22, 2013
1 parent b32ef96 commit e67becf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions hdata/hpoints/hpoints.module
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function hpoints_type_needs_email($typeid){
function hpoints_points_load($id){
$points = hdata_points_load($id);
$types = hpoints_get_type_options();
$points['title'] = t('Honors Point @type Submission @id',
$points['title'] = t('@type Submission #@id',
array('@id' => $points['id'], '@type' => $types[$points['type']]));
return (object) $points;
}
Expand All @@ -213,8 +213,8 @@ function hpoints_approve_action($submission, $context){
if(user_access('administer points submissions') || user_access('review points submissions')){
global $user;
$submission['status'] = 1;
$submission['reviewer'] = $user->uid;
$submission['reviewed_time'] = time();
$submission['reviewer'] = $user->name;
$submission['reviewed_time'] = gmdate('Y-m-d H:i:s');
$submission['credits'] = @$context['credits'];
hdata_points_save($submission);
}else{
Expand Down Expand Up @@ -250,15 +250,15 @@ function hpoints_approve_action_submit($form, &$form_state){
* Performs a database update to reject a Complearning submission,
* provided that the user has the appropriate permissions.
*/
function hpoints_reject_action($submission){
function hpoints_reject_action($submission,$context){
$submission = (array) $submission;
if(user_access('administer points submissions') || user_access('review points submissions')){
global $user;
$submission['status'] = -1;
$submission['reviewer'] = $user->uid;
$submission['reviewed_time'] = time();
$submission['reviewer'] = $user->name;
$submission['reviewed_time'] = gmdate('Y-m-d H:i:s');
$submission['credits'] = 0;
$submission['reason'] = @$context['reason'];
$submission['reason'] = @$context['reject_reason'];
hdata_points_save($submission);
}else{
drupal_set_message(t('You do not have sufficient priviledges to perform this action.'),'warning');
Expand Down Expand Up @@ -289,16 +289,16 @@ function hpoints_reject_action_submit($form, &$form_state){

/*----------------Access Callbacks------------------*/

/*
/**
* Allows access if the user has the right to submit points
*/
function _hpoints_form_access(){
return user_access('submit points') || user_access('bulk submit points');
}

/*
/**
* Allows access to the reviewing pages if the user has the
* 'review complementary learning' permission or is the superuser (UID 1)
* 'review complementary learning' or 'administer points submissions' permission
*
* Used for VBO
*/
Expand Down
6 changes: 3 additions & 3 deletions hdata/hpoints/hpoints.views.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ function hpoints_views_handlers(){
'parent' => 'views_handler_field',
'file' => 'hpoints_views_handler_field_type.inc',
),
'hpoints_views_handler_filter_cl_status' => array(
'hpoints_views_handler_filter_status' => array(
'parent' => 'views_handler_filter_in_operator',
'file' => 'hpoints_views_handler_filter_cl_status.inc',
'file' => 'hpoints_views_handler_filter_status.inc',
),
);
return $retval;
Expand Down Expand Up @@ -113,7 +113,7 @@ function hpoints_views_data(){
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'hpoints_views_handler_filter_cl_status',
'handler' => 'hpoints_views_handler_filter_status',
),
'sort' => array(
'handler' => 'views_handler_sort',
Expand Down
2 changes: 1 addition & 1 deletion hdata/hpoints/hpoints_views_handler_filter_status.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Filter by complearning submission status
*/
class hpoints_views_handler_filter_cl_status extends views_handler_filter_in_operator {
class hpoints_views_handler_filter_status extends views_handler_filter_in_operator {
function get_value_options() {
if (!isset($this->value_options)) {
$this->value_options = array(0=>'Pending',1=>'Approved',-1=>'Rejected');
Expand Down

0 comments on commit e67becf

Please sign in to comment.