set_context(context_system::instance()); //$PAGE->requires->js('/lib/jquery/jquery-3.1.0.min.js', true); $PAGE->requires->js('/lib/jquery/jquery-3.1.0.js', true); $PAGE->requires->js('/blocks/contest_bd/js/contest.js', true); /* $PAGE->requires->js('/lib/tablesorter/docs/js/jquery-latest.min.js', true); $PAGE->requires->js('/lib/tablesorter/docs/js/prettify.js', true); $PAGE->requires->js('/lib/tablesorter/docs/js/docs.js', true); $PAGE->requires->css('/lib/tablesorter/css/theme.blue.css'); */ ?> navbar->add($page); $PAGE->set_pagelayout('report'); $PAGE->set_url('/blocks/rss_client/editfeed.php'); $PAGE->set_title('БД систем профессионального воспитания РФ'); $PAGE->set_heading($title); echo $OUTPUT->header(); //echo html_writer::table(participants_table()); $scriptname = "participants.php"; echo listbox_regions($scriptname, $regionid); $fromcontext = context_block::instance(63); if(isloggedin() && has_capability('block/contest_participants:view', $fromcontext)) $flag = true; else $flag = false; echo html_writer::table(participants_short_table($regionid, $flag)); $options = array('action'=> 'add', 'sesskey' => sesskey()); echo '

'.$OUTPUT->single_button(new moodle_url('participate.php', $options), 'Добавить', 'get', $options).'


'; echo '
'; echo ''; echo '
'; echo $OUTPUT->footer(); function listbox_regions($scriptname, $regionid) { global $DB, $OUTPUT; $regions_menu = array(); $regions_menu[0] = 'ВСЕ'; $regions = $DB->get_records_sql("select * from mdl_contest_regions"); if($regions){ foreach ($regions as $region){ $regions_menu[$region->id] = $region->name; } $ret = '' . 'Субъект Российской Федерации' . ':'; $ret .= $OUTPUT->single_select($scriptname, 'regionid', $regions_menu, $regionid, null, 'switchregion'); $ret .= ''; } return $ret; } function participants_short_table($regionid, $flag) { global $DB, $USER, $CFG; $table = new html_table(); if($regionid == 0) $where = 'where approve=1'; else $where = "where regions=$regionid and approve=1 order by userid"; $sql = "SELECT * FROM mdl_contest_participants_bd $where"; //$table->head = array ('Образовательная организация', 'Заявление', 'Конкурсные материалы', '', '', 'Одобрить'); $table->head = array ('Образовательная организация', 'Направление проф. воспитания', 'Название проекта, практики ', 'Описание', 'Дата публикации', 'Действия'); $table->align = array ('left','center','center','center','center','center'); $table->attributes['class'] = 'tablesorter'; if($participants = $DB->get_records_sql($sql)){ $table->data[] = array(); foreach($participants as $participant){ $organization = $participant->organization; $napravlenie = $DB->get_record_sql("select * from mdl_contest_nomination where id=$participant->nomination2"); $napravlenie_text = $napravlenie->name; // $zayavlenie = $DB->get_record_sql("select * from mdl_files where itemid=$participant->zayavlenie and filename<>'.'"); // $zayav_link = "$zayavlenie->filename"; $work = $DB->get_record_sql("select * from mdl_files where itemid=$participant->work and filename<>'.'"); $work_link = "$work->filename"; $date_modified = date('d.m.Y', $work->timemodified); $zayavka = 'Заявка'; $zayavka = ''.$zayavka.''; $anketa = 'Анкета'; $anketa = ''.$anketa.''; $table->data[] = array($organization, $napravlenie_text, $participant->workname, $work_link, $date_modified, ''); } }else{ $table->head = ''; $table->align = ''; echo '
Заявки отсутствуют
'; } return $table; } function participants_table() { global $DB, $USER, $CFG; $table = new html_table(); $table->head = array ('Субъект РФ', 'Номинация', 'Образовательая организация', 'Телефон', 'ФИО руководителя', 'Конкурсная работа', 'Email', 'Заявление', 'Конкурсные материалы'); $table->align = array ('center','center','center','center','center','center','center','center','center'); // $table->size = array ('10%','13%','12%','10%','20%','5%','15%','15%','15%'); $table->data[] = array(); $sql = "SELECT * FROM mdl_contest_participants_bd order by userid"; if($participants = $DB->get_records_sql($sql)){ foreach($participants as $participant){ $regions = $participant->regions; $nomination = $participant->nomination; $organization = $participant->organization; $phone = $participant->phone; $fio = $participant->fio; $workname = $participant->workname; $email = $participant->email; $region = $DB->get_record('contest_regions', array('id' => $regions)); $nominationname = $DB->get_record('contest_nomination', array('id' => $nomination)); $zayavlenie = $DB->get_record_sql("select * from mdl_files where itemid=$participant->zayavlenie and filename<>'.'"); $zayav_link = "$zayavlenie->filename"; $work = $DB->get_record_sql("select * from mdl_files where itemid=$participant->work and filename<>'.'"); $work_link = "$work->filename"; $table->data[] = array($region->name, $nominationname->name, $organization, $phone, $fio, $workname, $email, $zayav_link, $work_link); } } return $table; } ?>