コード例 #1
0
 function eventHandlerThree()
 {
     $objResponse = new xajaxResponse();
     $objResponse->append('log', 'innerHTML', 'Message from event handler three.<br />');
     $objResponse->setReturnValue('return value from event handler three.');
     return $objResponse;
 }
コード例 #2
0
 function instructions()
 {
     $smarty = new TestSmarty();
     $objResponse = new xajaxResponse();
     $template = $smarty->fetch('instructions.tpl');
     $objResponse->setReturnValue($template);
     return $objResponse;
 }
コード例 #3
0
ファイル: practice.php プロジェクト: MaliahRajan/online_exam
 function practice($subject_code, $type_code)
 {
     $objResponse = new xajaxResponse();
     $this->load->model('Angular_online_exam_model');
     $duration = $this->Angular_online_exam_model->durationFetch($subject_code, $type_code);
     //Seconds Conversion
     if (!empty($duration)) {
         $duration = $duration * 60;
     }
     $objResponse->setReturnValue($duration);
     return $objResponse;
 }
コード例 #4
0
function showOutput()
{
    $testResponse = new xajaxResponse();
    $testResponse->alert("Hello");
    $testResponse2 = new xajaxResponse();
    $testResponse2->loadCommands($testResponse);
    $testResponse2->replace("this", "is", "a", "replacement]]>");
    $testResponseOutput = htmlspecialchars($testResponse2->getOutput());
    $objResponse = new xajaxResponse();
    $objResponse->assign("submittedDiv", "innerHTML", $testResponseOutput);
    $aValues = array();
    $aValues[] = "Yippie";
    $objResponse->setReturnValue($aValues);
    return $objResponse;
}
コード例 #5
0
 function questionFetch($subject_code, $type_code)
 {
     $objResponse = new xajaxResponse();
     $this->load->model('Angular_online_exam_model');
     $questions = $this->Angular_online_exam_model->questionFetch($subject_code, $type_code);
     $formattedQuestions;
     foreach ($questions as $key => $value) {
         $formattedQuestions[$key]['id'] = $key + 1;
         $formattedQuestions[$key]['question'] = $value['questions'];
         $formattedQuestions[$key]['option1'] = $value['option1'];
         $formattedQuestions[$key]['option2'] = $value['option2'];
         $formattedQuestions[$key]['option3'] = $value['option3'];
         $formattedQuestions[$key]['option4'] = $value['option4'];
         $formattedQuestions[$key]['answer'] = 'nill';
     }
     $objResponse->setReturnValue($formattedQuestions);
     return $objResponse;
 }
コード例 #6
0
ファイル: index.php プロジェクト: silvia-valdez/SignalsViewer
function eliminarArchivo($nombreArchivo)
{
    #Instanciamos el objeto para generar la respuesta con ajax.
    $output = new xajaxResponse();
    $path = "/home/silvia.valdez/public_html/ECG/tmp/";
    $archivo = $path . $nombreArchivo;
    if (file_exists($archivo)) {
        unlink($archivo);
        $output->setReturnValue(true);
    } else {
        $output->setReturnValue(false);
    }
    return $output;
}
コード例 #7
0
ファイル: swfupload.php プロジェクト: xajax/xajax
function sync_test()
{
    $objResponse = new xajaxResponse();
    $objResponse->setReturnValue('hello world');
    return $objResponse;
}
コード例 #8
0
function descargarSeñal($anot, $tabla, $indice1, $incremento, $nombreArchivo)
{
    #Instanciamos el objeto para generar la respuesta con ajax.
    $output = new xajaxResponse();
    conectar();
    #Parámetros de subsecuencia_arr: (NombreCampo, ValorInicial, NumDeValoresAconsultar)
    $result4 = pg_query("SELECT (subsecuencia_arr(signal,{$indice1},{$incremento})).f1,(subsecuencia_arr(signal,{$indice1},{$incremento})).f2 FROM derivacion WHERE id={$tabla}");
    if ($anot) {
        $result5 = pg_query("SELECT indice, nota FROM anotacion WHERE indice IN (SELECT (subsecuencia_arr(signal,{$indice1},{$incremento})).f1 FROM derivacion WHERE id={$tabla}) AND id_derivacion={$tabla}");
    }
    desconectar();
    #Guardar señal en un array.
    $i = 0;
    while ($row = pg_fetch_assoc($result4)) {
        #Guardar los datos en un array bidimensional.
        $s[$i][0] = (int) $row['f1'];
        #Índice.
        $s[$i][1] = (double) $row['f2'];
        #Voltaje.
        $i++;
    }
    if ($anot) {
        #Guardar anotaciones.
        $i = 0;
        while ($row = pg_fetch_assoc($result5)) {
            #Guardar los datos en un array bidimensional.
            $a[$i][0] = (int) $row['indice'];
            $a[$i][1] = $row['nota'];
            $i++;
        }
        #Guarda en un arreglo el resultado de ambas consultas.
        for ($i = 0; $i < count($s); $i++) {
            for ($k = 0; $k < count($a); $k++) {
                #Si el índice actual coincide con el de una anotación:
                if ($s[$i][0] == $a[$k][0]) {
                    $s[$i][2] = obtenerAnotacion($a[$k][1]);
                    #Nota.
                    break;
                } else {
                    #En caso de no haber anotación, escribe "-".
                    $s[$i][2] = "-";
                }
            }
        }
    }
    escribirArchivo($s, $anot, $nombreArchivo);
    #$output->alert("OK!");
    #Retornamos la salida XAJAX.
    $output->setReturnValue(true);
    return $output;
}
コード例 #9
0
ファイル: menu.php プロジェクト: silvia-valdez/SignalsViewer
function cargaDerivacion($selectDestino, $opcionSeleccionada)
{
    #Instanciamos el objeto para generar la respuesta con ajax.
    $output = new xajaxResponse();
    if ($output->call('xajax_validaSelect', $selectDestino, $opcionSeleccionada)) {
        conectar();
        $query = pg_query("SELECT id, posicion FROM derivacion WHERE id_electrocardiografia={$opcionSeleccionada}") or die("Error");
        desconectar();
        $i = 0;
        $j = 0;
        while ($row = pg_fetch_assoc($query)) {
            #Guardar los datos en un array bidimensional.
            $d[$i][$j] = $row['id'];
            $j++;
            $d[$i][$j] = $row['posicion'];
            $j = 0;
            $i++;
        }
        $output->setReturnValue($d);
    }
    return $output;
}
コード例 #10
0
ファイル: updatedata.php プロジェクト: nbgmaster/happify
function updatedata($table, $part, $data, $id = NULL)
{
    //global $tpl;
    global $memcache;
    global $l;
    global $tpl;
    global $user_data;
    global $getmonth;
    $objResponse = new xajaxResponse();
    //include('settings/template.php');
    include 'settings/tables.php';
    if ($user_data == '') {
        require_once 'lib/functions/get_userdata.php';
    }
    //update progress state of a goal
    if ($table == $tbl_goals && $part == 'progress') {
        require_once 'lib/functions/convert_date.php';
        $goals = new ModifyEntry();
        $goals->table = $table;
        switch ($data) {
            case 0:
                $progress = 0;
                break;
            case 1:
                $progress = 20;
                break;
            case 2:
                $progress = 40;
                break;
            case 3:
                $progress = 50;
                break;
            case 4:
                $progress = 60;
                break;
            case 5:
                $progress = 80;
                break;
            case 6:
                $progress = 100;
                break;
        }
        $achieved_date = date('Y-m-d H:i:s', time());
        if ($progress == 100) {
            $goals->changes = " progress = '" . $progress . "', achieved = '" . $achieved_date . "' ";
        } else {
            $goals->changes = " progress = '" . $progress . "', achieved = '' ";
        }
        $goals->condition = " ID = '{$id}' ";
        $goals->update();
        unset($goals);
        $ay_goals["progress"] = $progress;
        $ay_goals["achieved"] = convert_date($achieved_date, 0, $getmonth);
        $tpl->assign('goal', $ay_goals);
        $html = $tpl->fetch("modules/improve/goals/achieved.tpl");
        $objResponse->assign("achieved_" . $id, "innerHTML", $html);
        //no refresh necessary as dropdown has latest change
    } elseif ($table == $tbl_goals && $part == 'update_entry') {
        $goals = new ModifyEntry();
        $goals->table = $table;
        $ay_entry['entry_org'] = strip_tags($data);
        // $diary->changes   = " entry = '".$data['edit_entry_inp']."' ";
        $goals->changes = " goal = '" . $ay_entry['entry_org'] . "' ";
        $goals->condition = " ID = '{$id}' ";
        $goals->update();
        unset($goals);
        $objResponse->setReturnValue($ay_entry);
    } elseif ($table == $tbl_distorted_thoughts && $part == 'update_entry') {
        $thoughts = new ModifyEntry();
        $thoughts->table = $table;
        $get_values = explode("%%%!", $data);
        $ay_entry['thought'] = strip_tags($get_values[0]);
        $ay_entry['response'] = strip_tags($get_values[1]);
        $ay_entry['action'] = strip_tags($get_values[2]);
        // $diary->changes   = " entry = '".$data['edit_entry_inp']."' ";
        $thoughts->changes = " thought = '" . $ay_entry['thought'] . "', response = '" . $ay_entry['response'] . "', action = '" . $ay_entry['action'] . "' ";
        $thoughts->condition = " ID = '{$id}' ";
        $thoughts->update();
        unset($thoughts);
        $objResponse->setReturnValue($ay_entry);
    } elseif ($table == $tbl_distorted_thoughts && $part == 'update_status') {
        $thoughts = new ModifyEntry();
        $thoughts->table = $table;
        // $diary->changes   = " entry = '".$data['edit_entry_inp']."' ";
        $thoughts->changes = " status = '" . $data . "' ";
        $thoughts->condition = " ID = '{$id}' ";
        $thoughts->update();
        unset($thoughts);
    } elseif ($table == $tbl_users && $part == 'update_desc') {
        $update_desc = new ModifyEntry();
        $update_desc->table = $table;
        //$desc_me = mysql_real_escape_string($data['desc_me']);
        $update_desc->changes = " description = '" . $data['desc_me'] . "' ";
        $update_desc->condition = " ID = '" . $user_data['ID'] . "' ";
        $update_desc->update();
        unset($update_desc);
        //update cached user object
        // $mem_key1  = "user_data_".$l["token"];
        $user_data['description'] = $data['desc_me'];
        if (mod_memcache == 1) {
            $memcache->replace($mem_key1, $user_data, false);
        } else {
            $_SESSION['$mem_key1'] = $user_data;
        }
        //TODO refresh view
        $objResponse->assign("desc_me", "innerHTML", $data['desc_me']);
        $objResponse->assign("inp_me", "value", $data['desc_me']);
        $objResponse->assign("desc_me", "style.display", "block");
        if ($user_data['description'] == '') {
            $objResponse->assign("initial_msg", "style.display", "block");
            $objResponse->assign("desc_input", "style.display", "block");
            $objResponse->assign("desc_edit", "style.display", "none");
        } else {
            $objResponse->assign("desc_edit", "style.display", "block");
            $objResponse->assign("initial_msg", "style.display", "none");
            $objResponse->assign("desc_input", "style.display", "none");
        }
    } elseif ($table == $tbl_diary && $part == 'update_entry') {
        $diary = new ModifyEntry();
        $diary->table = $table;
        $ay_entry['entry_org'] = strip_tags($data);
        // $diary->changes   = " entry = '".$data['edit_entry_inp']."' ";
        $diary->changes = " entry = '" . $ay_entry['entry_org'] . "' ";
        $diary->condition = " ID = '{$id}' ";
        $diary->update();
        unset($diary);
        // The Regular Expression filter
        $reg_exUrl = "!((?:www|http://)[^ ]+)!";
        $ay_entry['entry_new_string'] = $ay_entry['entry_org'];
        // Check if there is a url in the text
        if (preg_match($reg_exUrl, $ay_entry['entry_org'], $url)) {
            // make the urls hyper links
            if (substr($url[0], 0, 3) == 'www') {
                $ay_entry['entry_new_string'] = preg_replace($reg_exUrl, '<a href="http://' . $url[0] . '" target="_blank">' . $url[0] . '</a>', $ay_entry['entry_org']);
            } else {
                $ay_entry['entry_new_string'] = preg_replace($reg_exUrl, '<a href="' . $url[0] . '" target="_blank">' . $url[0] . '</a>', $ay_entry['entry_org']);
            }
        }
        $objResponse->setReturnValue($ay_entry);
    }
    return $objResponse;
}