Esempio n. 1
0
 function execute()
 {
     $m = $this->getMethod();
     $params = array();
     if (isset($_GET['params'])) {
         $params = array_values($_GET['params']);
     }
     if (!is_null($m)) {
         $toret = call_user_func_array(array(&$this->o, $m), $params);
         return KT_json($toret);
     }
 }
Esempio n. 2
0
 function editForId($pkvalue, $fieldvalue)
 {
     $pkvalue = KT_DynamicData($pkvalue, null, '');
     if (is_null($fieldvalue) || $fieldvalue == '') {
         if ($this->isEnabled) {
             $fieldvalue = $GLOBALS['Widgets.EditInPlace.default_options']['empty'];
         }
     }
     $content = '' . '<div class="editinplace" id="editinplace_' . $this->id . '_' . $pkvalue . '">' . $fieldvalue . '</div>';
     if ($this->isEnabled) {
         $content .= '<script  type="text/javascript">' . 'var editinplace_' . $this->id . '_' . $pkvalue . ' =' . ' new Widgets.EditInPlace("' . addslashes($this->id) . '", ' . '"' . addslashes($pkvalue) . '", ' . KT_json($this->options) . ');' . '</script>';
     }
     return $content;
 }
Esempio n. 3
0
    function renderForId($index, $currentRating)
    {
        $index = KT_DynamicData($index, null, '');
        $content = '';
        $this->currentRating = intval($currentRating);
        if ($this->currentRating == null) {
            $this->currentRating = 0;
        }
        for ($i = 0; $i < 5; $i++) {
            $content .= '<a href="#' . ($i + 1) . '" title="' . $this->options['titles'][$i] . '">' . '<img src="' . $this->relPath . 'includes/jaxon/widgets/rating/img/' . $this->getRateClass($i + 1, $index) . '.gif" style="border:0px;" alt="' . $this->options['titles'][$i] . '"/>' . '</a>';
        }
        $content = '
		<div class="rater" id="rating_' . $this->id . '_' . $index . '">' . $content . '</div><script  type="text/javascript">var rating_' . $this->id . '_' . $index . ' = new Widgets.Rating("' . addslashes($this->id) . '", "' . addslashes($index) . '", ' . KT_json($this->options) . ', "' . md5($this->id . $this->config['table'] . $this->config['primaryKey'] . $this->config['ratingField'] . $index) . '");</script>';
        return $content;
    }
Esempio n. 4
0
 function showMissingAjaxServiceParamsError($params)
 {
     $toret = array('error' => array('code' => 'ServiceError', 'message' => $params));
     die(KT_json($toret));
 }
Esempio n. 5
0
 function handleAjaxRequest()
 {
     if (isset($_GET['AjaxServiceCall'])) {
         $this->checkServiceCall();
         //get object / method from variables
         $object = $_GET['ServiceObject'];
         if ($object == '') {
             $object = null;
         }
         $method = $_GET['ServiceMethod'];
         $params = array();
         foreach ($_GET as $k => $v) {
             if (preg_match("/^params_\\d{1,2}\$/", $k)) {
                 array_push($params, KT_getRealValue("GET", $k));
             }
         }
         foreach ($_POST as $k => $v) {
             array_push($params, KT_getRealValue("POST", $k));
         }
         $params = array_values($params);
         $m = $this->findServiceCall($object, $method);
         if ($m['object']) {
             $toret = call_user_func_array(array(&$GLOBALS[$m['object']], $m['method']), $params);
         } else {
             $toret = call_user_func_array($m['method'], $params);
         }
         // do not cache AJAX Requests
         $seconds_expire = -86400;
         //one day ago
         KT_sendExpireHeader($seconds_expire);
         $isOpera = false;
         if (isset($_SERVER) && isset($_SERVER['HTTP_USER_AGENT'])) {
             if (stristr($_SERVER['HTTP_USER_AGENT'], 'opera/9.')) {
                 $isOpera = true;
             }
         }
         if (isset($_SERVER['HTTP_KT_CHARSET'])) {
             header('Content-Type: text/' . (!$isOpera ? 'jaxon' : 'plain') . '; charset=' . $_SERVER['HTTP_KT_CHARSET']);
         } else {
             header('Content-Type: text/' . (!$isOpera ? 'jaxon' : 'plain') . '');
         }
         echo KT_json($toret);
         die;
     }
 }
Esempio n. 6
0
    function renderEnd()
    {
        if (!$this->options['load_on_demand']) {
            chdir($this->prevDir);
        }
        $toret = '</div>
		</div>';
        unset($this->options['has_width']);
        unset($this->options['has_height']);
        unset($this->options['dimensions']);
        $toret .= '
			</div>
			<script  type="text/javascript">
            <!--
			var ' . $this->id . ' = new Widgets.Collapsible("' . $this->id . '", "' . $this->file_name . '", ' . KT_json($this->options) . ');
            //-->
			</script>
		';
        if (!$this->options['load_on_demand']) {
            $this->resetAjaxStubContext();
        }
        return $toret;
    }
Esempio n. 7
0
    function renderEnd()
    {
        chdir($this->prevDir);
        $toret = '</div>
				</div>';
        for ($i = $this->selected + 1; $i < count($this->tabs); $i++) {
            $toret .= '
				<div id="' . $this->id . 'tab' . $i . '-body" class="tabBody ' . $this->getContentSelectedClass($i) . '" ' . ($this->options['has_width'] || $this->options['has_height'] ? 'style="' . implode(';', array($this->w, $this->h)) . ';overflow: auto;"' : '') . '>
					<div class="tabContent"></div>
				</div>';
        }
        $toret .= '
			</div>
			<script  type="text/javascript">
            <!--
			var ' . $this->id . ' = new Widgets.Tabset("' . $this->id . '", [';
        $tmp = array();
        for ($i = 0; $i < count($this->tabs); $i++) {
            $tmp[] = '"' . $this->tabs[$i]['file'] . '"';
        }
        $toret .= implode(", ", $tmp);
        unset($this->options['has_width']);
        unset($this->options['has_height']);
        unset($this->options['dimensions']);
        $toret .= '], ' . KT_json($this->options) . ');
            //-->
			</script>	
		';
        $this->resetAjaxStubContext();
        return $toret;
    }
Esempio n. 8
0
            $panelObj->renderEnd();
            $content = ob_get_contents();
            ob_end_clean();
            $content_js = $ctrl->renderJsBindings(false);
            $contents .= $content . $content_js;
            $strlen_content = strlen($content);
            $strlen_content_js = strlen($content_js);
            $strlen_all = $strlen_content + $strlen_content_js;
            $strlens[$panelId] = array('start' => $start_index, 'current_state' => $panelObj->currentState, 'end' => $start_index + $strlen_all, 'content' => $strlen_content, 'content_js' => $strlen_content_js);
            $start_index += $strlen_all;
        }
    }
    $tmp_arr = array('panels' => $strlens, 'title' => $ctrl->title);
    // do not cache AJAX Requests
    $seconds_expire = -86400;
    KT_sendExpireHeader($seconds_expire);
    $isOpera = false;
    if (isset($_SERVER) && isset($_SERVER['HTTP_USER_AGENT'])) {
        if (stristr($_SERVER['HTTP_USER_AGENT'], 'opera/9.')) {
            $isOpera = true;
        }
    }
    if (isset($_SERVER['HTTP_KT_CHARSET'])) {
        header('Content-Type: text/' . (!$isOpera ? 'jaxon' : 'plain') . '; charset=' . $_SERVER['HTTP_KT_CHARSET']);
    } else {
        header('Content-Type: text/' . (!$isOpera ? 'jaxon' : 'plain') . '');
    }
    header('Kt_json: ' . KT_json($tmp_arr));
    echo $contents;
    die;
}