// Print the main part of the page -----------------------------------------------
echo $OUTPUT->spacer(array('height' => 20));
echo $OUTPUT->heading(format_string($strassignmentpage) . $OUTPUT->help_icon('assignmentpage', 'blended'));
echo '<center>';
echo $OUTPUT->box(format_text($strassignpagedescr), 'generalbox', 'intro');
echo '</center>';
echo $OUTPUT->spacer(array('height' => 20));
// Imprimimos el formulario por pantalla -----------------------------------------
// Formulario ASSIGNMENTFORM
$url = 'printassignmentpage.php';
echo "<form method=\"post\" action=\"{$url}\" id=\"assignmentform\">";
echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\"/>";
//Table
echo '<table align="center" width="40%" cellspacing="10" cellpadding="5" >';
//Obtenemos la referencia a toda la informaci�n sobre los m�dulos dentro del curso
$activities = blended_get_available_items($blended);
//Etiqueta de la lista desplegable
echo "<tr><td><label>{$strassignments}</label></td>";
//Lista desplegable de las tareas existentes en el m�dulo
echo '<td><select name="assignment_id" align="left">';
foreach ($activities as $item) {
    if (blended_item_is_visible($item)) {
        $assignmentname = blended_get_item_name($item);
        $value = $item->id;
        echo "<option value=\"{$value}\">{$assignmentname}</option>";
    }
}
echo "</select></td></tr>";
// Codigo exclusivo para profesores y administradores
if (has_capability('mod/blended:selectoneamongallstudents', $context)) {
    list($userids, $nonstudentids, $activeids, $users) = blended_get_users_by_type($context_course);
    print_error("Course Module ID was incorrect");
}
if (!($course = get_course($cm->course))) {
    print_error("Course is misconfigured");
}
if (!($blended = $DB->get_record('blended', array('id' => $cm->instance)))) {
    print_error("Course module is incorrect");
}
if (!($context = context_course::instance($course->id))) {
    print_error("Context ID is incorrect");
}
// Log --------------------------------------------------------------
//add_to_log ( $course->id, "blended", "introgrades", "introgrades.php?a=$blended->id", "$blended->id" );
// Capabilities -----------------------------------------------------
require_login($cm->course, false, $cm);
$items = blended_get_available_items($blended);
if (count($items) == 0) {
    print_error("No calificable items in this course");
}
$context = context_module::instance($cm->id);
require_capability('mod/blended:introgrades', $context);
$url = new moodle_url('/mod/blended/teams/introgrades.php', array('id' => $id, 'itemid' => $item_id));
blended_include_autocomplete_support($context, $blended);
$PAGE->set_url($url);
$PAGE->set_title(format_string($blended->name));
$PAGE->set_heading($course->fullname);
$PAGE->set_pagelayout('standard');
$item = blended_get_item($item_id);
$assignmentname = blended_get_item_name($item);
$existingteams = false;
$existinglinkedteams = false;
Example #3
-1
 function definition()
 {
     global $CFG, $DB, $COURSE;
     $mform =& $this->_form;
     $key = mt_rand(0xfff, 0x7fffffff);
     $mform->addElement('hidden', 'randomkey', $key);
     $mform->setType('randomkey', PARAM_INT);
     $mform->setDefault('randomkey', $key);
     $strrequired = get_string('required', 'blended');
     // Cabecera --------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     // Nombre ----------------------------------------------------------------
     $mform->addElement('text', 'name', get_string('name', 'blended'), array('size' => '64'));
     $mform->setType('name', PARAM_TEXT);
     $mform->addRule('name', $strrequired, 'required', null, 'client');
     // Descripción -----------------------------------------------------------
     $this->add_intro_editor(true, get_string('description', 'blended'));
     //Metodo de identificación ----------------------------------------------
     $idmethodoptions = array(0 => get_string('coded', 'blended'), 1 => get_string('plain', 'blended'));
     $mform->addElement('select', 'idmethod', get_string("idmethod", "blended"), $idmethodoptions);
     $mform->addHelpButton('idmethod', 'idmethod', 'blended');
     $mform->setDefault('idmethod', 0);
     // Tipo Codigo de barras  ----------------------------------------------
     $idcodeoptions = array('QRCode,Q' => 'QR 2D', 'DATAMATRIX' => 'DATAMATRIX ISO/IEC 16022', 'PDF417' => 'PDF417 ISO/IEC 15438:2006', 'EAN13' => 'EAN13');
     $mform->addElement('select', 'codebartype', get_string("codebartype", "blended"), $idcodeoptions);
     $mform->addHelpButton('codebartype', 'codebartype', 'blended');
     $mform->setDefault('codebartype', 'QRCode,Q');
     // enable/disable OMR part
     $mform->addElement('checkbox', 'omrenabled', get_string('OMRenable', 'blended'), get_string('OMRenableLabel', 'blended'));
     // Número de columnas del cuestionario --------------------------------------
     $numbercols = array_combine(range(1, 4), range(1, 4));
     $mform->addElement('select', 'numcols', get_string("numbercols", "blended"), $numbercols);
     $mform->addHelpButton('numcols', 'numbercols', 'blended');
     $mform->setDefault('numcols', 2);
     // Identificador ---------------------------------------------------------
     $options1 = array('userid' => get_string('userid', 'blended'), 'idnumber' => get_string('idnumber', 'blended'));
     $options2 = array();
     if (!($options = $DB->get_records_menu("user_info_field", null, "name", "id, name"))) {
         //print('No info user fields found!');
     } else {
         foreach ($options as $id => $name) {
             //$fieldid = $DB->get_field("user_info_field","id",array("name"=>$name));
             $options2["2" . $id] = get_string("userinfo", "blended") . $name;
         }
     }
     $idtypeoptions = $options1 + $options2;
     //$idtypeoptions = array_merge($options1, $options2);
     $mform->addElement('select', 'idtype', get_string("idtype", "blended"), $idtypeoptions);
     $mform->addHelpButton('idtype', 'idtype', 'blended');
     //$mform->setDefault('idtype', "0");
     // Longitud de identificacion de usuario ----------------------------------------
     $lengthuserinfooptions = array_combine(range(2, 12), range(2, 12));
     $mform->addElement('select', 'lengthuserinfo', get_string("lengthuserinfo", "blended"), $lengthuserinfooptions);
     $mform->addHelpButton('lengthuserinfo', 'lengthuserinfo', 'blended');
     $mform->setDefault('lengthuserinfo', 8);
     // Creación de los equipos -----------------------------------------------
     $teammethodoptions = array(0 => get_string('byteacher', 'blended'), 1 => get_string('bystudents', 'blended'), 2 => get_string('bystudentswithleaders', 'blended'));
     $mform->addElement('select', 'teammethod', get_string("teammethod", "blended"), $teammethodoptions);
     $mform->addHelpButton('teammethod', 'teammethod', 'blended');
     $mform->setDefault('teammethod', 0);
     // Select items
     //
     $items = blended_get_calificable_items($COURSE);
     $selected_items = blended_get_available_items($this->current);
     if (count($items) == count($selected_items)) {
         // this is represented as no filtering
         $selected_items = array();
     }
     $optionsitems = array();
     foreach ($items as $id => $item) {
         $optionsitems[$id] = blended_get_item_name($item);
     }
     $selectitemsform = $mform->addElement('select', 'selecteditems', get_string('selectitems', 'blended'), $optionsitems);
     $mform->addHelpButton('selecteditems', 'selectitems', 'blended');
     $selectitemsform->setMultiple(true);
     $selectitemsform->setSelected(array_keys($selected_items));
     // Numero de equipos por defecto ----------------------------------------
     $teamsoptions = array_combine(range(1, TEAMS_MAX_ENTRIES), range(1, TEAMS_MAX_ENTRIES));
     $mform->addElement('select', 'numteams', get_string("defaultnumteams", "blended"), $teamsoptions);
     $mform->setDefault('numteams', 10);
     // Numero de miembros por defecto ----------------------------------------
     $nummembersoptions = array_combine(range(1, MEMBERS_MAX_ENTRIES), range(1, MEMBERS_MAX_ENTRIES));
     $mform->addElement('select', 'nummembers', get_string("defaultnummembers", "blended"), $nummembersoptions);
     $mform->addHelpButton('nummembers', 'defaultnummembers', 'blended');
     $mform->setDefault('nummembers', 4);
     // Otras caracteristicas -------------------------------------------------
     $features = new stdClass();
     $features->groups = false;
     $features->groupings = true;
     $features->groupmembersonly = true;
     $this->standard_coursemodule_elements($features);
     // buttons
     $this->add_action_buttons();
 }