/** * @param string $sSkinXML * @param array $aData */ public function LoadFromXml($sSkinXML, $aData = null) { if (Is_null($aData)) { $aData = array(); } $oXml = @simplexml_load_string($sSkinXML); if (!$oXml) { $sXml = '<?xml version="1.0" encoding="UTF-8"?> <skin> <name><lang name="default">' . (isset($aData['id']) ? $aData['id'] : '') . '</lang></name>' . '</skin>'; $oXml = @simplexml_load_string($sXml); } // Обрабатываем данные манифеста $sLang = E::ModuleLang()->GetLang(); $this->_xlang($oXml, 'name', $sLang); $this->_xlang($oXml, 'author', $sLang); $this->_xlang($oXml, 'description', $sLang, true); //$oXml->homepage = E::ModuleText()->Parser((string)$oXml->homepage); $oXml->homepage = filter_var((string) $oXml->homepage, FILTER_SANITIZE_URL); if ($sId = (string) $oXml->id) { $aData['id'] = $sId; } $aData['property'] = $oXml; $this->setProps($aData); }
public function actiondetalle($codalmacen, $codcentro) { $palma = MiFactoria::cleanInput($codalmacen); $pcentro = MiFactoria::cleanInput($codcentro); $model = Almacenes::Model()->find("codalm=:vcodal AND codcen=:vcentro", array(":vcodal" => $palma, ":vcentro" => $pcentro)); if (Is_null($model)) { throw new CHttpException(500, 'No se ha encontrado el almacen indicado'); } $this->render('detalle', array('model' => $model)); }
function elapsed_time($tp, $time = null) { //English (default): $terms = array('now' => 'Now', 'min' => 'minutes ago', 'hour' => 'hours ago', 'day' => 'days ago', 'yday' => 'yesterday', 'yday2' => '2 days ago', 'week' => 'weeks ago', 'oneyear' => 'Last year'); $days = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'); //Hungary - Magyar: //$terms = array('now'=>'Most','min'=>'perce','hour'=>'órája','day'=>'napja','yday'=>'tegnap','yday2'=>'tegnapelőtt','week'=>'hete','oneyear'=>'Tavaly'); //$days = array('Hétfő','Kedd','Szerda','Csütörtök',' Péntek','Szombat','Vasárnap'); //Germany - Deutch: //$terms = array ('now'=>'Jetzt','min'=>'minuten','hour'=>'stunden','day'=>'tagen','yday'=>'gestern','yday2'=>'vorgestern','week'=>'Wochen','oneyear'=>'letztes Jahr'); //$Tage = array ('Montag','Dienstag','Mittwoch','Donnerstag','Freitag', 'Samstag', 'Sonntag'); $timeformat = 'H:i'; //24 hours format //$timeformat = 'h:i a'; //12 hours format $dateformat = 'm.d'; $fulldateformat = 'Y.m.d'; $time = Is_null($time) ? time() : $time; $time_diff = abs($time - $tp); $sec = $time_diff; $min = floor($time_diff / 60); $min2 = $min % 60; $hour = floor($time_diff / 60 / 60); $hour2 = $hour % 24; $days = floor($time_diff / 60 / 60 / 24); $days2 = $days % 7; $week = $week2 = floor($time_diff / 60 / 60 / 24 / 7); if ($week2 >= 4) { $now_year = date('Y'); $t_year = date('Y', $tp); $buff1 = $now_year - $t_year; if ($buff1 == 0) { return date($dateformat . " " . $timeformat, $tp); } elseif ($buff1 == 1) { return $terms['oneyear'] . ' ' . date($dateformat . " " . $timeformat, $tp); } else { return date($fulldateformat . " " . $timeformat, $tp); } } if ($days == 2) { return $terms['yday2'] . ', ' . date($timeformat, $tp); } if ($days == 1) { return $terms['yday'] . ', ' . date($timeformat, $tp); } if ($days == 1 and $days2 == 0) { return $terms['yday'] . ', ' . $hour2 . ' ' . $terms['hour']; } $elap = ''; if ($sec > 0) { $elap = $terms['now']; if ($min != 0) { $elap = $min2 . ' ' . $terms['min']; if ($hour != 0) { if ($hour2 < 2) { $elap = $hour2 . ' ' . $terms['hour'] . ' ' . $min2 . ' ' . $terms['min']; } else { $elap = $hour2 . ' ' . $terms['hour']; } if ($days != 0) { if ($days == $days2) { $days3 = $days2; } else { $days3 = $days2 + ($days - $days2); } if ($days3 > date("N") and $days3 < date("N") + 7) { $napja = date("N", $tp); $napja1 = $napja - 1; $elap = $days[$napja1] . ', ' . date($dateformat . " " . $timeformat, $tp); } else { $elap = $days3 . ' ' . $terms['day'] . ', ' . date($dateformat . " " . $timeformat, $tp); } if ($week != 0) { $elap = $week2 . ' ' . $terms['week'] . ', ' . date($dateformat . " " . $timeformat, $tp); } } } } } if ($elap == '') { return $terms['now']; } else { return $elap; } }