. # # -- END LICENSE BLOCK ------------------------------------ /** @Description Pizza aux lentilles widget timezone class */ class timezone { public $__timezone = array(); // array Post object properties public $__type = "timezone"; // string Define the content type public $__res = null; // ressource Database query ressource public $__row = array(); // array Database query result public $__index = 0; // integer Database query result public function __construct() { global $oQuery, $oWidget; $res = $oQuery->select("SHOW COLUMNS FROM ".DBPREFIX."widget_".$this->__type); $res = $oQuery->getData(); foreach ($res as $k => $v) $this->__timezone[$v['Field']] = ""; loadAjaxFunction(); } /** Methods that returns an array with the complete content properties. @return array Array with all the user information for each content */ public function loadTimezone() { global $oQuery, $oWidget; # execute query on database to retrieve the result $oQuery->setTable(DBPREFIX."widget_".$this->__type); $req = $oQuery->getSelect(array_keys($this->__timezone), null, null); $this->__res = $oQuery->__con->db_query($req); } public function getTimezone() { global $oQuery, $oSetting, $oLang; $timezone = null; $this->loadTimezone(); while ($this->__row = $oQuery->__con->db_fetch($this->__res)) { $this->__index++; $timezone .= "
  • ".$this->__row['timezone_title']."".strftime($oSetting->getSetting("pal_interface:date_pattern")." ".$oSetting->getSetting("pal_interface:time_pattern"), strtotime($this->getTimezoneTime()))."
  • "; } if(empty($timezone) === true) $timezone = "
  • ".$oLang->getTranslation("Il n'y a aucune donnée pour ce widget")."
  • "; # clean the database ressource $this->__res = null; # clean the data result once content print on screen $this->__row = array(); return $timezone; } private function getTimezoneTime() { $timezone = new DateTimeZone($this->__row['timezone']); $time = new DateTime("now", $timezone); date_timezone_set($time, $timezone); if($this->__row['timezone_pattern'] != "") return $time->format($this->__row['timezone_pattern']); else return $time->format("Y-m-d H:i:s"); } private function addTimezoneGui($zone) { global $oLang, $oSetting; return $addTimezoneGui = "
    ".$oLang->getTranslation("Ajouter une timezone")." __type."', 'timezone_caption');\">
    "; } public function adminWidget() { global $oQuery, $oSetting, $oLang, $oAdminEditor; $widgetCode = $this->addTimezoneGui("edit-widget"); $widgetCode .= "
    ".$oLang->getTranslation("Paramètres du widget ".$this->__type)." "; $this->loadTimezone(); # loop through the result and print on screen the content using the template while ($this->__row = $oQuery->__con->db_fetch($this->__res)) { $id = $this->__row['timezone_id']; $widgetCode .= ""; } $widgetCode .= "
    ".$oLang->getTranslation("Titre")." ".$oLang->getTranslation("Timezone")." ".$oLang->getTranslation("Format")."
    ".$this->timezoneGui($this->__row['timezone'], 'timezone', 'disabled', $id)."
    "; return $widgetCode; } /** Methods that returns the GUI component to define a content status. @param $statusId integer A content ID @return string The content status GUI component source code */ public function timezoneGui($timezoneId=null, $type, $status=null, $id) { global $oBlog, $oSetting, $oText, $oLang; $timezoneGui = null; $tz = $oText->getZones(); if(empty($timezoneId) === true) $timezoneId = $oSetting->getSetting("pal_interface:timezone"); if($status == "disabled") $timezoneGui = ""; $timezoneGui .= ""; return $timezoneGui; } } ?>