コード例 #1
0
 public function edit($id = null)
 {
     $pagina = page($this->dados['modulo'], 'form');
     //se formulário for submetido
     if ($this->input->post()) {
         //setando os valores a serem enviado ao bd
         $data = setData($this->input->post());
         $data['administrador_id'] = $this->administrador_id;
         //alteracao
         if ($data['veiculo_id'] > 0) {
             $this->veiculo->update($data['veiculo_id'], $data);
         } else {
             $data['veiculo_data'] = date('Y-m-d H:i:s');
             $this->veiculo->insert($data);
         }
         redirect('veiculo');
     } else {
         $this->load->model('computador_model');
         $this->dados['computadores'] = $this->computador_model->getAll(array('computador_status' => 1), array('computador_nome', 'asc'));
         //alteracao
         if (!is_null($id)) {
             $this->dados['veiculo'] = $this->veiculo->getById($id);
         }
         //pagina do formulário
         $this->template->view($pagina, $this->dados);
     }
 }
コード例 #2
0
 public function edit($id = null)
 {
     $pagina = page($this->dados['modulo'], 'form');
     //se formulário for submetido
     if ($this->input->post()) {
         //setando os valores a serem enviado ao bd
         $data = setData($this->input->post());
         $data['administrador_id'] = $this->administrador_id;
         //alteracao
         if ($data['tipo_ocorrencia_id'] > 0) {
             $this->tipo_ocorrencia->update($data['tipo_ocorrencia_id'], $data);
         } else {
             $data['tipo_ocorrencia_data'] = date('Y-m-d H:i:s');
             $this->tipo_ocorrencia->insert($data);
         }
         redirect('tipo_ocorrencia');
     } else {
         //alteracao
         if (!is_null($id)) {
             $this->dados['tipo_ocorrencia'] = $this->tipo_ocorrencia->getById($id);
         }
         //pagina do formulário
         $this->template->view($pagina, $this->dados);
     }
 }
コード例 #3
0
 public function getContactById()
 {
     $request = $this->getRequest();
     $id = $request->query->get('id');
     $contact = $this->getDoctrine()->getManager()->createQuery('SELECT c.firstName, c.lastName from TSKUserBundle:Contact c WHERE c.id = :id')->setParameter(':id', $id)->getResult();
     $view = View::create()->setStatusCode(200) - setData($contact);
     return $this->get('fos_rest.view_handler')->handle($view);
 }
コード例 #4
0
ファイル: my_account.php プロジェクト: Arnuga3/shop
function connectServ($x)
{
    global $_servername, $_username, $_password, $_db;
    $conn = new mysqli($_servername, $_username, $_password, $_db);
    // Create connection
    if ($conn->connect_error) {
        // Check connection
        die("Connection failed: " . $conn->connect_error);
    }
    if ($x == "out") {
        getData($conn);
    }
    if ($x == "in") {
        setData($conn);
    }
    //close connection
    $conn->close();
}
コード例 #5
0
         Check::JsonReturn($Read->Execute()->getResult(), 'Nenhuma convênio cadastrada!', '204');
     } else {
         $Read->Execute()->findAll();
         Check::JsonReturn($Read->Execute()->getResult(), 'Nenhuma convênio cadastrada!', '204');
     }
     break;
 case "POST":
     if (!empty($request->conv_id)) {
         //update
         $request = setData($request);
         $Read->setThis($request);
         $Read->Execute()->update(NULL, 'conv_id');
         echo json_encode($request);
     } else {
         //salvar
         $request = setData($request);
         $Read->setThis($request);
         $insert = $Read->Execute()->insert();
         if ($insert) {
             $request->conv_id = (int) $Read->Execute()->MaxFild("conv_id");
         }
         echo json_encode($request);
     }
     break;
 case "DELETE":
     //deleta arquivo
     $Read->setConv_id($id);
     $delete = $Read->Execute()->delete();
     echo json_encode($delete);
     break;
 default:
コード例 #6
0
ファイル: getJson.php プロジェクト: sujalshrestha/harakat
// }
setData($data_staff);
echo '],"HumanResource":[';
setData($data_hr);
echo '],"Support":[';
setData($data_sprt);
echo '],"Procurement":[';
setData($data_procurement);
echo '],"Implementation":[';
setData($data_implementation);
// echo '],"KeyBarriers":[';
// setData($data_bar);
echo '],"Reporting":[';
setData($data_reporting);
echo '],"Monitoring":[';
setData($data_monitoring);
echo '],"Finance":[';
setData($data_finance);
echo '],"Support_from_stakeholders":[';
setData($data_stakeholders);
echo ']}}';
function setData($data_array)
{
    for ($i = 0; $i < sizeof($data_array); $i++) {
        $intro_json = json_encode($data_array[$i]);
        echo $intro_json;
        if ($i != sizeof($data_array) - 1) {
            echo ',';
        }
    }
}
コード例 #7
0
 public function relatorio()
 {
     if ($this->input->post()) {
         $this->dados['data_inicial'] = null;
         $this->dados['data_final'] = null;
         $this->dados['tipo_ocorrencia_id'] = null;
         $this->dados['veiculo_id'] = null;
         $data = setData($this->input->post());
         $where = 'oc.ocorrencia_status = "A" ';
         if (isset($data['data_de']) && isset($data['data_ate'])) {
             $data_de = dateToDb($data['data_de']);
             $data_ate = dateToDb($data['data_ate']);
             $this->dados['data_inicial'] = $data['data_de'];
             $this->dados['data_final'] = $data['data_ate'];
             $where .= " AND ocorrencia_data BETWEEN '{$data_de}' AND '{$data_ate}' ";
         }
         if (isset($data['tipo_ocorrencia_id']) && $data['tipo_ocorrencia_id'] > 0) {
             $where .= " AND oc.tipo_ocorrencia_id = '{$data['tipo_ocorrencia_id']}' ";
             $this->dados['tipo_ocorrencia_id'] = $data['tipo_ocorrencia_id'];
         }
         if (isset($data['veiculo_id']) && $data['veiculo_id'] > 0) {
             $where .= " AND oc.veiculo_id = '{$data['veiculo_id']}' ";
             $this->dados['veiculo_id'] = $data['veiculo_id'];
         }
         $where .= ' order by oc.ocorrencia_id DESC';
         $this->dados['ocorrencias'] = $this->ocorrencia->getWhere($where);
     }
     $this->load->model('tipo_ocorrencia_model');
     $this->dados['tipo_ocorrencias'] = $this->tipo_ocorrencia_model->getAll(array('tipo_ocorrencia_status' => 1), array('tipo_ocorrencia_nome', 'asc'));
     $this->load->model('veiculo_model');
     $this->dados['veiculos'] = $this->veiculo_model->getAll(array('veiculo_status' => 1), array('veiculo_nome', 'asc'));
     //padronizando o caminho da página
     $pagina = page($this->dados['modulo'], 'relatorio');
     //chamando a pagina pelo template
     $this->template->view($pagina, $this->dados);
 }
コード例 #8
0
ファイル: feedback.php プロジェクト: BBKolton/EXCO
<?php

require "common.php";
if ($_POST) {
    setData($DATABASE);
}
head();
?>
	<section class="content">
		<div class="container">
			<h1>Feedback</h1>
			<p>Have something you want to say about the website, a class, or the Experimental
			College in general? This is the place! Share your thoughts with us to help ExCo grow.</p>
			<p><em>Please note that unless you choose, your feedback is completely anonymous</em></p>
			<form action="/asuwxpcl/feedback.php" method="post">
				<div class='form-group'>
					<p>What are you giving feedback about?</p>
					<select class='form-control' name="type">
						<option value="website">The Website</option>
						<option value="personel">An ExCo Employee</option>
						<option value="instructor">An Instructor</option>
						<option value="general">ExCo in General</option>
						<option value="other">Something Else</option>
					</select>
				</div>
				<div class='form-group'>
					<p>What would you like to say?</p>
					<textarea class='form-control' name="text" cols="70" rows="7" name="comment" placeholder="Comment here..."></textarea>
				</div>
				<div class='form-group'>
					<p>Provide your email if you wish</p>
コード例 #9
0
ファイル: curl_51job.php プロジェクト: renjun0106/dao
<?php

error_reporting(E_ALL);
ini_set('display_errors', 'on');
date_default_timezone_set('PRC');
set_time_limit(0);
header("Content-Type: text/html;charset=utf-8");
$url = 'http://search.51job.com/jobsearch/search_result.php?fromJs=1&jobarea=180200%2C00&district=000000&funtype=0000&industrytype=00&issuedate=9&providesalary=07%2C08%2C09%2C10%2C06&keyword=java&keywordtype=0&lang=c&stype=2&postchannel=0000&workyear=99&cotype=99&degreefrom=99&jobterm=99&companysize=99&lonlat=0%2C0&radius=-1&ord_field=0&list_type=0&fromType=14&dibiaoid=0&confirmdate=9&curr_page=';
$content = grap($url . '1');
//creatFlie('java.html',$content);
preg_match('/onclick="jumpPage\\(\'(\\d+)\'\\);/s', $content, $num);
$file = fopen('java_10000.html', 'a');
setData($content);
for ($i = 2; $i <= $num[1]; $i++) {
    $content = grap($url . $i);
    setData($content);
}
fclose($file);
function setData($content)
{
    global $file;
    preg_match_all('/(<div class="el">.+)(?=<div class="el">|<div class="dw_tlc">)/Us', $content, $arr);
    foreach ($arr[0] as $key => $value) {
        fwrite($file, $value);
    }
}
function creatFlie($filename, $content)
{
    $file = fopen($filename, 'w');
    fwrite($file, $content);
    fclose($file);
コード例 #10
0
    $tavola = $_POST["tavola"];
    $perc = $_POST["perc_area"];
    $zona = $_POST["zona"];
    if ($azione == "Aggiungi") {
        $sql_del = "delete from cdu.mappali where foglio='{$foglio}' and mappale='{$mappale}' and coalesce(vincolo,'')='';";
        print_debug($sql_del);
        $db->sql_query($sql_del);
        $sql = "insert into cdu.mappali (pratica,sezione,foglio,mappale,vincolo,tavola,zona,perc_area) values({$idpratica},'{$sezione}','{$foglio}','{$mappale}','{$vincolo}','{$tavola}','{$zona}','{$perc}') ;";
        //print "$sql";
        $db->sql_query($sql);
    }
} else {
    // EDIT MAPPALI
    $sezione = setData($_POST["sezione"]);
    $foglio = setData($_POST["foglio"]);
    $mappale = setData($_POST["mappale"]);
    $sqlmappali = "foglio={$foglio} and mappale={$mappale}";
    if (isset($_POST["sezione"])) {
        $sqlmappali .= " and sezione={$sezione}";
    }
    if ($azione == "Aggiungi") {
        $sql = "insert into cdu.mappali (pratica,sezione,foglio,mappale,vincolo,tavola,zona,perc_area) \n\t\tselect {$idpratica},particelle.sezione,particelle.foglio,particelle.mappale,zona_plg.nome_vincolo,zona_plg.nome_tavola,zona_plg.nome_zona,\n\t\tround(sum(area(intersection (particelle." . THE_GEOM . ",zona_plg.the_geom))/area (particelle." . THE_GEOM . ")*100)::numeric,1) from\n\t\tnct.particelle,vincoli.zona_plg WHERE {$sqlmappali} and (particelle." . THE_GEOM . " && zona_plg.the_geom) and\n\t\t(area(intersection (particelle." . THE_GEOM . ",zona_plg.the_geom))>10 or (area(intersection(particelle." . THE_GEOM . ",zona_plg.the_geom))/area (particelle." . THE_GEOM . ")*100)>=0.02) and \n\t\t(nome_vincolo,nome_tavola) in (SELECT DISTINCT nome_vincolo,nome_tavola FROM vincoli.tavola WHERE cdu=1)\n\n\t\tgroup by particelle.sezione,particelle.foglio,particelle.mappale,zona_plg.nome_vincolo,zona_plg.nome_tavola,zona_plg.nome_zona,particelle." . THE_GEOM;
        $result = $db->sql_query($sql);
        //echo "<p>$sql</p>";
        $err = $db->sql_error();
        print_debug($sql);
        $numrows = $db->sql_affectedrows();
        if ($numrows === 0 or $err["message"]) {
            $sql = "insert into cdu.mappali (pratica,sezione,foglio,mappale) values ({$idpratica},{$sezione},{$foglio},{$mappale})";
            $result = $db->sql_query($sql);
        }
コード例 #11
0
//FUNCTION DEFINITIONS
function getData()
{
    $resource = db_Query('SELECT * FROM settings');
    $returnArray = array();
    while ($tempObj = mysqli_fetch_object($resource)) {
        $returnArray[] = $tempObj;
    }
    return $returnArray;
}
function setData()
{
    $value = $_REQUEST['value'];
    $settingName = $_REQUEST['settingName'];
    db_Query('UPDATE settings SET value="' . $value . '" WHERE name="' . $settingName . '"');
}
//FUNCTION DIRECTORY
$instruction = $_REQUEST['action'];
$returnVal = '';
switch ($instruction) {
    case "getData":
        $returnVal = getData();
        break;
    case 'setData':
        setData();
        break;
}
print json_encode($returnVal);
?>

コード例 #12
0
if (!isset($_GET['pack'])) {
    echo 'error data';
    die;
}
function setData($data, $name)
{
    $aData = array('data' => trim($data), 'time' => time() + 3600);
    file_put_contents('./cache/' . $name, json_encode($aData));
}
$file = md5($_GET['pack']) . '.cache';
if (is_file($file)) {
    $fileDataRaw = file_get_contents('./cache/' . $file);
    $fileData = json_decode($fileDataRaw);
    if ($fileData->time > time()) {
        die($fileData->data . '');
    }
}
$url = 'https://play.google.com/store/apps/details?id=' . $_GET['pack'];
//com.stfalcon.nizam.android'
$page = file_get_contents($url);
$page = str_replace(["\n", "\r"], [''], $page);
$matches = false;
preg_match_all('/\\"softwareVersion\\">([\\d\\s\\.]+)<\\/div>/Ui', $page, $matches);
if (isset($matches[1][0])) {
    echo trim($matches[1][0]);
    setData($matches[1][0], $file);
} else {
    echo 'null';
    setData('null', $file);
}