require_login(); $url = new moodle_url('/local/library/edit.php', array('i' => $i)); $context = context_system::instance(); $admin = is_siteadmin(); if (!$admin) { redirect(new moodle_url('/')); } $name = get_string('createpoll', 'local_library'); $PAGE->set_context($context); $PAGE->navbar->add($name); $PAGE->set_title($name); $PAGE->set_heading($name); $model = new library_Model(); $edata = ''; if (!empty($i)) { $edata = $model->get_librarys($i); } $mform = new local_library_library($url, $edata); if ($data = $mform->get_data()) { $record = array(); $record['name'] = $data->name; $record['fullname'] = 'curso'; $record['userid'] = $USER->id; $record['category'] = $data->category; $record['timecreate'] = time(); $record['timemodified'] = time(); if (empty($i)) { $record['state'] = 0; } //$record['htmlfront'] = $html; //$ruta = $CFG->dirroot .'/local/library';
echo html_writer::tag('a', get_string('addpoll', 'local_library'), array('style' => 'margin-bottom:10px;display:inline-block;', 'class' => 'fb-btn', 'href' => $addlink)); echo html_writer::end_tag('div'); $html .= '<div id="region-main" class="body-biblioteca"> <div class="container-fluid"> <div class="row-fluid"> <div class="span10"> <h2 class="fb-title-modules-biblioteca fb-txt-gray"> <span class="fb-icon fb-icon-title-modules-biblioteca"> </span> Biblioteca de cursos virtuales </h2> </div> </div> <div class="row-fluid"> <div class="span10">'; foreach ($category as $key => $value) { $polls = $model->get_librarys($value->id); $html .= '<div class="fb-table"> <div class="fb-table-header fb-txt-green"> <span class="fb-ancho100">' . $value->name . '</span> </div>'; foreach ($polls as $pollid => $pollvalue) { $viewlink = new moodle_url('/local/library/files/' . $pollvalue->id . '/index.html'); $html .= '<div class="fb-table-body"> <span class="fb-ancho100"> <span class="fb-icon fb-icon-course"> </span> <a href="' . $viewlink . '" class="fb-txt-gray fancybox fancybox.iframe">' . $pollvalue->name . '</a> </span> </div>'; } $html .= '</div>'; }