当前位置: 首页>>代码示例>>PHP>>正文


PHP Tools::atk_iconv方法代码示例

本文整理汇总了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);
 }
开发者ID:sintattica,项目名称:atk,代码行数:23,代码来源:EditFormModifier.php

示例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>';
 }
开发者ID:sintattica,项目名称:atk,代码行数:23,代码来源:Attribute.php


注:本文中的Sintattica\Atk\Core\Tools::atk_iconv方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。