本文整理汇总了PHP中news::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP news::delete方法的具体用法?PHP news::delete怎么用?PHP news::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类news
的用法示例。
在下文中一共展示了news::delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
} else {
$message .= '<span class="error">' . $content->errormsg . '</span>';
}
}
//Eintrag entfernen
if (isset($_GET['action']) && $_GET['action'] == 'delete') {
if (!$rechte->isBerechtigt('basis/news', null, 'suid') && !$is_lector) {
die($p->t('global/keineBerechtigungFuerDieseSeite'));
}
if (isset($_GET['news_id']) && is_numeric($_GET['news_id'])) {
$news_id = $_GET['news_id'];
$news = new news();
if ($news->load($news_id)) {
$studiengang_kz = $news->studiengang_kz;
$semester = $news->semester;
if ($news->delete($news_id)) {
$message .= '<span class="ok">' . $p->t('global/erfolgreichgelöscht') . '</span>';
$news_id = '';
} else {
$message .= '<span class="error">' . $news->errormsg . '</span>';
}
} else {
$message .= '<span class="error">' . $p->t('global/fehlerBeimLesenAusDatenbank') . '</span>';
}
} else {
die($p->t('global/fehlerBeiDerParameteruebergabe'));
}
}
//Speichern eines Eintrags
if (isset($_POST['save'])) {
$save_error = false;
示例2: tpl
$lists = $do->get_list('status=2' . $condition, $dorder[$order]);
include tpl('news_check', $module);
}
break;
case 'reject':
if ($itemid && !$psize) {
$do->reject($itemid);
dmsg('拒绝成功', $forward);
} else {
$lists = $do->get_list('status=1' . $condition, $dorder[$order]);
include tpl('news_reject', $module);
}
break;
case 'delete':
$itemid or msg('请选择新闻');
isset($recycle) ? $do->recycle($itemid) : $do->delete($itemid);
dmsg('删除成功', $forward);
break;
case 'restore':
$itemid or msg('请选择新闻');
$do->restore($itemid);
dmsg('还原成功', $forward);
break;
case 'clear':
$do->clear();
dmsg('清空成功', $forward);
break;
case 'level':
$itemid or msg('请选择新闻');
$level = intval($level);
$do->level($itemid, $level);
示例3: initialize
/**
* Initialize lesson
*
* This function is used to initialize specific aspects of the current lesson
* These aspects can be the lesson content, announcements, users, glossary etc
* specified in the $deleteEntities array.
* <br/>Example:
* <code>
* try {
* $lesson = new EfrontLesson(32); //32 is the lesson id
* $lesson -> initialize(array('content', 'glossary', 'rules')); //Erase all content, glossary terms and content rules
* } catch (Exception $e) {
* echo $e -> getMessage();
* }
* </code><br/>
* If $deleteEntities is 'all', then all lesson aspects are reset
*
* @param mixed $deleteEntities Eiterh an array with lesson aspects to initialize, or 'all' which equals to 'reset everything'
* @return boolean True if everything is ok
* @since 3.5.0
* @access public
*/
public function initialize($deleteEntities)
{
$possibleEntities = array('content', 'tests', 'questions', 'rules', 'conditions', 'comments', 'users', 'news', 'files', 'calendar', 'glossary', 'tracking', 'scheduling', 'surveys', 'events', 'modules', 'projects');
if ($deleteEntities == 'all') {
$deleteEntities = $possibleEntities;
}
$content = eF_getTableDataFlat("content", "*", "lessons_ID=" . $this->lesson['id']);
//Get the lesson units
sizeof($content['id']) > 0 ? $content_list = implode(",", $content['id']) : ($content_list = array());
//Create list of content ids, will come in handy later
$commonFolderLessons = eF_getTableData("lessons", "id", "share_folder=" . $this->lesson['id']);
foreach ($deleteEntities as $value) {
switch ($value) {
case 'tests':
$lessonTests = $this->getTests(true);
foreach ($lessonTests as $id => $test) {
$test->delete();
}
break;
case 'questions':
$lessonQuestions = $this->getQuestions(true);
foreach ($lessonQuestions as $id => $question) {
$question->delete();
}
break;
case 'rules':
$content = new EfrontContentTree($this->lesson['id']);
$contentRules = $content->getRules();
$content->deleteRules(array_keys($contentRules));
break;
case 'conditions':
$lessonConditions = $this->getConditions();
$this->deleteConditions(array_keys($lessonConditions));
break;
case 'comments':
$content = new EfrontContentTree($this->lesson['id']);
$content->deleteComments(array_keys($content->getComments()));
//Delete all comments
break;
case 'content':
$content = new EfrontContentTree($this->lesson['id']);
foreach (new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($content->tree), RecursiveIteratorIterator::SELF_FIRST)) as $key => $unit) {
$unit->delete();
}
break;
case 'users':
$lessonUsers = $this->getUsers('student');
$this->removeUsers(array_keys($lessonUsers));
break;
case 'news':
$lessonNews = news::getNews($this->lesson['id']);
//$this -> getNews();
foreach ($lessonNews as $value) {
$value = new news($value);
$value->delete();
}
break;
case 'files':
//Only delete files if this lesson is not sharing its folder
if (!$this->lesson['share_folder'] && empty($commonFolderLessons)) {
$directory = new EfrontDirectory($this->directory);
$directory->delete();
mkdir($this->directory, 0755);
}
break;
case 'calendar':
!in_array('calendar', $deleteEntities) or calendar::deleteLessonCalendarEvents($this->lesson['id']);
break;
case 'glossary':
in_array('glossary', $deleteEntities) ? eF_deleteTableData("glossary", "lessons_ID=" . $this->lesson['id']) : null;
break;
case 'projects':
$lessonProjects = $this->getProjects(true);
foreach ($lessonProjects as $value) {
$value->delete();
}
break;
case 'tracking':
//.........这里部分代码省略.........
示例4: json_encode
<?php
require_once "model.php";
$news = new news();
$id = $_POST['id'];
if ($news->delete($id)) {
$data['status'] = 1;
$data['msg'] = "删除成功";
} else {
$data['status'] = 0;
$data['msg'] = "删除失败";
}
echo json_encode($data);