コード例 #1
0
ファイル: lock.php プロジェクト: ronniebrito/moodle_hiperbook
if (!($course = get_record('course', 'id', $cm->course))) {
    error('Course is misconfigured');
}
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);
コード例 #2
0
	array_push($groups,$group);

}

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);
コード例 #3
0
ファイル: lib.php プロジェクト: ronniebrito/moodle_hiperbook
function hiperbook_unlock_hiperbook($bookid, $lock)
{
    global $CFG, $db;
    if ($lock == 1) {
        $value = 0;
    } else {
        $value = 1;
    }
    // desbloqueia o navpath e capitulos
    $res = execute_sql("update " . $CFG->prefix . "hiperbook set opentostudents = '{$value}' where id = '{$bookid}'");
    echo $err;
    if ($res == 0) {
        error('Could not update your hiperbook!!! :(');
    }
    $navpaths = get_records_select('hiperbook_navigationpath', 'bookid=' . $book->id);
    foreach ($navpaths as $navpath) {
        hiperbook_unlock_navpath($navpath->id, $lock);
    }
}