require_once("$CFG->libdir/packer/zip_packer.php");
+/**
+ * Given a physical path to a file, returns the URL through which it can be reached in Moodle.
+ * @param string $path Physical path to a file
+ * @param array $options associative array of GET variables to append to the URL
+ * @param string $type (questionfile|rssfile|user|usergroup|httpscoursefile|coursefile)
+ * @return string URL to file
+ */
function get_file_url($path, $options=null, $type='coursefile') {
global $CFG, $HTTPSPAGEREQUIRED;
}
/**
- * @return int an available draft itemid that can be used to create a new draft
+ * @return int a random but available draft itemid that can be used to create a new draft
* file area.
*/
function file_get_unused_draft_itemid() {
$this->ttl = $CFG->curlcache;
}
}
+
+ /**
+ * TODO Document
+ */
public function get($param){
global $CFG, $USER;
$this->cleanup($this->ttl);
}
return false;
}
+
+ /**
+ * TODO Document
+ */
public function set($param, $val){
global $CFG, $USER;
$filename = 'u'.$USER->id.'_'.md5(serialize($param));
fwrite($fp, serialize($val));
fclose($fp);
}
+
+ /**
+ * TODO Document
+ */
public function cleanup($expire){
if($dir = opendir($this->dir)){
while (false !== ($file = readdir($dir))) {
}
}
}
+
+/**
+ * TODO Document
+ */
class file_type_to_ext {
public function __construct($file = '') {
global $CFG;
$this->tree = array();
$this->result = array();
}
+
+ /**
+ * TODO Document
+ */
private function _browse_nodes($parent, $types) {
$key = (string)$parent['TEXT'];
if(isset($parent->node)) {
$this->tree[] = $key;
}
}
+
+ /**
+ * TODO Document
+ */
private function _select_nodes($parent){
if(isset($parent->node)) {
foreach($parent->node as $v){
}
}
+
+ /**
+ * TODO Document
+ */
public function get_file_ext($types) {
$this->result = array();
if ((is_array($types) && in_array('*', $types)) ||