本文整理汇总了PHP中Sintattica\Atk\Core\Tools::atk_iconv方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::atk_iconv方法的具体用法?PHP Tools::atk_iconv怎么用?PHP Tools::atk_iconv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sintattica\Atk\Core\Tools
的用法示例。
在下文中一共展示了Tools::atk_iconv方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refreshAttribute
/**
* Re-render / refresh the attribute with the given name.
*
* @param string $name attribute name
*/
public function refreshAttribute($name)
{
if ($this->isInitial()) {
return;
}
$offset = count($this->getNode()->getPage()->getLoadScripts());
$error = [];
$editArray = array('fields' => array());
$this->m_node->getAttribute($name)->addToEditArray($this->getMode(), $editArray, $this->getRecord(), $error, $this->getFieldPrefix());
$scriptCode = '';
foreach ($editArray['fields'] as $field) {
$element = str_replace('.', '_', $this->getNode()->atkNodeUri() . '_' . $field['id']);
$value = Json::encode(Tools::atk_iconv(Tools::atkGetCharset(), 'UTF-8', $field['html']));
// Json::encode excepts string in UTF-8
$scriptCode .= "if (\$('{$element}')) { \$('{$element}').update({$value}); } ";
}
$this->getNode()->getPage()->register_loadscript($scriptCode, $offset);
}
示例2: partial_refresh
/**
* Partial method to refresh the add/edit field for this attribute.
*
* @param string $mode add/edit mode
*
* @return string HTML the output needed to refresh the attribute.
*/
public function partial_refresh($mode)
{
$record = $this->m_ownerInstance->updateRecord();
$fieldprefix = $this->m_ownerInstance->m_postvars['atkfp'];
$arr = array('fields' => array());
$defaults =& $record;
$error = [];
$this->addToEditArray($mode, $arr, $defaults, $error, $fieldprefix);
$script = '';
foreach ($arr['fields'] as $field) {
//Json::encode expect string in in ASCII or UTF-8 format, so convert data to UTF-8
$value = Tools::atk_iconv(Tools::atkGetCharset(), 'UTF-8', $field['html']);
$script .= "\$('" . str_replace('.', '_', $this->m_ownerInstance->atkNodeUri() . '_' . $field['id']) . "').update(" . Json::encode($value) . ");\r\n";
}
return '<script type="text/javascript">' . $script . '</script>';
}