本文整理汇总了PHP中XoopsLists::getTimeZoneList方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsLists::getTimeZoneList方法的具体用法?PHP XoopsLists::getTimeZoneList怎么用?PHP XoopsLists::getTimeZoneList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsLists
的用法示例。
在下文中一共展示了XoopsLists::getTimeZoneList方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
$zonas = XoopsLists::getTimeZoneList();
if ($this->type) {
$rtn = "<table cellpadding='2' cellspacing='1' border='0'>";
foreach ($zonas as $k => $v) {
$rtn .= "<tr><td>";
if ($this->multi) {
if (!is_array($this->selected)) {
$this->selected = array($this->selected);
}
$rtn .= "<label><input type='checkbox' value='{$k}' name='" . $this->getName() . "[]' id='" . $this->getName() . "[]'" . (is_array($this->selected) ? in_array($k, $this->selected) ? " checked='checked'" : '' : '') . " /> {$v}</label>";
} else {
$rtn .= "<label><input type='radio' value='{$k}' name='" . $this->getName() . "' id='" . $this->getName() . "'" . ($k == $this->selected ? " checked='checked'" : '') . " /> {$v}</label>";
}
$rtn .= "</td></tr>";
$i++;
}
$rtn .= "</table>";
} else {
if ($this->multi) {
if (!is_array($this->selected)) {
$this->selected = array($this->selected);
}
$rtn = "<select name='" . $this->getName() . "[]' id='" . $this->getName() . "[]' size='{$this->size}' multiple='multiple'>";
foreach ($zonas as $k => $v) {
$rtn .= "<option value='{$k}'" . (is_array($this->selected) ? in_array($k, $this->selected) ? " selected='selected'" : '' : '') . ">{$v}</option>";
}
$rtn .= "</select>";
} else {
$rtn = "<select name='" . $this->getName() . "' id='" . $this->getName() . "'>";
foreach ($zonas as $k => $v) {
$rtn .= "<option value='{$k}'" . ($k == $this->selected ? " selected='selected'" : '') . ">{$v}</option>";
}
$rtn .= "</select>";
}
}
return $rtn;
}
示例2: XoopsFormSelect
case "yesno":
$element = new XoopsFormSelect($fields[$i]->getVar('field_title'), $fields[$i]->getVar('field_name'), null, 2, true);
$element->addOption(1, _YES);
$element->addOption(0, _NO);
$searchform->addElement($element);
unset($element);
break;
case "date":
case "datetime":
$searchform->addElement(new XoopsFormTextDateSelect(sprintf(_PROFILE_MA_LATERTHAN, $fields[$i]->getVar('field_title')), $fields[$i]->getVar('field_name') . "_larger", 15, 0));
$searchform->addElement(new XoopsFormTextDateSelect(sprintf(_PROFILE_MA_EARLIERTHAN, $fields[$i]->getVar('field_title')), $fields[$i]->getVar('field_name') . "_smaller", 15, time()));
break;
case "timezone":
$element = new XoopsFormSelect($fields[$i]->getVar('field_title'), $fields[$i]->getVar('field_name'), null, 6, true);
include_once $GLOBALS['xoops']->path('class/xoopslists.php');
$element->addOptionArray(XoopsLists::getTimeZoneList());
$searchform->addElement($element);
unset($element);
break;
case "language":
$element = new XoopsFormSelectLang($fields[$i]->getVar('field_title'), $fields[$i]->getVar('field_name'), null, 6);
$searchform->addElement($element);
unset($element);
break;
}
}
asort($sortby_arr);
$sortby_arr = array_merge(array("" => _NONE, "uname" => _US_NICKNAME, "email" => _US_EMAIL), $sortby_arr);
$sortby_select = new XoopsFormSelect(_PROFILE_MA_SORTBY, 'sortby');
$sortby_select->addOptionArray($sortby_arr);
$searchform->addElement($sortby_select);
示例3: XoopsFormSelectTimezone
/**
* Constructor
*
* @param string $caption
* @param string $name
* @param mixed $value Pre-selected value (or array of them).
* Legal values are "-12" to "12" with some ".5"s strewn in ;-)
* @param int $size Number of rows. "1" makes a drop-down-box.
*/
function XoopsFormSelectTimezone($caption, $name, $value = null, $size = 1)
{
$this->XoopsFormSelect($caption, $name, $value, $size);
$this->addOptionArray(XoopsLists::getTimeZoneList());
}
示例4: explode
$xoopsMailer->setToGroups($member_handler->getGroup($xoopsConfigUser['new_user_notify_group']));
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject(sprintf(_US_NEWUSERREGAT, $xoopsConfig['sitename']));
$xoopsMailer->setBody(sprintf(_US_HASJUSTREG, $allowed_requests['uname']));
$xoopsMailer->send();
}
include XOOPS_ROOT_PATH . '/footer.php';
exit;
}
//
// FORM STAGE
//
include XOOPS_ROOT_PATH . '/header.php';
$xoopsOption['template_main'] = 'minihaku_register.html';
$stop_reasons = explode('<br />', @$stop_reason);
if (empty($stop_reasons[sizeof($stop_reasons) - 1])) {
array_pop($stop_reasons);
}
$xoopsTpl->assign(array('stop_reason' => @$stop_reason, 'stop_reasons' => array_merge($stop_reasons, $stop_reason_extras), 'timezone_options' => XoopsLists::getTimeZoneList(), 'reg_disclaimer' => $xoopsConfigUser['reg_disclaimer'], 'xoops_config_user' => $xoopsConfigUser, 'xoops_config_general' => $xoopsConfig));
$xoopsTpl->assign($allowed_requests);
// extra field which has options
if (!empty($extra_fields)) {
foreach ($extra_fields as $key => $attribs) {
if (!empty($attribs['options'])) {
$xoopsTpl->assign($key . '_options', $attribs['options']);
}
}
}
include XOOPS_ROOT_PATH . '/footer.php';
exit;
示例5: getOutputValue
//.........这里部分代码省略.........
include_once $GLOBALS['xoops']->path('modules/profile/language/english/modinfo.php');
}
$value = in_array($this->getVar('field_name'), $this->getUserVars()) ? $user->getVar($this->getVar('field_name')) : $profile->getVar($this->getVar('field_name'));
switch ($this->getVar('field_type')) {
default:
case "textbox":
if ($this->getVar('field_name') == 'url' && $value != '') {
return '<a href="' . formatURL($value) . '" rel="external">' . $value . '</a>';
} else {
return $value;
}
break;
case "textarea":
case "dhtml":
case 'theme':
case "language":
case "list":
return $value;
break;
case "select":
case "radio":
$options = $this->getVar('field_options');
if (isset($options[$value])) {
$value = htmlspecialchars(defined($options[$value]) ? constant($options[$value]) : $options[$value]);
} else {
$value = "";
}
return $value;
break;
case "select_multi":
case "checkbox":
$options = $this->getVar('field_options');
$ret = array();
if (count($options) > 0) {
foreach (array_keys($options) as $key) {
if (in_array($key, $value)) {
$ret[$key] = htmlspecialchars(defined($options[$key]) ? constant($options[$key]) : $options[$key]);
}
}
}
return $ret;
break;
case "group":
$member_handler =& xoops_gethandler('member');
$options = $member_handler->getGroupList();
$ret = isset($options[$value]) ? $options[$value] : '';
return $ret;
break;
case "group_multi":
$member_handler =& xoops_gethandler('member');
$options = $member_handler->getGroupList();
$ret = array();
foreach (array_keys($options) as $key) {
if (in_array($key, $value)) {
$ret[$key] = htmlspecialchars($options[$key]);
}
}
return $ret;
break;
case "longdate":
//return YYYY/MM/DD format - not optimal as it is not using local date format, but how do we do that
//when we cannot convert it to a UNIX timestamp?
return str_replace("-", "/", $value);
case "date":
return formatTimestamp($value, 's');
break;
case "datetime":
if (!empty($value)) {
return formatTimestamp($value, 'm');
} else {
return $value = _PROFILE_MI_NEVER_LOGGED_IN;
}
break;
case "autotext":
$value = $user->getVar($this->getVar('field_name'), 'n');
//autotext can have HTML in it
$value = str_replace("{X_UID}", $user->getVar("uid"), $value);
$value = str_replace("{X_URL}", XOOPS_URL, $value);
$value = str_replace("{X_UNAME}", $user->getVar("uname"), $value);
return $value;
break;
case "rank":
$userrank = $user->rank();
$user_rankimage = "";
if (isset($userrank['image']) && $userrank['image'] != "") {
$user_rankimage = '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="' . $userrank['title'] . '" /><br />';
}
return $user_rankimage . $userrank['title'];
break;
case "yesno":
return $value ? _YES : _NO;
break;
case "timezone":
include_once $GLOBALS['xoops']->path('class/xoopslists.php');
$timezones = XoopsLists::getTimeZoneList();
$value = empty($value) ? "0" : strval($value);
return $timezones[str_replace('.0', '', $value)];
break;
}
}
示例6: get_user_info
function get_user_info($uid)
{
$textutil =& xoonips_getutility('text');
$u_handler =& xoonips_getormhandler('xoonips', 'xoops_users');
$xu_handler =& xoonips_getormhandler('xoonips', 'users');
$m_handler =& xoops_gethandler('member');
$p_handler =& xoonips_getormhandler('xoonips', 'positions');
if ($uid == 0) {
$u_obj =& $u_handler->create();
$xu_obj =& $xu_handler->create();
} else {
$u_obj =& $u_handler->get($uid);
$xu_obj =& $xu_handler->get($uid);
}
if (!is_object($u_obj) || !is_object($xu_obj)) {
return false;
}
$user['xoops'] = $u_obj->getVarArray('e');
$user['xoonips'] = $xu_obj->getVarArray('e');
// groups
$grouplist = $m_handler->getGroupList(new Criteria('groupid', XOOPS_GROUP_ANONYMOUS, '!='));
if ($uid == 0) {
$groups = array(XOOPS_GROUP_USERS);
} else {
$groups = $m_handler->getGroupsByUser($user['xoops']['uid']);
}
$user['groups'] = array();
foreach ($grouplist as $gid => $name) {
$user['groups'][] = array('gid' => $gid, 'name' => $textutil->html_special_chars($name), 'selected' => in_array($gid, $groups) ? 'selected="selected"' : '');
}
// position
$positionlist =& $p_handler->getPositionList('s');
$user['position'] = array();
$user['position'][] = array('posi_id' => 0, 'title' => '--------------', 'selected' => empty($user['xoonips']['posi']) ? 'selected="selected"' : '');
foreach ($positionlist as $posi_id => $vars) {
$user['position'][] = array('posi_id' => $posi_id, 'title' => $vars['posi_title'], 'selected' => $user['xoonips']['posi'] == $posi_id ? 'selected="selected"' : '');
}
// timezone
$timezones = XoopsLists::getTimeZoneList();
$user['timezone'] = array();
foreach ($timezones as $offset => $name) {
$user['timezone'][] = array('offset' => $offset, 'name' => $textutil->html_special_chars($name), 'selected' => $offset == $user['xoops']['timezone_offset'] ? 'selected="selected"' : '');
}
// umode - comment display mode
$user['umode'] = array();
$umodes = array('nest' => _NESTED, 'flat' => _FLAT, 'thread' => _THREADED);
foreach ($umodes as $key => $name) {
$user['umode'][] = array('umode' => $key, 'name' => $textutil->html_special_chars($name), 'selected' => $key == $user['xoops']['umode'] ? 'selected="selected"' : '');
}
// uorder - comment sort order
$user['uorder'] = array();
$uorders = array('0' => _OLDESTFIRST, '1' => _NEWESTFIRST);
foreach ($uorders as $key => $name) {
$user['uorder'][] = array('uorder' => $key, 'name' => $textutil->html_special_chars($name), 'selected' => $key == $user['xoops']['uorder'] ? 'selected="selected"' : '');
}
// rank
$ranklist = XoopsLists::getUserRankList();
if (count($ranklist) > 0) {
$user['rank'][] = array('rank' => 0, 'name' => '--------------', 'selected' => $user['xoops']['rank'] == 0 ? 'selected="selected"' : '');
foreach ($ranklist as $rank => $name) {
$user['rank'][] = array('rank' => $rank, 'name' => $textutil->html_special_chars($name), 'selected' => $user['xoops']['rank'] == $rank ? 'selected="selected"' : '');
}
} else {
$user['rank'][] = array('rank' => 0, 'name' => $textutil->html_special_chars(_AM_NSRID), 'selected' => 'selected="selected"');
}
// notify method
$user['notify_method'] = array();
$notify_methods = array(XOOPS_NOTIFICATION_METHOD_DISABLE => _NOT_METHOD_DISABLE, XOOPS_NOTIFICATION_METHOD_PM => _NOT_METHOD_PM, XOOPS_NOTIFICATION_METHOD_EMAIL => _NOT_METHOD_EMAIL);
foreach ($notify_methods as $key => $name) {
$user['notify_method'][] = array('notify_method' => $key, 'name' => $textutil->html_special_chars($name), 'selected' => $key == $user['xoops']['notify_method'] ? 'selected="selected"' : '');
}
// notify mode
$user['notify_mode'] = array();
$notify_modes = array(XOOPS_NOTIFICATION_MODE_SENDALWAYS => _NOT_MODE_SENDALWAYS, XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE => _NOT_MODE_SENDONCE, XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT => _NOT_MODE_SENDONCEPERLOGIN);
foreach ($notify_modes as $key => $name) {
$user['notify_mode'][] = array('notify_mode' => $key, 'name' => $textutil->html_special_chars($name), 'selected' => $key == $user['xoops']['notify_mode'] ? 'selected="selected"' : '');
}
// mailok
$user['user_mailok'] = array();
$user_mailoks = array(1 => _AM_XOONIPS_LABEL_YES, 0 => _AM_XOONIPS_LABEL_NO);
foreach ($user_mailoks as $key => $name) {
$user['user_mailok'][] = array('user_mailok' => $key, 'title' => $textutil->html_special_chars($name), 'checked' => $key == $user['xoops']['user_mailok'] ? 'checked="checked"' : '');
}
return $user;
}
示例7: __construct
/**
* Constructor
*
* @param string $caption caption
* @param string $name name
* @param mixed $value Pre-selected value (or array of them).
* Legal values are "-12" to "12" with some ".5"s strewn in ;-)
* @param integer $size Number of rows. "1" makes a drop-down-box.
*/
public function __construct($caption, $name, $value = null, $size = 1)
{
parent::__construct($caption, $name, $value, $size);
$this->addOptionArray(\XoopsLists::getTimeZoneList());
}
示例8: foreach
$displayId = $response->get4Show('displayId');
Openid_Utils::loadEncoder();
$xoopsOption['template_main'] = 'openid_new_user.html';
require XOOPS_ROOT_PATH . '/header.php';
$xoopsTpl->assign('displayId', $displayId);
if (strpos($displayId, 'http') === 0) {
$uname = Openid_Encoder::fromUtf8($response->get4Show('nickname'));
} else {
$uname = $displayId;
}
$xoopsTpl->assign('unam', $uname);
if ($xoopsModuleConfig['allow_register']) {
$xoopsTpl->assign('allow_register', true);
$xoopsTpl->assign('email', $response->get4Show('email'));
require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
$xoopsTpl->assign('timezones', XoopsLists::getTimeZoneList());
$timezone_offset = $xoopsConfig['default_TZ'];
$sreg_tz = $response->get('timezone');
if ($sreg_tz && function_exists('timezone_abbreviations_list')) {
$timezones = timezone_abbreviations_list();
foreach ($timezones as $timezone) {
foreach ($timezone as $tz) {
if ($tz['timezone_id'] == $sreg_tz) {
$timezone_offset = $tz['offset'] / 3600;
break;
}
}
}
}
$xoopsTpl->assign('timezone_offset', $timezone_offset);
if (!$member->validateUname($uname)) {
示例9: getOutputValue
//.........这里部分代码省略.........
{
$xoops = Xoops::getInstance();
$xoops->loadLanguage('modinfo', 'profile');
$value = in_array($this->getVar('field_name'), $this->getUserVars()) ? $user->getVar($this->getVar('field_name')) : $profile->getVar($this->getVar('field_name'));
switch ($this->getVar('field_type')) {
default:
case "textbox":
if ($this->getVar('field_name') == 'url' && $value != '') {
return '<a href="' . $xoops->formatURL($value) . '" rel="external">' . $value . '</a>';
} else {
return $value;
}
break;
case "textarea":
case "dhtml":
case 'theme':
case "language":
case "list":
return $value;
break;
case "select":
case "radio":
$options = $this->getVar('field_options');
if (isset($options[$value])) {
$value = htmlspecialchars(defined($options[$value]) ? constant($options[$value]) : $options[$value]);
} else {
$value = "";
}
return $value;
break;
case "select_multi":
case "checkbox":
$options = $this->getVar('field_options');
$ret = array();
if (count($options) > 0) {
foreach (array_keys($options) as $key) {
if (in_array($key, $value)) {
$ret[$key] = htmlspecialchars(defined($options[$key]) ? constant($options[$key]) : $options[$key]);
}
}
}
return $ret;
break;
case "group":
$member_handler = $xoops->getHandlerMember();
$options = $member_handler->getGroupList();
$ret = isset($options[$value]) ? $options[$value] : '';
return $ret;
break;
case "group_multi":
$member_handler = $xoops->getHandlerMember();
$options = $member_handler->getGroupList();
$ret = array();
foreach (array_keys($options) as $key) {
if (in_array($key, $value)) {
$ret[$key] = htmlspecialchars($options[$key]);
}
}
return $ret;
break;
case "longdate":
//return YYYY/MM/DD format - not optimal as it is not using local date format, but how do we do that
//when we cannot convert it to a UNIX timestamp?
return str_replace("-", "/", $value);
case "date":
return XoopsLocale::formatTimestamp($value, 's');
break;
case "datetime":
if (!empty($value)) {
return XoopsLocale::formatTimestamp($value, 'm');
} else {
return _PROFILE_MI_NEVER_LOGGED_IN;
}
break;
case "autotext":
$value = $user->getVar($this->getVar('field_name'), 'n');
//autotext can have HTML in it
$value = str_replace("{X_UID}", $user->getVar("uid"), $value);
$value = str_replace("{X_URL}", \XoopsBaseConfig::get('url'), $value);
$value = str_replace("{X_UNAME}", $user->getVar("uname"), $value);
return $value;
break;
case "rank":
$userrank = $user->rank();
$user_rankimage = "";
if (isset($userrank['image']) && $userrank['image'] != "") {
$user_rankimage = '<img src="' . $userrank['image'] . '" alt="' . $userrank['title'] . '" /><br />';
}
return $user_rankimage . $userrank['title'];
break;
case "yesno":
return $value ? XoopsLocale::YES : XoopsLocale::NO;
break;
case "timezone":
$timezones = XoopsLists::getTimeZoneList();
$value = empty($value) ? "0" : (string) $value;
return $timezones[str_replace('.0', '', $value)];
break;
}
}
示例10: foreach
$db =& Database::getInstance();
foreach (array_keys($extra_fields) as $field) {
$db->query("UPDATE " . $db->prefix("users") . " SET {$field}='" . addslashes(@$allowed_requests[$field]) . "' WHERE uid=" . $xoopsUser->getVar("uid"));
}
}
if (!$member_handler->insertUser($edituser)) {
include XOOPS_ROOT_PATH . '/header.php';
echo $edituser->getHtmlErrors();
include XOOPS_ROOT_PATH . '/footer.php';
} else {
redirect_header('userinfo.php?uid=' . $uid, 2, _US_PROFUPDATED);
}
exit;
}
}
if ($op == 'editprofile') {
include_once XOOPS_ROOT_PATH . '/header.php';
$xoopsOption['template_main'] = 'minihaku_edituser.html';
$xoopsTpl->assign(array('error_msg' => implode('<br />', $errors), 'stop_reasons' => $errors, 'timezone_options' => XoopsLists::getTimeZoneList(), 'umode_options' => $umode_options, 'uorder_options' => $uorder_options, 'notify_method_options' => $notify_method_options, 'notify_mode_options' => $notify_mode_options, 'yn_options' => array(1 => _YES, 0 => _NO), 'usercookie' => intval(!empty($_COOKIE[$xoopsConfig['usercookie']])), 'allow_chgmail' => $xoopsConfigUser['allow_chgmail']));
$xoopsTpl->assign($allowed_requests);
// extra field which has options
if (!empty($extra_fields)) {
foreach ($extra_fields as $key => $attribs) {
if (!empty($attribs['options'])) {
$xoopsTpl->assign($key . '_options', $attribs['options']);
}
}
}
include XOOPS_ROOT_PATH . '/footer.php';
exit;
}
示例11: date
<?php
/**
*
* @package Legacy
* @version $Id: install_siteInit.inc.php,v 1.3 2008/09/25 15:12:19 kilica Exp $
* @copyright Copyright 2005-2007 XOOPS Cube Project <http://xoopscube.sourceforge.net/>
* @license http://xoopscube.sourceforge.net/license/GPL_V2.txt GNU GENERAL PUBLIC LICENSE Version 2
*
*/
include_once '../mainfile.php';
include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
$current_timezone = date('O');
$current_timediff = floatval(substr($current_timezone, 0, 1) . (substr($current_timezone, 1, 2) + substr($current_timezone, 3, 2) / 60));
$wizard->assign('current_timediff', $current_timediff);
$wizard->assign('timediffs', XoopsLists::getTimeZoneList());
$wizard->render('install_siteInit.tpl.php');