Source for file news.core.php
Documentation is available at news.core.php
* @author PHPShop Software
$this->objBase= $GLOBALS['SysValue']['base']['table_name8'];
$this->objPath= "/news/news_";
$this->action= array("nav"=> "ID","post"=> "news_plus","get"=> "news_del");
$this->dataArray= parent::getListInfoItem(array('*'),false,array('order'=> 'id DESC'));
if(!isset ($this->dataArray)) return $this->setError404();
foreach($this->dataArray as $row) {
$this->set('newsId',$row['id']);
$this->set('newsData',$row['date']);
$this->set('newsZag',$row['title']);
$this->set('newsKratko',$row['description']);
$this->title= "Новости - ". $this->PHPShopSystem->getValue("name");
* Пагинация в подробном описании
$curId = $this->PHPShopNav->getId();
$PHPShopOrm->Option['where'] = ' or ';
$PHPShopOrm->debug = $this->debug;
$PHPShopOrm->sql = 'select id from '. $this->objBase. ' where id='. $prevId. ' or id='. $nextId;
$row = $PHPShopOrm->select();
// Проверка на последнюю запись
if(count($row) == 1) $data[0] = $row;
if($data[0]['id'] == $prevId) $navigat= '<a href="./ID_'. $prevId. '.html" title="'. $this->getValue('lang.prev_page'). '">'.
$this->getValue('lang.prev_page'). '</a>';
if($data[1]['id'] == $nextId) $navigat.= ' | <a href="./ID_'. $nextId. '.html" title="'. $this->getValue('lang.next_page'). '">'.
$this->getValue('lang.next_page'). '</a>';
* Экшен выборки подробной информации при наличии переменной навигации ID
$row= parent::getFullInfoItem(array('*'),array('id'=> '='. $this->PHPShopNav->getId()));
$this->set('newsData',$row['date']);
$this->set('newsZag',$row['title']);
$this->set('newsKratko',$row['description']);
$this->set('newsPodrob',$row['content']);
$this->title= $row['title']. " - ". $this->PHPShopSystem->getValue("name");
* Экшен записи новости при получении $_POST[news_plus]
switch($_POST['status']) {
$this->title= "Новости - Подписка - ". $this->PHPShopSystem->getValue("name");
* @param string $mail почта
$PHPShopOrm->debug= $this->debug;
$num= $PHPShopOrm->select(array('id'),array('mail'=> "='$mail'"),false,array('limit'=> 1));
if(empty($num['id'])) return true;
$PHPShopOrm->debug= $this->debug;
$PHPShopOrm->insert(array('date'=> date("d-m-y"),'mail'=> $mail),$prefix= '');
$mes= "<FONT style=\"font-size:14px;color:red\">
<B>". $this->getValue('lang.good_news_message_1'). "</B></FONT><BR>". $this->getValue('lang.good_news_message_2');
$mes= "<FONT style=\"font-size:14px;color:red\">
<B>". $this->getValue('lang.bad_news_message_1'). "</B></FONT><BR>". $this->getValue('lang.good_news_message_2');
$mes= "<FONT style=\"font-size:14px;color:red\">
<B>". $this->getValue('lang.bad_news_message_3'). "</B></FONT><BR>". $this->getValue('lang.good_news_message_2');
$this->set('mesageText',$mes);
if(!$this->chek($mail)) {
$PHPShopOrm->debug= $this->debug;
$PHPShopOrm->delete(array('mail'=> "='$mail'"));
$mes= "<FONT style=\"font-size:14px;color:red\">
<B>". $this->getValue('lang.bad_news_message_2'). "</B></FONT><BR>". $this->getValue('lang.good_news_message_2');
$mes= "<FONT style=\"font-size:14px;color:red\">
<B>". $this->getValue('lang.bad_news_message_3'). "</B></FONT><BR>". $this->getValue('lang.good_news_message_2');
$this->set('mesageText',$mes);
* Экшен удаления подписчика при получении $_GET[news_del]
// Проверка на безопсность
$this->title= "Новости - Отписка - ". $this->PHPShopSystem->getValue("name");
|