/**
  * Load your component.
  * 
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $_CORELANG, $page, $objTemplate, $subMenuTitle;
     switch ($this->cx->getMode()) {
         case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
             $newsObj = new News(\Env::get('cx')->getPage()->getContent());
             \Env::get('cx')->getPage()->setContent($newsObj->getNewsPage());
             $newsObj->getPageTitle(\Env::get('cx')->getPage()->getTitle());
             // Set the meta page description to the teaser text if displaying news details
             $teaser = $newsObj->getTeaser();
             if ($teaser !== null) {
                 //news details, else getTeaser would return null
                 $page->setMetadesc(contrexx_raw2xhtml(contrexx_strip_tags(html_entity_decode($teaser, ENT_QUOTES, CONTREXX_CHARSET))));
             }
             if (substr($page->getCmd(), 0, 7) == 'details') {
                 \Env::get('cx')->getPage()->setTitle($newsObj->newsTitle);
                 \Env::get('cx')->getPage()->setContentTitle($newsObj->newsTitle);
                 \Env::get('cx')->getPage()->setMetaTitle($newsObj->newsTitle);
             }
             break;
         case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
             $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
             $objTemplate = $this->cx->getTemplate();
             \Permission::checkAccess(10, 'static');
             $subMenuTitle = $_CORELANG['TXT_NEWS_MANAGER'];
             $objNews = new NewsManager();
             $objNews->getPage();
             break;
         default:
             break;
     }
 }
示例#2
0
 public function search()
 {
     $input = Input::all();
     // dd($input);
     $inputNew = NewsManager::searchNews($input);
     return View::make('admin.news.index')->with(compact('inputNew', 'input'));
 }
 public function addNewsSubmitHandle()
 {
     $this->load->model('application_model');
     $this->load->model('indiacom_news_model');
     $this->load->database();
     $this->db->trans_begin();
     $appId = $this->application_model->getApplicationId("Indiacom Online System");
     $newsId = parent::addNewsSubmitHandle($appId);
     if (!isset($this->form_validation)) {
         $this->load->library('form_validation');
     }
     $this->form_validation->set_rules('event', "Event", 'required');
     if ($this->form_validation->run() && $newsId) {
         $newsDetails = array("news_id" => $newsId, "news_event_id" => $this->input->post('event'));
         if ($this->input->post('stickyDate') != '') {
             $newsDetails['news_sticky_date'] = $this->input->post('stickyDate');
         }
         $this->indiacom_news_model->addNews($newsDetails);
         $attachments = $_FILES['attachments'];
         $attachmentNames = $this->input->post('attachmentNames');
         if (!empty($attachmentNames) && ($paths = $this->uploadAttachments($newsId, $attachments)) == false) {
             $this->db->trans_rollback();
             return false;
         }
         foreach ($paths as $key => $path) {
             $attachmentDetails = array("attachment_name" => $attachmentNames[$key], "attachment_url" => $path);
             $this->indiacom_news_model->addAttachment($newsId, $attachmentDetails);
         }
         $this->db->trans_commit();
         return true;
     }
     $this->db->trans_rollback();
     return false;
 }
示例#4
0
 function showEdit()
 {
     $request = fvRequest::getInstance();
     if (!($ex = NewsManager::getInstance()->getByPk($request->getRequestParameter('id')))) {
         $ex = new News();
     }
     $this->__assign('ex', $ex);
     $this->__assign('metaManager', MetaManager::getInstance());
     $this->__assign("module", $this->moduleName);
     $this->__assign("weights", range(0, 999));
     return $this->__display('edit.tpl');
 }
示例#5
0
 function executeDelete()
 {
     $request = fvRequest::getInstance();
     $id = intval($request->getRequestParameter('id'));
     if (!($ex = NewsManager::getInstance()->getByPk($id))) {
         $this->setFlash("Ошибка при удаленни данных. Такой записи не существует", self::$FLASH_ERROR);
     } else {
         $ex->getMeta()->delete();
         $ex->delete();
         $this->setFlash("Данные удалены", self::$FLASH_SUCCESS);
     }
     fvResponce::getInstance()->setHeader('redirect', fvSite::$fvConfig->get('dir_web_root') . $request->getRequestParameter('module') . "/");
     if (fvRequest::getInstance()->isXmlHttpRequest()) {
         return self::$FV_AJAX_CALL;
     } else {
         return self::$FV_OK;
     }
 }
示例#6
0
文件: news.php 项目: ilivanoff/www
 protected function processRequest(ArrayAdapter $params)
 {
     $newsLine = NewsManager::getInstance()->getNewsLine();
     return new IdentPageFilling(array('line' => $newsLine), array('states' => $newsLine['states']));
 }
示例#7
0
<?php

if (!defined('MCR')) {
    exit;
}
if (empty($user) or !$user->getPermission('add_news')) {
    header("Location: " . BASE_URL);
    exit;
}
loadTool('upload.class.php');
loadTool('catalog.class.php');
$page = 'Добавить новость';
LoadTinyMCE();
$news_manager = new NewsManager(null, 'news/');
$files_manager = new FileManager('other/');
$menu->SetItemActive('add_news');
$content_main = $news_manager->ShowNewsEditor();
// TODO вывод последних добавленых файлов $files_manager->ShowFilesByUser($list = 1, $user_id = false);
$content_main .= $files_manager->ShowAddForm();
示例#8
0
 public function __construct(NewsModule $module)
 {
     parent::__construct($module);
     NewsManager::$instance = $this;
 }
示例#9
0
文件: news.php 项目: tareqy/Caracal
 /**
  * Public function that creates a single instance
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
示例#10
0
                            $tab_retour_netx = NewsManager::insertNewsTextesBDD($obj_news);
                        }
                    }
                    switch ($tab_retour_news[0]) {
                        case 0:
                            //Succès de la mise à jour
                            setFlashData('message', "Enregistrement effectué de l'élément <a style='color:blue' href=#{$id}>{$id}</a>");
                            break;
                        default:
                            //Problème de mise à jour
                            setFlashData('message', $tab_retour_news[1]);
                            break;
                    }
                    redirectBacko(10);
                } else {
                    if ($http_request['act'] == 'updateValideListe') {
                        $id = isset($http_request['id']) && $http_request['id'] != '' ? $http_request['id'] : null;
                        $obj_news = new News($id);
                        if (isset($http_request['valideNews']) && $http_request['valideNews'] == "on") {
                            $obj_news->setValide(1);
                        } else {
                            $obj_news->setValide(0);
                        }
                        echo $id;
                        NewsManager::updateNewsBDD($obj_news);
                    }
                }
            }
        }
    }
}
示例#11
0
<?php

$news = NewsManager::LastNews();
include __DIR__ . "/../view/pubs.php";
include __DIR__ . "/../view/news.php";
}
// La class NewsManager
class NewsManager2
{
    protected $dao;
    // On souhaite un objet instanciant une classe qui implémente iDB.
    public function __construct(iDB $dao)
    {
        $this->dao = $dao;
    }
    public function get($id)
    {
        $q = $this->dao->query('SELECT id, auteur, titre, contenu FROM news WHERE id = ' . (int) $id);
        // On vérifie que le résultat implémente bien iResult.
        if (!$q instanceof iResult) {
            throw new Exception('Le résultat d\'une requête doit être un objet implémentant iResult');
        }
        return $q->fetchAssoc();
    }
}
// Tester le code
$dao = new MyPDO('mysql:host=localhost;dbname=news', 'root', '');
// $dao = new MyMySQLi('localhost', 'root', '', 'news');
$manager = new NewsManager($dao);
print_r($manager->get(2));
?>
                </p>
            </section>
        </div>
    </body>
</html>
示例#13
0
 public static function getNewsForYear($year)
 {
     return NewsManager::getYears()[$year];
 }
示例#14
0
<?php

$db = new Mypdo();
$newsManager = new NewsManager($db);
$listeNews = $newsManager->listerNews();
?>
<!-- Page Header -->
<!-- Set your background image for this header on the line below. -->
<header class="intro-header" style="background-image: url('images/fondTemp.png')">
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <div class="site-heading">
                    <h1>Damien Vareille</h1>
                    <hr class="small">
                    <span class="subheading">Illusionniste & Mentaliste</span>
                </div>
            </div>
        </div>
    </div>
</header>
<?php 
if (!isset($_GET['news'])) {
    ?>
<!-- Main Content -->
<div class="container">
    <div class="row">
        <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">

          <?php 
    foreach ($listeNews as $news) {
示例#15
0
 protected function executeImpl(ArrayAdapter $params)
 {
     $states = $params->arr('states');
     $newsLine = NewsManager::getInstance()->getNewsLine($states);
     return new AjaxSuccess($newsLine);
 }
示例#16
0
文件: news.php 项目: qexyorg/webMCR-1
<?php

if (!defined('MCR')) {
    exit;
}
loadTool('catalog.class.php');
$category = Filter::input('cid', 'get', 'int');
if ($category) {
    $news_manager = new NewsManager($category, 'news/', 'index.php?cid=' . $category . '&');
} else {
    $news_manager = new NewsManager(-1, 'news/');
}
/* Default vars */
$page = lng('PAGE_NEWS');
/* Get \ Post options */
$curlist = Filter::input('l', 'get', 'int');
if ($curlist <= 0) {
    $curlist = 1;
}
$menu->SetItemActive('main');
$content_main .= $news_manager->ShowNewsListing($curlist);
$content_main .= $news_manager->ShowCategorySelect();
$news_manager->destroy();
unset($news_manager);
示例#17
0
文件: news.php 项目: qexyorg/webMCR-1
<?php

header('Content-Type: text/html;charset=UTF-8');
require '../system.php';
loadTool('user.class.php');
loadTool('monitoring.class.php');
loadTool('catalog.class.php');
DBinit('news');
$news = '';
$page_title = 'Новостная лента';
$news_manager = new NewsManager($config['game_news'], 'launcher/news/', $config['s_root'] . 'index.php?');
$curlist = Filter::input('l', 'get', 'int');
if ($curlist <= 0) {
    $curlist = 1;
}
$news = $news_manager->ShowNewsListing($curlist);
$servManager = new ServerManager('launcher/serverstate/');
$server_state_html = $servManager->Show('game');
unset($servManager);
include View::Get('index.html', 'launcher/');