} 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');
$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;
/** * 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': $tracking_info = array("done_content" => "", "issued_certificate" => "", "comments" => "", "completed" => 0, "current_unit" => 0, "score" => 0); eF_updateTableData("users_to_lessons", $tracking_info, "lessons_ID = " . $this->lesson['id']); /* foreach ($this -> getUsers as $user => $foo) { $cacheKey = "user_lesson_status:lesson:".$this -> lesson['id']."user:"******"completed_tests", "tests_ID={$id}"); } $units = $this->getUnits(); if (sizeof($units) > 0) { eF_deleteTableData("scorm_data", "content_ID in (" . implode(",", $units) . ")"); } break; case 'scheduling': $this->lesson['from_timestamp'] = null; $this->lesson['to_timestamp'] = null; $this->persist(); break; case 'surveys': $surveys = eF_getTableDataFlat("surveys", "id", "lessons_ID=" . $this->lesson['id']); $surveys_list = implode(",", $surveys['id']); if (!empty($surveys_list)) { eF_deleteTableData("questions_to_surveys", "surveys_ID IN ({$surveys_list})"); eF_deleteTableData("survey_questions_done", "surveys_ID IN ({$surveys_list})"); eF_deleteTableData("users_to_surveys", "surveys_ID IN ({$surveys_list})"); eF_deleteTableData("users_to_done_surveys", "surveys_ID IN ({$surveys_list})"); eF_deleteTableData("surveys", "lessons_ID=" . $this->lesson['id']); } break; case 'events': eF_deleteTableData("events", "lessons_ID=" . $this->lesson['id']); break; case 'modules': $modules = eF_loadAllModules(); foreach ($modules as $module) { $module->onDeleteLesson($this->lesson['id']); } break; } EfrontCache::getInstance()->deleteCache(); } /* if (in_array('questions', $deleteEntities)) { //Delete lesson questions $result = eF_getTableData("questions", "id", "lessons_ID=".$this -> lesson['id']); foreach ($result as $value) { $questionIds[] = $value['id']; } if (sizeof($questionIds) > 0) { eF_deleteTableData("tests_to_questions", "questions_ID in (".implode(",", $questionIds).")"); } eF_deleteTableData("questions", "lessons_ID=".$this -> lesson['id']); } if (in_array('content', $deleteEntities)) { //Delete lesson units foreach ($content['id'] as $value) { $value = new EfrontUnit($value); $value -> delete(); } $result = eF_getTableDataFlat("content", "id", "lessons_ID=".$this -> lesson['id']); $list = implode(",", $result['id']); EfrontSearch :: removeText('content', $list, '', true); eF_deleteTableData("content", "lessons_ID=".$this -> lesson['id']); //Just make sure everything is deleted } if (in_array('surveys', $deleteEntities)) { $surveys = eF_getTableDataFlat("surveys", "id", "lessons_ID=".$this -> lesson['id']); $surveys_list = implode(",", $surveys['id']); eF_deleteTableData("questions_to_surveys", "surveys_ID IN ($surveys_list)"); eF_deleteTableData("survey_questions_done", "surveys_ID IN ($surveys_list)"); eF_deleteTableData("users_to_surveys", "surveys_ID IN ($surveys_list)"); eF_deleteTableData("users_to_done_surveys", "surveys_ID IN ($surveys_list)"); eF_deleteTableData("surveys", "lessons_ID=".$this -> lesson['id']); } if (in_array('tracking', $deleteEntities)) { $tracking_info = array("done_content" => "", "issued_certificate" => "", "comments" => "", "completed" => 0, "current_unit" => 0, "score" => 0); eF_updateTableData("users_to_lessons", $tracking_info, "lessons_ID = ".$this -> lesson['id']); } if (in_array('files', $deleteEntities)) { $filesystem = new FileSystemTree($this -> getDirectory()); foreach (new ArrayIterator($filesystem -> tree) as $key => $value) { $value -> delete(); } } in_array('conditions', $deleteEntities) ? eF_deleteTableData("lesson_conditions", "lessons_ID=".$this -> lesson['id']) : null; in_array('calendar', $deleteEntities) ? eF_deleteTableData("calendar", "lessons_ID=".$this -> lesson['id']) : null; in_array('periods', $deleteEntities) ? eF_deleteTableData("periods", "lessons_ID=".$this -> lesson['id']) : null; in_array('news', $deleteEntities) ? eF_deleteTableData("news", "lessons_ID=".$this -> lesson['id']) : null; in_array('glossary', $deleteEntities) ? eF_deleteTableData("glossary", "lessons_ID=".$this -> lesson['id']) : null; in_array('users', $deleteEntities) ? eF_deleteTableData("users_to_lessons", "lessons_ID=".$this -> lesson['id']." and user_type = 'student'") : null; in_array('comments', $deleteEntities) ? eF_deleteTableData("comments", "content_ID IN (".$content_list.")") : null; in_array('rules', $deleteEntities) ? eF_deleteTableData("rules", "content_ID IN (".$content_list.") or rule_content_ID IN (".$content_list.")") : null; $done_tests = eF_getTableDataFlat("done_tests", "id", "tests_ID IN ($content_list)"); sizeof($done_tests) > 0 ? eF_deleteTableData("done_questions", "done_tests_ID IN (".implode(",", $done_tests['id']).")") : null; eF_deleteTableData("done_tests", "tests_ID IN ($content_list)"); eF_deleteTableData("users_to_done_tests", "tests_ID IN ($content_list)"); eF_deleteTableData("logs", "action='test_begin' AND comments IN ($content_list)"); */ }
} $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]);
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)); }
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) { $eventObject = new EfrontEvent($value); $eventObject -> createMessage(); pr($eventObject); } break; */ case 'structure': if ($lesson) { $contentTree = new EfrontContentTree($lesson); $contentPath = $contentTree->toPathStrings(); foreach ($contentPath as $key => $value) { $data[] = array('title' => $value, 'link' => G_SERVERNAME . 'userpage.php?lessons_ID=' . $lesson . '&unit=' . $key, 'description' => $value); } } break; case 'forum': if ($mode == 'system') { $result = eF_getTableData("f_messages fm JOIN f_topics ft JOIN f_forums ff LEFT OUTER JOIN lessons l ON ff.lessons_ID = l.id", "ff.title as forum_name, fm.body, fm.title, fm.id, ft.id as topic_id, ft.title as topic_title, fm.users_LOGIN, fm.timestamp, l.name as lessons_name, lessons_id as show_lessons_id", "ft.f_forums_ID=ff.id AND fm.f_topics_ID=ft.id ", "fm.timestamp desc LIMIT 100"); } elseif ($mode == 'lesson') { if ($lesson) { $result = eF_getTableData("f_messages fm JOIN f_topics ft JOIN f_forums ff LEFT OUTER JOIN lessons l ON ff.lessons_ID = l.id", "ff.title as forum_name, fm.body, fm.title, fm.id, ft.id as topic_id, ft.title as topic_title, fm.users_LOGIN, fm.timestamp, l.name as lessons_name, lessons_id as show_lessons_id", "ft.f_forums_ID=ff.id AND fm.f_topics_ID=ft.id AND ff.lessons_ID = '" . $lesson . "'", "fm.timestamp desc LIMIT 100"); } else { $result = eF_getTableData("f_messages fm JOIN f_topics ft JOIN f_forums ff LEFT OUTER JOIN lessons l ON ff.lessons_ID = l.id", "ff.title as forum_name, fm.body, fm.title, fm.id, ft.id as topic_id, ft.title as topic_title, fm.users_LOGIN, fm.timestamp, l.name as lessons_name, lessons_id as show_lessons_id", "ft.f_forums_ID=ff.id AND fm.f_topics_ID=ft.id AND ff.lessons_ID != 0", "fm.timestamp desc LIMIT 100"); } } foreach ($result as $value) { $value['title'] = $value['forum_name'] . ' >> ' . $value['topic_title'] . ' >> ' . $value['title']; if ($mode == 'system' && $value['lessons_name'] || $mode == 'lesson' && !$lesson) { $value['title'] = $value['lessons_name'] . ': ' . $value['title']; } $data[] = array('title' => $value['title'], 'link' => G_SERVERNAME . 'userpage.php?ctg=forum&topic=' . $value['topic_id'], 'description' => $value['body']); } break; default: break; } return $data; }
} 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; } }
$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'])) {
//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'); }
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']; /////////////////////////////////////////////////////////////// // Проверка данных, полученных из формы
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