/** * 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(); }
/** * Returns a simple date-form element. By default used to enter a date without a time. * * @param string $strName * @param string $strTitle * @param class_date $objDateToShow * @param string $strClass = inputDate * @param boolean $bitWithTime * * @throws class_exception * @return string * @since 3.2.0.9 */ public function formDateSingle($strName, $strTitle, $objDateToShow, $strClass = "", $bitWithTime = false) { //check passed param if ($objDateToShow != null && !$objDateToShow instanceof class_date) { throw new class_exception("param passed to class_toolkit_admin::formDateSingle is not an instance of class_date", class_exception::$level_ERROR); } if ($bitWithTime) { $strTemplateID = $this->objTemplate->readTemplate("/elements.tpl", "input_datetime_simple"); } else { $strTemplateID = $this->objTemplate->readTemplate("/elements.tpl", "input_date_simple"); } $arrTemplate = array(); $arrTemplate["class"] = $strClass; $arrTemplate["titleDay"] = $strName . "_day"; $arrTemplate["titleMonth"] = $strName . "_month"; $arrTemplate["titleYear"] = $strName . "_year"; $arrTemplate["titleHour"] = $strName . "_hour"; $arrTemplate["titleMin"] = $strName . "_minute"; $arrTemplate["title"] = $strTitle; $arrTemplate["valueDay"] = $objDateToShow != null ? $objDateToShow->getIntDay() : ""; $arrTemplate["valueMonth"] = $objDateToShow != null ? $objDateToShow->getIntMonth() : ""; $arrTemplate["valueYear"] = $objDateToShow != null ? $objDateToShow->getIntYear() : ""; $arrTemplate["valueHour"] = $objDateToShow != null ? $objDateToShow->getIntHour() : ""; $arrTemplate["valueMin"] = $objDateToShow != null ? $objDateToShow->getIntMin() : ""; $arrTemplate["valuePlain"] = dateToString($objDateToShow, false); // if($bitWithTime) $arrTemplate["dateFormat"] = class_carrier::getInstance()->getObjLang()->getLang("dateStyleShort", "system"); // else // $arrTemplate["dateFormat"] = class_carrier::getInstance()->getObjLang()->getLang("dateStyleLong", "system"); $arrTemplate["calendarLang"] = class_carrier::getInstance()->getObjSession()->getAdminLanguage(); $arrTemplate["titleTime"] = class_carrier::getInstance()->getObjLang()->getLang("titleTime", "system"); //set up the container div $arrTemplate["calendarId"] = $strName; $strContainerId = $strName . "_calendarContainer"; $arrTemplate["calendarContainerId"] = $strContainerId; $arrTemplate["calendarLang_weekday"] = " [" . class_carrier::getInstance()->getObjLang()->getLang("toolsetCalendarWeekday", "system") . "]\n"; $arrTemplate["calendarLang_month"] = " [" . class_carrier::getInstance()->getObjLang()->getLang("toolsetCalendarMonth", "system") . "]\n"; return $this->objTemplate->fillTemplate($arrTemplate, $strTemplateID); }
/** * 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; }