Beispiel #1
0
    die(json_encode($result));
}
// For write operations check if tag can be written
if ($tagOp == 'rename' || $tagOp == 'delete') {
    if (!\OCA\OCLife\hTags::writeAllowed($tagID)) {
        $result = array('result' => 'NOTALLOWED', 'title' => '', 'key' => $tagID);
        die(json_encode($result));
    }
}
// Tag handler instance
$ctags = new \OCA\OCLife\hTags();
// Switch between possible operations
switch ($tagOp) {
    case 'new':
        $tagID = $ctags->newTag($tagLang, $tagName, $parentID);
        $permission = $ctags->getTagPermission($tagID);
        $result = TRUE;
        break;
    case 'rename':
        $tagData = array($tagLang => $tagName);
        $result = $ctags->alterTag($tagID, $tagData);
        $permission = $ctags->getTagPermission($tagID);
        break;
    case 'delete':
        $result = $ctags->deleteTagAndChilds(intval($tagID));
        $permission = '';
        $owner = '';
        break;
    case 'info':
        $tagData = $ctags->getTagData($tagID);
        if ($tagData !== FALSE) {