function fetch_xmlpairs($courseid) { global $CFG; $pairs = fetch_pairs($courseid); $xml_output = "<pairsets>\n"; foreach ($pairs as $pair) { $pairstreamname = rand(1000000, 9999999); $xml_output .= "\t<pair name='{$pairstreamname}' dirty='false'>\n"; foreach ($pair as $pelement) { $user = get_record('user', 'username', $pelement['username']); $xml_output .= "\t\t<pairelement username='******'username'] . "' showname='" . $pelement['fullname'] . "' pictureurl='" . fetch_user_picture($user, 35) . "' />\n"; } $xml_output .= "\t</pair>\n"; } $xml_output .= "</pairsets>"; //echo $xml_output; return $xml_output; }
error("Could not delete PoodLL Pairwork session"); } //fetch all users online from the course containing this module, that have not yet been put into a pair session $users = fetch_unassigned_users($ttl, $course->id, $context); //lets init our oairs array. $pairs = array(); break; //clear an individual pair from a session //clear an individual pair from a session case 'clearpair': if ($pairid != '0') { $pairid = trim($pairid); delete_records_select('poodllpairwork_usermap', " username = '******' AND course = {$course->id} "); delete_records_select('poodllpairwork_usermap', " partnername = '{$pairid}' AND course = {$course->id}"); //if (!(delete_records_select('poodllpairwork_usermap', " username = '******' ") && // delete_records_select('poodllpairwork_usermap', " partnername = '$pairid' "))){ // error ("Could not delete pair"); //} } //fetch our updated pairs array $pairs = fetch_pairs($course->id); //fetch all users online from the course containing this module, that have not yet been put into a pair session $users = fetch_unassigned_users($ttl, $course->id, $context); break; case 'refreshsession': default: //fetch our pairs array $pairs = fetch_pairs($course->id); //fetch all users online from the course containing this module, that have not yet been put into a pair session $users = fetch_unassigned_users($ttl, $course->id, $context); }
} return $rows; } // Database connection $mysqli = mysqli_init(); $mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5); $mysqli->real_connect($config['db_host'], $config['db_user'], $config['db_password'], $config['db_name']); // create a new EditableGrid object $grid = new EditableGrid(); /* * Add columns. The first argument of addColumn is the name of the field in the databse. * The second argument is the label that will be displayed in the header */ $grid->addColumn('id', 'ID', 'integer', NULL, false); $grid->addColumn('name', 'Name', 'string'); $grid->addColumn('firstname', 'Firstname', 'string'); $grid->addColumn('age', 'Age', 'integer'); $grid->addColumn('height', 'Height', 'float'); /* The column id_country and id_continent will show a list of all available countries and continents. So, we select all rows from the tables */ $grid->addColumn('id_continent', 'Continent', 'string', fetch_pairs($mysqli, 'SELECT id, name FROM continent'), true); $grid->addColumn('id_country', 'Country', 'string', fetch_pairs($mysqli, 'SELECT id, name FROM country'), true); $grid->addColumn('email', 'Email', 'email'); $grid->addColumn('freelance', 'Freelance', 'boolean'); $grid->addColumn('lastvisit', 'Lastvisit', 'date'); $grid->addColumn('website', 'Website', 'string'); $grid->addColumn('action', 'Action', 'html', NULL, false, 'id'); $mydb_tablename = isset($_GET['db_tablename']) ? stripslashes($_GET['db_tablename']) : 'demo'; $result = $mysqli->query('SELECT *, date_format(lastvisit, "%d/%m/%Y") as lastvisit FROM ' . $mydb_tablename); $mysqli->close(); // send data to the browser $grid->renderJSON($result);
$mysqli = mysqli_init(); $mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5); $mysqli->real_connect($config['db_host'], $config['db_user'], $config['db_password'], $config['db_name']); // create a new EditableGrid object $grid = new EditableGrid(); /* * Add columns. The first argument of addColumn is the name of the field in the databse. * The second argument is the label that will be displayed in the header */ $grid->addColumn('ALUNOATIV_ALUNO_CDG', 'Aluno', 'integer', NULL, false); $grid->addColumn('ATIVIDADE_NOME', 'Atividade', 'string'); $grid->addColumn('ALUNOATIV_ACERTOS', 'Acertos', 'integer'); $grid->addColumn('ALUNOATIV_ERROS', 'Erros', 'integer'); //$grid->addColumn('firstname', 'Firstname', 'string'); //$grid->addColumn('age', 'Age', 'integer'); //$grid->addColumn('height', 'Height', 'float'); /* The column id_country and id_continent will show a list of all available countries and continents. So, we select all rows from the tables */ $grid->addColumn('ALUNO_NOME', 'ALUNO', 'string', fetch_pairs($mysqli, 'SELECT ALUNO_CDG, ALUNO_NOME FROM ALUNO'), true); $grid->addColumn('TURMA', 'Turma', 'STRING', NULL, false); //$grid->addColumn('id_continent', 'Continent', 'string' , fetch_pairs($mysqli,'SELECT id, name FROM continent'),true); //$grid->addColumn('id_country', 'Country', 'string', fetch_pairs($mysqli,'SELECT id, name FROM country'),true ); //$grid->addColumn('email', 'Email', 'email'); //$grid->addColumn('freelance', 'Freelance', 'boolean'); //$grid->addColumn('lastvisit', 'Lastvisit', 'date'); //$grid->addColumn('website', 'Website', 'string'); //$grid->addColumn('action', 'Action', 'html', NULL, false, 'id'); $mydb_tablename = isset($_GET['db_tablename']) ? stripslashes($_GET['db_tablename']) : 'aluno_atividade'; $result = $mysqli->query("SELECT AA.*,AL.*, AT.*,\n CONCAT(TURMA_SERIE,'º',TURMA_LETRA) AS TURMA FROM \n ALUNO_ATIVIDADE AA LEFT JOIN ALUNO AL ON ALUNO_CDG = ALUNOATIV_ALUNO_CDG \n LEFT JOIN ATIVIDADE AT ON ATIVIDADE_CDG = ALUNOATIV_ATIVIDADE_CDG\n left join turma on turma_Cdg = alunoativ_turma\n "); $mysqli->close(); // send data to the browser $grid->renderJSON($result);
$value = $val; break; } } $rows[$key] = $value; } return $rows; } // create a new EditableGrid object $grid = new EditableGrid(); /* * Add columns. The first argument of addColumn is the name of the field in the databse. * The second argument is the label that will be displayed in the header */ $grid->addColumn('id', 'Cdg', 'integer', NULL, false); $grid->addColumn('TURMA_NOME', 'Série', 'string'); $grid->addColumn('TURMA_ANO', 'Ano', 'string'); //$grid->addColumn('firstname', 'Firstname', 'string'); //$grid->addColumn('age', 'Age', 'integer'); //$grid->addColumn('height', 'Height', 'float'); /* The column id_country and id_continent will show a list of all available countries and continents. So, we select all rows from the tables */ $grid->addColumn('TURMA_PROF', 'Prof.', 'string', fetch_pairs($System, 'SELECT USUARIO_CDG,USUARIO_NOME ' . ' FROM USUARIO ' . ' LEFT JOIN USUARIO_ESCOLA ON USUARIOESCOLA_USUARIO = USUARIO_CDG ' . ' WHERE USUARIOESCOLA_ESCOLA = ' . $_SESSION['ESCOLA']), true); //$grid->addColumn('TURMA', 'Turma', 'STRING',NULL,false); //$grid->addColumn('id_continent', 'Continent', 'string' , fetch_pairs($mysqli,'SELECT id, name FROM continent'),true); //$grid->addColumn('id_country', 'Country', 'string', fetch_pairs($mysqli,'SELECT id, name FROM country'),true ); //$grid->addColumn('lastvisit', 'Lastvisit', 'date'); //$grid->addColumn('website', 'Website', 'string'); $grid->addColumn('action', 'Ações', 'html', NULL, false, 'id'); $Turma = new Turma(); $result = $Turma->resultset_turmas($_SESSION['ESCOLA']); $grid->renderJSON($result);