@extends('layouts.master') @section('navigation') @if(Auth::user()->role==1) @include('local.managers.admins._navigation') @elseif(Auth::user()->role==2) @include('local.managers.sCoords._new_navigation') @elseif(Auth::user()->role==3) @include('local.managers.pCoords._new_navigation') @endif @stop @section('main')
General Information
Rubrics with "##" at the beginning contain criteria that are not associated with your program or school. You will not be able to use them until your criteria is matched with your program or school.
@if(Auth::user()->role==1)
@endif @if(Auth::user()->role==1 || Auth::user()->role==2 || Auth::user()->role==3)
@endif
% of all students must score at least point(s) in a criterion for it to pass.

Note: You can hide or show this section by clicking on its heading. You may want to hide it to have more space.

@if(Auth::user()->role != '1')
@if(Auth::user()->role == '3') @endif
@endif
updated
@stop @section('included-js') @stop @section('javascript') $('#select-outcome').on('change',function(){ fetchObjective(this); }) // -------------------------------------------------------------------------- // Functions // -------------------------------------------------------------------------- function fetchObjective(outcome){ $.post( "{{URL::route('fetchObjectivesForSelect')}}", { outcomeID:$(outcome).find(':selected').data('outcome-id'), }, function(data){ options = ''; for(objective_index in data){ options += ''; } $('#select-objective').html(options); $('#select-objective').selectpicker('refresh'); fetchCriteria($('#select-outcome'), $('#select-objective')); }, 'json', ); } // Fetch criteria associated to a specific learning outcome function fetchCriteria(outcome, objective) { amount_of_scales = parseInt($('#number_of_scales').find(':selected').val()); maximum = parseInt($('#max_score').find(":selected").val()); $.post ( "{{ URL::route('fetchCriteria') }}", { outcome_id: outcome.find(':selected').data('outcome-id'), objective_id: objective.find(':selected').val(), num_scales: amount_of_scales, maximum: maximum, filter: $('input[name=criteria-filter]:checked').val() }, function(data) { $('#select-criterion').empty(); console.log(data); // Append criteria data.forEach( function (arrayItem) { objectives = JSON.stringify(arrayItem.objectives); $('#select-criterion') .append(''); }); // If there are no criteria assigned to the selected outcome, disable the // input and the button used to add criteria. if(!$('#select-criterion').children().length) { $('#select-criterion').prop('disabled', true); $('#button-add-criterion').prop('disabled', true); } // Otherwise, enable both the input and the button else { $('#select-criterion').prop('disabled', false); $('#button-add-criterion').prop('disabled', false); } $('#updated-text').fadeIn('slow').fadeOut('slow'); refreshSelects(); } ); } // Add a new criterion to the rubric function addCriterion() { // Show the rubric container if(!$('tbody').children().length) { $('#rubric-container').show(); } // Get the selected criterion's id var id= parseInt($('#select-criterion').find(':selected').data('criterion-id')); var program_ids = $('#select-criterion').find(':selected').data('program-ids'); var objectives = $('#select-criterion').find(':selected').data('assoc-objectives'); // Check for duplicates var duplicates=false; numberOfScale = $('#number_of_scales').find(':selected').val(); $('tbody tr').each(function() { if ($(this).data('criterion-id') == id) { duplicates=true; } }); // If there are any, display an error if(duplicates) { $('#js-error-row').show(); $('#js-error-row').find('#error-message').text('Error: The selected criterion was already added.'); return; } // Otherwise, hide the error container else { $('#js-error-row').hide(); } // Fetch information of the criterion selected $.post ( "{{ URL::route('fetchCriterionWithTemplate') }}", { id: id, }, function(data) { // Append the fetched data copyright = null; notes = null; if(data.criterion.copyright){ copyright = data.criterion.copyright; } if(data.criterion.notes){ notes = data.criterion.notes; } objectives = JSON.stringify(objectives); var str =''; // console.log(str); var subcriteria = ''; if(data.criterion.subcriteria){ var subcriteria_array = JSON.parse(data.criterion.subcriteria); subcriteria = ''; } if(notes) { str+=''+data.criterion.name+''+subcriteria+''; } else { str+=''+data.criterion.name+''+subcriteria+''; } numberOfScale = $('#number_of_scales').find(':selected').val(); for(i=0; i'; } str+= ''+data.outcomes+'' str +=''; console.log(str); $('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(); // Sortable rows $('.table').sortable({ handle: 'span.glyphicon.glyphicon-move', containerSelector: 'table', itemPath: '> tbody', itemSelector: 'tr', placeholder: '' }); }, 'json', ); } // Fetch single criterion function fetchCriterion(criterion) { $.post ( "{{ URL::route('fetchCriterion') }}", { id: outcome.find(':selected').data('outcome-id')}, function(data) { $('#select-criterion').empty(); data.forEach( function (arrayItem) { $('#select-criterion') .append(''); }); $('#select-criterion').append(''); refreshSelects(); } ); } // 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(); }} /* if(criterion.data('criterion-copyright')!=null) { var copyright = criterion.data('criterion-copyright'); // If there is anything in the copyright list if($('#copyright-list li').length>0) { // Check copyright list for the same copyright text 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+'
  • '); } } // Otherwise, give it number 1 and append it 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(); } } */ function refreshSelects() { $('#select-template').selectpicker('refresh'); $('#select-school').selectpicker('refresh'); $('#select-program').selectpicker('refresh'); $('#select-outcome').selectpicker('refresh'); $('#select-criterion').selectpicker('refresh'); $('#expected_percentage').selectpicker('refresh'); $('#expected_points').selectpicker('refresh'); $('#number_of_scales').selectpicker('refresh'); $('#select-objective').selectpicker('refresh'); } // Fetch programs associated to a specific school function fetchPrograms(school) { $.ajax({ type: 'POST', url: "{{ URL::action('ProgramsController@fetch') }}", data: { id: school.find(':selected').data('school-id')}, success: function(data) { $('#select-program').empty(); $('#select-program').append(''); data.forEach( function (program) { $('#select-program') .append(''); }); }, async:false }); if($('#select-school').find(':selected').data('school-id')!=0) $('#select-program').prop('disabled', false); else $('#select-program').prop('disabled', true); refreshSelects(); } // Load a template. This function is different from the one for professors 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); console.log(data.template.school_id); console.log($('#select-school')); // Set school id to 0, then to the saved value if it exists $('#select-school option[data-school-id="0"]').prop('selected', true); $('#select-school option[data-school-id="'+data.template.school_id+'"]').prop('selected', true); console.log($('#select-school')); // Fetch programs associated to that school fetchPrograms($('#select-school')); // Set program id to 0, then to the saved value if it exists $('#select-program option[data-program-id="0"]').prop('selected', true); $('#select-program option[data-program-id="'+data.template.program_id+'"]').prop('selected', true); // Set expected values console.log(data.template.expected_percentage); console.log(data.template.expected_points); console.log(data.template.max_score); $('#max_score').val(data.template.max_score); $('#max_score').trigger("change"); $('#expected_percentage').val(data.template.expected_percentage); $('#expected_points').val(data.template.expected_points); $('#number_of_scales').val(data.template.num_scales); refreshSelects(); changeTable(); // Set visibility var is_visible = data.template.is_visible; if(is_visible) { $('#is_visible0').prop('checked', false); $('#is_visible1').prop('checked', true); } else { $('#is_visible1').prop('checked', false); $('#is_visible0').prop('checked', true); } // Set the contents of the rubric var temp_criterion = data.criterion; console.log(temp_criterion); for(temp_c in temp_criterion){ current_criterion = temp_criterion[temp_c] console.log(current_criterion.program_ids); objectives = JSON.stringify(current_criterion.objectives); //var str = ''; var str = ""; console.log(str); var subcriteria =''; if(current_criterion.subcriteria){ var subcriteria_array = JSON.parse(current_criterion.subcriteria); subcriteria = '
      '; subcriteria_array.forEach(function (value) { subcriteria += '
    • '+value+'
    • '; }); subcriteria += '
    '; } if(current_criterion.notes) { str+=''+current_criterion.name+''+subcriteria; } else { str+=''+current_criterion.name+''+subcriteria; } str+= ''; for(scaleIndex in current_criterion.scales){ scale = current_criterion.scales[scaleIndex]; str+=''+scale.description+''; } str+= ''+current_criterion.outcomes+'' str+=''; console.log(str); $('table tbody').append(str); // 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(); refreshSelects(); } /* 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 = '
      '; subcriteria_array.forEach(function (value) { subcriteria += '
    • '+value+'
    • '; }); 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(); refreshSelects(); }); */ // Sortable rows $('.table').sortable({ handle: 'span.glyphicon.glyphicon-move', containerSelector: 'table', itemPath: '> tbody', itemSelector: 'tr', placeholder: '' }); // Build Copyright List buildCopyrightList(); $('.editable').each(function (index){ $(this).text(data.titles[index].text); }) var selected = $('#select-template').find(':selected'); var programs = {{ json_encode(Auth::user()->programs->lists('id')) }}; var template_program = selected.data('template-program-id'); // console.log(selected.data('template-program-id')); // console.log(programs.includes(selected.data('template-program-id').toString())); if( {{ Auth::user()->role }}==1 || ({{ Auth::user()->role }}==2 && selected.data('admin')!=1) || ({{ Auth::user()->role }}==3 && programs.includes(selected.data('template-program-id').toString()) && selected.data('admin')!=1 ) ) { $('#button-confirm-delete-rubric').prop('disabled', false); $('#button-confirm-update-rubric').prop('disabled', false); } else { // Disable update and edit $('#button-confirm-delete-rubric').prop('disabled', true); $('#button-confirm-update-rubric').prop('disabled', true); } // Enable print button $('#button-print-rubric').prop('disabled', false); fetchCriteria($('#select-outcome'), $('#select-objective')); }, 'json', ); } // Checks whether the user wants to save a rubric with a name that already exists function nameExists() { var duplicates = false; $('#select-template option').each(function() { var optionName = $(this).text().trim(); if($('#rubric-name').val().trim()===optionName) { duplicates = true; } }); refreshSelects(); return duplicates; } //Enable disable program select function toggleProgramSelect(school) { if(school.find(':selected').data('school-id') <1) { $('#select-program option[data-program-id="0"]').prop('selected', true); $('#select-program').prop('disabled', true); } else { console.log(school); fetchPrograms(school); $('#select-program').prop('disabled', false); } refreshSelects(); } fetchObjective($('#select-outcome')); // -------------------------------------------------------------------------- // Events // -------------------------------------------------------------------------- // Toggle visibility for accordion panels $('.panel-heading').on('click', function() { if($(this).find('.glyphicon').hasClass('glyphicon-triangle-right')) { $(this).find('.glyphicon').removeClass('glyphicon-triangle-right'); $(this).find('.glyphicon').addClass('glyphicon-triangle-bottom'); } else if($(this).find('.glyphicon').hasClass('glyphicon-triangle-bottom')) { $(this).find('.glyphicon').removeClass('glyphicon-triangle-bottom'); $(this).find('.glyphicon').addClass('glyphicon-triangle-right'); } $(this).siblings('.panel-body').stop().slideToggle(); }); // Fetch criteria everytime something changes $('#select-objective').on('change', function(){ fetchCriteria($('#select-outcome'), $('#select-objective')); }) $("#number_of_scales").on('change', function(){ fetchCriteria($('#select-outcome'), $('#select-objective')); }) // When trying to change the template, ask the user to confirm and reset the // rubric if s/he does $('#select-template').on('change', function() { // If changing to custom template, reset if($('#select-template').find(':selected').data('template-id')=='0') { $('#rubric-container').hide(); $('#rubric-name').val(''); $('tbody').empty(); // Disable delete, update and print buttons $('#button-confirm-delete-rubric').prop('disabled', true); $('#button-confirm-update-rubric').prop('disabled', true); $('#button-print-rubric').prop('disabled', true); } // Otherwise, load the selected template else { loadTemplate(); //If user is admin, or the templates id matches user's, or the template // id's school matches user, allow editing var selected = $('#select-template').find(':selected'); var programs = {{ json_encode(Auth::user()->programs->lists('id')) }}; var template_program = selected.data('template-program-id'); if( {{ Auth::user()->role }}==1 || ({{ Auth::user()->role }}==2 && selected.data('admin')!=1) || ({{ Auth::user()->role }}==3 && programs.includes(selected.data('template-program-id')) && selected.data('admin')!=1 ) ) { $('#button-confirm-delete-rubric').prop('disabled', false); $('#button-confirm-update-rubric').prop('disabled', false); } else { // Disable update and edit $('#button-confirm-delete-rubric').prop('disabled', true); $('#button-confirm-update-rubric').prop('disabled', true); } if($('#select-template').find(':selected').data('unmatch-criteria')=='1') { $('#button-confirm-delete-rubric').prop('disabled', true); $('#button-confirm-update-rubric').prop('disabled', true); $('#button-create-rubric').prop('disabled', true); } else { $('#button-create-rubric').prop('disabled', false); } // Enable print button $('#button-print-rubric').prop('disabled', false); } }); function changeTable(){ amount_of_scales = parseInt($('#number_of_scales').find(':selected').val()); counter2 = 0; maximum = parseInt($('#max_score').find(":selected").val()); newScaleHeaders = 'Criterion'; editableTitles = ''; counter = 0; division = maximum/amount_of_scales; if(amount_of_scales==1){ newScaleHeaders+= "Score (1 - "+maximum+")"; editableTitles += "Click to edit Title " } else if(maximum!= amount_of_scales){ while(counter "; editableTitles+="Click to edit Title "+(counter+1)+"" counter++; } }else{ while(counter "; editableTitles+="Click to edit Title "+(counter+1)+"" counter++; } } newScaleHeaders += 'Outcomes'; editableTitles += ''; $('#theScaleTitles').html(editableTitles); $("#criterion-header").html(newScaleHeaders); $('#allCriteria').html(' '); } // When a school changes, update its programs. If all is selected, disable $('#select-school').on('change', function() { toggleProgramSelect($(this)); }); $('#max_score').on('change', function(){ var max = parseInt($('#max_score').find(':selected').val()); var stringToScales = ""; selectedValue = 1; valueBefore = 0; for(i=2; i<=20; i++){ if(max%i==0){ stringToScales += ""; selectedValue = i - valueBefore; valueBefore = i; } } $('#number_of_scales').html(stringToScales); $('#number_of_scales').selectpicker('refresh'); $('#number_of_scales').val(selectedValue); $('#number_of_scales').selectpicker('refresh'); var expected_points = Math.floor(max *0.7); var expected_points_html = ''; for(i=1; i '+i+''; } $('#expected_points').html(expected_points_html); refreshSelects(); $('#expected_points').val(expected_points); refreshSelects(); changeTable(); fetchCriteria($('#select-outcome'), $('#select-objective')) }) $('#number_of_scales').on('change', function(){ changeTable(); $('#rubric-container').hide(); $('#rubric-name').val(''); $('tbody').empty(); }) // When a learning outcome changes, update its criteria /*$('#select-outcome, input[name=criteria-filter]').on('change', function() { fetchCriteria($('#select-outcome')); }); */ // When the add button is clicked $('#button-add-criterion').on('click', function(e) { //Prevent page refresh e.preventDefault(); //Add new criterion addCriterion(); }); // When the create or update buttons are clicked (.save) $('.save').on('click', function(e) { //Prevent page refresh e.preventDefault(); var emptyFields=false; $('#allCriteria').children('td').each(function() { if (($(this).text() == "" || $(this).text() == "Empty") && !($(this).hasClass('nullable')) ) { emptyFields=true; } }); // If any fields are empty, display error if(emptyFields || $.trim($('#rubric-name').val())=='') { $('#js-error-row').show(); $('#js-error-row').find('#error-message').text('Error: Please fill all the fields. Make sure your rubric has a name and all scale scores are filled.'); return; } else { $('#js-error-row').hide(); } // Check whether a rubric with the written name already exists if($(this).attr('id')=='button-create-rubric' && nameExists()) { $('#js-error-row').show(); $('#js-error-row').find('#error-message').text('Error: A template with that name already exists.'); return; } else { $('#js-error-row').hide(); } program_id = $('#select-program').find(':selected').data('program-id') if(program_id == 0){ $('#modal-title-rubric').html("All criteria will be associated with this school's programs"); htmlString = "
    The following criteria and objectives will be matched with all programs
    " htmlString += "
      " $('tbody tr').each(function( index ) { objectives = $(this).data('assoc-objectives'); htmlString += "
    1. " +$(this).data('criterion-name'); htmlString += "
      This criterion is associated with these objectives
      " htmlString +="
        " for(index in objectives){ objective_string = objectives[index]; htmlString +="
      • "+objective_string+"
      • "; } htmlString += "
      " htmlString +="
    2. " htmlString+= "
      "; }); htmlString +='
    '; $("#modal-body-rubric").html(htmlString); } else{ $('#modal-title-rubric').html('Some criteria will be associated with this program'); $('tbody tr').each(function( index ) { htmlString = ''; console.log($(this)); if(typeof $(this).data('program_ids')!== 'undefined') { program_ids = $(this).data('program_ids'); console.log("ids"+program_ids); console.log("ids"+$(this).data('program_ids')); } else if(typeof $(this).data('program-ids')!== 'undefined') { program_ids = $(this).data('program-ids') console.log("Ids"+program_ids); } else { program_ids = []; console.log(" "+program_ids); } console.log(program_ids); // program_ids = $(this).data('program_ids') if(!program_ids.includes(program_id) ){ title = "
    The following criteria and objectives will be matched with this program
    " htmlString += "
      " objectives = $(this).data('assoc-objectives'); //objectives = objectives.split(','); htmlString += "
    1. " +$(this).data('criterion-name'); htmlString += "
      This criterion is associated with these objectives
      " htmlString +="
        " for(index in objectives){ objective_string = objectives[index]; htmlString +="
      • "+objective_string+"
      • "; } htmlString += "
      " htmlString +="
    2. " htmlString+= "
      "; } if(htmlString != ''){ $("#modal-body-rubric").html(title); $("#modal-body-rubric").append(htmlString); } }); } $('#rubric-modal').modal('toggle'); $('#saveButton').data('button-id',$(this).attr('id')); }); // When the confirm delete button is clicked $('#button-delete-rubric').on('click', function(e) { $('#modal-confirm-delete').modal('hide'); // Delete from database $.post ( "{{ URL::to('deleteTemplate') }}", { id: $('#select-template').find(':selected').data('template-id') }, function(data) { location.reload(); } ); }); // Remove a criterion and hide the table if it was the only one $('table').on('click', 'span.glyphicon-remove', function(e) { $(this).closest('tr').remove(); if(!$('tbody').children().length) { $('#rubric-container').hide(); } buildCopyrightList(); }); // When print button is clicked, redirect to print page $('#button-print-rubric').on('click', function(e) { e.preventDefault(); window.location = "printRubric/"+$('#select-template').find(':selected').data('template-id'); }); // -------------------------------------------------------------------------- // Page load // -------------------------------------------------------------------------- $('#updated-text').hide(); // Enable/disable program selection depending on school selection if user is // admin if({{Auth::user()->role}}==1) toggleProgramSelect($('#select-school')); // Fetch criteria of first outcome fetchCriteria($('#select-outcome'), $('#select-objective')); changeTable(); // Hide table $('#rubric-container').hide(); // Disable Update and Delete Buttons by default $('#button-confirm-update-rubric').prop('disabled', true); $('#button-confirm-delete-rubric').prop('disabled', true); $('#button-print-rubric').prop('disabled', true); // Sortable rows $('.table').sortable({ handle: 'span.glyphicon.glyphicon-move', containerSelector: 'table', itemPath: '> tbody', itemSelector: 'tr', placeholder: '' }); @stop