コード例 #1
0
ファイル: ArticleCtrl.class.php プロジェクト: Jnnock/myyyk
 public function index()
 {
     //var_dump($_SESSION['qq']);
     $articleId = $_GET['articleId'];
     $article = new ArticleModel();
     $content = $article->getArticleById($articleId);
     $collect = new CollectModel();
     $comment = new CommentModel();
     $commentNum = $comment->getCommentCountByArticleId($articleId);
     $content['commentNum'] = $commentNum;
     if ($this->isLogin()) {
         if ($collect->getCollects($article, $_SESSION['qq']['userId'])) {
             $this->assign('collects', '已收藏');
         } else {
             $collectNum = $collect->getCollectCountByuserId($article);
             $this->assign('collectNum', $collectNum);
             $this->assign('collects', '收藏');
         }
     }
     $this->assign('article', $content);
     //评论查询
     $comments = $comment->getComment($articleId);
     $user = new UserModel();
     $arr = array();
     foreach ($comments as $key => $val) {
         $val[$key]['user'] = $user->getUserById($val['userId']);
     }
     $this->assign('comments', $comments);
     $this->display();
 }
コード例 #2
0
ファイル: ArticleController.php プロジェクト: kxopa/slimvc
 public function delete($id)
 {
     var_dump(__METHOD__);
     $config = $this->getConfig();
     $model = new ArticleModel($config);
     $ret = $model->delete($id);
     var_dump($ret);
 }
コード例 #3
0
 public function actionView($id)
 {
     $articleModel = new ArticleModel();
     $article = $articleModel->get($id);
     if ($article === false) {
         throw new Http404();
     }
     $templateEngine = new TemplateEngine();
     return $templateEngine->render('articles/view.html', $article);
 }
コード例 #4
0
ファイル: Banner.php プロジェクト: tanqinwang/test_own
 public function indexAction()
 {
     /*
             $tBMO = new BannerModel;
     		$tImgUrl = Yaf_Registry::get("config")->web->url->img;
             $tDatas = $tBMO->field('aid,concat(\''.$tImgUrl.'\',img) img')->order(' id asc ')->fList();
             Tool_Fnc::ajaxMsg('',1,$tDatas);
     */
     $tAMO = new ArticleModel();
     $tImgUrl = Yaf_Registry::get("config")->web->url->img;
     $tDatas = $tAMO->field('id aid,concat(\'' . $tImgUrl . '\',head_img) img')->where(' cate_id = 18')->order('id asc')->fList();
     Tool_Fnc::ajaxMsg('', 1, $tDatas);
 }
コード例 #5
0
 /**
  *  添加新的子菜单,但是要选择是 哪种类型(Article,Category,Section).
  *  从组件中找出存在的组建
  */
 function add()
 {
     //查找出子菜单,并且显示分配在左侧菜单中
     $menus = new MenuModel();
     $menu_list = $menus->select();
     $this->assign('menulist', $menu_list);
     //导入分页类
     import("ORG.Util.Page");
     //查询组件,相当于哪几种类型
     $component = new ComponentModel();
     $where = array('enabled' => 1);
     $list = $component->where($where)->select();
     $this->assign('comlist', $list);
     //得到类型
     $link = strtolower($_REQUEST['link']);
     //查询数据,如果默认为空,则显示文章列表
     if (empty($link) || $link == 'article') {
         $art = new ArticleModel();
         $count = $art->count();
         $page = new Page($count, C("PAGESIZE"));
         //完成分页
         $show = $page->show();
         //查询分页数据
         $list = $art->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
     } else {
         if ($link == 'category') {
             $cat = new CategoryModel();
             $count = $cat->count();
             $page = new Page($count, C("PAGESIZE"));
             //完成分页
             $show = $page->show();
             //查询分页数据
             $list = $cat->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
         } else {
             $sec = new SectionModel();
             $count = $sec->count();
             $page = new Page($count, C("PAGESIZE"));
             //完成分页
             $show = $page->show();
             //查询分页数据
             $list = $sec->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
         }
     }
     $this->assign('show', $show);
     $this->assign('list', $list);
     $this->assign('link', $link);
     $this->display();
 }
コード例 #6
0
 public function indexAction()
 {
     header('content-type: application/json');
     header('Access-Control-Allow-Origin: *');
     header('Access-Control-Allow-Methods: GET');
     echo json_encode(ArticleModel::showLastArticles($this->pdo));
 }
コード例 #7
0
 /**
  * Parse the template
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         // create new backend template
         $objTemplate = new \BackendTemplate('be_include');
         // get the article
         $objArticle = \ArticleModel::findByPk($this->articleAlias);
         if ($objArticle === null) {
             return parent::generate();
         }
         // get the parent pages
         $objPages = \PageModel::findParentsById($objArticle->pid);
         if ($objPages === null) {
             return parent::generate();
         }
         // get the page titles
         $arrPageTitles = array_reverse($objPages->fetchEach('title'));
         // set breadcrumb to original element
         $objTemplate->original = array('crumbs' => implode(' » ', $arrPageTitles), 'article' => array('title' => $objArticle->title, 'link' => 'contao/main.php?do=article&table=tl_content&id=' . $objArticle->id . '&rt=' . REQUEST_TOKEN));
         // get include breadcrumbs
         $includes = \IncludeInfoHelper::getIncludes('articleAlias', $this->articleAlias, $this->id);
         // set include breadcrumbs
         if (count($includes) > 1) {
             $objTemplate->includes = $includes;
         }
         // add CSS
         $GLOBALS['TL_CSS'][] = \IncludeInfoHelper::BACKEND_CSS;
         // return info + content
         return $objTemplate->parse() . parent::generate();
     }
     // return content only
     return parent::generate();
 }
 public function indexAction()
 {
     header('content-type: application/json');
     header('Access-Control-Allow-Origin: *');
     header('Access-Control-Allow-Methods: POST');
     $valid = true;
     $errors = [];
     $id = htmlentities($_POST['article']);
     $user = $_SESSION['auth']['username'];
     $comment = trim(htmlentities($_POST['comment']));
     $timestamp = time();
     if (!ArticleModel::exists($this->pdo, $id)) {
         $errors['article'] = '<span class="errors">Cet article n\'existe pas</span>';
         $valid = false;
     } elseif (!isset($comment) || empty($comment)) {
         $errors['comment'] = '<span class="errors">Non saisi</span>';
         $valid = false;
     } elseif (strlen($comment) > 200) {
         $errors['comment'] = '<span class="errors">200 caractères max</span>';
         $valid = false;
     }
     $errors['valid'] = $valid;
     if ($valid) {
         CommentModel::create($this->pdo, $id, $user, $comment, $timestamp);
     }
     echo json_encode($errors);
 }
 public function indexAction()
 {
     header('content-type: application/json');
     header('Access-Control-Allow-Origin: *');
     header('Access-Control-Allow-Methods: POST');
     $valid = true;
     $errors = [];
     if (ArticleModel::exists($this->pdo, htmlentities($_POST['id']))) {
         $id = htmlentities($_POST['id']);
     } else {
         return json_encode($errors['id'] = '<span class="errors">Cet article n\'existe pas</span>');
     }
     $title = trim(ucfirst(strtolower(htmlentities($_POST['title']))));
     $content = trim(htmlentities($_POST['content']));
     if (!isset($title) || empty($title)) {
         $errors['title'] = '<span class="errors">Non saisi</span>';
         $valid = false;
     } elseif (strlen($title) > 51) {
         $errors['title'] = '<span class="errors">Trop long</span>';
         $valid = false;
     }
     if (!isset($content) || empty($content)) {
         $errors['content'] = '<span class="errors">Non saisi</span>';
         $valid = false;
     }
     $errors['valid'] = $valid;
     if ($valid) {
         $errors['edit'] = ArticleModel::edit($this->pdo, $id, $title, $content, $_SESSION['auth']['username']);
     }
     echo json_encode($errors);
 }
コード例 #10
0
 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var \PageModel $objPage */
     global $objPage;
     if (!strlen($this->inColumn)) {
         $this->inColumn = 'main';
     }
     $intCount = 0;
     $articles = array();
     $id = $objPage->id;
     $this->Template->request = \Environment::get('request');
     // Show the articles of a different page
     if ($this->defineRoot && $this->rootPage > 0) {
         if (($objTarget = $this->objModel->getRelated('rootPage')) !== null) {
             $id = $objTarget->id;
             /** @var \PageModel $objTarget */
             $this->Template->request = $objTarget->getFrontendUrl();
         }
     }
     // Get published articles
     $objArticles = \ArticleModel::findPublishedByPidAndColumn($id, $this->inColumn);
     if ($objArticles === null) {
         return;
     }
     while ($objArticles->next()) {
         // Skip first article
         if (++$intCount <= intval($this->skipFirst)) {
             continue;
         }
         $cssID = deserialize($objArticles->cssID, true);
         $alias = $objArticles->alias ?: $objArticles->title;
         $articles[] = array('link' => $objArticles->title, 'title' => specialchars($objArticles->title), 'id' => $cssID[0] ?: standardize($alias), 'articleId' => $objArticles->id);
     }
     $this->Template->articles = $articles;
 }
コード例 #11
0
 public function checkLog($ptable, $tstamp, $item)
 {
     switch ($ptable) {
         case 'tl_article':
             $objArticle = \ArticleModel::findById($item['pid']);
             $objPage = \PageModel::findById($objArticle->pid);
             $item['page'] = $objPage->title;
             $item['showUrl'] = $this->generateFrontendUrl($objPage->row(), '');
             break;
         case 'tl_news':
             $objNews = \NewsModel::findById($item['pid']);
             $objArchive = \NewsArchiveModel::findById($objNews->pid);
             $objPage = \PageModel::findById($objArchive->jumpTo);
             $item['page'] = $objNews->headline;
             $item['showUrl'] = ampersand($this->generateFrontendUrl($objPage->row(), (\Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/' : '/items/') . (!\Config::get('disableAlias') && $objNews->alias != '' ? $objNews->alias : $objNews->id)));
             break;
         case 'tl_calendar':
             break;
         case 'tl_faq':
             $objFAQ = \FaqModel::findById($item['id']);
             $objCategory = \FaqCategoryModel::findById($item['pid']);
             $objPage = \PageModel::findById($objCategory->jumpTo);
             $item['htmlElement'] = '<div class="ce_faq"><h1>' . $objFAQ->question . '</h1>' . $objFAQ->answer . '</div>';
             $item['page'] = $objCategory->title;
             $item['title'] = $objFAQ->question;
             $item['showUrl'] = ampersand($this->generateFrontendUrl($objPage->row(), (\Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/' : '/items/') . (!\Config::get('disableAlias') && $objFAQ->alias != '' ? $objFAQ->alias : $objFAQ->id)));
             break;
     }
     return $item;
 }
コード例 #12
0
 protected function compile()
 {
     $objContentStart = \Database::getInstance()->prepare("SELECT * FROM tl_content WHERE pid=? AND type=? ORDER BY sorting")->limit(1)->execute($this->pid, 'formhybridStart');
     if ($objContentStart->numRows === 0) {
         return;
     }
     $objModule = \ModuleModel::findByPk($objContentStart->formhybridModule);
     if ($objModule === null) {
         return;
     }
     $objModule->refresh();
     $strClass = \Module::findClass($objModule->type);
     // Return if the class does not exist
     if (!class_exists($strClass)) {
         static::log('Module class "' . $strClass . '" (module "' . $objModule->type . '") does not exist', __METHOD__, TL_ERROR);
         return '';
     }
     $objArticle = \ArticleModel::findByPk($this->pid);
     if ($objArticle === null) {
         return;
     }
     global $objPage;
     $objModule = new $strClass($objModule, $objArticle->inColumn);
     $objModule->renderStop = true;
     $objModule->startModule = $_SESSION[FormSession::FORMHYBRID_FORMSESSION_START_KEY][$objPage->id . '_' . $objModule->formHybridDataContainer];
     $this->Template->content = $objModule->generate();
 }
コード例 #13
0
 /**
  * Do not display the module if there are no articles
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         /** @var \BackendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['articlenav'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = '' . $GLOBALS['TL_CONFIG']['backendPath'] . '/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     /** @var \PageModel $objPage */
     global $objPage;
     $this->objArticles = \ArticleModel::findPublishedWithTeaserByPidAndColumn($objPage->id, $this->strColumn);
     // Return if there are no articles
     if ($this->objArticles === null) {
         return '';
     }
     // Redirect to the first article if no article is selected
     if (!\Input::get('articles')) {
         if (!$this->loadFirst) {
             return '';
         }
         /** @var \ArticleModel $objArticle */
         $objArticle = $this->objArticles->current();
         $strAlias = $objArticle->alias != '' && !\Config::get('disableAlias') ? $objArticle->alias : $objArticle->id;
         $this->redirect($this->generateFrontendUrl($objPage->row(), '/articles/' . $strAlias));
     }
     return parent::generate();
 }
コード例 #14
0
ファイル: Article.php プロジェクト: nishantjr/JUgly
  static function save($request){
/*HACK ZONE*/
    self::$request = $request;
    self::textEntry("Title", "title");
    self::dropDown("Category", "category_id", "CategoryModel", "title", "id");
    self::dropDown("Section", "section_id", "SectionModel", "title", "id");
    self::dropDown("Location", "location_id", "LocationModel", "name", "id");
    self::textEntry("Summary", "summary");
    self::longEntry("Intro", "intro");
    self::longEntry("Rules", "rules");
    self::longEntry("Specification", "specification");
    self::textEntry("Domain", "domain");
    self::textEntry("Entry Fee", "entry_fee");
    self::textEntry("Max participants in a group", "participants");
    self::textEntry("1st Prize", "prize_first");
    self::textEntry("2nd Prize", "prize_second");
    self::textEntry("3rd Prize", "prize_third");
    self::textEntry("Prize Info", "prize_info");
    self::textEntry("Co-ordinator", "coordinator");
    self::textEntry("Event Head", "event_head");
    self::textEntry("Date", "date_elim");
    self::textEntry("Date", "date_final");
    self::textEntry("Image 1", "image_1");
    self::textEntry("Image 2", "image_2");
    self::textEntry("Image 3", "image_3");

    $set = join(", ", self::$set);
    $sql = "UPDATE articles SET $set WHERE id='".$request["article"]."'";
    $result = BaseModel::$database->query($sql);
    return;
  }/*HACK ZONE*/
コード例 #15
0
ファイル: ModuleArticlenav.php プロジェクト: rburch/core
 /**
  * Do not display the module if there are no articles
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ARTICLE NAVIGATION ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     global $objPage;
     $this->objArticles = \ArticleModel::findPublishedWithTeaserByPidAndColumn($objPage->id, $this->strColumn);
     // Return if there are no articles
     if ($this->objArticles === null) {
         return '';
     }
     // Redirect to the first article if no article is selected
     if (!\Input::get('articles')) {
         if (!$this->loadFirst) {
             return '';
         }
         $strAlias = $this->objArticles->alias != '' && !$GLOBALS['TL_CONFIG']['disableAlias'] ? $this->objArticles->alias : $this->objArticles->id;
         $this->redirect($this->addToUrl('articles=' . $strAlias));
     }
     return parent::generate();
 }
コード例 #16
0
ファイル: UserCtrl.class.php プロジェクト: Jnnock/myyyk
 public function index()
 {
     //header('content-type:text/html;charset=utf-8');
     $userId = $_SESSION['qq']['userId'];
     $collect = new CollectModel();
     //查询收藏
     $user_collect = $collect->getCollectByuserId($userId);
     $article = new ArticleModel();
     $arr = array();
     foreach ($user_collect as $v) {
         //根据收藏的文章id查询文章
         $a = $article->getArticleById($v['articleId']);
         //取出admin的昵称
         $a['adminName'] = $this->getAdmin($a['adminId']);
         $arr[] = $a;
     }
     $comment = new CommentModel();
     $commentAlbum = $comment->getCommentByAlbum($userId);
     $album = new AlbumModel();
     $articles = array();
     $albums = array();
     foreach ($commentAlbum as $v) {
         if ($v['albumId'] != null) {
             $c = $album->getAlbumById($v['albumId']);
             $c['adminName'] = $this->getAdmin($v['adminId']);
             $albums[] = $c;
         }
     }
     $commentArticle = $comment->getCommentByArticle($userId);
     foreach ($commentArticle as $v) {
         if ($v['articleId'] != null) {
             $a = $article->getArticleById($v['articleId']);
             $a['adminName'] = $this->getAdmin($v['adminId']);
             $articles[] = $a;
         }
     }
     var_dump($albums);
     $this->assign('user', $_SESSION['qq']['userName']);
     //评论过的相册
     $this->assign('albums', $albums);
     //评论过的文章
     $this->assign('articles', $articles);
     //收藏
     $this->assign('user_collect', $arr);
     $this->display();
 }
コード例 #17
0
ファイル: Article.php プロジェクト: tanqinwang/test_own
 public function detailAction()
 {
     $p = $_REQUEST;
     $pAid = empty($p['aid']) ? 0 : intval($p['aid']);
     if (empty($pAid)) {
         echo 'error aid';
         exit;
     }
     $tMO = new ArticleModel();
     $tImgUrl = Yaf_Registry::get("config")->web->url->img;
     $tRow = $tMO->field('id aid, concat(\'' . $tImgUrl . '\', head_img)  head_img,content,(view+initview) viewtotal,title,description,created,source')->where(' id = ' . $pAid)->fRow();
     if (empty($tRow['aid'])) {
         die('该文章不存在');
     }
     $tData = array('id' => $pAid, 'view' => $tRow['viewtotal'] + 1);
     $tMO->update($tData);
     $this->assign('tRow', $tRow);
 }
コード例 #18
0
 public function detail()
 {
     $aid = ggp('aid:i');
     $detail = ArticleModel::I()->find($aid);
     $sort = D('Sort')->find($detail['sort_id']);
     $this->a('$sort', $sort);
     $this->a('$detail', $detail);
     $this->d();
 }
コード例 #19
0
ファイル: Article.php プロジェクト: ruansheng/RsBlog
 /**
  * 发布
  * @return bool
  */
 public function publishAction()
 {
     if (!$this->getRequest()->isPost()) {
         $this->responseJson(401, '请求方式不正确');
     }
     //$username = $this->getRequest()->getParam('username','');
     //$password = $this->getRequest()->getParam('password','');
     $title = $_POST['title'];
     $content = $_POST['content'];
     if (empty($title) && empty($content)) {
         $this->responseJson(401, '文章title或内容不能为空');
     }
     $article = new ArticleModel();
     $ret = $article->addArticle($title, $content);
     if ($ret[0]) {
         $this->responseJson(200, $ret[1]);
     } else {
         $this->responseJson(401, $ret[1]);
     }
     return false;
 }
コード例 #20
0
 public function deleteAction()
 {
     if (!isset($_POST['id_article'])) {
         return json_encode(["error" => "article_id missing"]);
     }
     $article_id = $_POST['id_article'];
     $result = ArticleModel::getArticle($this->pdo, $article_id);
     if ($result['id_user'] != $_SESSION['id_user']) {
         return json_encode(['error' => 'utilisateur']);
     }
     ArticleModel::delete($this->pdo, $article_id);
     return json_encode(["message" => "delete", "article_id" => $article_id]);
 }
コード例 #21
0
 public function indexAction()
 {
     if (empty(explode('/', $_SERVER['REQUEST_URI'], 4)[2])) {
         header('Location : /');
         exit;
     } else {
         $article_id = explode('/', $_SERVER['REQUEST_URI'], 4)[2];
     }
     if (ArticleModel::exists($this->pdo, $article_id)) {
         include '../app/views/article.php';
         return;
     }
 }
コード例 #22
0
ファイル: Article.php プロジェクト: tanqinwang/test_own
 public function indexAction()
 {
     $tTime = time();
     $tMO = new ArticleModel();
     $tDatas = $tMO->field('title,id,description')->where('is_tui = 0 and status = 1 and push_time <= ' . $tTime)->fList();
     print_R($tDatas);
     if (!count($tDatas)) {
         exit;
     }
     $tGMO = new GetuiModel();
     $tGDatas = $tGMO->field('devicetoken,cid')->fList();
     $tRedis = Cache_Redis::instance();
     foreach ($tDatas as $tRow) {
         foreach ($tGDatas as $tR) {
             $tRes = serialize(array_merge($tRow, $tR, array('type' => 'article', 'content' => '')));
             $tRedis->lpush('dakang_getui', $tRes);
         }
         $tData = array('is_tui' => 1, 'id' => $tRow['id']);
         $tMO->update($tData);
     }
     exit;
 }
コード例 #23
0
ファイル: ContentTeaser.php プロジェクト: rikaix/core
 /**
  * Check whether the target page and article are published
  * @return string
  */
 public function generate()
 {
     $objArticle = \ArticleModel::findPublishedById($this->article);
     if ($objArticle === null) {
         return '';
     }
     $objPage = $objArticle->getPage();
     if ($objPage === null) {
         return '';
     }
     $objArticle->pid = $objPage;
     $this->objArticle = $objArticle;
     return parent::generate();
 }
コード例 #24
0
 public function __call($n, $v)
 {
     $param = str_replace('action', '', $n);
     $param = str_replace('.html', '', $param);
     $article = new ArticleModel();
     $article->sql_params = array('name' => 'alias', 'value' => $param);
     $item = $article->findAllParams()[1];
     if (empty($item)) {
         die('Данный материал не доступен!');
     } else {
         // Получаем данные для корзины
         $basket_ob = new BasketModel();
         $basket = $basket_ob->getBasket();
         $labelprod = new ProductLabelModel();
         $slabel_items = $labelprod->getLabelProducts(2, 6);
         // Создаем шаблон и передаем ему нужные переменные
         $left_content = $this->template('/main/tpl_left.php', array('categories' => $this->catmenu->showMenu()));
         $sales_module = $this->template('/main/tpl_new_sales.php', array('stitle' => 'Акции', 'sitems' => $slabel_items));
         $right_content = $this->template('/main/tpl_article.php', array('article' => $item[0], 'sales_module' => $sales_module));
         $tmp = $this->template('/main/tpl_main.php', array('title' => 'Онлайн-аптека в Англии с доставкой', 'top_menu' => $this->top_menu, 'basket' => array('quantity' => $basket[0], 'price' => $basket[1]), 'left_content' => $left_content, 'right_content' => $right_content, 'fmenu' => $this->footer_menu));
         echo $tmp;
     }
 }
コード例 #25
0
 /**
  * 首页,调用3个frame页面
  */
 function index()
 {
     //得到最新的7篇文章
     $arts = new ArticleModel();
     $list_arts_data = $arts->limit('7')->order('id desc')->select();
     //动态缓存最新文章
     if (!S('art_list')) {
         $art_list = $list_arts_data;
         S('art_list', $list_arts_data, 3600);
     } else {
         $art_list = S('art_list');
     }
     $this->assign('art_list', $art_list);
     //得到最新的5次登陆记录
     $logs = new LoginRecordModel();
     $list_logs_data = $logs->limit('7')->order('id desc')->select();
     //动态缓存登陆记录
     if (!S('log_list')) {
         $log_list = $list_logs_data;
         S('log_list', $list_logs_data, 3600);
     } else {
         $log_list = S('log_list');
     }
     $this->assign('log_list', $log_list);
     //得到最新的文章评论
     $comments = D('Comment');
     $list_com_data = $comments->limit('7')->order('id desc')->select();
     //动态缓存留言记录
     if (!S('com_list')) {
         $com_list = $list_com_data;
         S('com_list', $list_com_data, 3600);
     } else {
         $com_list = S('com_list');
     }
     $this->assign('com_list', $com_list);
     $this->display();
 }
コード例 #26
0
ファイル: NewsController.php プロジェクト: vera23/Articles
 protected function EditAction($id)
 {
     try {
         $editArt = ArticleModel::findByPk($id);
     } catch (Exception $e) {
         echo "Исключение: " . $e->getMessage();
         die;
     }
     $editArt->title = $_POST['title'];
     $editArt->content = $_POST['content'];
     $editArt->id = $_POST['id'];
     $editArt->save();
     $view = new View();
     $view->display('change.php');
 }
コード例 #27
0
ファイル: ContentTeaser.php プロジェクト: juergen83/contao
 /**
  * Check whether the target page and the article are published
  *
  * @return string
  */
 public function generate()
 {
     $objArticle = \ArticleModel::findPublishedById($this->article);
     if ($objArticle === null) {
         return '';
     }
     // Use findPublished() instead of getRelated()
     $objParent = \PageModel::findPublishedById($objArticle->pid);
     if ($objParent === null) {
         return '';
     }
     $this->objArticle = $objArticle;
     $this->objParent = $objParent;
     return parent::generate();
 }
コード例 #28
0
 public function getContentSliderCarousels(DataContainer $dc)
 {
     $arrOptions = array();
     $objSlider = \ContentModel::findBy('type', 'slick-content-start');
     if ($objSlider === null) {
         return $arrOptions;
     }
     while ($objSlider->next()) {
         $objArticle = \ArticleModel::findByPk($objSlider->pid);
         if ($objArticle === null) {
             continue;
         }
         $arrOptions[$objSlider->id] = sprintf($GLOBALS['TL_LANG']['tl_content']['contentSliderCarouselSelectOption'], $objArticle->title, $objArticle->id, $objSlider->id);
     }
     return $arrOptions;
 }
コード例 #29
0
 protected function compile()
 {
     $arrNavigation = array();
     $objArticle = \ArticleModel::findByPid($GLOBALS['objPage']->id);
     while ($objArticle->next()) {
         if ($objArticle->addNavigation && $objArticle->published) {
             if ($objArticle->navigation_title) {
                 $objArticle->title = $objArticle->navigation_title;
             }
             $arrNavigation[] = (object) $objArticle->row();
         }
     }
     $arrNavigation[0]->css = 'first active';
     $arrNavigation[count($arrNavigation) - 1]->css = 'last';
     $this->Template->navigation = $arrNavigation;
 }
コード例 #30
0
 public function createItem(CreateItemEvent $event)
 {
     $item = $event->getItem();
     if ($item->getType() == 'article') {
         $article = \ArticleModel::findByPk($item->getName());
         if ($article) {
             $page = \PageModel::findByPk($article->pid);
             if ($page) {
                 $cssID = deserialize($article->cssID, true);
                 $item->setUri(\Frontend::generateFrontendUrl($page->row()) . '#' . (empty($cssID[0]) ? $article->alias : $cssID[0]));
                 $item->setLabel($article->title);
                 $item->setExtras($article->row());
             }
         }
     }
 }