/**
  * Responsible for creating the xml-feed
  *
  * @param string $strTitle
  * @param string $strLink
  * @param string $strDesc
  * @param string $strPage
  * @param class_module_news_news[] $arrNews
  *
  * @return string
  */
 private function createNewsfeedXML($strTitle, $strLink, $strDesc, $strPage, $arrNews)
 {
     $objFeed = new class_rssfeed();
     $objFeed->setStrTitle($strTitle);
     $objFeed->setStrLink($strLink);
     $objFeed->setStrDesc($strDesc);
     foreach ($arrNews as $objOneNews) {
         if ($objOneNews->rightView()) {
             $objDate = $objOneNews->getObjStartDate();
             if ($objDate == null) {
                 $objDate = new class_date();
             }
             $objFeed->addElement($objOneNews->getStrTitle(), getLinkPortalHref($strPage, "", "newsDetail", "", $objOneNews->getSystemid(), "", $objOneNews->getStrTitle()), $objOneNews->getSystemid(), $objOneNews->getStrIntro(), mktime($objDate->getIntHour(), $objDate->getIntMin(), $objDate->getIntSec(), $objDate->getIntMonth(), $objDate->getIntDay(), $objDate->getIntYear()));
         }
     }
     return $objFeed->generateFeed();
 }
Ejemplo n.º 2
0
/**
 * Converts a dateobject to a readable string
 *
 * @param class_date $objDate
 * @param bool $bitLong
 * @param string $strFormat if given, the passed format will be used, otherwise the format defined in the i18n files
 *                          usable placeholders are: d, m, y, h, i, s
 *
 * @return string
 */
function dateToString($objDate, $bitLong = true, $strFormat = "")
{
    $strReturn = "";
    //if the $objDate is a string, convert it to date object
    if ($objDate != null && !$objDate instanceof class_date && uniEreg("([0-9]){14}", $objDate)) {
        $objDate = new class_date($objDate);
    }
    if ($objDate instanceof class_date) {
        //convert to a current date
        if ($strFormat == "") {
            if ($bitLong) {
                $strReturn = uniStrtolower(class_carrier::getInstance()->getObjLang()->getLang("dateStyleLong", "system"));
            } else {
                $strReturn = uniStrtolower(class_carrier::getInstance()->getObjLang()->getLang("dateStyleShort", "system"));
            }
        } else {
            $strReturn = $strFormat;
        }
        //"d.m.Y H:i:s";
        $strReturn = uniStrReplace("d", $objDate->getIntDay(), $strReturn);
        $strReturn = uniStrReplace("m", $objDate->getIntMonth(), $strReturn);
        $strReturn = uniStrReplace("y", $objDate->getIntYear(), $strReturn);
        $strReturn = uniStrReplace("h", $objDate->getIntHour(), $strReturn);
        $strReturn = uniStrReplace("i", $objDate->getIntMin(), $strReturn);
        $strReturn = uniStrReplace("s", $objDate->getIntSec(), $strReturn);
    }
    return $strReturn;
}