Files
aktualia.com.pl/_rejestracja/Admin/controller/IndexController.php
2026-04-24 15:32:21 +02:00

121 lines
3.5 KiB
PHP

<?php
/**
* $Id: IndexController.php 423 2008-05-30 14:42:41Z dakl $
* Strona glowna
*
*/
class IndexController extends MainController implements ControllerInterface {
/**
* strona glowna
*
*/
public function IndexAction($param) {
$kat = '../temp/compile';
$katalog = opendir($kat);
while ($plik = readdir($katalog)) {
if ($plik != '.' AND $plik != '..') {
unlink($kat . '/' . $plik);
}
}
//$this->AddRedirect(URL_MAIN . '/Structure/', 0);
$this->AddRedirect(URL_MAIN . '/Calc/Reg', 0);
}
public function ParserXmlAction($param) {
//ini_set($varname, $newvalue)
$xml = simplexml_load_file(PATH_STATIC_CONTENT . "/wanda.xml");
//$arrayXml = XML2Array::createArray($xml->channel);
$k = 0;
foreach ($xml->channel->item as $key => $entry) {
//Utils::ArrayDisplay($entry);
$htmlString[$k]['content'] = (string) $entry->children('content', true)->encoded;
$htmlString[$k]['title'] = (string) $entry->title;
$date = $entry->pubDate;
$htmlString[$k]['pubDate'] = (string) $entry->children('wp', true)->post_date;
$htmlString[$k]['autor'] = (string) $entry->children('dc', true)->creator;
$content = (string) $entry->children('content', true)->encoded;
$arrayContent = explode("<!--more-->", $content);
Utils::ArrayDisplay($arrayContent);
$htmlString[$k]['shortnote'] = nl2br($arrayContent[0]);
if (isset($arrayContent[1])) {
$htmlString[$k]['content'] = nl2br($arrayContent[1]);
} else {
$htmlString[$k]['content'] = "";
}
//Utils::ArrayDisplay((string)$entry->children('wp', true)->post_date);
$objArticle = SimpleArticle_MfArticleDAL::GetEmptyObj();
$objArticleDescription = $objArticle->GetDescriptionObj();
$objArticle->SetDate(date('Y-m-d'));
$objArticle->SetDatePublication((string) $entry->children('wp', true)->post_date);
$objArticle->SetDateShown(Utils::GetNowDate());
$objArticle->SetWeight(0);
$objArticle->SetPublication(1);
$objArticle->SetType(2);
$objArticle->SetDateUpdate(Utils::GetNowDate());
$objArticle->SetAddDate(Utils::GetNowDate());
$objArticle->SetEditDate(Utils::GetNowDate());
$objArticle->SetIdStructure(1);
$objArticle->SetIdCategory(0);
$objArticleDescription->SetLang('pl');
$objArticleDescription->SetDescription($htmlString[$k]['content']);
$objArticleDescription->SetShortnote($htmlString[$k]['shortnote']);
$objArticleDescription->SetTitle((string) $entry->title);
$objArticleDescription->SetBrowserTitle((string) $entry->title);
$objArticleDescription->SetPublication(1);
$objArticleDescription->SetAutor($htmlString[$k]['autor']);
// $iid = SimpleArticle_MfArticleDAL::Save($objArticle);
// $objArticleDescription->SetIdMfArticle($iid);
//
//
// $objLink = new MfLink('-1');
// $objLink->SetSourceType('mf_article');
// $objLink->SetIdSource($iid);
// $objLink->SetDestinationType('mf_article_category');
// $objLink->SetIdDestination(2);
// $objLink->SetLinkType(1);
// MfLinkDAL::Save($objLink);
//
// SimpleArticle_MfArticleDescriptionDAL::Save($objArticleDescription);
//
//
//echo $entry;
$k++;
}
Utils::ArrayDisplay($htmlString);
}
/**
* Metoda wspolna
*
*/
public function preDispatch($param) {
$this->smarty->assign('titleAdmin', 'Panel Administracyjny');
// $this->RunShared('Auth');
// $this->RunShared('Auth', array());
// $this->smarty->assign("menuSelected", "");
// $this->smarty->assign('activeTab', 'index');
// $this->AddScript("formAction.js");
// $this->Run($param);
}
/**
*
*
*/
public function postDispatch($param) {
}
}
?>