本文整理汇总了PHP中content::saveContent方法的典型用法代码示例。如果您正苦于以下问题:PHP content::saveContent方法的具体用法?PHP content::saveContent怎么用?PHP content::saveContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类content
的用法示例。
在下文中一共展示了content::saveContent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if (isset($_POST['nodeID']) && is_int((int) $_POST['nodeID']) && isset($_POST['languageID']) && is_int((int) $_POST['languageID']) && isset($_POST['notes'])) {
// TO DO encode the entity value pairs into an array to pass into the saveContent node
$entityValuesArray = array();
foreach ($_POST as $name => $value) {
if (substr($name, 0, 7) === "entity-") {
$entityID = substr($name, 7);
if (is_numeric($entityID)) {
$entityValuesArray[$entityID] = $value;
}
// TO DO ELSE? Content could go walkies otherwise!
}
}
// DEBUG ONLY error_log(print_r($entityValuesArray,1));
// Testing
// $saveSuccess = true;
$saveSuccess = $content->saveContent((int) $_POST['nodeID'], (int) $_POST['languageID'], $_POST['notes'], $entityValuesArray);
if ($saveSuccess !== true) {
echo json_encode(array('result' => false, 'msg' => 'Error storing content to the database'));
exit;
} else {
echo json_encode(array('result' => $saveSuccess, 'msg' => 'Content stored'));
exit;
}
} else {
echo json_encode(array('result' => false, 'msg' => 'AJAX Validation failed'));
exit;
}
}
////////////////////////////////////////////////////
// setTemplate Set template - used for new nodes
////////////////////////////////////////////////////
示例2: catch
if (is_numeric($sectionInstanceID)) {
$sectionInstancesArray[$key]['sectionInstanceID'] = $sectionInstanceID;
$sectionInstancesArray[$key]['sectionID'] = $sectionID;
$sectionInstancesArray[$key]['sortOrder'] = $value['sortOrder'];
// error_log("Added instance: ". $sectionInstanceID . " sectionID: " . $sectionID . " sortorder:" . $value['sortOrder']);
}
}
}
} catch (Exception $e) {
error_log('Throwing exception in the save Content AJAX call ' . $e->getMessage());
echo json_encode(array('result' => $saveSuccess, 'msg' => 'Content stored'));
exit;
}
// Testing
// $saveSuccess = $content->saveContent((int)$_REQUEST['nodeID'], (int)$_REQUEST['languageID'], $_REQUEST['notes'], $entityValuesArray);
$saveSuccess = $content->saveContent((int) $_POST['nodeID'], (int) $_POST['languageID'], $_POST['notes'], (int) $_POST['noCache'], $entityValuesArrayNEW, $sectionInstancesArray);
// $saveSuccess = true;
if ($saveSuccess !== true) {
echo json_encode(array('result' => false, 'msg' => 'Error storing content to the database'));
exit;
} else {
echo json_encode(array('result' => $saveSuccess, 'msg' => 'Content stored'));
exit;
}
} else {
echo json_encode(array('result' => false, 'msg' => 'AJAX Validation failed'));
exit;
}
}
////////////////////////////////////////////////////
// setTemplate Set template - used for new nodes
示例3: isset
$version = isset($_GET['version']) ? $_GET['version'] : null;
$content_id = isset($_GET['content_id']) ? $_GET['content_id'] : null;
$parent_content_id = isset($_GET['parent_content_id']) ? $_GET['parent_content_id'] : null;
$action = isset($_GET['action']) ? $_GET['action'] : '';
$method = isset($_GET['method']) ? $_GET['method'] : null;
$filter = isset($_GET['filter']) ? $_GET['filter'] : null;
$deleted = isset($_GET['deleted']) ? $_GET['deleted'] : '';
$message = '';
$submenu_depth = 0;
$datum_obj = new datum();
$filterstr = explode(' ', TRIM(str_replace(array('!', '.', '?', ','), '', $filter)));
//Inhalt Speichern
if (isset($_POST['XSDFormPrinter_XML'])) {
$content = new content();
$content->getContent($content_id, $sprache, $version);
if ($content->saveContent($content->contentsprache_id, $_POST['XSDFormPrinter_XML'])) {
$message .= '<span class="ok">Inhalt wurde erfolgreich gespeichert</span>';
} else {
$message .= '<span class="error">' . $content->errormsg . '</span>';
}
}
if (!is_null($method)) {
switch ($method) {
case 'content_sperre':
//Sperren und Freigeben von Content
if (!isset($_GET['contentsprache_id'])) {
die('Falsche Parameteruebergabe');
}
if (!$rechte->isBerechtigt('basis/cms', null, 'su')) {
$message .= '<span class="error">Sie haben keine Berechtigung fuer diese Aktion</span>';
break;