@extends('layouts.master') @section('navigation') @if($role==1) @include('local.managers.admins._new_navigation') @elseif($role==2) @include('local.managers.sCoords._new_navigation') @elseif($role==3) @include('local.managers.pCoords._new_navigation') @else @include('local.professors._navigation') @endif @stop @section('main')
{{ HTML::linkAction('ActivitiesController@show', 'Back to Activity', array($activity->id), array('class'=>'btn btn-default btn-sm pull-right')) }}

@if(count($activity->rubric)!=0) @endif
@if($activity->draft) @endif @foreach ($templates as $template) @if(count($activity->rubric)!=0 && $template->name == Rubric::find($activity->rubric[0]->id)->name) @else @endif @endforeach
% of all students must score at least points in a criterion for it to pass.

CriterionBeginning (1-2)In Progress (3-4)Good (5-6)Excellent (7-8)
@if($activity->outcomes_attempted!=NULL) @endif
@stop @section('javascript') // -------------------------------------------------------------------------- // Page load // -------------------------------------------------------------------------- console.log({{ $activity }}); //If there are no rubrics to show, alert user and redirect. if($('#select-template').children().length) loadTemplate(); else { $('#modal-no-rubric').modal({ backdrop: 'static' }); } // -------------------------------------------------------------------------- // Functions // -------------------------------------------------------------------------- // Fetch criteria associated to a specific learning outcome function fetchCriteria(outcome) { $.post ( "{{ URL::route('fetchCriteria') }}", { id: outcome.find(':selected').data('outcome-id')}, function(data) { $('#select-criterion').empty(); data.forEach( function (arrayItem) { // If criterion does not belong to a user, display it if(arrayItem.user_id==null) { $('#select-criterion') .append(''); } // If it does, but the user is the one logged on, display. // Otherwise, ignore else if(arrayItem.user_id!="" && {{{Auth::id()}}}==arrayItem.user_id ) { $('#select-criterion') .append(''); } }); // Add custom option $('#select-criterion') .append(''); $('#select-criterion').prop('disabled', false); $('#button-add-criterion').prop('disabled', false); } ); } // Build list from copyright info in rubric function buildCopyrightList() { // Empty the copyright list $('#copyright-list').empty(); $('tbody tr').each(function( index ) { var criterion = $(this); // If there's copyright info if(criterion.data('criterion-copyright')!=null){ var copyright = criterion.data('criterion-copyright'); if($('#copyright-list li').length>0) { var found = false; $('#copyright-list li').each(function() { // If found, give the string its number if(copyright==$(this).find('span').text()) { copyrightNumber = Number.parseInt($(this).find('sup').text()); console.log('a: '+copyrightNumber); criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber); found =true; //to break return false; } }); // Otherwise, give it the next number and append a new item to the // list if(!found) { var copyrightNumber = $('#copyright-list li').length+1; console.log('b: '+copyrightNumber); console.log(criterion.children('td:nth-child(2)').find('sup').length); criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber); $('#copyright-list').append('
  • '+copyrightNumber+' '+copyright+'
  • '); } } else { criterion.children('td:nth-child(2)').find('sup').text('1'); $('#copyright-list').append('
  • 1 '+copyright+'
  • '); } } }); if($('#copyright-info li').length>0) { $('#copyright-info').show(); } else { $('#copyright-info').hide(); }} // Load a template function loadTemplate() { $.post ( "{{ URL::to('loadTemplate') }}", { id: $('#select-template').find(':selected').data('template-id')}, function(data) { // Show the container and empty all rows $('#rubric-container').show(); $('tbody').empty(); //Set the name of the rubric $('#rubric-name').val(data.template.name); $('#expected_percentage').text(data.template.expected_percentage); $('#expected_points').text(data.template.expected_points) $('#max').val(data.template.max_score); $('#num_of_scales').val(data.template.num_scales); changeTable(data); // Set the contents of the rubric var temp_criterion = data.criterion; for(temp_c in temp_criterion){ var str = ''; current_criterion = temp_criterion[temp_c] var subcriteria =''; if(current_criterion.subcriteria){ var subcriteria_array = JSON.parse(current_criterion.subcriteria); subcriteria = ''; } if(current_criterion.notes) { str+=''+current_criterion.name+''+subcriteria+''; } else { str+=''+current_criterion.name+''+subcriteria+''; } for(scaleIndex in current_criterion.scales){ scale = current_criterion.scales[scaleIndex]; str+=''+scale.description+''; } str+= ''+current_criterion.outcomes+''; str+=''; $('table tbody').append(str); buildCopyrightList(); // Turn on tooltips again (because content is dynamic) $('[data-toggle="tooltip"]').tooltip(); } /* var contents = JSON.parse(data.contents); contents.forEach(function (data) { // Append the fetched data var str =''; var subcriteria = ''; if(data.subcriteria){ var subcriteria_array = data.subcriteria; subcriteria = ''; } if(data.notes) { str+=''+data.name+''+subcriteria; } else { str+=''+data.name+''+subcriteria; } str+=''+data.description12+'' +''+data.description34+'' +''+data.description56+'' +''+data.description78+'' +''; $('table tbody').append(str); // Build copyright list buildCopyrightList(); // Enable X-Edtable on this new row $('.editable').editable({ unsavedclass: null, rows: 4 }); // Turn on tooltips again (because content is dynamic) $('[data-toggle="tooltip"]').tooltip(); }); */ // Build Copyright List buildCopyrightList(); }, 'json', ); } /* console.log($('#expected_percentage').text()); console.log($('#expected_points').text()); // Set expected values $('#expected_percentage').text(data.expected_percentage); $('#expected_points').text(data.expected_points); // Set the contents of the rubric var contents = JSON.parse(data.contents); contents.forEach(function (criterion) { var str =''; var subcriteria = ''; if(criterion.subcriteria){ var subcriteria_array = criterion.subcriteria; subcriteria = ''; } // If the criterion has notes, set the tooltip with them if(criterion.notes) { str+=''+criterion.name+''+subcriteria+''; } else { str+=''+criterion.name+''+subcriteria+''; } // Add the descriptions str+=''+criterion.description12.replace(/\n/gi, '
    ')+'' +''+criterion.description34.replace(/\n/gi, '
    ')+'' +''+criterion.description56.replace(/\n/gi, '
    ')+'' +''+criterion.description78.replace(/\n/gi, '
    ')+''; // Append the string to the table $('table tbody').append(str); // Turn on tooltips again (because content is dynamic) $('[data-toggle="tooltip"]').tooltip(); }); // Build Copyright List buildCopyrightList(); } ); } */ // -------------------------------------------------------------------------- // Events // -------------------------------------------------------------------------- // When trying to change the template, ask the user to confirm and reset the // rubric if s/he does $('#select-template').on('change', function() { loadTemplate(); }); // When a learning outcome changes, update its criteria $('#select-outcome').on('change', function() { fetchCriteria($(this)); }); // When save button is clicked $('#button-save-rubric').on('click', function(e) { //Prevent page refresh e.preventDefault(); var criteria = []; var titles = []; max_score = $('#max').val(); // For each criterion in the rubric, get its value and put it into an array $('tbody tr').each(function( index ) { criteria.push($(this).data('criterion-id')); /* criterionObject.id = $(this).data('criterion-id'); criterionObject.outcome_id = $(this).data('assoc-outcome-id'); criterionObject.name = $(this).children('td:nth-child(1)').find('span').text(); var subcriteriaArray = new Array(); $(this).children('td:nth-child(1)').find('.subcriteria li').each(function(index){ subcriteriaArray.push($(this).text()); }); criterionObject.subcriteria = subcriteriaArray; criterionObject.description12 = $(this).children('td:nth-child(2)').html().replace(/
    /gi, '\n'); criterionObject.description34 = $(this).children('td:nth-child(3)').html().replace(/
    /gi, '\n'); criterionObject.description56 = $(this).children('td:nth-child(4)').html().replace(/
    /gi, '\n'); criterionObject.description78 = $(this).children('td:nth-child(5)').html().replace(/
    /gi, '\n'); criterionObject.copyright = $(this).data('criterion-copyright'); criterionObject.notes = $(this).data('criterion-notes'); // Clone the object and push it into the array var clone = jQuery.extend({}, criterionObject); criteriaArray.push(clone); */ }); $('.titles').each(function(index){ titles.push($(this).data('title-id')); }); // If activity does not have a rubric, create it if($('#assigned_rubric').length === 0) { $('#js-error-row').hide(); // Create $.post ( "{{ URL::to('professor/saveRubric') }}", { name: $('#select-template').find(':selected').text(), activity_id: parseInt($('#activity_id').val()), expected_percentage: $('#expected_percentage').text(), expected_points: $('#expected_points').text(), criteria: criteria, titles:titles, max_score:max_score }, function(data) { location.replace(data); } ); } // Else, update it else { // Update database $.post ( "{{ URL::to('professor/updateRubric') }}", { id: $('#assigned_rubric').data('assigned-rubric'), name: $('#select-template').find(':selected').text(), activity_id: parseInt($('#activity_id').val()), expected_percentage: $('#expected_percentage').text(), expected_points: $('#expected_points').text(), criteria: criteria, titles:titles, max_score:max_score }, function(data) { location.replace(data); } ); } }); // When Ok button is clicked, redirect to previous page // When save button is clicked $('#button-redirect').on('click', function(e) { e.preventDefault(); history.go(-1); }); @stop