Example #1
0
function insert_woot_content($rec_id, $content)
{
    $result = loadWoot(array("title" => "record:{$rec_id}"));
    if (!$result["success"]) {
        return;
    }
    $woot = $result["woot"];
    if ($woot["chunks"]) {
        foreach ($woot["chunks"] as $chunk) {
            $chunk["unmodified"] = 1;
        }
    } else {
        $woot["chunks"] = array();
    }
    if (!$woot["permissions"]) {
        $woot["permissions"] = array(array("type" => "RW", "groupId" => -1));
    }
    $new_chunk = array("text" => "<p>{$content}</p>", "permissions" => array(array("type" => "RW", "groupId" => -1)));
    array_push($woot["chunks"], $new_chunk);
    $result = saveWoot($woot);
}
Example #2
0
<?php

/*
* Copyright (C) 2005-2013 University of Sydney
*
* Licensed under the GNU License, Version 3.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/gpl-3.0.txt
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/**
 Thin wrapper service to save and return woot save results
*
* @author      Kim Jackson
* @copyright   (C) 2005-2013 University of Sydney
* @link        http://Sydney.edu.au/Heurist
* @version     3.1.0
* @license     http://www.gnu.org/licenses/gpl-3.0.txt GNU License 3.0
* @package     Heurist academic knowledge management system
* @subpackage  Records/Woot
*/
require_once dirname(__FILE__) . "/../woot.php";
$data = json_decode(@$_POST["data"] ? $_POST["data"] : base64_decode(@$_GET["data"]), true);
print json_encode(saveWoot($data));