Beispiel #1
0
    } else {
        flash();
    }
}
if (isset($_POST['save']) && !empty($_POST['data']['market'])) {
    $vals = array();
    $vals = $_POST['data']['market'];
    $id = intval($_POST['id']);
    if (!empty($_FILES['pic']['name'])) {
        $attachment->if_thumb_large = true;
        $attachment->large_scale = "472*220";
        $attachment->if_watermark = false;
        if (!empty($id)) {
            $attachment->rename_file = "market-" . $id;
        } else {
            $attachment->rename_file = "market-" . ($market->getMaxId() + 1);
        }
        $attachment->upload_process();
        $vals['picture'] = $attachment->file_full_url;
    }
    $vals['industry_id'] = PbController::getMultiId($_POST['industry']['id']);
    $vals['area_id'] = PbController::getMultiId($_POST['area']['id']);
    if (!empty($id)) {
        $vals['modified'] = $time_stamp;
        $result = $market->save($vals, "update", $id);
    } else {
        $vals['created'] = $vals['modified'] = $time_stamp;
        $result = $market->save($vals);
    }
    if (!$result) {
        flash();