$pdf->WriteHTML($textos_wiki_html[$i]); } } //name of the pdf file with the name of the first page $pdf->Output($pagenamewiki[0] . '.pdf', 'D'); } //----------- Here starts the execution------------------- // $WS = new storage(); $id = optional_param('id', NULL, PARAM_INT); $WS->gid = optional_param('gid', NULL, PARAM_INT); $cid = optional_param('cid', NULL, PARAM_INT); $WS->pagedata->version = optional_param('version', NULL, PARAM_INT); $WS->page = optional_param('page', NULL, PARAM_CLEAN); $WS->page = stripslashes($WS->page); //WS class is initialized $WS->set_info($id); $WS->cm->id = $id; require_login($cid); global $COURSE; //only for theachers and admins: $context = get_context_instance(CONTEXT_MODULE, $WS->cm->id); require_capability('mod/wiki:canexporttopdf', $context); //check Moodle version(higher than 1.5) if ($CFG->version < 2006050500) { error("Error: Wiki to PDFs only for Moodle 1.6 version or higher."); } $fform = data_submitted(); $textwiki = get_record_sql(' SELECT wp.id, wp.content, wp.refs FROM ' . $CFG->prefix . 'wiki_pages wp, ' . $CFG->prefix . 'course_modules cm, ' . $CFG->prefix . 'wiki w WHERE cm.id = ' . $id . ' AND cm.course = w.course AND wp.dfwiki = ' . $WS->dfwiki->id . ' AND wp.dfwiki = w.id
/** * gets/sets a wiki_param variable. Also can execute some special actions * over a wiki_param (defined by $special param): * 'unset' => unsets a wiki_param * 'print' or 'print_object': do a print_object of a wiki_param * 'isset' => will returns only true or false if a wiki_param is set * 'set_info' => load main info into global structure * 'all_ws' => (deprecated) returns all variables in a single object * * @param String $name: wiki_param name * @param mixed $value=null: assign wiki_param value * @param Stirng $special=false: some special actions * @return mixed: wiki_param value or null if it's not set */ function wiki_param($name, $value = null, $special = false) { global $WS; if (!isset($WS)) { $WS = new storage(); $WS->recover_variables(); } if ($special == 'set_info') { $WS->set_info(); } //this is a deprecated line and will be removed shortly if ($special == 'all_ws') { return $WS; } if (!$name) { return null; } if ($value !== null) { $WS->{$name} = $value; } //special actions switch ($special) { case 'isset': return isset($WS->{$name}); break; case 'unset': if (isset($WS->{$name})) { unset($WS->{$name}); } break; case 'print': case 'print_object': if (isset($WS->{$name})) { print_object(); } else { echo '$WS->' . $name . ' is not set!'; } break; } if (!isset($WS->{$name})) { return null; } return $WS->{$name}; }