public function put($d = array()) { $res = new responseGmp(); $id = $this->_getIDFromReq($d); $d = prepareParamsGmp($d); if (is_numeric($id) && $id) { if (isset($d['active'])) { $d['active'] = is_string($d['active']) && $d['active'] == 'true' || $d['active'] == 1 ? 1 : 0; } //mmm.... govnokod?....))) /* else $d['active'] = 0;*/ if (frameGmp::_()->getTable('modules')->update($d, array('id' => $id))) { $res->messages[] = langGmp::_('Module Updated'); $mod = frameGmp::_()->getTable('modules')->getById($id); $newType = frameGmp::_()->getTable('modules_type')->getById($mod['type_id'], 'label'); $newType = $newType['label']; $res->data = array('id' => $id, 'label' => $mod['label'], 'code' => $mod['code'], 'type' => $newType, 'params' => utilsGmp::jsonEncode($mod['params']), 'description' => $mod['description'], 'active' => $mod['active']); } else { if ($tableErrors = frameGmp::_()->getTable('modules')->getErrors()) { $res->errors = array_merge($res->errors, $tableErrors); } else { $res->errors[] = langGmp::_('Module Update Failed'); } } } else { $res->errors[] = langGmp::_('Error module ID'); } parent::put($d); return $res; }
function prepareParamsGmp(&$d = array(), &$options = array()) { if (!empty($d['params'])) { if (isset($d['params']['options'])) { $options = $d['params']['options']; //unset($d['params']['options']); } if (is_array($d['params'])) { $params = utilsGmp::jsonEncode($d['params']); $params = str_replace(array('\\n\\r', "\n\r", '\\n', "\r", '\\r', "\r"), '<br />', $params); $params = str_replace(array('<br /><br />', '<br /><br /><br />'), '<br />', $params); $d['params'] = $params; } } elseif (isset($d['params'])) { $d['params']['attr']['class'] = ''; $d['params']['attr']['id'] = ''; $params = utilsGmp::jsonEncode($d['params']); $d['params'] = $params; } if (empty($options)) { $options = array('value' => array('EMPTY'), 'data' => array()); } if (isset($d['code'])) { if ($d['code'] == '') { $d['code'] = prepareFieldCodeGmp($d['label']) . '_' . rand(0, 9999999); } } return $d; }
public static function userFieldDestToDB($value) { return utilsGmp::jsonEncode($value); }
<script type='text/javascript'> var gmpExistsGroups = JSON.parse('<?php echo utilsGmp::jsonEncode($this->groupsList); ?> '); </script> <table class="gmpTable" id="GmpTableGroups"> <thead> <tr> <th><?php langGmp::_e("ID"); ?> </th> <th><?php langGmp::_e("Title"); ?> </th> <th> <?php langGmp::_e("Description"); ?> </th> <th class='thOperations'> <?php langGmp::_e("Operations"); ?> </th> </tr> </thead> <tbody> <?php
<script type="text/javascript"> // <!-- var toeTextEditorInst = null; //Here will be stored current text editor instance, see shortcodes/js/textEditroPlugin.js - ed var var toeShortCodesData = <?php echo utilsGmp::jsonEncode($this->shortcodes); ?> ; var toeShortCodeDataSelected = ''; var toeShortCodeCurrentMenuSelectedHtml = null; (function(){ jQuery('#toeInsertShortcodeSelectBox').accordion({ change: function(event, ui) { toeShortCodeCurrentMenuSelectedHtml = ui.newContent; var code = jQuery(ui.newHeader).find('a:first').attr('title'); jQuery('#toeInsertShortcodeSelectBox > div').css('height', ''); if(code) { toeShortcodeSelect(code, toeShortCodeCurrentMenuSelectedHtml); } else { toeShortcodeSelect(jQuery('#toeInsertShortcodeForm select[name=shortcodeType]').val(), toeShortCodeCurrentMenuSelectedHtml); } }, create: function(event, ui) { toeShortCodeCurrentMenuSelectedHtml = jQuery('#toeInsertShortcodeContentDefault'); } }); jQuery('#toeInsertShortcodeSelectBox > div').css('height', ''); jQuery('#toeInsertShortcodeForm').submit(function(){ if(jQuery(toeShortCodeCurrentMenuSelectedHtml).find('.toeInsertShortcodeAtts').find('input, select, textarea').size()) { var attsStr = ' '; var insertedAtts = 0; jQuery(toeShortCodeCurrentMenuSelectedHtml).find('.toeInsertShortcodeAtts').find('input, select, textarea').each(function(){
onclick='gmpEditMarkerItem(<?php echo $marker['id']?>); return false;'> <span class='gmpIcon gmpIconEdit '></span> <?php echo langGmp::_("Edit")?></a> <a class='btn btn-danger gmpRemoveBtn gmpListActBtn' id='<?php echo $marker['id']?>' onclick="gmpRemoveMarkerItem(<?php echo $marker['id']?>)"> <span class='gmpIcon gmpIconRemove '></span> <?php echo langGmp::_("Remove")?> </a> <span id="gmpMarkerListTableLoader_<?php echo $marker['id']?>"></span> </td> </tr> <?php } ?> </tbody><?php */ ?> </table> <script type="text/javascript"> // <!-- jQuery(document).ready(function(){ gmpMarkersTblColumns = <?php echo utilsGmp::jsonEncode($this->displayColumns); ?> ; }); // --> </script>
public function welcomePageSaveInfo($params) { $findOpts = frameGmp::_()->getModule('options')->getFindOptions(); $insert = array("code" => "find_us", "value" => $params["where_find_us"], "label" => $findOpts[$params["where_find_us"]]['label'], "params" => utilsGmp::jsonEncode(array("save_statistic" => (int) $params['statistic']))); switch ($params["where_find_us"]) { case "5": $insert['description'] = $params['other_way_desc']; break; case "4": $insert['description'] = $params['find_on_web_url']; break; } frameGmp::_()->getTable("options")->insert($insert); return true; }
public static function listToJson($array) { return str_replace("'", "\\'", str_replace('\\', '\\\\', utilsGmp::jsonEncode($array))); }
public static function statesInput($name, $params = array('value' => '', 'attrs' => '', 'notSelected' => true, 'id' => '', 'selectHtml' => '')) { if (empty($params['selectHtml']) || !method_exists(html, $params['selectHtml'])) { return false; } $params['notSelected'] = isset($params['notSelected']) ? $params['notSelected'] : true; $states = fieldAdapterGmp::getStates($params['notSelected']); foreach ($states as $sid => $s) { $params['options'][$sid] = $s['name']; } $idSelect = ''; $idText = ''; $id = ''; if (!empty($params['id'])) { $id = $params['id']; } else { $id = self::nameToClassId($name); } $paramsText = $paramsSelect = $params; $paramsText['attrs'] .= 'id = "' . $id . '_text"'; $paramsSelect['attrs'] .= 'id = "' . $id . '_select"'; $res = ''; $res .= self::$params['selectHtml']($name, $paramsSelect); $res .= self::text($name, $paramsText); if (empty($params['doNotAddJs'])) { $res .= '<script type="text/javascript"> // <!-- if(!toeStates.length) toeStates = ' . utilsGmp::jsonEncode($states) . '; toeStatesObjects["' . $id . '"] = new toeStatesSelect("' . $id . '"); // --> </script>'; } return $res; }
public function initJsVars() { $ajaxurl = admin_url('admin-ajax.php'); if (frameGmp::_()->getModule('options')->get('ssl_on_ajax')) { $ajaxurl = uriGmp::makeHttps($ajaxurl); } $jsData = array('siteUrl' => GMP_SITE_URL, 'imgPath' => GMP_IMG_PATH, 'loader' => GMP_LOADER_IMG, 'close' => GMP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameGmp::_()->getModule('options')->get('js_animation_speed'), 'GMP_CODE' => GMP_CODE); return '<script type="text/javascript"> // <!-- var GMP_DATA = ' . utilsGmp::jsonEncode($jsData) . '; // --> </script>'; }