if (!isteacheredit($course->id)) { error('Only editing teachers can edit books!'); } if (!($book = get_record('hiperbook', 'id', $cm->instance))) { error('Course module is incorrect'); } $db->debug = true; switch ($mode) { case 'hiperbook': hiperbook_unlock_hiperbook($bookid, $lock); break; case 'navpath': hiperbook_unlock_navpath($navpathid, $lock); break; case 'chapter': hiperbook_unlock_chapter($chapterid, $lock); break; case 'page': hiperbook_unlock_page($pageid, $lock); break; case 'tip': hiperbook_unlock_tip($tipid, $lock); break; case 'hotword': hiperbook_unlock_hotword($hotwordid, $lock); break; case 'suggestion': hiperbook_unlock_suggestion($suggestionid, $lock); break; } add_to_log($course->id, 'course', 'update mod', '../mod/hiperbook/view.php?id=' . $cm->id, 'hiperbook ' . $book->id);
if (!$cm->visible and !$isteacher) { notice(get_string('activityiscurrentlyhidden')); } ?> <?php if ($unlock_navpath_id){ // abre para alunos todas os capitulos e paginas presentes no navpath hiperbook_unlock_navpath( $unlock_navpath_id); } if ($unlock_chapter_id){ // abre para alunos todas as paginas presentes no navpath hiperbook_unlock_chapter($unlock_chapter_id); } if ($unlock_page_id){ // abre para alunos a pagina identificada hiperbook_unlock_page($unlock_page_id); } if(!$navchapterid){ $navchapterid = 0; } // se nao encontrou um navchapter, esta na raiz //var_dump($navchapterid); /// read chapters // busca os capitulos q aparecem na area lateral em funcao do parametro chapterid // se chapterid = null, entao esta no inicio e busca os capitulos com parentchapter = 0
function hiperbook_unlock_navpath($np_id, $lock) { global $CFG, $db; if ($lock == 1) { $value = 0; } else { $value = 1; } // desbloqueia o navpath e capitulos $navpath = get_record('hiperbook_navigationpath', 'id', $np_id); $navpath->opentostudents = $value; if (!update_record('hiperbook_navigationpath', $navpath)) { error('Could not update your navpath!!!'); } $chapterids = get_records_select('hiperbook_navigation_chapters', 'navigationid=' . $navpath->id, 'chapterid'); foreach ($chapterids as $chapterid) { hiperbook_unlock_chapter($chapterid->chapterid, $lock); } }