function print_header($title, $morebreadcrumbs = NULL) { global $USER, $CFG, $WS; $this->init_full(); if ($this->user_allowed_editing()) { $buttons = wiki_table_start('', true); $buttons .= update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'wiki')); if (!empty($CFG->showblocksonmodpages)) { $buttons .= wiki_change_column('', true); $prop = null; $prop->method = "get"; $prop->action = "view.php"; $prop->events = 'onsubmit="this.target=\'_top\'; return true"'; $buttons .= wiki_form_start($prop, true); $buttons .= wiki_div_start('', true); $prop = null; $prop->name = "id"; $prop->value = $this->modulerecord->id; $buttons .= wiki_input_hidden($prop, true); $prop = null; $prop->name = "edit"; $prop->value = $this->user_is_editing() ? 'off' : 'on'; $buttons .= wiki_input_hidden($prop, true); $prop = null; $prop->value = get_string($this->user_is_editing() ? 'blockseditoff' : 'blocksediton'); $buttons .= wiki_input_submit($prop, true); $buttons .= wiki_div_end(true); $buttons .= wiki_form_end(true); } $buttons .= wiki_table_end('', true); } else { $buttons = ' '; } // print_header($title, $this->courserecord->fullname, $crumbtext, '', '', true, $buttons, navmenu($this->courserecord, $this->modulerecord)); /// Print header. $navlinks = array(); $navlinks[] = array('name' => get_string('modulenameplural', 'wiki'), 'link' => $CFG->wwwroot . '/mod/wiki/index.php?id=' . $this->courserecord->id, 'type' => 'activity'); $navlinks[] = array('name' => format_string($this->activityrecord->name), 'link' => "view.php", 'type' => 'activityinstance'); $navigation = build_navigation($navlinks); print_header_simple(format_string($this->activityrecord->name), "", $navigation, "", "", true, $buttons, navmenu($this->courserecord, $WS->cm)); }
function wiki_export_html(&$WS) { global $CFG; check_dir_exists("{$CFG->dataroot}/temp", true); check_dir_exists("{$CFG->dataroot}/temp/html", true); check_dir_exists("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}", true); check_dir_exists("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}/atachments", true); check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}", true); check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}/moddata", true); check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}/moddata/dfwiki{$WS->cm->id}", true); //export contents wiki_export_html_content($WS); //export attached files $flist = list_directories_and_files("{$CFG->dataroot}/{$WS->dfwiki->course}/moddata/dfwiki{$WS->cm->id}"); if ($flist != null) { foreach ($flist as $fil) { $from_file = "{$CFG->dataroot}/{$WS->dfwiki->course}/moddata/dfwiki{$WS->cm->id}/{$fil}"; $to_file = "{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}/atachments/{$fil}"; copy($from_file, $to_file); } } //zip file name $times = time(); $name = $WS->dfwiki->name . '-' . $times . '.zip'; $cleanzipname = clean_filename($name); //List of files and directories $filelist = list_directories_and_files("{$CFG->dataroot}/temp/html"); //Convert them to full paths $files = array(); if ($filelist != null) { foreach ($filelist as $file) { $files[] = "{$CFG->dataroot}/temp/html/{$file}"; } } check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}", true); check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}/exportedhtml", true); $destination = "{$CFG->dataroot}/{$WS->dfwiki->course}/exportedhtml/{$cleanzipname}"; $status = zip_files($files, $destination); //delete the folder created in temp $filelist2 = list_directories_and_files("{$CFG->dataroot}/temp/html"); if ($filelist2 != null) { $del = delete_dir_contents("{$CFG->dataroot}/temp/html"); } //show it all to be albe to download the file $prop = null; $prop->class = "textcenter"; wiki_div_start($prop); wiki_size_text(get_string("exporthtmlcorrectly", "wiki"), 2); wiki_div_end(); $prop = null; $prop->border = "0"; $prop->class = "boxaligncenter"; $prop->classtd = "nwikileftnow"; wiki_table_start($prop); $wdir = '/exportedhtml'; $fileurl = "{$wdir}/{$cleanzipname}"; $ffurl = "/file.php?file=/{$WS->cm->course}{$fileurl}"; $icon = mimeinfo("icon", $cleanzipname); link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" height=\"16\" width=\"16\" alt=\"File\" />", 480, 640); echo "\n" . ' '; link_to_popup_window($ffurl, "display", htmlspecialchars($cleanzipname), 480, 640); $prop = null; $prop->class = "nwikileftnow"; wiki_change_row($prop); echo ' '; wiki_table_end(); $prop = null; $prop->border = "0"; $prop->class = "boxaligncenter"; $prop->classtd = "nwikileftnow"; wiki_table_start($prop); $prop = null; $prop->id = "form"; $prop->method = "post"; $prop->action = '../xml/index.php?id=' . $WS->dfwiki->course . '&wdir=/exportedhtml'; wiki_form_start($prop); wiki_div_start(); $prop = null; $prop->name = "dfform[viewexported]"; $prop->value = get_string('viewexported', 'wiki'); wiki_input_submit($prop); wiki_div_end(); wiki_form_end(); wiki_change_column(); print_continue("{$CFG->wwwroot}/mod/wiki/view.php?id={$WS->cm->id}"); wiki_table_end(); }
$opt = null; foreach ($size_fonts as $size_fontop) { $prop = null; $prop->value = $size_fontop; if ($size_fontop == $size_font_default) { $prop->selected = "selected"; } $opt .= wiki_option($size_fontop, $prop, true); } $prop = null; $prop->name = "size"; $prop->size = "1"; $prop->events = "onchange=\"javascript:view_evaluations(event)\""; wiki_select($opt, $prop); } $prop = null; $prop->colspan = '2'; $prop->class = "textcenter"; wiki_change_row($prop); wiki_br(); $prop = null; $prop->name = "continue"; $prop->value = get_string('continue'); wiki_input_submit($prop); wiki_table_end(); wiki_div_end(); wiki_form_end(); echo "<!-- Fi del Formulari -->" . "\n"; /// Finish the page print_footer($COURSE); }
function displaydir($wdir) { // $wdir == / or /a or /a/b/c/d etc global $basedir; global $id; global $USER, $CFG; global $choose; $fullpath = $basedir . $wdir; check_dir_exists($fullpath, true); $directory = opendir($fullpath); // Find all files while (false !== ($file = readdir($directory))) { if ($file == "." || $file == "..") { continue; } if (is_dir($fullpath . "/" . $file)) { $dirlist[] = $file; } else { $filelist[] = $file; } } closedir($directory); $strname = get_string("name"); $strsize = get_string("size"); $strmodified = get_string("modified"); $straction = get_string("action"); $strmakeafolder = get_string("makeafolder"); $struploadafile = get_string("uploadafile"); $strwithchosenfiles = get_string("withchosenfiles"); $strmovetoanotherfolder = get_string("movetoanotherfolder"); $strmovefilestohere = get_string("movefilestohere"); $strdeletecompletely = get_string("deletecompletely"); $strcreateziparchive = get_string("createziparchive"); $strrename = get_string("rename"); $stredit = get_string("edit"); $strunzip = get_string("unzip"); $strlist = get_string("list"); $strrestore = get_string("restore"); $strchoose = get_string("choose"); $prop = null; $prop->action = "index.php"; $prop->method = "post"; $prop->id = "dirform"; wiki_form_start($prop); wiki_div_start(); $prop = null; $prop->name = "choose"; $prop->value = $choose; wiki_input_hidden($prop); wiki_hr(); $prop = null; $prop->border = "0"; $prop->spacing = "2"; $prop->padding = "2"; $prop->width = "640"; $prop->class = "files"; $prop->header = true; $prop->styleth = "width:5%"; wiki_table_start($prop); $prop = null; $prop->header = true; $prop->align = "left"; $prop->class = "header name"; wiki_change_column($prop); echo $strname; $prop = null; $prop->header = true; $prop->align = "right"; $prop->class = "header size"; wiki_change_column($prop); echo $strsize; $prop = null; $prop->header = true; $prop->align = "right"; $prop->class = "header date"; wiki_change_column($prop); echo $strmodified; $prop = null; $prop->header = true; $prop->align = "right"; $prop->class = "header commands"; wiki_change_column($prop); echo $straction; if ($wdir == "/") { $wdir = ""; } if (!empty($wdir)) { $dirlist[] = '..'; } $count = 0; $header = true; if (!empty($dirlist)) { asort($dirlist); foreach ($dirlist as $dir) { if ($header) { $header = false; $prop = null; $prop->header = true; } else { $prop = null; } if ($dir == '..') { $fileurl = rawurlencode(dirname($wdir)); $prop->style = "white-space: nowrap;"; $prop->align = "center"; $prop->classtr = "folder"; wiki_change_row($prop); echo ' '; $prop = null; $prop->class = 'name'; $prop->align = 'left'; $prop->style = "white-space: nowrap;"; wiki_change_column($prop); $prop = null; $prop->src = $CFG->pixpath . '/f/parent.gif'; $prop->height = "16"; $prop->width = "16"; $prop->alt = get_string('parentfolder'); $out = wiki_img($prop, true); $prop = null; $prop->href = 'index.php?id=' . $id . '&wdir=' . $fileurl; wiki_a($out, $prop); $prop = null; $prop->href = 'index.php?id=' . $id . '&wdir=' . $fileurl; wiki_a(get_string('parentfolder'), $prop); wiki_change_column(); echo ' '; wiki_change_column(); echo ' '; wiki_change_column(); echo ' '; } else { $count++; $filename = $fullpath . "/" . $dir; $fileurl = rawurlencode($wdir . "/" . $dir); $filesafe = rawurlencode($dir); $filesize = display_size(get_directory_size("{$fullpath}/{$dir}")); $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p"); $prop->align = "center"; $prop->style = "white-space: nowrap;"; $prop->class = "checkbox"; $prop->classtr = "folder"; wiki_change_row($prop); $prop = null; $prop->name = 'file' . $count; $prop->value = $fileurl; wiki_input_checkbox($prop); $prop = null; $prop->class = 'name'; $prop->align = "left"; $prop->style = "white-space: nowrap;"; wiki_change_column($prop); $prop = null; $prop->src = $CFG->pixpath . '/f/folder.gif'; $prop->height = "16"; $prop->width = "16"; $prop->alt = "Folder"; $out = wiki_img($prop, true); $prop = null; $prop->href = 'index.php?id=' . $id . '&wdir=' . $fileurl . '&choose=' . $choose; wiki_a($out, $prop); $prop = null; $prop->href = 'index.php?id=' . $id . '&wdir=' . $fileurl . '&choose=' . $choose; wiki_a(htmlspecialchars($dir), $prop); $prop = null; $prop->class = 'size'; $prop->align = "right"; $prop->style = "white-space: nowrap;"; wiki_change_column($prop); echo $filesize; $prop = null; $prop->class = 'date'; $prop->align = "right"; $prop->style = "white-space: nowrap;"; wiki_change_column($prop); echo $filedate; $prop = null; $prop->class = 'commands'; $prop->align = "right"; $prop->style = "white-space: nowrap;"; wiki_change_column($prop); $prop = null; $prop->href = 'index.php?id=' . $id . '&wdir=' . $wdir . '&file=' . $filesafe . '&action=rename&choose=' . $choose; wiki_a($strrename, $prop); //echo "<a href=\"index.php?id=$id&wdir=$wdir&file=$filesafe&action=rename&choose=$choose\">$strrename</a>"; } } } if (!empty($filelist)) { asort($filelist); foreach ($filelist as $file) { $icon = mimeinfo("icon", $file); $count++; $filename = $fullpath . "/" . $file; $fileurl = "{$wdir}/{$file}"; $filesafe = rawurlencode($file); $fileurlsafe = rawurlencode($fileurl); $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p"); if (substr($fileurl, 0, 1) == '/') { $selectfile = substr($fileurl, 1); } else { $selectfile = $fileurl; } if ($header) { $header = false; $prop = null; $prop->header = true; } else { $prop = null; } $prop->align = "center"; $prop->style = "white-space: nowrap;"; $prop->class = "checkbox"; $prop->classtr = "file"; wiki_change_row($prop); $prop = null; $prop->name = 'file' . $count; $prop->value = $fileurl; wiki_input_checkbox($prop); $prop = null; $prop->align = "left"; $prop->class = "name nwikileftnow"; wiki_change_column($prop); if ($CFG->slasharguments) { $ffurl = "/file.php/" . $id . $fileurl; } else { $ffurl = "/file.php?file=/" . $id . $fileurl; } link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" height=\"16\" width=\"16\" alt=\"File\" />", 480, 640); echo ' '; link_to_popup_window($ffurl, "display", htmlspecialchars($file), 480, 640); $file_size = filesize($filename); $prop = null; $prop->class = 'size'; $prop->align = "right"; $prop->style = "white-space: nowrap;"; wiki_change_column($prop); echo display_size($file_size); $prop = null; $prop->class = 'date'; $prop->align = "right"; $prop->style = "white-space: nowrap;"; wiki_change_column($prop); echo $filedate; if ($choose) { $edittext = "<b><a onMouseDown=\"return set_value('{$selectfile}')\" href=\"\">{$strchoose}</a></b> "; } else { $edittext = ''; } if ($icon == "text.gif" || $icon == "html.gif") { $edittext .= "<a href=\"index.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=edit&choose={$choose}\">{$stredit}</a>"; } else { if ($icon == "zip.gif") { $edittext .= "<a href=\"index.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=unzip&sesskey={$USER->sesskey}&choose={$choose}\">{$strunzip}</a> "; $edittext .= "<a href=\"index.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=listzip&sesskey={$USER->sesskey}&choose={$choose}\">{$strlist}</a> "; } } $prop = null; $prop->class = 'commands'; $prop->align = "right"; $prop->style = "white-space: nowrap;"; wiki_change_column($prop); echo $edittext; echo "<a href=\"index.php?id={$id}&wdir={$wdir}&file={$filesafe}&action=rename&choose={$choose}\">{$strrename}</a>"; } } if ($header) { $prop = null; $prop->header = true; wiki_table_end($prop); $header = false; } else { wiki_table_end(); } wiki_hr(); if (empty($wdir)) { $wdir = "/"; } $prop = null; $prop->name = "id"; $prop->value = $id; wiki_input_hidden($prop); $prop = null; $prop->name = "choose"; $prop->value = $choose; wiki_input_hidden($prop); $prop = null; $prop->name = "wdir"; $prop->value = $wdir; wiki_input_hidden($prop); $prop = null; $prop->name = "sesskey"; $prop->value = $USER->sesskey; wiki_input_hidden($prop); $options = array("move" => "{$strmovetoanotherfolder}", "delete" => "{$strdeletecompletely}", "zip" => "{$strcreateziparchive}"); if (!empty($count)) { choose_from_menu($options, "action", "", "{$strwithchosenfiles}...", "javascript:document.forms['dirform'].submit()"); } wiki_div_end(); wiki_form_end(); $prop = null; $prop->border = "0"; $prop->spacing = "2"; $prop->padding = "2"; $prop->class = "boxalignright"; $prop->aligntd = "center"; wiki_table_start($prop); if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $wdir) { $prop = null; $prop->action = "index.php"; $prop->method = "get"; wiki_form_start($prop); wiki_div_start(); $prop = null; $prop->name = "choose"; $prop->value = $choose; wiki_input_hidden($prop); $prop = null; $prop->name = "id"; $prop->value = $id; wiki_input_hidden($prop); $prop = null; $prop->name = "wdir"; $prop->value = $wdir; wiki_input_hidden($prop); $prop = null; $prop->name = "action"; $prop->value = "paste"; wiki_input_hidden($prop); $prop = null; $prop->name = "sesskey"; $prop->value = $USER->sesskey; wiki_input_hidden($prop); $prop = null; $prop->value = $strmovefilestohere; wiki_input_submit($prop); wiki_div_end(); wiki_form_end(); $prop = null; $prop->align = "right"; wiki_change_column($prop); } $prop = null; $prop->action = "index.php"; $prop->method = "get"; wiki_form_start($prop); wiki_div_start(); $prop = null; $prop->name = "choose"; $prop->value = $choose; wiki_input_hidden($prop); $prop = null; $prop->name = "id"; $prop->value = $id; wiki_input_hidden($prop); $prop = null; $prop->name = "wdir"; $prop->value = $wdir; wiki_input_hidden($prop); $prop = null; $prop->name = "action"; $prop->value = "mkdir"; wiki_input_hidden($prop); $prop = null; $prop->value = $strmakeafolder; wiki_input_submit($prop); wiki_div_end(); wiki_form_end(); $prop = null; $prop->align = "right"; wiki_change_column($prop); $prop = null; $prop->action = "index.php"; $prop->method = "get"; wiki_form_start($prop); wiki_div_start(); $prop = null; $prop->name = "choose"; $prop->value = $choose; wiki_input_hidden($prop); $prop = null; $prop->name = "id"; $prop->value = $id; wiki_input_hidden($prop); $prop = null; $prop->name = "wdir"; $prop->value = $wdir; wiki_input_hidden($prop); $prop = null; $prop->name = "action"; $prop->value = "upload"; wiki_input_hidden($prop); $prop = null; $prop->value = $struploadafile; wiki_input_submit($prop); wiki_div_end(); wiki_form_end(); wiki_table_end(); wiki_hr(); }
function wiki_print_menu_teachers($listteachers, $cm) { //this function prints the list of theachers in the wiki's student if (empty($listteachers)) { return; } wiki_br(2); $prop = null; $prop->border = "0"; $prop->class = "boxalignright"; $prop->classtd = "nwikileftnow"; wiki_table_start($prop); print_string('anotherteacher', 'wiki'); wiki_change_column(); $prop = null; $prop->id = "selectteacher"; $prop->method = "post"; $prop->action = 'view.php?id=' . $cm->id; wiki_form_start($prop); wiki_div_start(); $opt = null; foreach ($listteachers as $lteacher) { $prop = null; $prop->value = $lteacher->id; $opt .= wiki_option($lteacher->lastname . ', ' . $lteacher->firstname, $prop, true); } $prop = null; $prop->name = "dfformselectteacher"; wiki_select($opt, $prop); $prop = null; $prop->value = get_string("continue"); wiki_input_submit($prop); wiki_div_end(); wiki_form_end(); $prop = null; $prop->class = "nwikileftnow"; wiki_change_row($prop); echo " "; wiki_table_end(); }
function wiki_grade_print_edition_evaluation_box(&$WS) { $context = get_context_instance(CONTEXT_MODULE, $WS->cm->id); if (has_capability('mod/wiki:evaluateawiki', $context)) { print_box_start(); $prop = null; $prop->id = "form_grades"; $prop->method = "post"; $prop->action = 'view.php?id=' . $WS->linkid . '&page=' . urlencode($WS->pageaction . '/' . stripslashes_safe($WS->page)) . '&dfcontent=11&ver=' . $WS->ver . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id; wiki_form_start($prop); $prop = null; $prop->padding = "2"; $prop->aligntd = "right"; wiki_table_start($prop); echo '<b>' . get_string('grade') . '</b>: '; wiki_change_column(); /// 1 -> "+", 2 -> "=", 3 -> "-" $prop = null; $prop->value = '1'; $opt = wiki_option('+', $prop, true); $prop = null; $prop->value = '2'; $opt .= wiki_option('=', $prop, true); $prop = null; $prop->value = '3'; $opt .= wiki_option('-', $prop, true); $prop = null; $prop->name = "grade_edition"; wiki_select($opt, $prop); echo ' '; $prop = null; $prop->name = 'grade_edition_confirm'; $prop->value = get_string('set', 'wiki'); wiki_input_submit($prop); unset($prop); $prop->name = 'oldversion'; $prop->value = $WS->pageolddata->version; wiki_input_hidden($prop); unset($prop); $prop->name = 'currentversion'; $prop->value = $WS->pageverdata->version; wiki_input_hidden($prop); wiki_change_row(); echo '<b>' . get_string('eval_feedback', 'wiki') . '</b>: '; wiki_change_column(); unset($prop); $prop->size = 60; $prop->value = ''; $prop->name = 'feedback'; wiki_input_text($prop); $prop->align = 'right'; wiki_change_row($prop); echo '<i>' . get_string('note', 'wiki') . '</i>: '; wiki_change_column(); $oldversion = $WS->pageolddata->version; $currentversion = $WS->pageverdata->version; if ($currentversion < $oldversion) { $tmp = $currentversion; $currentversion = $oldversion; $oldversion = $tmp; } $version = $oldversion + 1; $count = $version - $currentversion; if ($count == 1) { echo get_string('evaluate_hist_edition', 'wiki') . ' ' . $version; } else { echo '<i>' . get_string('evaluate_hist_editions', 'wiki') . ': '; for ($i = $version; $i <= $currentversion; $i++) { echo $i; if ($i < $currentversion) { echo ', '; } } echo '</i>'; } wiki_table_end(); wiki_form_end(); print_box_end(); } }
function wiki_import_wiki(&$WS) { global $file; //if the form is complete $sure = optional_param('dfformsure', NULL, PARAM_ALPHA); if (isset($sure)) { //import to xml wiki_import_wiki_XML($WS); $prop = null; $prop->class = 'textcenter'; $info = wiki_size_text(get_string("importcorrectly", 'wiki'), 2, '', true); wiki_div($info, $prop); $prop = null; $prop->action = '../view.php?id=' . $WS->cm->id; $prop->method = 'post'; $prop->id = 'form'; wiki_form_start($prop); $prop = null; $prop->border = '0'; $prop->class = 'boxaligncenter'; $prop->classtd = 'nwikileftnow'; wiki_table_start($prop); $prop = null; $prop->name = 'dfformcontinue'; $prop->value = get_string('continue'); $input = wiki_input_submit($prop, true); wiki_div($input); wiki_table_end(); wiki_form_end(); } else { if (isset($WS->dfform['import'])) { $extension = explode("/", $WS->path); $num = count($extension) - 1; $name = $extension[$num]; $info = wiki_b(get_string("importcheckwarning", 'wiki'), '', true); $info .= ' ' . $name; $prop = null; $prop->class = 'textcenter'; wiki_paragraph($info, $prop); switch ($WS->dfform['incase']) { case 0: $name = get_string("always", 'diki'); break; case 1: $name = get_string("never", 'wiki'); break; case 2: $name = get_string("before", 'wiki'); break; case 3: $name = get_string("after", 'wiki'); break; default: break; } $info = wiki_b(get_string("incase", 'wiki'), '', true); $info .= ' ' . $name; $prop = null; $prop->class = 'textcenter'; wiki_paragraph($info, $prop); switch ($WS->dfform['incaseatach']) { case 0: $name = get_string("alwaysatach", 'wiki'); break; case 1: $name = get_string("neveratach", 'wiki'); break; case 2: $name = get_string("beforeatach", 'wiki'); break; case 3: $name = get_string("afteratach", 'wiki'); break; case 4: $name = get_string("bigeratach", 'wiki'); break; case 5: $name = get_string("smalleratach", 'wiki'); break; default: break; } $info = wiki_b(get_string("incaseatach", 'wiki'), '', true); $info .= ' ' . $name; $prop = null; $prop->class = 'textcenter'; wiki_paragraph($info, $prop); wiki_br(); $prop = null; $prop->class = 'textcenter'; wiki_paragraph(get_string("importcheckfiles", 'wiki'), $prop); $prop = null; $prop->class = 'boxaligncenter'; wiki_table_start($prop); $prop = null; $prop->action = 'exportxml.php?id=' . $WS->cm->id . '&pageaction=importxml&path=' . $WS->path; $prop->method = 'post'; $prop->id = 'form1'; wiki_form_start($prop); $prop = null; $prop->name = 'dfformincase'; $prop->value = $WS->dfform['incase']; wiki_input_hidden($prop); $prop = null; $prop->name = 'dfformincaseatach'; $prop->value = $WS->dfform['incaseatach']; wiki_input_hidden($prop); $prop = null; $prop->name = 'dfformsure'; $prop->value = get_string('yes'); wiki_input_submit($prop); wiki_form_end(); wiki_change_column(); $prop = null; $prop->action = 'exportxml.php?id=' . $WS->cm->id . '&pageaction=importewiki&path=' . $WS->path . '&file=' . $file; $prop->method = 'post'; $prop->id = 'form2'; wiki_form_start($prop); $prop = null; $prop->name = 'dfformcancel'; $prop->value = get_string('no'); wiki_input_submit($prop); wiki_form_end(); wiki_table_end(); } else { //create the form to import $prop = null; $prop->action = 'exportxml.php?id=' . $WS->cm->id . '&pageaction=importewiki&type=' . $WS->type . '&path=' . $WS->path . '&file=' . $file; $prop->method = 'post'; $prop->id = 'form'; wiki_form_start($prop); $prop = null; $prop->border = '0'; $prop->class = 'boxaligncenter'; $prop->classtd = 'nwikileftnow'; wiki_table_start($prop); wiki_b(get_string('incase', 'wiki')); wiki_table_start(); $prop = null; $prop->name = 'dfformincase'; $prop->value = '0'; $prop->checked = 'checked'; wiki_input_radio($prop); print_string('always', 'wiki'); wiki_change_row(); $prop = null; $prop->name = 'dfformincase'; $prop->value = '1'; wiki_input_radio($prop); print_string('never', 'wiki'); wiki_change_row(); $prop = null; $prop->name = 'dfformincase'; $prop->value = '2'; wiki_input_radio($prop); print_string('before', 'wiki'); wiki_change_row(); $prop = null; $prop->name = 'dfformincase'; $prop->value = '3'; wiki_input_radio($prop); print_string('after', 'wiki'); wiki_table_end(); wiki_br(2); $prop = null; $prop->class = "nwikileftnow"; wiki_change_row($prop); wiki_b(get_string('incaseatach', 'wiki')); wiki_table_start(); $prop = null; $prop->name = 'dfformincaseatach'; $prop->value = '0'; $prop->checked = 'checked'; wiki_input_radio($prop); print_string('alwaysatach', 'wiki'); wiki_change_row(); $prop = null; $prop->name = 'dfformincaseatach'; $prop->value = '1'; wiki_input_radio($prop); print_string('neveratach', 'wiki'); wiki_change_row(); $prop = null; $prop->name = 'dfformincaseatach'; $prop->value = '2'; wiki_input_radio($prop); print_string('beforeatach', 'wiki'); wiki_change_row(); $prop = null; $prop->name = 'dfformincaseatach'; $prop->value = '3'; wiki_input_radio($prop); print_string('afteratach', 'wiki'); wiki_change_row(); $prop = null; $prop->name = 'dfformincaseatach'; $prop->value = '4'; wiki_input_radio($prop); print_string('bigeratach', 'wiki'); wiki_change_row(); $prop = null; $prop->name = 'dfformincaseatach'; $prop->value = '5'; wiki_input_radio($prop); print_string('smalleratach', 'wiki'); wiki_table_end(); wiki_br(2); $prop = null; $prop->class = "nwikicenternow"; wiki_change_row($prop); $prop = null; $prop->name = 'dfformimport'; $prop->value = get_string('import', 'wiki'); wiki_input_submit($prop); wiki_table_end(); wiki_form_end(); } } }
function wiki_hist_restore(&$WS) { if ($WS->dfperms['restore']) { $prop = null; $prop->id = "form"; $prop->method = "post"; $prop->action = 'view.php?id=' . $WS->linkid . '&page=view/' . urlencode($WS->pageolddata->pagename) . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id; wiki_form_start($prop); wiki_div_start(); $prop = null; $prop->name = "dfformversion"; $prop->value = $WS->pagedata->version; wiki_input_hidden($prop); $prop = null; $prop->name = "dfformcreated"; $prop->value = $WS->pageolddata->created; wiki_input_hidden($prop); $prop = null; $prop->name = "dfformeditable"; $prop->value = $WS->pageolddata->editable; wiki_input_hidden($prop); $prop = null; $prop->name = "dfformeditor"; $prop->value = $WS->pageolddata->editor; wiki_input_hidden($prop); $prop = null; $prop->name = "dfformaction"; $prop->value = "edit"; wiki_input_hidden($prop); $prop = null; $prop->name = "dfformcontent"; $prop->value = htmlspecialchars($WS->pageolddata->content); wiki_input_hidden($prop); $prop = null; $prop->name = "dfformsave"; $prop->value = get_string('restore', 'wiki'); wiki_input_submit($prop); wiki_div_end(); wiki_form_end(); } }
print_header("{$course->shortname}: {$dfwiki->name}", "{$course->fullname}", "{$navigation} <a href=\"../index.php?id={$course->id}\">{$strdfwikis}</a> -> {$dfwiki->name}"); print_heading(get_string("importing", 'wiki')); $prop = null; $prop->class = 'box generalbox generalboxcontent boxaligncenter textcenter'; wiki_div_start($prop); $prop = null; $prop->action = 'import.php?id=' . $course->id . '&cm=' . $cm->id . '&wdir=/'; $prop->method = 'post'; $prop->id = 'form1'; wiki_form_start($prop); $prop = null; $prop->name = 'dfform[importfromxml]'; $prop->value = get_string('importfromxml', 'wiki'); $input = wiki_input_submit($prop, true); wiki_div($input); wiki_form_end(); wiki_br(); $prop = null; $prop->action = 'importwiki.php?id=' . $course->id . '&cm=' . $cm->id . '&wdir=/'; $prop->method = 'post'; $prop->id = 'form2'; wiki_form_start($prop); $prop = null; $prop->name = 'dfform[importfrombackup]'; $prop->value = get_string('importfrombackup', 'wiki'); $input = wiki_input_submit($prop, true); wiki_div($input); wiki_form_end(); wiki_div_end(); //Print footer print_footer();
function wiki_print_edit_uploaded(&$WS) { global $CFG; //initiates images array $context = get_context_instance(CONTEXT_MODULE, $WS->cm->id); $pl->src = $CFG->wwwroot . '/mod/wiki' . '/images/plus.gif'; if (isset($WS->dfcourse)) { $pl->class = 'wiki_folding_co'; } else { $pl->class = 'wiki_folding'; } $mi->src = $CFG->wwwroot . '/mod/wiki' . '/images/minus.gif'; if (isset($WS->dfcourse)) { $mi->class = 'wiki_folding_co'; } else { $mi->class = 'wiki_folding'; } $sq->src = $CFG->wwwroot . '/mod/wiki' . '/images/square.gif'; $images = array('plus' => wiki_img($pl, true), 'minus' => wiki_img($mi, true), 'square' => wiki_img($sq, true)); //get www path: if (has_capability('mod/wiki:uploadfiles', $context) || $WS->dfperms['attach']) { $prop = null; $prop->width = '100%'; $prop->valigntd = 'top'; $prop->classtd = 'nwikileftnow'; wiki_table_start($prop); if ($WS->dfperms['attach']) { print_string('insertfile', 'wiki'); $prop = null; $prop->valign = 'top'; $prop->class = 'nwikileftnow'; wiki_change_column($prop); } if ($WS->dfperms['attach']) { if (count($WS->dfdir->content) != 0) { $prop = null; $prop->class = 'wiki_listme'; $prop->classli = 'wiki_listme'; wiki_start_ul($prop); echo $images['plus']; $prop = null; $prop->href = '#'; if (isset($WS->dfcourse)) { $prop->class = 'wiki_folding_co'; } else { $prop->class = 'wiki_folding'; } $button = wiki_a(get_string('uploaded', 'wiki'), $prop); $numm = 0; //generate tree content. foreach ($WS->dfdir->content as $file) { if ($numm == 0) { $prop = null; $prop->class = 'wiki_listme'; $prop->style = 'margin:auto auto auto 15px;display:none'; $prop->classli = 'wiki_listme'; wiki_start_ul($prop); $numm++; } else { $prop = null; $prop->class = 'wiki_listme'; wiki_change_li($prop); } //image url: http://147.83.59.184/moodle15/file.php/#courseid/ $url = $WS->dfdir->www . '/' . $file; $url = substr($url, strlen($CFG->wwwroot)); echo $images['square']; $prop = null; $prop->href = 'javascript:insertTags(\'[[attach:' . $file . ']]\',\'\',\'\');'; $button = wiki_a($file, $prop); $prop = null; $prop->src = $CFG->wwwroot . '/mod/wiki/editor/images/file_view.gif'; link_to_popup_window($url, get_string('view'), wiki_img($prop, true), $height = 400, $width = 500, get_string('view')); if (has_capability('mod/wiki:deletefiles', $context)) { $prop = null; $prop->name = 'dfformdelfile'; $prop->value = $file; $prop->src = $CFG->wwwroot . '/mod/wiki/images/delete.gif'; wiki_input_image($prop); } } wiki_end_ul(); wiki_end_ul(); } else { //no files where uploaded print_string('nofiles', 'wiki'); } } //print upload form $prop = null; $prop->valign = 'top'; $prop->class = 'nwikiuptam'; wiki_change_column($prop); // show upload files if enabled in wiki settings (students can upload) (nadavkav) if (has_capability('mod/wiki:uploadfiles', $context) and $WS->dfwiki->attach == '1') { $prop = null; $prop->name = 'MAX_FILE_SIZE'; $prop->value = get_max_upload_file_size(); wiki_input_hidden($prop); $prop = null; $prop->name = 'dfformfile'; $prop->size = '20'; wiki_input_file($prop); $prop = null; $prop->name = 'dfformupload'; $prop->value = get_string('upload'); wiki_input_submit($prop); } //print help $prop = null; $prop->valign = 'top'; $prop->class = 'nwikileftnow'; wiki_change_column($prop); helpbutton('attach', get_string('help'), 'wiki'); wiki_table_end(); wiki_hr(); } }