Exemplo n.º 1
0
 public function put($d = array())
 {
     $res = new responseBup();
     $id = $this->_getIDFromReq($d);
     $d = prepareParamsBup($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 (frameBup::_()->getTable('modules')->update($d, array('id' => $id))) {
             $res->messages[] = langBup::_('Module Updated');
             $mod = frameBup::_()->getTable('modules')->getById($id);
             $newType = frameBup::_()->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' => utilsBup::jsonEncode($mod['params']), 'description' => $mod['description'], 'active' => $mod['active']);
         } else {
             if ($tableErrors = frameBup::_()->getTable('modules')->getErrors()) {
                 $res->errors = array_merge($res->errors, $tableErrors);
             } else {
                 $res->errors[] = langBup::_('Module Update Failed');
             }
         }
     } else {
         $res->errors[] = langBup::_('Error module ID');
     }
     parent::put($d);
     return $res;
 }
Exemplo n.º 2
0
    public function initJsVars()
    {
        $ajaxurl = admin_url('admin-ajax.php');
        if (frameBup::_()->getModule('options')->get('ssl_on_ajax')) {
            $ajaxurl = uriBup::makeHttps($ajaxurl);
        }
        $jsData = array('siteUrl' => BUP_SITE_URL, 'imgPath' => BUP_IMG_PATH, 'loader' => BUP_LOADER_IMG, 'close' => BUP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameBup::_()->getModule('options')->get('js_animation_speed'), 'BUP_CODE' => BUP_CODE);
        return '<script type="text/javascript">
		// <!--
			var BUP_DATA = ' . utilsBup::jsonEncode($jsData) . ';
		// -->
		</script>';
    }
Exemplo n.º 3
0
 public static function userFieldDestToDB($value)
 {
     return utilsBup::jsonEncode($value);
 }
Exemplo n.º 4
0
<script type="text/javascript">
// <!--
jQuery(document).ready(function(){
	var toeGlobalMessages = <?php 
echo utilsBup::jsonEncode($this->messages);
?>
;
	var toeGlobalMessagesStr = '';
	if(toeGlobalMessages.adminAlerts) {
		for(var i in toeGlobalMessages.adminAlerts) {
			toeGlobalMessagesStr += '<div class="toeSystemAlert">'+ 
				'<i style="font-size: 12px;"><?php 
echo $this->forAdminOnly;
?>
</i><br class="toeClear" />'+ 
				toeGlobalMessages.adminAlerts[ i ]+ 
				'</div>';
		}
	}
	if(toeGlobalMessagesStr != '') {
		jQuery('body:first').prepend(toeGlobalMessagesStr);
	}
		
});
// -->
</script>
Exemplo n.º 5
0
 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 = fieldAdapterBup::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 = ' . utilsBup::jsonEncode($states) . ';
             toeStatesObjects["' . $id . '"] = new toeStatesSelect("' . $id . '");
             // -->
         </script>';
     }
     return $res;
 }