本文整理汇总了PHP中news::getNews方法的典型用法代码示例。如果您正苦于以下问题:PHP news::getNews方法的具体用法?PHP news::getNews怎么用?PHP news::getNews使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类news
的用法示例。
在下文中一共展示了news::getNews方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
}
if (!$smarty->is_cached('index.tpl', $cacheId) || !$GLOBALS['configuration']['smarty_caching']) {
foreach (eF_loadAllModules(true, true) as $module) {
$module->onIndexPageLoad();
}
$positions = $GLOBALS['currentTheme']->layout['positions'];
//Main scripts, such as prototype
$mainScripts = getMainScripts();
$smarty->assign("T_HEADER_MAIN_SCRIPTS", implode(",", $mainScripts));
//Operation/file specific scripts
$loadScripts = array_diff($loadScripts, $mainScripts);
//Clear out duplicates
$smarty->assign("T_HEADER_LOAD_SCRIPTS", implode(",", array_unique($loadScripts)));
//array_unique, so it doesn't send duplicate entries
if (in_array('news', array_merge($positions['leftList'], $positions['rightList'], $positions['centerList']))) {
$smarty->assign("T_NEWS", news::getNews(0, true));
}
if (G_VERSIONTYPE == 'enterprise') {
#cpp#ifdef ENTERPRISE
require_once "../libraries/module_hcd_tools.php";
}
#cpp#endif
if (EfrontUser::isOptionVisible('online_users') && in_array('online', array_merge($positions['leftList'], $positions['rightList'], $positions['centerList']))) {
$smarty->assign("T_ONLINE_USERS_LIST", EfrontUser::getUsersOnline($GLOBALS['configuration']['autologout_time'] * 60));
}
$smarty->assign("T_CURRENT_USER", $currentUser);
$smarty->load_filter('output', 'eF_template_setEditorOffset');
$smarty->display('index.tpl');
} else {
$smarty->load_filter('output', 'eF_template_setEditorOffset');
$smarty->display('index.tpl');
示例2: news
$model = $_REQUEST['model'];
$action = $_REQUEST['action'];
include_once MODELS_ADMIN . "/" . $model . "_model.php";
switch (strtoupper($action)) {
case 'ADD':
break;
case 'SAVE':
$objNews = new news();
$objNews->setNews($_REQUEST);
$objComm->redirect('index.php?model=' . $model);
break;
case 'VIEW':
case 'EDIT':
$objNews = new news();
$row = $objNews->getNews($_REQUEST['id']);
break;
case 'UPDATE':
$objNews = new news();
$objNews->setNews($_REQUEST);
$objComm->redirect('index.php?model=' . $model . '&action=edit&id=' . $_REQUEST['pk_id']);
break;
case 'DELETE':
$objNews = new news();
$objNews->delNews($_REQUEST['id']);
$objComm->redirect('index.php?model=' . $model);
break;
default:
$objNews = new news();
$Records = $objNews->getAllNews();
break;
示例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: IN
}
$smarty->assign("T_FORUM_OPTIONS", $forum_options);
//Assign forum options to smarty
/*Lesson announcements list*/
if (!isset($currentUser->coreAccess['news']) || $currentUser->coreAccess['news'] != 'hidden') {
if (!empty($lessons_list)) {
if ($currentUser->getType() == "student") {
//See only non-expired news
$news = news::getNews(0, true) + news::getNews($lessons_list, true);
} else {
//See both expired and non-expired news
$news = news::getNews(0, true) + news::getNews($lessons_list, false);
}
} else {
//Administrator news, he doesn't have to see lesson news (since he can't actually access them)
$news = news::getNews(0, true);
}
$news = array_slice($news, 0, 10, true);
$smarty->assign("T_NEWS", $news);
//Assign announcements to smarty
}
/*Comments list*/
if (!empty($lessons_list)) {
$comments = eF_getTableData("comments cm JOIN content c JOIN lessons l ON c.lessons_ID = l.id", "cm.id AS id, cm.data AS data, cm.users_LOGIN AS users_LOGIN, cm.timestamp AS timestamp, c.name AS content_name, c.id AS content_ID, c.ctg_type AS content_type, l.name as show_lessons_name, l.id as show_lessons_id", "c.lessons_ID IN ('" . implode("','", $lessons_list) . "') AND cm.content_ID=c.id AND c.active=1 AND cm.active=1 AND cm.private=0", "cm.timestamp DESC LIMIT 5");
if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) {
//this applies to supervisors only
$currentBranch = new EfrontBranch($_SESSION['s_current_branch']);
$branchTreeUsers = array_keys($currentBranch->getBranchTreeUsers());
foreach ($comments as $key => $value) {
if (!in_array($value['users_LOGIN'], $branchTreeUsers)) {
unset($comments[$key]);
示例5: elseif
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_COMPLAINT_NOT_SEND));
}
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_COMPLAINT_NOT_SEND));
}
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_COMPLAINT_NOT_SEND));
}
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_COMPLAINT_NOT_SEND));
}
} elseif (isset($_POST['deleteComment']) && isset($_POST['newsId'])) {
if (!empty($_POST['deleteComment']) && !empty($_POST['newsId'])) {
$news = new news();
$newsComments = new newsComments();
if ($arrNews = $news->getNews("id=" . secure::escQuoteData($_POST['newsId'] . " AND token='active'"))) {
if (!empty($_SESSION['sd_user']['data']['id']) && $_SESSION['sd_user']['data']['id'] == $arrNews['id_user']) {
if ($newsComments->deleteRecords("id=" . secure::escQuoteData($_POST['deleteComment']))) {
echo ajax::sdgJSONencode(array('success' => true));
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_NOT_DELETE));
}
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_NOT_DELETE));
}
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_NOT_DELETE));
}
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_NOT_DELETE));
}
示例6: getRssSource
private function getRssSource($source, $mode, $lesson)
{
$feeds = $this->getProvidedFeeds();
foreach ($feeds as $value) {
if ($value['active'] && $value['mode'] == 'system') {
$systemFeeds[$value['type']] = $value;
} else {
if ($value['active'] && $value['mode'] == 'lesson') {
$lessonFeeds[$value['type']] = $value;
}
}
}
if ($mode == 'system' && !in_array($source, array_keys($systemFeeds))) {
return array();
} elseif ($mode == 'lesson' && !in_array($source, array_keys($lessonFeeds))) {
return array();
}
$data = array();
switch ($source) {
case 'announcements':
if ($mode == 'system') {
$news = news::getNews(0, true);
} elseif ($mode == 'lesson') {
if ($lesson) {
$news = news::getNews($lesson, true);
} else {
$lessons = eF_getTableDataFlat("lessons", "id, name");
$lessonNames = array_combine($lessons['id'], $lessons['name']);
$news = news::getNews($lessons['id'], true);
}
}
$count = 1;
foreach ($news as $value) {
if ($mode == 'lesson' && !$lesson) {
$value['title'] = $lessonNames[$value['lessons_ID']] . ': ' . $value['title'];
$link = G_SERVERNAME . 'userpage.php?lessons_ID=' . $value['lessons_ID'] . '&ctg=news&view=' . $value['id'];
} else {
$link = G_SERVERNAME . 'userpage.php?ctg=news&view=' . $value['id'];
}
$data[] = array('title' => $value['title'], 'link' => $link, 'description' => $value['data']);
/*
if ($count++ == $this -> feedLimit) {
break;
}
*/
}
break;
case 'catalog':
$constraints = array("return_objects" => false, 'archive' => false, 'active' => true);
$result = EfrontCourse::getAllCourses($constraints);
$directionsTree = new EfrontDirectionsTree();
$directionPaths = $directionsTree->toPathString();
foreach ($result as $value) {
$pathString = $directionPaths[$value['directions_ID']] . ' → ' . $value['name'];
$data[] = array('title' => $pathString, 'link' => G_SERVERNAME . 'index.php?ctg=lesson_info&courses_ID=' . $value['id'], 'description' => implode("<br>", unserialize($value['info'])));
}
$result = eF_getTableData("lessons", "id,name,directions_ID, info", "archive=0 and instance_source = 0 and active=1 and course_only=0", "name");
foreach ($result as $value) {
$pathString = $directionPaths[$value['directions_ID']] . ' → ' . $value['name'];
$data[] = array('title' => $pathString, 'link' => G_SERVERNAME . 'index.php?ctg=lesson_info&lessons_ID=' . $value['id'], 'description' => implode("<br>", unserialize($value['info'])));
}
$data = array_values(eF_multisort($data, 'title', 'asc'));
//Sort results based on path string
break;
case 'calendar':
if ($mode == 'system') {
$events = calendar::getGlobalCalendarEvents();
} elseif ($mode == 'lesson') {
if ($lesson) {
$events = calendar::getLessonCalendarEvents($lesson);
} else {
$events = calendar::getCalendarEventsForAllLessons();
}
}
foreach ($events as $value) {
$value['name'] ? $title = formatTimestamp($value['timestamp']) . ' (' . $value['name'] . ')' : ($title = formatTimestamp($value['timestamp']));
$data[] = array('title' => $title, 'link' => G_SERVERNAME . 'userpage.php?ctg=calendar&view_calendar=' . $value['timestamp'] . '&type=0', 'description' => $value['data']);
}
break;
/*
case 'history':
$currentUser = $this -> getCurrentUser();
$eventObjects = array();
$result = eF_getTableData("events", "*", "", "timestamp DESC limit 100");
foreach ($result as $value) {
$eventObject = new EfrontEvent($value);
$eventObject -> createMessage();
pr($eventObject);
}
break;
*/
/*
case 'history':
$currentUser = $this -> getCurrentUser();
$eventObjects = array();
$result = eF_getTableData("events", "*", "", "timestamp DESC limit 100");
foreach ($result as $value) {
//.........这里部分代码省略.........
示例7: array_keys
} else {
$lessonId = array_keys($eligibleLessons);
}
} else {
$lessonId = $currentLesson->lesson['id'];
}
if ($_admin_) {
$news = news::getNews(0);
} else {
if ($_professor_ || $_student_) {
$news = news::getNews(0, true);
if ($_professor_) {
$lessonNews = news::getNews($lessonId, false);
} else {
if ($_student_) {
$lessonNews = news::getNews($lessonId, true);
}
}
if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) {
//this applies to branch urls
$currentBranch = new EfrontBranch($_SESSION['s_current_branch']);
$branchTreeUsers = array_keys($currentBranch->getBranchTreeUsers());
foreach ($lessonNews as $key => $value) {
if ($value['type'] != 'global' && !in_array($value['users_LOGIN'], $branchTreeUsers)) {
unset($lessonNews[$key]);
}
}
}
$news = $news + $lessonNews;
}
}
示例8: elseif
$user->changeTable('users', USR_PREFIX);
echo $response;
} elseif (!empty($_POST['getArticleDetail']) && !empty($_POST['strQuery'])) {
$articles = new articles();
$arrArticle = $articles->getArticle("id IN (" . secure::escQuoteData($_POST['getArticleDetail']) . ")");
$aComments = new articlesComments();
$arrOrder = array('datetime' => 'DESC');
$arrComments = $aComments->getRecords("id_article=" . secure::escQuoteData($_POST['getArticleDetail']) . " AND token='active'", $arrOrder, false, false);
// адресная строка
$smarty->assignByRef('qString', $_POST['strQuery']);
$smarty->assignByRef('arrArticle', $arrArticle);
$smarty->assignByRef('arrComments', $arrComments);
$smarty->display('adm.manager.articles.detail.tpl');
} elseif (!empty($_POST['getNewsDetail']) && !empty($_POST['strQuery'])) {
$news = new news();
$arrNews = $news->getNews("id=" . secure::escQuoteData($_POST['getNewsDetail']));
$newsComments = new newsComments();
$arrOrder = array('datetime' => 'DESC');
$arrComments = $newsComments->getRecords("id_news=" . secure::escQuoteData($_POST['getNewsDetail']) . " AND token='active'", $arrOrder, false, false);
// адресная строка
$smarty->assignByRef('qString', $_POST['strQuery']);
$smarty->assignByRef('arrNews', $arrNews);
$smarty->assignByRef('arrComments', $arrComments);
$smarty->display('adm.manager.news.detail.tpl');
} elseif (!empty($_POST['getLogPaymentsFileDetail'])) {
if (file_exists('core/data/log/' . $_POST['getLogPaymentsFileDetail'])) {
echo ($fData = file_get_contents('core/data/log/' . $_POST['getLogPaymentsFileDetail'])) ? nl2br($fData) : ERROR_FILE_NOT_OPEN;
} else {
echo ERROR_FILE_NOT_FOUND;
}
} elseif (!empty($_POST['getLogPaymentsDetail'])) {
示例9: array
//Get unseen messages in Incoming folder
$smarty->assign("T_PERSONAL_MESSAGES", $personal_messages);
if (!EfrontUser::isOptionVisible('messages_student') && $_SESSION['s_type'] == "student") {
$personal_message_options = array(array('text' => _GOTOINBOX, 'image' => "16x16/go_into.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=messages"));
} else {
$personal_message_options = array(array('text' => _MESSAGES, 'image' => "16x16/add.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=messages&add=1&popup=1", 'onClick' => "eF_js_showDivPopup(event, '" . _NEWMESSAGE . "', 2)", 'target' => 'POPUP_FRAME'), array('text' => _GOTOINBOX, 'image' => "16x16/go_into.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=messages"));
}
$smarty->assign("T_PERSONAL_MESSAGES_OPTIONS", $personal_message_options);
$smarty->assign("T_PERSONAL_MESSAGES_LINK", basename($_SERVER['PHP_SELF']) . "?ctg=messages");
}
//News block (Common block)
if (EfrontUser::isOptionVisible('news')) {
$news = news::getNews(0, true);
if (!$_admin_) {
//Get lesson news as well
$lessonNews = news::getNews($currentLesson->lesson['id'], true);
if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) {
//this applies to branch urls
$currentBranch = new EfrontBranch($_SESSION['s_current_branch']);
$branchTreeUsers = array_keys($currentBranch->getBranchTreeUsers());
foreach ($lessonNews as $key => $value) {
if ($value['type'] != 'global' && !in_array($value['users_LOGIN'], $branchTreeUsers)) {
unset($lessonNews[$key]);
}
}
}
$news = array_merge($news, $lessonNews);
}
if (!$_student_ && (!isset($currentUser->coreAccess['news']) || $currentUser->coreAccess['news'] == 'change')) {
$newsOptions[] = array('text' => _ANNOUNCEMENTADD, 'image' => "16x16/add.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=news&add=1&popup=1", 'onClick' => "eF_js_showDivPopup(event, '" . _ANNOUNCEMENTADD . "', 2)", 'target' => 'POPUP_FRAME');
}
示例10: elseif
if (!$arrErrors) {
// присваеваем полученные данные объекту
$news->arrBindFields = $arrBindFields;
$news->arrNoBindFields = $arrNoBindFields;
// производим запись в таблицу БД
!$news->recNews() ? $arrErrors[] = db::$message_error ? db::$message_error : ERROR_MISMATCH_FIELDS : messages::messageChangeSaved(MESSAGE_NEWS_ADDED, false, CONF_ADMIN_FILE . '?m=manager&s=news');
} else {
$smarty->assign('retFields', $arrBindFields + $arrNoBindFields);
}
}
} elseif ($arrActions['edit']) {
if (!empty($_GET['id']) && ($id = validate::checkNaturalNumber($_GET['id']))) {
// инициируем "Наименование страницы" отображаемое в форме
$arrNamePage[] = array('name' => MENU_MANAGER_NEWS_EDIT, 'link' => false);
// проверяем существование новости
if ($arrNews = $news->getNews("token IN ('active','archived') AND id IN (" . secure::escQuoteData($id) . ")")) {
$smarty->assignByRef('retFields', $arrNews);
// передаем новость в шаблон
// сохраняем изменения
if (isset($_POST['save'])) {
// получаем из формы поля обязательные для заполнения
$arrBindFields = $_POST['arrBindFields'];
// получаем из формы поля не обязательные для заполнения
$arrNoBindFields = $_POST['arrNoBindFields'];
$arrNoBindFields['noComments'] = !empty($_POST['arrNoBindFields']['noComments']) ? 1 : 0;
// устанавливаем состояние новости
$arrBindFields['token'] = isset($arrBindFields['token']) ? 'active' : 'archived';
// устанавливаем дату новости
$arrBindFields['datetime'] = !$_POST['date'] ? terms::currentDateTime() : $_POST['date'] . ' ' . $_POST['time']['Time_Hour'] . ':' . $_POST['time']['Time_Minute'];
///////////////////////////////////////////////////////////////
// Проверка данных, полученных из формы
示例11: pages
ob_start();
include "config.inc.php";
include LANG_CONFIG;
//Inizializzazione strumenti necessari
include DB;
require_once CLASS_pages;
require_once CLASS_news;
$main = new pages($db_conn);
$news = new news($db_conn, 'news', $_SESSION['lang']['id']);
@(include LANG_PATH . $_SESSION['lang']['label'] . '/' . LANG_NEWS);
//inclusione dizionario news
//Informazioni pagina
$curr_page = "news";
$curr_page_id = 12;
$page = $main->getPage(TABLE_cms, $curr_page_id, $_SESSION['lang']['id']);
$list_news = $news->getNews();
?>
<?php
include TPL_HEADER;
?>
<section class="pageContent">
<?php
include_once TPL_TITLE;
?>
<div class="wrapperCatalog black">
<div class="container" style="min-height:250px">
<?php