예제 #1
0
파일: save.php 프로젝트: Tzeak/Looma
function addNew()
{
    global $filename;
    global $timelines;
    global $timelineArray;
    echo "new timeline create";
    $info = array("name" => $_POST["lesson_title"], "line" => $_POST["items_array"]);
    $timelines->insert($info);
    $info = fixDocId($info);
    //Add new timeline information into $file//
    $timelineArray[] = $info;
}
예제 #2
0
파일: search.php 프로젝트: Tzeak/Looma
<?php

require_once 'mongoSetup.php';
//Glob attempt. It technically works, in the worst way.
$filename = globber();
//echo $filename;
if ($filename) {
    $mongodoc = searchMongoByFilename($filename);
    $mongodoc = fixDocId($mongodoc);
    echo json_encode($mongodoc);
} else {
    echo "No file found";
}
function globber()
{
    $dir_iterator = new RecursiveDirectoryIterator("../content/");
    $iterator = new RecursiveIteratorIterator($dir_iterator);
    if (isset($_GET['search']) && $_GET['search'] != '') {
        foreach ($iterator as $filepath) {
            $filename = $filepath . '/*' . $_GET['search'];
            //   ../content/*Classroom*
            foreach (ciGlob($filename . '*') as $found) {
                if ($found) {
                    echo basename($found);
                    return basename($found);
                }
            }
        }
    }
    return null;
}
예제 #3
0
파일: mongoSetup.php 프로젝트: Tzeak/Looma
function fixDocArray($docArray)
{
    $docCount = count($docArray);
    for ($i = 0; $i < $docCount; $i++) {
        $docArray[$i] = fixDocId($docArray[$i]);
    }
    return $docArray;
}