text
stringlengths
2
1.03M
<main role="main" class="col-md-9 col-lg-10 px-4 mt-3"> <h1 class="h3"><?= $titulo_pagina ?></h1> <!-- Button --> <div class="row"> <div class="col-12"> <a class="btn btn-primary" href="<?= base_url('usuarios/adicionar') ?>" title="Novo Usuário">Novo Usuário</a> </div> </div> <!-- FlashData --> <div class="row"> <div class="mx-auto col-lg-10 mt-3"> <?= $this->session->flashdata('msg'); ?> </div> </div> <!-- Table --> <div class="row"> <div class="col-lg-10 mx-auto mt-4"> <table class="table table-hover" id="tabela-listar"> <thead> <tr> <th scope="col">#</th> <th scope="col">Nome</th> <th scope="col">E-mail</th> <th scope="col">Ativo</th> <th scope="col">Ações</th> </tr> </thead> <tbody> <?php foreach($usuarios as $usuario) { ?> <tr> <td><?= $usuario->id ?></td> <td><?= $usuario->nome ?></td> <td class="text-break"><?= $usuario->email ?></td> <td><?= $usuario->ativo ? '<span class="badge badge-success">Sim</span>':'<span class="badge badge-danger">Não</span>' ?></td> <td> <a href="<?= base_url('usuarios/editar/'.$usuario->id) ?>" class="btn btn-inverse-info hover-white">Editar</a> <a href="<?= base_url('usuarios/deletar/'.$usuario->id) ?>" class="btn btn-inverse-info hover-white">Deletar</a> <?php if($usuario->ativo) { ?> <a href="<?= base_url('usuarios/inativo/'.$usuario->id) ?>" class="btn btn-inverse-info hover-white">Desativar</a> <?php } else { ?> <a href="<?= base_url('usuarios/ativo/'.$usuario->id) ?>" class="btn btn-inverse-info hover-white">Ativar</a> <?php } ?> </td> </tr> <?php } ?> </tbody> </table> </div> </div>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content=""> <meta name="author" content="Ansonika"> <title>UDEMA | Modern Educational site template</title> <!-- Favicons--> <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon"> <link rel="apple-touch-icon" type="image/x-icon" href="img/apple-touch-icon-57x57-precomposed.png"> <link rel="apple-touch-icon" type="image/x-icon" sizes="72x72" href="img/apple-touch-icon-72x72-precomposed.png"> <link rel="apple-touch-icon" type="image/x-icon" sizes="114x114" href="img/apple-touch-icon-114x114-precomposed.png"> <link rel="apple-touch-icon" type="image/x-icon" sizes="144x144" href="img/apple-touch-icon-144x144-precomposed.png"> <!-- GOOGLE WEB FONT --> <link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800" rel="stylesheet"> <!-- BASE CSS --> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <!-- SPECIFIC CSS --> <link href="css/wizard.css" rel="stylesheet"> <!-- YOUR CUSTOM CSS --> <link href="css/custom.css" rel="stylesheet"> <script type="text/javascript"> function delayedRedirect(){ window.location = "index.html" } </script> </head> <body onLoad="setTimeout('delayedRedirect()', 8000)" style="background-color:#fff;"> <?php $mail = $_POST['email']; $to = "test@domani.com";/* YOUR EMAIL HERE */ $subject = "Admission from UDEMA"; $headers = "From: Admission from UDEMA <noreply@yourdomain.com>"; $message = "DETAILS\n"; $message .= "\nFirst name: " . $_POST['firstname']; $message .= "\nLast name: " . $_POST['lastname']; $message .= "\nEmail: " . $_POST['email']; $message .= "\nTelephone: " . $_POST['telephone']; $message .= "\nEducation level: " . $_POST['education_apply']; $message .= "\nAge: " . $_POST['age']; $message .= "\nGender: " . $_POST['gender'] . "\n"; $message .= "\nAddress: " . $_POST['address']; $message .= "\nCity: " . $_POST['city']; $message .= "\nZipcode: " . $_POST['zip_code']; $message .= "\nCountry: " . $_POST['country'] . "\n"; $message .= "\nYour course preferences\n" ; foreach($_POST['preferences'] as $value) { $message .= "- " . trim(stripslashes($value)) . "\n"; }; $message .= "\nAdditional message: " . $_POST['additional_message']; $message .= "\nTerms and conditions accepted: " . $_POST['terms']; //Receive Variable $sentOk = mail($to,$subject,$message,$headers); //Confirmation page $user = "$mail"; $usersubject = "Thank You"; $userheaders = "From: info@udema.com\n"; /*$usermessage = "Thank you for your time. Your quotation request is successfully submitted.\n"; WITH OUT SUMMARY*/ //Confirmation page WITH SUMMARY $usermessage = "Thank you for your time. Your request is successfully submitted. We will reply shortly.\n\nBELOW A SUMMARY\n\n$message"; mail($user,$usersubject,$usermessage,$userheaders); ?> <!-- END SEND MAIL SCRIPT --> <div id="success"> <div class="icon icon--order-success svg"> <svg xmlns="http://www.w3.org/2000/svg" width="72px" height="72px"> <g fill="none" stroke="#8EC343" stroke-width="2"> <circle cx="36" cy="36" r="35" style="stroke-dasharray:240px, 240px; stroke-dashoffset: 480px;"></circle> <path d="M17.417,37.778l9.93,9.909l25.444-25.393" style="stroke-dasharray:50px, 50px; stroke-dashoffset: 0px;"></path> </g> </svg> </div> <h4><span>Request successfully sent!</span>Thank you for your time</h4> <small>You will be redirect back in 5 seconds.</small> </div> </body> </html>
<div class="header"> <h2>LINKED.BY</h2> <p>CARI LAPANGAN KERJA MU.</p> </div> <div id="navbar"> <a class="active" href="<?= base_url('index.php/Kariyawan_ctrl/') ?>"><i class="fa fa-fw fa-home"></i> Home</a> <!-- <a href="<?= base_url('') ?>"><i class="fa fa-fw fa-search"></i> Search</a> --> <?php if ($this->session->userdata('email')) { ?> <a href="<?= base_url('index.php/Kariyawan_ctrl/main_page') ?>"><i class="fa fa-fw fa-user"></i> Profile</a> <a href="<?= base_url('index.php/Welcome/logout') ?>"><i class="fa fa-sign-in"></i> Logout</a> <?php } else { ?> <a href="<?= base_url('index.php/Kariyawan_ctrl/login_karyawan') ?>"><i class="fa fa-sign-in"></i> Login</a> <?php } ?> <input type="text" id="myInput" onkeyup="cari()" placeholder="Search for Keyword.." title="Keywordnya Apa?"> </div>
<?php use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model app\models\Estudiantessituacion */ $this->title = Yii::t('app', 'Update {modelClass}: ', [ 'modelClass' => 'Estudiantessituacion', ]) . $model->id; $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Estudiantessituacions'), 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); ?> <div class="estudiantessituacion-update"> <h1><?= Html::encode($this->title) ?></h1> <?= $this->render('_form', [ 'model' => $model, ]) ?> </div>
<?php namespace Database\Seeders; use Illuminate\Database\Seeder; use TCG\Voyager\Models\Setting; class SettingsTableSeeder extends Seeder { /** * Auto generated seed file. */ public function run() { $setting = $this->findSetting('site.title'); if (!$setting->exists) { $setting->fill([ 'display_name' => __('voyager::seeders.settings.site.title'), 'value' => __('voyager::seeders.settings.site.title'), 'details' => '', 'type' => 'text', 'order' => 1, 'group' => 'Site', ])->save(); } $setting = $this->findSetting('site.description'); if (!$setting->exists) { $setting->fill([ 'display_name' => __('voyager::seeders.settings.site.description'), 'value' => __('Admin Panel for Standard Oil Qazaqstan'), 'details' => '', 'type' => 'text', 'order' => 2, 'group' => 'Site', ])->save(); } $setting = $this->findSetting('site.logo'); if (!$setting->exists) { $setting->fill([ 'display_name' => __('voyager::seeders.settings.site.logo'), 'value' => '', 'details' => '', 'type' => 'image', 'order' => 3, 'group' => 'Site', ])->save(); } $setting = $this->findSetting('site.google_analytics_tracking_id'); if (!$setting->exists) { $setting->fill([ 'display_name' => __('voyager::seeders.settings.site.google_analytics_tracking_id'), 'value' => '', 'details' => '', 'type' => 'text', 'order' => 4, 'group' => 'Site', ])->save(); } $setting = $this->findSetting('admin.bg_image'); if (!$setting->exists) { $setting->fill([ 'display_name' => __('voyager::seeders.settings.admin.background_image'), 'value' => '', 'details' => '', 'type' => 'image', 'order' => 5, 'group' => 'Admin', ])->save(); } $setting = $this->findSetting('admin.title'); if (!$setting->exists) { $setting->fill([ 'display_name' => __('voyager::seeders.settings.admin.title'), 'value' => 'Standard Oil Qazaqstan', 'details' => '', 'type' => 'text', 'order' => 1, 'group' => 'Admin', ])->save(); } $setting = $this->findSetting('admin.description'); if (!$setting->exists) { $setting->fill([ 'display_name' => __('voyager::seeders.settings.admin.description'), 'value' => __('Admin Panel for Standard Oil Qazaqstan'), 'details' => '', 'type' => 'text', 'order' => 2, 'group' => 'Admin', ])->save(); } $setting = $this->findSetting('admin.loader'); if (!$setting->exists) { $setting->fill([ 'display_name' => __('voyager::seeders.settings.admin.loader'), 'value' => '', 'details' => '', 'type' => 'image', 'order' => 3, 'group' => 'Admin', ])->save(); } $setting = $this->findSetting('admin.icon_image'); if (!$setting->exists) { $setting->fill([ 'display_name' => __('voyager::seeders.settings.admin.icon_image'), 'value' => '', 'details' => '', 'type' => 'image', 'order' => 4, 'group' => 'Admin', ])->save(); } $setting = $this->findSetting('admin.google_analytics_client_id'); if (!$setting->exists) { $setting->fill([ 'display_name' => __('voyager::seeders.settings.admin.google_analytics_client_id'), 'value' => '', 'details' => '', 'type' => 'text', 'order' => 1, 'group' => 'Admin', ])->save(); } } /** * [setting description]. * * @param [type] $key [description] * * @return [type] [description] */ protected function findSetting($key) { return Setting::firstOrNew(['key' => $key]); } }
<?php /* Copyright (c) 2010 Thai Pangsakulyanont Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ abstract class OAuthDamnitBase { var $consumer_key; var $consumer_secret; var $access_token = ''; var $access_token_secret = ''; abstract function http($method, $url, $data); function __construct($consumer_key, $consumer_secret, $access_token = '', $access_token_secret = '') { $this->consumer_key = $consumer_key; $this->consumer_secret = $consumer_secret; $this->access_token = $access_token; $this->access_token_secret = $access_token_secret; } function get($url, $params = array()) { return $this->request('GET', $url, $params); } function post($url, $params = array()) { return $this->request('POST', $url, $params); } function request($method, $url, $params = array()) { $signed_params = $this->sign($method, $url, $params); return $this->http($method, $url, $this->build_query($signed_params)); } function sign($method, $url, $params = array()) { $params['oauth_consumer_key'] = $this->consumer_key; $params['oauth_nonce'] = $this->nonce(); $params['oauth_signature_method'] = 'HMAC-SHA1'; $params['oauth_timestamp'] = time(); $params['oauth_version'] = '1.0'; if (!empty($this->access_token)) { $params['oauth_token'] = $this->access_token; } $params['oauth_signature'] = $this->signature($method, $url, $params); return $params; } function signature($method, $url, $params = array()) { $query = $this->build_query($params); $base = $method . '&' . $this->encode($url) . '&' . $this->encode($query); $key = $this->consumer_secret . '&'; if (!empty($this->access_token_secret)) { $key .= $this->access_token_secret; } return base64_encode($this->hmac_sha1($key, $base)); } function build_query($params) { $output = array(); foreach ($params as $k => $v) { if (is_array($v)) { foreach ($v as $vv) { $output[] = $this->encode($k) . ' ' . $this->encode($vv); } } else { $output[] = $this->encode($k) . ' ' . $this->encode($v); } } sort ($output, SORT_STRING); return str_replace(' ', '=', implode('&', $output)); } function hmac_sha1($key, $message) { if (function_exists('hash_hmac')) { return hash_hmac('sha1', $message, $key, true); } if (strlen($key) > 64) { $key = sha1($key, true); } $key = str_pad($key, 64, "\0"); $key1 = $key2 = ''; for ($i = 0; $i < 64; $i ++) { $key1 .= chr(ord($key[$i]) ^ 0x5C); $key2 .= chr(ord($key[$i]) ^ 0x36); } return sha1($key1 . sha1($key2 . $message, true), true); } function nonce() { return bin2hex(md5(microtime(), true) . sha1(microtime(), true)); } function encode($string) { // var_dump(str_replace('%7E', '~', rawurlencode($string))); return str_replace('%7E', '~', rawurlencode($string)); } } class OAuthDamnit extends OAuthDamnitBase { var $ch; function curl_set_options() { curl_setopt ($this->ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($this->ch, CURLOPT_USERAGENT, 'OAuth Damnit v0.1'); } function curl_execute() { return curl_exec($this->ch); } function http($method, $url, $data) { if (!isset($this->ch)) { $this->ch = curl_init(); $this->curl_set_options(); } if ($method == 'POST') { curl_setopt ($this->ch, CURLOPT_URL, $url); curl_setopt ($this->ch, CURLOPT_POST, true); curl_setopt ($this->ch, CURLOPT_POSTFIELDS, $data); curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false); } else { $append = strpos($url, '?') === false ? '?' : '&'; curl_setopt ($this->ch, CURLOPT_URL, $url . $append . $data); curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false); } return $this->curl_execute(); } }
@extends('layouts.app') @section('content') <div class="row"> <div class="col-lg-12 margin-tb"> <div class="pull-left"> <h2>Add New Product</h2> </div> <div class="pull-right"> <a class="btn btn-primary" href="{{ route('products.index') }}"> Back</a> </div> </div> </div> @if ($errors->any()) <div class="alert alert-danger"> <strong>Whoops!</strong> There were some problems with your input.<br><br> <ul> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif <form action="{{ route('products.store') }}" method="POST"> @csrf <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12"> <div class="form-group"> <strong>Name:</strong> <input type="text" name="name" class="form-control" placeholder="Name"> </div> </div> <div class="col-xs-12 col-sm-12 col-md-12"> <div class="form-group"> <strong>Detail:</strong> <textarea class="form-control" style="height:150px" name="detail" placeholder="Detail"></textarea> </div> </div> <div class="col-xs-12 col-sm-12 col-md-12 text-center"> <button type="submit" class="btn btn-primary">Submit</button> </div> </div> </form> @endsection
<?php /** * WHMCS Digiwallet EPS Callback File * * @copyright Copyright (c) WHMCS Limited 2020 * @license http://www.whmcs.com/license/ WHMCS Eula */ use WHMCS\Database\Capsule; // Require libraries needed for gateway module functions. require_once __DIR__ . '/../../../init.php'; require_once __DIR__ . '/../../../includes/gatewayfunctions.php'; require_once __DIR__ . '/../../../includes/invoicefunctions.php'; require_once __DIR__ . '/../digiwallet/digiwalletPayment.php'; $dwLang = digiwalletPayment::dwLoadLanguage(); // Detect module name from filename. $gatewayModuleName = basename(__FILE__, '.php'); // Fetch gateway configuration parameters. $gatewayParams = getGatewayVariables($gatewayModuleName); // Die if module is not active. if (!$gatewayParams['type']) { throw new Exception($dwLang['digiwallet']['error_module_not_activated']); } $isReport = $_SERVER['REQUEST_METHOD'] === 'POST' ? true :false; $invoiceId = $_REQUEST["invoice_id"]; $transactionId = $_REQUEST['transactionID']; if (!$invoiceId || !$transactionId) { throw new Exception($dwLang['digiwallet']['bad_request']); } $digiwalletData = Capsule::table('mod_digiwallet')->where([ ['invoice_id', $invoiceId], ['transaction_id', $transactionId], ])->first(); if (!$digiwalletData) { throw new Exception($dwLang['digiwallet']['bad_request']); } $redirect = $_GET['return_redirect']; $invoiceId = checkCbInvoiceID($invoiceId, $gatewayParams['name']); $cbTrans= Capsule::table('tblaccounts')->where([ ['invoiceid', $invoiceId], ['transid', $transactionId], ])->first(); $invoice = digiwalletPayment::getInvoiceById($invoiceId); if (empty($cbTrans)) { $digiwallet = new digiwalletPayment($gatewayParams); $result = $digiwallet->processCallback($transactionId); logTransaction($gatewayParams['name'], array_merge($_POST, $_GET), $result['message']); $paymentFee = null; if ($result['error'] == 0) { addInvoicePayment( $invoiceId, $transactionId, $result['paymentAmount'], $paymentFee, $gatewayModuleName ); } if ($isReport) { echo $result['message'] . PHP_EOL; $invoiceNew = digiwalletPayment::getInvoiceById($invoiceId); echo "Old:{$invoice->status}, New:{$invoiceNew->status}"; } } else { echo sprintf($dwLang['digiwallet']['invoice_paid'], $invoiceId); } if ($redirect) { if ($result['error']) { $redirect .= '&paymentfailed=true'; } header("Location: {$redirect}");exit(); }
@extends('layouts.backend') @section('content') @include('admin.common.form', [ 'title' => 'Види діяльності', 'fields' => [ [ 'name' => 'is_active', 'title' => 'Відображати на сайті', 'type' => 'checkbox', ], [ 'name' => 'name', 'title' => 'Назва', 'required' => true, ], [ 'name' => 'city_id', 'title' => 'Miсто', 'type' => 'select', 'values' => $user->citiesForDropDown(), ], ], 'entity' => empty($entity) ? new $model : $entity, ]) @endsection
<?php namespace App\Http\Controllers\API; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\User; use Illuminate\Support\Facades\Hash; class UserController extends Controller { /** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('auth:api'); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // $this->authorize('isAdmin'); if (\Gate::allows('isAdmin') || \Gate::allows('isAuthor')) { return User::latest()->paginate(5); } } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $this->validate($request,[ 'name' => 'required|string|max:191', 'email' => 'required|string|email|max:191|unique:users', 'password' => 'required|string|min:6', ]); return User::create([ 'name' => $request['name'], 'email' => $request['email'], 'type' => $request['type'], 'bio' => $request['bio'], 'photo' => $request['photo'], 'password' => Hash::make($request['password']), ]); } public function updateProfile(Request $request) { $user = auth('api')->user(); $this->validate($request,[ 'name' => 'required|string|max:191', 'email' => 'required|string|email|max:191|unique:users,email,'.$user->id, 'password' => 'sometimes|required||min:6', ]); $currentPhoto = $user->photo; if($request->photo != $currentPhoto){ $name = time().'.'. explode('/', explode(':' , substr($request->photo, 0 , strpos($request->photo, ';')))[1])[1]; \Image::make($request->photo)->save(public_path('img/profile/').$name); $request->merge(['photo' => $name]); $userPhoto = public_path('img/profile/').$currentPhoto; if(file_exists($userPhoto)){ @unlink($userPhoto); } } if(!empty($request->password)){ $request->merge(['password' => Hash::make($request['password'])]); } $user->update($request->all()); } public function profile() { return auth('api')->user(); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $user = User::findOrFail($id); $this->validate($request,[ 'name' => 'required|string|max:191', 'email' => 'required|string|email|max:191|unique:users,email,'.$user->id, 'password' => 'sometimes|min:6', ]); $request->merge(['password' => Hash::make($request['password'])]); $user->update($request->all()); return ['message' => 'Update']; } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $this->authorize('isAdmin'); $user = User::findOrFail($id); $user->delete(); return ['message' => 'User Deleted']; } public function search(){ if($search = ) } }
<?php declare(strict_types=1); /* * This file is part of Composer. * * (c) Nils Adermann <naderman@naderman.de> * Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Composer\Command; use Composer\Factory; use Composer\Json\JsonFile; use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Composer\Repository\CompositeRepository; use Composer\Repository\PlatformRepository; use Composer\Repository\RepositoryInterface; use Composer\Plugin\CommandEvent; use Composer\Plugin\PluginEvents; /** * @author Robert Schönthal <seroscho@googlemail.com> */ class SearchCommand extends BaseCommand { /** * @return void */ protected function configure(): void { $this ->setName('search') ->setDescription('Searches for packages.') ->setDefinition(array( new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in package names'), new InputOption('only-vendor', 'O', InputOption::VALUE_NONE, 'Search only for vendor / organization names, returns only "vendor" as result'), new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'), new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'), new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'), )) ->setHelp( <<<EOT The search command searches for packages by its name <info>php composer.phar search symfony composer</info> Read more at https://getcomposer.org/doc/03-cli.md#search EOT ) ; } protected function execute(InputInterface $input, OutputInterface $output): int { // init repos $platformRepo = new PlatformRepository; $io = $this->getIO(); $format = $input->getOption('format'); if (!in_array($format, array('text', 'json'))) { $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format)); return 1; } if (!($composer = $this->tryComposer())) { $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins')); } $localRepo = $composer->getRepositoryManager()->getLocalRepository(); $installedRepo = new CompositeRepository(array($localRepo, $platformRepo)); $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories())); $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output); $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent); $mode = RepositoryInterface::SEARCH_FULLTEXT; if ($input->getOption('only-name') === true) { if ($input->getOption('only-vendor') === true) { throw new \InvalidArgumentException('--only-name and --only-vendor cannot be used together'); } $mode = RepositoryInterface::SEARCH_NAME; } elseif ($input->getOption('only-vendor') === true) { $mode = RepositoryInterface::SEARCH_VENDOR; } $type = $input->getOption('type'); $query = implode(' ', $input->getArgument('tokens')); if ($mode !== RepositoryInterface::SEARCH_FULLTEXT) { $query = preg_quote($query); } $results = $repos->search($query, $mode, $type); if ($results && $format === 'text') { $width = $this->getTerminalWidth(); $nameLength = 0; foreach ($results as $result) { $nameLength = max(strlen($result['name']), $nameLength); } $nameLength += 1; foreach ($results as $result) { $description = $result['description'] ?? ''; $warning = !empty($result['abandoned']) ? '<warning>! Abandoned !</warning> ' : ''; $remaining = $width - $nameLength - strlen($warning) - 2; if (strlen($description) > $remaining) { $description = substr($description, 0, $remaining - 3) . '...'; } $link = $result['url'] ?? null; if ($link !== null) { $io->write('<href='.OutputFormatter::escape($link).'>'.$result['name'].'</>'. str_repeat(' ', $nameLength - strlen($result['name'])) . $warning . $description); } else { $io->write(str_pad($result['name'], $nameLength, ' ') . $warning . $description); } } } elseif ($format === 'json') { $io->write(JsonFile::encode($results)); } return 0; } }
<?php namespace Lrt\CMSBundle\DataFixtures\ORM; use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Lrt\CMSBundle\Entity\Article; use Lrt\SiteBundle\Entity\Activity; class LoadArticleData extends AbstractFixture implements OrderedFixtureInterface { public function load(ObjectManager $manager) { $this->manager = $manager; $user2 = $this->getReference('julien1'); $category = $this->getReference('category1'); /*$this->newArticle($category, 'Interview de jérémy et philippe sur le Marathon de Paris 2013', $user2, '<p class="p1"><span class="s1"><b>A</b></span> deux semaines de l&#39;&eacute;dition 2013 du marathon de Paris en course &agrave; pied, les deux pensionnaires du Longchamp Roller Team, J&eacute;r&eacute;my DUBOSC et Philippe CABON, se sont pr&ecirc;t&eacute;s au jeu de l&#39;interview et nous font part de leur approche de cette &eacute;preuve mythique &agrave; laquelle ils participeront. Souhaitons leur d&#39;atteindre leurs objectifs.</p> <p class="p2"><b>1.</b><span class="s2">&nbsp;&nbsp;</span><b>Est ce ton premier marathon en course a pied ?</b><span class="s3"><b>&nbsp;</b></span></p> <p class="p3"><b style="line-height: 1.6em;">Jeremy :</b><span style="line-height: 1.6em;"> Et non en Novembre 2011 j&rsquo;ai particip&eacute; au marathon&nbsp;</span><span style="line-height: 1.6em;">des Alpes Maritime (Nice-Cannes), une 1</span><span class="s4" style="line-height: 1.6em;"><sup>er</sup></span><span style="line-height: 1.6em;"> exp&eacute;rience&nbsp;</span><span style="line-height: 1.6em;">tr&egrave;s difficile et sans grande pr&eacute;paration la course&nbsp;</span><span style="line-height: 1.6em;">est vite devenue un enfer.</span></p> <p class="p1"><b>Philippe :</b> Oui, j&#39;ai d&eacute;j&agrave; fait plusieurs semi, mais jamais de Marathon</p> <p class="p6"><b>2. &nbsp;Quel est ton objectif ?</b><span class="s3"><b>&nbsp;</b></span></p> <p class="p3"><b style="line-height: 1.6em;">Jeremy :</b><span style="line-height: 1.6em;"> Je me suis lanc&eacute; le d&eacute;fi de ne pas d&eacute;passer&nbsp;</span><span style="line-height: 1.6em;">les 3h20 mais tout en gardant pour objectif de me&nbsp;</span><span style="line-height: 1.6em;">rapprocher au plus pr&ecirc;t des 3h00.</span></p> <p class="p1"><span class="s5"><b>Philippe :</b> </span>Je me suis entra&icirc;n&eacute; pour 3h45&nbsp;<span style="line-height: 1.6em;">mais je n&#39;ai aucune r&eacute;f&eacute;rence, donc on verra !</span></p> <p class="p8"><b>3. &nbsp;Quel a &eacute;t&eacute; ton programme d&#39;entra&icirc;nement ?</b><span class="s6"><b>&nbsp;</b></span></p> <p class="p3"><b style="line-height: 1.6em;">Jeremy :</b><span style="line-height: 1.6em;"> J&rsquo;ai commenc&eacute; ma pr&eacute;paration il y &agrave; 11 semaines,&nbsp;</span><span style="line-height: 1.6em;">&agrave; raison de 5 entrainements par semaine m&eacute;langeant&nbsp;</span><span style="line-height: 1.6em;">s&eacute;ances de fractionn&eacute; et sorties longues sans oublier&nbsp;</span><span style="line-height: 1.6em;">les sorties de r&eacute;cup&eacute;ration active.&nbsp;</span></p> <p class="p1"><b>Philippe </b>: 13 semaines d&#39;entra&icirc;nement avec 4 s&eacute;ances&nbsp;<span style="line-height: 1.6em;">par semaine dont 1 s&eacute;ance longue (jusqu&#39;&agrave; 2h30)&nbsp;</span><span style="line-height: 1.6em;">et 1 s&eacute;ance de fractionn&eacute;e</span></p> <p class="p6"><b>4. &nbsp;Comment as tu g&eacute;r&eacute; la transition roller / CAP ?</b><span class="s3"><b>&nbsp;</b></span></p> <p class="p1"><b>Jeremy :</b> La transition entre le Roller et la course &agrave; pieds fut&nbsp;<span style="line-height: 1.6em;">relativement facile, mais je pense qu&rsquo;elle sera beaucoup&nbsp;</span><span style="line-height: 1.6em;">plus dure dans l&rsquo;autre sens vu que j&rsquo;ai pr&eacute;f&eacute;r&eacute; couper compl&egrave;tement</span><span style="line-height: 1.6em;">ma pr&eacute;paration en roller pour pouvoir me consacrer au maximum&nbsp;</span><span style="line-height: 1.6em;">sur le marathon de Paris.</span></p> <p class="p1"><b>Philippe :</b> Naturellement car l&#39;hiver est plus propice &agrave; la CAP,&nbsp;<span style="line-height: 1.6em;">par contre l&#39;inverse va &ecirc;tre dur car on reprend la saison roller&nbsp;</span><span style="line-height: 1.6em;">tr&egrave;s rapidement apr&egrave;s le marathon</span></p> <p class="p6"><b>5. &nbsp;Quelle sera la bande son de ton &eacute;preuve ?&nbsp;</b></p> <p class="p3"><b style="line-height: 1.6em;">Jeremy :</b><span style="line-height: 1.6em;"> Pour l&rsquo;instant je ne les pas encore pr&eacute;par&eacute;e,&nbsp;</span><span style="line-height: 1.6em;">&agrave; 15 jours de l&rsquo;&eacute;preuve j&rsquo;&eacute;vite de me stresser&nbsp;</span><span style="line-height: 1.6em;">avec ce genre de petit d&eacute;tail mais elle sera orient&eacute;e&nbsp;</span><span style="line-height: 1.6em;">RAP US / Techno (Florida, David Guetta)</span></p> <p class="p1"><b>Philippe : </b>Assez vari&eacute;e, plut&ocirc;t soft au d&eacute;part (par exemple l&#39;album de Nneka)&nbsp;<span style="line-height: 1.6em;">puis plus rythm&eacute; (rap, electro)</span></p> <p class="p8"><b>6.&nbsp;Un dernier mot ?</b><span class="s7"><b>&nbsp;</b></span></p> <p class="p3"><b style="line-height: 1.6em;">Jeremy :</b><span style="line-height: 1.6em;"> Un grand merci &agrave; tous mes amis et famille&nbsp;</span><span style="line-height: 1.6em;">qui me soutiennent depuis plusieurs semaines dans ma pr&eacute;paration&nbsp;</span><span style="line-height: 1.6em;">en esp&eacute;rant leur faire honneur, alors rendez-vous le 7 Avril 2013 pour conclure.</span></p> <p class="p1"><b>Philippe :</b> Ravi de me confronter &agrave; ce nouveau challenge et de le faire&nbsp;<span style="line-height: 1.6em;">avec Jeremy (enfin presque parce on devrait pas beaucoup se voir !)&quot;</span></p>', Activity::IS_VALIDATED, new \DateTime('22-03-2013'), 'jeremy-marathon.png', 'uploads/articles/jeremy-marathon.png'); $this->newArticle($category, 'Les 3 pistes', $user2, '<p>Le week-end prochain aura lieu la 27&egrave;me &eacute;dition de l&#39;&eacute;preuve internationale &quot;LES 3 PISTES&quot; qui se d&eacute;roule sur 3 &eacute;tapes (Pibrac, Valence d&#39;Agen et Gujan Mestras). La formation LONGCHAMP ROLLER TEAM alignera pour l&#39;occasion 3 patineurs dans la cat&eacute;gorie nationale (Baptiste CHATAIGNIER, J&eacute;r&eacute;my DUBOSC et Julien MORELLE).</p> <p>L&#39;organisateur annonce l&#39;inscription de 800 patineurs parmi lesquels on pourra retrouver, outre les principaux clubs fran&ccedil;ais, &nbsp;des formations internationales prestigieuses (Etats Unis, Allemagne, Espagne, Portugal, Italie, Colombie, V&eacute;n&eacute;zuela...).</p> <p>Les courses seront &agrave; suivre en direct sur <a href="http://www.3pistes.com" target="_blank">www.3pistes.com</a></p> ', Activity::IS_VALIDATED, new \DateTime('25-03-2013'), '3-pistes.png', 'uploads/articles/3-pistes.png');*/ } protected function newArticle($category, $title, $user, $content, $valid, $date, $picture, $path) { $article = new Article(); $article->setCategory($category); $article->setTitle($title); $article->setContent($content); $article->setIsValid($valid); $article->setUser($user); $article->setDateSubmission($date); $article->setPicture($picture); $article->setPath($path); if ($valid === 0) { $article->setStatus(Article::DRAFTS); $article->setIsPublic(0); } else { $article->setStatus(Article::IMMEDIATE); $article->setIsPublic(1); } $this->manager->persist($article); $this->manager->flush(); } public function getOrder() { return 3; } }
@extends('layouts.app') @section('title', 'Tags') @section('content') <div class="container"> <div class="row"> <div class="col-md-6"> <h1>Daftar Tag</h1> </div> <div class="col-md-6"> @if (Auth::check()) <a href="/tags/create" class="btn btn-primary mb-2">Buat</a> @else <a href="/login" class="btn btn-primary mb-2">Login</a> @endif </div> </div> @if (session('berhasil')) <div class="row"> <div class="col-md-6"> <div class="alert alert-success alert-dismissible fade show" role="alert"> {{session('berhasil')}} <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> </div> </div> </div> @endif <div class="row d-flex justify-content-around text-center"> @foreach ($tags as $tag) <div class="col-lg-4 col-md-6 mb-3"> <div class="card" style="width: 18rem;"> @if ($tag->thumbnail) <img src="{{$tag->takeImage}}" class="card-img-top" alt=""> @endif <div class="card-body"> <h5 class="card-title">{{$tag->name}}</h5> <div class="text-secondary">Di tulis oleh : {{$tag->user->name}}</div> <div class="d-flex justify-content-around"> <a href="/tags/{{$tag->slug}}" class="btn btn-primary">List</a> @can('delete', $tag) <form action="/tags/{{$tag->slug}}" method="post"> @csrf @method('delete') <button type="submit" class="btn btn-danger" onclick="return confirm('yakin')">Hapus</button> </form> @endcan @can('update', $tag) <a href="/tags/{{$tag->slug}}/edit" class="btn btn-success">Edit</a> @endcan </div> </div> </div> </div> @endforeach </div> </div> @endsection
<?php session_start(); $_SESSION['page'] = "field-guide"; ?> <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- suitable for mobile devices--> <title>Field Guide</title> <link rel="stylesheet" href="creek.css"> <script src="node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script> <link href="https://fonts.googleapis.com/css?family=Dosis:200,300,400,500,600,700,800" rel="stylesheet"> <link rel="stylesheet" href="https://cdn.materialdesignicons.com/4.4.95/css/materialdesignicons.min.css"> <script src="node_modules/body-scroll-lock/lib/bodyScrollLock.js" charset="utf-8"></script> <style> /* :root { --grey: rgba(220,220,220, .6); } */ p { width: 75%; font-size: 24px; font-family: 'Dosis', sans-serif; display: inline-block; } .cont { width: 100%; text-align: center; } #intro { margin-bottom: 10px; margin-top: 80px; } .dropdown { background-color: white; padding-left: 3%; padding-right: 3%; padding-top: .2%; padding-bottom: .4%; width: 10%; display: inline-block; font-family: 'Dosis', sans-serif; font-size: 20px; border-radius: 3px; } .dropdown i { position: relative; top: 2px; font-size: 18pt; } .dropdown-item { background-color: white; padding-left: 3%; padding-right: 3%; padding-top: .2%; padding-bottom: .4%; width: 10%; display: inline-block; font-family: 'Dosis', sans-serif; font-size: 20px; border-radius: 3px; margin-top: .5%; } #fgdisplay { text-align: center; border-radius: 3px; width: 90%; margin-left: 5%; margin-top: 1.5%; margin-bottom: 1.5%; } .displaych { margin: 1%; text-align: left; } .displaych img { float: left; width: 35%; margin-right: 2%; } #speciesInfo p { display: block; width: 100%; margin-top: 0px; margin-bottom: 10px; } #fgtree { text-align: center; margin-bottom: 1.5%; background-color: var(--grey); display: inline-block; width: 100%; border-radius: 2px; box-shadow: 0px 3px 5px 4px #474747; } .card { display: inline-block; width: 200px; padding: 1%; background-color: var(--grey); border-radius: 3px; margin: 1%; cursor: pointer; } .card-image { display: inline-block; width: 100%; height: 200px; } .card-image img { display: inline-block; width: 100%; height: 100%; object-fit: cover; border-radius: 3px; } .card-text { width: 100%; display: inline-block; text-align: center; font-family: 'Dosis', sans-serif; font-size: 18pt; } /* .arrow { display: inline-block; font-size: 25pt; z-index: 0; } .arrow:hover { opacity: .4; cursor: pointer; } .arrow-disabled { opacity: .4; } */ .levels { font-weight: 600; } /* .mdi-arrow-left { margin-left: 30%; } .mdi-arrow-right { margin-right: 30%; } */ #fginfo { text-align: center; margin: 0px; width: 95%; margin-left: 2.5%; } .button:hover { text-decoration: underline; } @media (max-width: 768px) { #speciesInfo p { overflow-x: hidden; } h2 { font-size: 15pt; } .card-image { display: none; } .mdi-arrow-left { margin-left: 10%; } .mdi-arrow-right { margin-right: 10%; } /* .arrow { font-size: 20pt; margin-top: 10px; } */ #fgtree { padding: 0px; display: block; padding-bottom: 10px } #fgtree h2 { display: inline-block; margin-top: 10px; } .card-text { font-size: 15pt; } p { font-size: 13pt; } .displaych img { width: 100%; margin: 0%; float: left; margin-bottom: 10px; } #general-header { margin-top: 35px; } #fginfo { margin-bottom: 10px; } #speciesInfo p { margin-bottom: 0px; } .levels-margin-mobile { margin-bottom: 10px !important; } } </style> </head> <body> <image-gallery></image-gallery> <script> var currentFG = ""; </script> <?php include 'navbar.php'; ?> <h2 id="intro">Organisms at the Arroyo Del Valle!</h2> <p id="fginfo">Scroll down for more info about the current selection.</p> <div id="fgdisplay" class="cont"> <div id="fgtree"> <div class="displaych" style="text-align: center"> <!-- <i class="mdi mdi-arrow-left arrow arrow-disabled" style="float: left; position: relative"></i> <i class="mdi mdi-arrow-right arrow arrow-disabled" style="float: right; position: relative"></i> --> <h2 style="margin-bottom: 10px">Phylogenetic Tree</h2> </div> </div> <div class="displaych" id="main-display-area"> <h2 id="general-header"></h2> <img id="general-image" src="" alt="image"> <div id='speciesInfo'> <p id="kingdom" class="levels"></p> <p id="phylum" class="levels"></p> <p id="class" class="levels"></p> <p id="order" class="levels"></p> <p id="family" class="levels"></p> <p id="genus" class="levels"></p> <p id="species" class="levels"></p> <p id='genInfo'></p> </div> <div style="clear: both"></div> </div> </div> <script src="js/pathmaker.js" charset="utf-8"></script> <script> var pathMaker = new pathmaker(); function setCardProperty(path) { for (let card of document.getElementsByClassName("card")) { card.addEventListener("click", () => { let header; for (let child of card.children) { if (child.classList.contains("card-text")) { header = child.innerText.trim(); path = path.replace(/ /g, "_"); header = header.replace(/ /g, "_"); break; } } changeContent(path, header, false, true); }); } } function changeContent(path, header, back, setHistory, callback) { fetch(`field-guide${path}/${header}/main.json`).then(function(response) { return response.json(); }).then((json) => { //url and history injection var urlPath = `${path}/${header}`; //document.querySelector("#fgtree h2").innerText = `Home${pathMaker.getCurrentConvertedPath()}`; if (json["organism"] != null) { if (setHistory) window.history.pushState(urlPath, urlPath, `?p=${path}&o=${header}`); //console.log("organism"); newIms(); var levels = document.querySelectorAll(".levels"); for (var element of levels) { element.classList.add("levels-margin-mobile"); } if (json.kingdom != null) { document.getElementById("kingdom").innerText = "Kingdom: " + json.kingdom; } if (json.phylum != null) { document.getElementById("phylum").innerText = "Phylum: " + json.phylum; } if (json.class != null) { document.getElementById("class").innerText = "Class: " + json.class; } if (json.order != null) { document.getElementById("order").innerText = "Order: " + json.order; } if (json.family != null) { document.getElementById("family").innerText = "Family: " + json.family; } if (json.genus != null) { document.getElementById("genus").innerText = "Genus: " + json.genus; } if (json.species != null) { document.getElementById("species").innerText = "Species: " + json.species; } document.getElementById("genInfo").innerText = json.text; document.getElementById("general-image").src = json.image; document.getElementById("general-header").innerText = json.name; var displayArea = document.getElementById("main-display-area"); window.scrollTo(0, displayArea.offsetTop - parseInt(window.getComputedStyle(document.getElementById("navbar")).getPropertyValue("height")) - 20); var fgPath = `Home/${pathMaker.getCurrentPath()}/**${header}` } else { var levels = document.querySelectorAll(".levels"); let name = json.name.replace(/ /g, "_"); for (var element of levels) { element.classList.remove("levels-margin-mobile"); } if (setHistory) window.history.pushState(urlPath, urlPath, `?p=${urlPath}`); if (back) { pathMaker.backCounter = 0; } pathMaker.changePath(json.level, name); displayCards(json); var fgPath = `Home/${pathMaker.getCurrentPath()}` } //path buttons var headerOfTree = document.querySelector("#fgtree h2"); headerOfTree.innerHTML = ""; fgPath = fgPath.split("/"); console.log(fgPath); for (var i = 0; i < fgPath.length; i++) { let button = document.createElement("a"); let separator = document.createElement("i"); separator.style.marginLeft = "5px"; separator.style.marginRight = "5px"; separator.classList.add("mdi", "mdi-arrow-right-thick"); button.style.cursor = "pointer"; button.innerText = fgPath[i].replace(/_/g, " ").replace(/\*\*/, ""); let pathOfButton = ""; let optionalHeader = "" for (var e = 1; e <= i; e++) { if (fgPath[e].substring(0, 2) != "**") { pathOfButton += `${fgPath[e]}/`; } else { optionalHeader = fgPath[e].substring(2); } } button.onclick = function() { changeContent(pathOfButton, optionalHeader, false, true); } if (button.innerText.trim() != "" && i != 0) { headerOfTree.appendChild(separator); } headerOfTree.appendChild(button); } }).finally(function() { if (callback) callback(); }) } function displayCards(json) { //display organisms/category cards //document.querySelector("#fgtree h2").innerText = `Home${pathMaker.getCurrentConvertedPath()}`; //alert(pathMaker.getCurrentPath()); while (document.getElementsByClassName("card").length != 0) { for (let olditem of document.getElementsByClassName("card")) { olditem.remove(); } } for (let item of json["folders"]) { let card = document.createElement("div"); card.classList.add("card"); let imageDiv = document.createElement("div"); imageDiv.classList.add("card-image"); let image = document.createElement("img"); //console.log(item[1]); image.src = item[1]; image.classList.add("gallery-exception"); let textDiv = document.createElement("div"); textDiv.classList.add("card-text"); let itemInstance = item[0]; itemInstance = itemInstance.replace(/_/g, " "); textDiv.innerText = itemInstance; imageDiv.appendChild(image); card.appendChild(imageDiv); card.appendChild(textDiv); document.getElementsByClassName("displaych")[0].appendChild(card); } setCardProperty(pathMaker.getCurrentPath()); newIms(); document.getElementById("kingdom").innerText = ""; document.getElementById("phylum").innerText = ""; document.getElementById("class").innerText = ""; document.getElementById("order").innerText = ""; document.getElementById("family").innerText = ""; document.getElementById("genus").innerText = ""; document.getElementById("species").innerText = ""; document.getElementById("genInfo").innerText = json.text; document.getElementById("general-image").src = json.image; document.getElementById("general-header").innerText = json.name; } // document.querySelector(".mdi-arrow-left").addEventListener("click", function() { //back button // let path = pathMaker.getBackwardPath(); // if (path !== null) { // changeContent(path, "", true, true); // } // }); </script> <script src="js/customurlFG.js" charset="utf-8"></script> <!-- This starts off the home page and handles custom urls --> <script src="js/gallery.js" charset="utf-8"></script> <footer> <div id="creekwatch-footer"> <img class="gallery-exception" src="images/avweb.png" alt="hi"> <script> var avlogo = document.querySelector("#creekwatch-footer img"); avlogo.onclick = function() { window.open("https://amadorweb.org", '_blank'); } </script> <p>© AV Web Development</p> </div> <ul> <h4>Sections</h4> <li><a href="index.php">Home</a></li> <li><a href="studysites.php">Study Sites</a></li> <li><a href="data.php">Data</a></li> <li><a href="fieldguide.php">Field Guide</a></li> </ul> <ul> <h4>Other Links</h4> <li><a href="index.php#im2">File Downloads</a></li> <li><a href="fieldguide.php?p=/Endangered_Species">Endangered Species</a></li> <li><a href="fieldguide.php?p=/Indicator_Species">Indicator Species</a></li> </ul> <!-- <div id="contact-footer"> <p><a>Contact Teachers</a></p> <p><a>Contact Development Team</a></p> <p><a>Want to make a change to the website?</a></p> </div> --> <ul> <h4>Contact</h4> <li><a href="">Contact Teachers</a></li> <li><a href="">Contact Development Team</a></li> <li><a href="">Want to make a change to the website?</a></li> </ul> </footer> </body> </html>
<!DOCTYPE html> <html> <head> <title>Welcome</title> <link rel="stylesheet" href="https://cdn.rawgit.com/Chalarangelo/mini.css/v3.0.1/dist/mini-default.min.css"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> body { margin-top: 10%; } #list { margin-left: 30%; } main { text-align: center; } </style> </head> <body> <main> <h1>educhamp Mathematics Assessment Test</h1><br> <a class="button tertiary" href="<?php echo base_url();?>index.php/questions/display_quiz">Start Test</a> <a class="button secondary" href="<?php echo base_url();?>index.php/logged_in/logout">Logout</a> </main><br> <ul id="list"> <li>The test consists of 20 questions.</li> <li>Each question carries 1 mark.</li> <li>You have 20 minutes to solve the test.</li> <li>After 20 minutes. The test will be auto-submitted.</li> <li>Your Scores will be displayed after the test.</li> </ul> </body> </html>
<?php namespace App; use Illuminate\Database\Eloquent\Model; class Blog extends Model { protected $fillable = [ 'title', 'body','bio', ]; public function user() { return $this->belongsTo('App\User'); } public function articles() { return $this->hasMany('App\Article'); } }
<?php namespace BinSoul\Net\Mqtt\Client\React; use BinSoul\Net\Mqtt\Connection; use BinSoul\Net\Mqtt\DefaultConnection; use BinSoul\Net\Mqtt\DefaultIdentifierGenerator; use BinSoul\Net\Mqtt\Flow; use BinSoul\Net\Mqtt\Flow\IncomingPublishFlow; use BinSoul\Net\Mqtt\Flow\OutgoingConnectFlow; use BinSoul\Net\Mqtt\Flow\OutgoingDisconnectFlow; use BinSoul\Net\Mqtt\Flow\OutgoingPingFlow; use BinSoul\Net\Mqtt\Flow\OutgoingPublishFlow; use BinSoul\Net\Mqtt\Flow\OutgoingSubscribeFlow; use BinSoul\Net\Mqtt\Flow\OutgoingUnsubscribeFlow; use BinSoul\Net\Mqtt\DefaultMessage; use BinSoul\Net\Mqtt\IdentifierGenerator; use BinSoul\Net\Mqtt\Message; use BinSoul\Net\Mqtt\Packet; use BinSoul\Net\Mqtt\Packet\PublishRequestPacket; use BinSoul\Net\Mqtt\StreamParser; use BinSoul\Net\Mqtt\Subscription; use Evenement\EventEmitter; use React\EventLoop\Timer\TimerInterface; use React\Promise\Deferred; use React\EventLoop\LoopInterface; use React\Promise\ExtendedPromiseInterface; use React\Promise\RejectedPromise; use React\Socket\ConnectorInterface; use React\Stream\DuplexStreamInterface; /** * Connects to a MQTT broker and subscribes to topics or publishes messages. * * The following events are emitted: * - open - The network connection to the server is established. * - close - The network connection to the server is closed. * - warning - An event of severity "warning" occurred. * - error - An event of severity "error" occurred. * * If a flow finishes it's result is also emitted, e.g.: * - connect - The client connected to the broker. * - disconnect - The client disconnected from the broker. * - subscribe - The client subscribed to a topic filter. * - unsubscribe - The client unsubscribed from topic filter. * - publish - A message was published. * - message - A message was received. */ class ReactMqttClient extends EventEmitter { /** @var ConnectorInterface */ private $connector; /** @var LoopInterface */ private $loop; /** @var DuplexStreamInterface */ private $stream; /** @var StreamParser */ private $parser; /** @var IdentifierGenerator */ private $identifierGenerator; /** @var string */ private $host; /** @var int */ private $port; /** @var Connection */ private $connection; /** @var bool */ private $isConnected = false; /** @var bool */ private $isConnecting = false; /** @var bool */ private $isDisconnecting = false; /** @var TimerInterface[] */ private $timer = []; /** @var ReactFlow[] */ private $receivingFlows = []; /** @var ReactFlow[] */ private $sendingFlows = []; /** @var ReactFlow */ private $writtenFlow; /** * Constructs an instance of this class. * * @param ConnectorInterface $connector * @param LoopInterface $loop * @param IdentifierGenerator $identifierGenerator * @param StreamParser $parser */ public function __construct( ConnectorInterface $connector, LoopInterface $loop, IdentifierGenerator $identifierGenerator = null, StreamParser $parser = null ) { $this->connector = $connector; $this->loop = $loop; $this->parser = $parser; if ($this->parser === null) { $this->parser = new StreamParser(); } $this->parser->onError(function (\Exception $e) { $this->emitWarning($e); }); $this->identifierGenerator = $identifierGenerator; if ($this->identifierGenerator === null) { $this->identifierGenerator = new DefaultIdentifierGenerator(); } } /** * Return the host. * * @return string */ public function getHost() { return $this->host; } /** * Return the port. * * @return string */ public function getPort() { return $this->port; } /** * Indicates if the client is connected. * * @return bool */ public function isConnected() { return $this->isConnected; } /** * Returns the underlying stream or null if the client is not connected. * * @return DuplexStreamInterface|null */ public function getStream() { return $this->stream; } /** * Connects to a broker. * * @param string $host * @param int $port * @param Connection $connection * @param int $timeout * * @return ExtendedPromiseInterface */ public function connect($host, $port = 1883, Connection $connection = null, $timeout = 5) { if ($this->isConnected || $this->isConnecting) { return new RejectedPromise(new \LogicException('The client is already connected.')); } $this->isConnecting = true; $this->isConnected = false; $this->host = $host; $this->port = $port; if ($connection === null) { $connection = new DefaultConnection(); } if ($connection->isCleanSession()) { $this->cleanPreviousSession(); } if ($connection->getClientID() === '') { $connection = $connection->withClientID($this->identifierGenerator->generateClientID()); } $deferred = new Deferred(); $this->establishConnection($this->host, $this->port, $timeout) ->then(function (DuplexStreamInterface $stream) use ($connection, $deferred, $timeout) { $this->stream = $stream; $this->emit('open', [$connection, $this]); $this->registerClient($connection, $timeout) ->then(function (Connection $connection) use ($deferred) { $this->isConnecting = false; $this->isConnected = true; $this->connection = $connection; $this->emit('connect', [$connection, $this]); $deferred->resolve($this->connection); }) ->otherwise(function (\Exception $e) use ($deferred, $connection) { $this->isConnecting = false; $this->emitError($e); $deferred->reject($e); if ($this->stream !== null) { $this->stream->close(); } $this->emit('close', [$connection, $this]); }); }) ->otherwise(function (\Exception $e) use ($deferred) { $this->isConnecting = false; $this->emitError($e); $deferred->reject($e); }); return $deferred->promise(); } /** * Disconnects from a broker. * * @return ExtendedPromiseInterface */ public function disconnect() { if (!$this->isConnected || $this->isDisconnecting) { return new RejectedPromise(new \LogicException('The client is not connected.')); } $this->isDisconnecting = true; $deferred = new Deferred(); $this->startFlow(new OutgoingDisconnectFlow($this->connection), true) ->then(function (Connection $connection) use ($deferred) { $this->isDisconnecting = false; $this->isConnected = false; $this->emit('disconnect', [$connection, $this]); $deferred->resolve($connection); if ($this->stream !== null) { $this->stream->close(); } }) ->otherwise(function () use ($deferred) { $this->isDisconnecting = false; $deferred->reject($this->connection); }); return $deferred->promise(); } /** * Subscribes to a topic filter. * * @param Subscription $subscription * * @return ExtendedPromiseInterface */ public function subscribe(Subscription $subscription) { if (!$this->isConnected) { return new RejectedPromise(new \LogicException('The client is not connected.')); } return $this->startFlow(new OutgoingSubscribeFlow([$subscription], $this->identifierGenerator)); } /** * Unsubscribes from a topic filter. * * @param Subscription $subscription * * @return ExtendedPromiseInterface */ public function unsubscribe(Subscription $subscription) { if (!$this->isConnected) { return new RejectedPromise(new \LogicException('The client is not connected.')); } return $this->startFlow(new OutgoingUnsubscribeFlow([$subscription], $this->identifierGenerator)); } /** * Publishes a message. * * @param Message $message * * @return ExtendedPromiseInterface */ public function publish(Message $message) { if (!$this->isConnected) { return new RejectedPromise(new \LogicException('The client is not connected.')); } return $this->startFlow(new OutgoingPublishFlow($message, $this->identifierGenerator)); } /** * Calls the given generator periodically and publishes the return value. * * @param int $interval * @param Message $message * @param callable $generator * * @return ExtendedPromiseInterface */ public function publishPeriodically($interval, Message $message, callable $generator) { if (!$this->isConnected) { return new RejectedPromise(new \LogicException('The client is not connected.')); } $deferred = new Deferred(); $this->timer[] = $this->loop->addPeriodicTimer( $interval, function () use ($message, $generator, $deferred) { $this->publish($message->withPayload($generator($message->getTopic())))->then( function ($value) use ($deferred) { $deferred->notify($value); }, function (\Exception $e) use ($deferred) { $deferred->reject($e); } ); } ); return $deferred->promise(); } /** * Emits warnings. * * @param \Exception $e */ private function emitWarning(\Exception $e) { $this->emit('warning', [$e, $this]); } /** * Emits errors. * * @param \Exception $e */ private function emitError(\Exception $e) { $this->emit('error', [$e, $this]); } /** * Establishes a network connection to a server. * * @param string $host * @param int $port * @param int $timeout * * @return ExtendedPromiseInterface */ private function establishConnection($host, $port, $timeout) { $deferred = new Deferred(); $timer = $this->loop->addTimer( $timeout, function () use ($deferred, $timeout) { $exception = new \RuntimeException(sprintf('Connection timed out after %d seconds.', $timeout)); $deferred->reject($exception); } ); $this->connector->connect($host.':'.$port) ->always(function () use ($timer) { $this->loop->cancelTimer($timer); }) ->then(function (DuplexStreamInterface $stream) use ($deferred) { $stream->on('data', function ($data) { $this->handleReceive($data); }); $stream->on('close', function () { $this->handleClose(); }); $stream->on('error', function (\Exception $e) { $this->handleError($e); }); $deferred->resolve($stream); }) ->otherwise(function (\Exception $e) use ($deferred) { $deferred->reject($e); }); return $deferred->promise(); } /** * Registers a new client with the broker. * * @param Connection $connection * @param int $timeout * * @return ExtendedPromiseInterface */ private function registerClient(Connection $connection, $timeout) { $deferred = new Deferred(); $responseTimer = $this->loop->addTimer( $timeout, function () use ($deferred, $timeout) { $exception = new \RuntimeException(sprintf('No response after %d seconds.', $timeout)); $deferred->reject($exception); } ); $this->startFlow(new OutgoingConnectFlow($connection, $this->identifierGenerator), true) ->always(function () use ($responseTimer) { $this->loop->cancelTimer($responseTimer); })->then(function (Connection $connection) use ($deferred) { $this->timer[] = $this->loop->addPeriodicTimer( floor($connection->getKeepAlive() * 0.75), function () { $this->startFlow(new OutgoingPingFlow()); } ); $deferred->resolve($connection); })->otherwise(function (\Exception $e) use ($deferred) { $deferred->reject($e); }); return $deferred->promise(); } /** * Handles incoming data. * * @param string $data */ private function handleReceive($data) { if (!$this->isConnected && !$this->isConnecting) { return; } $flowCount = count($this->receivingFlows); $packets = $this->parser->push($data); foreach ($packets as $packet) { $this->handlePacket($packet); } if ($flowCount > count($this->receivingFlows)) { $this->receivingFlows = array_values($this->receivingFlows); } $this->handleSend(); } /** * Handles an incoming packet. * * @param Packet $packet */ private function handlePacket(Packet $packet) { switch ($packet->getPacketType()) { case Packet::TYPE_PUBLISH: /* @var PublishRequestPacket $packet */ $message = new DefaultMessage( $packet->getTopic(), $packet->getPayload(), $packet->getQosLevel(), $packet->isRetained(), $packet->isDuplicate() ); $this->startFlow(new IncomingPublishFlow($message, $packet->getIdentifier())); break; case Packet::TYPE_CONNACK: case Packet::TYPE_PINGRESP: case Packet::TYPE_SUBACK: case Packet::TYPE_UNSUBACK: case Packet::TYPE_PUBREL: case Packet::TYPE_PUBACK: case Packet::TYPE_PUBREC: case Packet::TYPE_PUBCOMP: $flowFound = false; foreach ($this->receivingFlows as $index => $flow) { if ($flow->accept($packet)) { $flowFound = true; unset($this->receivingFlows[$index]); $this->continueFlow($flow, $packet); break; } } if (!$flowFound) { $this->emitWarning( new \LogicException(sprintf('Received unexpected packet of type %d.', $packet->getPacketType())) ); } break; default: $this->emitWarning( new \LogicException(sprintf('Cannot handle packet of type %d.', $packet->getPacketType())) ); } } /** * Handles outgoing packets. */ private function handleSend() { $flow = null; if ($this->writtenFlow !== null) { $flow = $this->writtenFlow; $this->writtenFlow = null; } if (count($this->sendingFlows) > 0) { $this->writtenFlow = array_shift($this->sendingFlows); $this->stream->write($this->writtenFlow->getPacket()); } if ($flow !== null) { if ($flow->isFinished()) { $this->loop->nextTick(function () use ($flow) { $this->finishFlow($flow); }); } else { $this->receivingFlows[] = $flow; } } } /** * Handles closing of the stream. */ private function handleClose() { foreach ($this->timer as $timer) { $this->loop->cancelTimer($timer); } $this->timer = []; $connection = $this->connection; $this->isConnecting = false; $this->isDisconnecting = false; $this->isConnected = false; $this->connection = null; $this->stream = null; if ($connection !== null) { $this->emit('close', [$connection, $this]); } } /** * Handles errors of the stream. * * @param \Exception $e */ private function handleError(\Exception $e) { $this->emitError($e); } /** * Starts the given flow. * * @param Flow $flow * @param bool $isSilent * * @return ExtendedPromiseInterface */ private function startFlow(Flow $flow, $isSilent = false) { try { $packet = $flow->start(); } catch (\Exception $e) { $this->emitError($e); return new RejectedPromise($e); } $deferred = new Deferred(); $internalFlow = new ReactFlow($flow, $deferred, $packet, $isSilent); if ($packet !== null) { if ($this->writtenFlow !== null) { $this->sendingFlows[] = $internalFlow; } else { $this->stream->write($packet); $this->writtenFlow = $internalFlow; $this->handleSend(); } } else { $this->loop->nextTick(function () use ($internalFlow) { $this->finishFlow($internalFlow); }); } return $deferred->promise(); } /** * Continues the given flow. * * @param ReactFlow $flow * @param Packet $packet */ private function continueFlow(ReactFlow $flow, Packet $packet) { try { $response = $flow->next($packet); } catch (\Exception $e) { $this->emitError($e); return; } if ($response !== null) { if ($this->writtenFlow !== null) { $this->sendingFlows[] = $flow; } else { $this->stream->write($response); $this->writtenFlow = $flow; $this->handleSend(); } } elseif ($flow->isFinished()) { $this->loop->nextTick(function () use ($flow) { $this->finishFlow($flow); }); } } /** * Finishes the given flow. * * @param ReactFlow $flow */ private function finishFlow(ReactFlow $flow) { if ($flow->isSuccess()) { if (!$flow->isSilent()) { $this->emit($flow->getCode(), [$flow->getResult(), $this]); } $flow->getDeferred()->resolve($flow->getResult()); } else { $result = new \RuntimeException($flow->getErrorMessage()); $this->emitWarning($result); $flow->getDeferred()->reject($result); } } /** * Cleans previous session by rejecting all pending flows. */ private function cleanPreviousSession() { $error = new \RuntimeException('Connection has been closed.'); foreach ($this->receivingFlows as $receivingFlow) { $receivingFlow->getDeferred()->reject($error); } foreach ($this->sendingFlows as $sendingFlow) { $sendingFlow->getDeferred()->reject($error); } $this->receivingFlows = []; $this->sendingFlows = []; } }
<div class="col-12 mt-4 profil-detail box-camp" id="profil-data"> <div class="p-3"> <h3>Data Diri</h3> </div> <div class="mt-3 p-3"> <form id="form-data-diri" action="<?php echo site_url();?>/action/update-data" method="post"> <input type="hidden" value="<?php echo $this->security->get_csrf_hash();?>" name="<?php echo $this->security->get_csrf_token_name();?>"> <div class="form-group row"> <div class="col-3 pt-3"> Nama Depan </div> <div class="col-9"> <input class="form-control input-camp-violet" value="<?php echo $this->LSession->user()['first_name'];?>" name="first_name" type="text" data-parsley-required> </div> </div> <div class="form-group row"> <div class="col-3 pt-3"> Nama Belakang </div> <div class="col-9"> <input class="form-control input-camp-violet" value="<?php echo $this->LSession->user()['last_name'];?>" name="last_name" type="text" data-parsley-required> </div> </div> <div class="form-group row"> <div class="col-3 pt-3"> Email </div> <div class="col-9"> <input class="form-control input-camp-violet" value="<?php echo $this->LSession->user()['email'];?>" name="email" type="text" data-parsley-type="email" data-parsley-required> </div> </div> <div class="form-group row"> <div class="col-3 pt-3"> No Telp </div> <div class="col-9"> <input class="form-control input-camp-violet" value="<?php echo $this->LSession->user()['phone'];?>" name="phone" type="text" data-parsley-type="number" data-parsley-required> </div> </div> <div class="form-group row"> <div class="col-3 pt-3"> Alamat </div> <div class="col-9"> <textarea class="form-control textarea-camp-violet" name="address" data-parsley-required><?php echo $this->LSession->user()['address'];?></textarea> </div> </div> <div class="form-group row"> <div class="col-3 pt-3"> Jenis Kelamin </div> <div class="col-9 pt-2"> <?php if($this->LSession->user()['gender'] == 'male'){ ?> <b>Laki-Laki</b> <?php }else{ ?> <b>Perempuan</b> <?php } ?> </div> </div> <div class="form-group row"> <div class="col-3 pt-3"> Password Konfirmasi </div> <div class="col-9"> <input class="form-control input-camp-violet" name="password" type="password" data-parsley-minlength="8" data-parsley-required> </div> </div> <div> <button class="btn btn-violet no-border box-button-camp text-light" id="button-data-diri"> <i class="fab fa-telegram-plane"></i> Kirim </button> </div> </form> </div> </div>
<?php namespace Users\UserBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; /** * This is the class that validates and merges configuration from your app/config files * * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} */ class Configuration implements ConfigurationInterface { /** * {@inheritDoc} */ public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('users_user'); // Here you should define the parameters that are allowed to // configure your bundle. See the documentation linked above for // more information on that topic. return $treeBuilder; } }
<?php namespace app\models; use Yii; use yii\db\ActiveRecord; use yii\helpers\ArrayHelper; class Order_of_Route extends ActiveRecord { public function rules() { return [ [['id_route','id_shop','NPP'],'required','message'=>'Данное поле должно быть заполнено'] ]; } public static function tableName() { return 'order_of_route'; // TODO: Change the autogenerated stub } public function attributeLabels() { return [ 'id_route'=>'Название маршрута', 'id_shop'=>'Название точки продаж', 'NPP'=>'Очередность в маршруте' ]; } public function getShop_name() { $name=(Entity::find()->where(['id'=>(Shop::find()->where(['id'=>$this->id_shop])->one())->id_entity])->one())->name." ".(Shop::find()->where(['id'=>$this->id_shop])->one())->address." ".(Shop::find()->where(['id'=>$this->id_shop])->one())->name; return $name ; } public static function getShops_for_route($id_route) { $all_shops=ArrayHelper::map(Shop::find()->where(['deleted'=>0])->all(),'id','name'); foreach ($all_shops as $key=>$shop) { $all_shops[$key]=(Entity::find()->where(['id'=>(Shop::find()->where(['id'=>$key])->one())->id_entity])->one())->name." ".(Shop::find()->where(['id'=>$key])->one())->address; } $all_using_shops=Order_of_Route::find()->where(['and',['deleted'=>0,'id_route'=>$id_route]])->select('id_shop')->asArray()->column(); foreach ($all_using_shops as $all_using_shop) { unset($all_shops[$all_using_shop]); } return $all_shops; } }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="author" content="ScriptsBundle"> <title>Scubbi Diving Portal</title> <!--link rel="icon" href="images/favicon.ico" type="image/x-icon" /--> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"> <!-- BOOTSTRAPE STYLESHEET CSS FILES --> <link rel="stylesheet" href="<?php echo base_url('assets/css/datepicker.css');?>"> <link rel="stylesheet" href="<?php echo base_url('assets/css/daterangepicker.css');?>"> <link href='http://fonts.googleapis.com/css?family=Cookie' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="<?php echo base_url('assets/frontend/css/bootstrap.min.css'); ?>"> <!-- JQUERY SELECT --> <link href="<?php echo base_url('assets/frontend/css/select2.min.css'); ?>" rel="stylesheet" /> <!-- JQUERY MENU --> <link rel="stylesheet" href="<?php echo base_url('assets/frontend/css/bootstrap-dropdownhover.css'); ?>"> <!-- ANIMATION --> <link rel="stylesheet" href="<?php echo base_url('assets/frontend/css/animate.min.css'); ?>"> <!-- OWl CAROUSEL--> <link rel="stylesheet" href="<?php echo base_url('assets/frontend/css/owl.carousel.css'); ?>"> <link rel="stylesheet" href="<?php echo base_url('assets/frontend/css/owl.style.css'); ?>"> <!-- TEMPLATE CORE CSS --> <link rel="stylesheet" href="<?php echo base_url('assets/frontend/css/style.css'); ?>"> <!-- MOBILE MENU CSS --> <link href="<?php echo base_url('assets/frontend/css/meanmenu.min.css'); ?>" rel="stylesheet"> <!-- FONT AWESOME --> <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/frontend/css/font-awesome.min.css'); ?>"> <link rel="stylesheet" href="<?php echo base_url('assets/frontend/css/et-line-fonts.css'); ?>" type="text/css"> <link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/frontend/fonts/classified/flaticon.css'); ?>"> <!-- MASTER SLIDER --> <link rel="stylesheet" href="<?php echo base_url('assets/frontend/masterslider/css/masterslider.css'); ?>" /> <link href="<?php echo base_url('assets/frontend/masterslider/css/style.css'); ?>" rel='stylesheet' type='text/css'> <link rel="stylesheet" href="<?php echo base_url('assets/frontend/masterslider/css/layer-style.css'); ?>"> <link href="<?php echo base_url('assets/frontend/masterslider/css/ms-staff-style.css'); ?>" rel='stylesheet' type='text/css'> <!-- Google Fonts --> <link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,900%7cOpen+Sans:400,600,700" rel="stylesheet" type="text/css"> <link href="<?php echo base_url('assets/frontend/css/nouislider.min.css'); ?>" rel="stylesheet"> <!-- Theme Color --> <link rel="stylesheet" id="color" href="<?php echo base_url('assets/frontend/css/colors/defualt.css'); ?>"> <!-- For Style Switcher --> <link rel="stylesheet" id="theme-color" type="text/css" href="#" /> <!-- JavaScripts --> <script src="<?php echo base_url('assets/frontend/js/modernizr.js'); ?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/frontend/js/jquery-3.1.1.min.js'); ?>"></script> <!-- BOOTSTRAP CORE JS --> <script type="text/javascript" src="<?php echo base_url('assets/frontend/js/bootstrap.min.js'); ?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/bootstrap-datepicker.js');?>"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> <!-- <link type="text/css" href="<?php echo base_url('assets/frontend/assert/gentleSelect/jquery-gentleSelect.css');?>" rel="stylesheet" /> <script type="text/javascript" src="<?php echo base_url('assets/frontend/assert/gentleSelect/jquery-gentleSelect.js');?>"></script> --> <link href="<?php echo base_url('assets/frontend/daterange/css/datepicker.css');?>" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="<?php echo base_url('assets/frontend/daterange/js/datepicker.js');?>"></script> <!-- ############################# path: assets/jQuery_Date_Range_Picker #######################################################################--> <link rel="stylesheet" href="<?php echo base_url(); ?>assets/jQuery_Date_Range_Picker/font-awesome.min.css" /> <link rel="stylesheet" href="<?php echo base_url(); ?>assets/jQuery_Date_Range_Picker/daterangepicker.min.css" /> <script src="<?php echo base_url(); ?>assets/jQuery_Date_Range_Picker/jquery.min.js" type="text/javascript"></script> <script src="<?php echo base_url(); ?>assets/jQuery_Date_Range_Picker/moment.min.js" type="text/javascript"></script> <script src="<?php echo base_url(); ?>assets/jQuery_Date_Range_Picker/jquery.daterangepicker.min.js"></script> <script src="<?php echo base_url(); ?>assets/jQuery_Date_Range_Picker/demo.js"></script> <!-- ############################# path: assets/jQuery_Date_Range_Picker #######################################################################--> </head> <body> <header class="index4-header"> <a class="navbar-brand visible-xs" id="navbar-logo-mobile" href=""><img src="<?php echo base_url(); ?>assets/images/logo-new-chrcle-small.jpg" alt="" class="img-responsive"></a> <a href="" class=" visible-xs " style=" font: 400 30px/0.8 'Cookie', Helvetica, sans-serif; padding:30px 15px;">Connecting Drivers Globally </a> <nav class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header col-md-5"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" id="navbar-logo" href="<?php echo base_url(); ?>"> <img src="<?php echo base_url(); ?>assets/images/logo-new-chrcle-small.jpg" alt="" class="img-responsive"></a> <div style=" font: 400 30px/0.8 'Cookie', Helvetica, sans-serif; padding:30px 15px;margin-top: 13px;">Connecting Drivers Globally</div> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1" data-hover="dropdown" data-animations="fadeInDown fadeInRight fadeInUp fadeInLeft"> <ul class="nav navbar-nav navbar-right" id="menu-right"> <li> <a href="" >Become a Partner </a> </li> <li> <a href="" >Help</a> </li> <li> <div class="dropdown"> <img src="<?php echo base_url('upload/1483346768735.png');?>" data-toggle="dropdown" style="width: 50px; height: 50px;margin:20px 0 0 0;"> <ul class="dropdown-menu" role="menu" aria-labelledby="menu1"> <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Profile</a></li> <li role="presentation"><a role="menuitem" tabindex="-1" href="<?php echo base_url('Customer/logout'); ?>">Logout</a></li> </ul> </div> </li> </ul> </div> </div> <div class="separator"></div> </nav> </header> <!-- mobile-menu-area-start --> <!--div class="mobile-menu-area visible-xs hidden-sm"> <div class="container"> <div class="row"> <div class="col-md-12 col-xs-12"> <div class="mobile-menu"> <nav id="mobile-menu-active"> <ul> <li> <a href="" >Become a Partner </a> </li> <li> <a href="" >Help</a> </li> <li> <a href="" >Register</a> </li> <li> <a href="" >Login</a> </li> </ul> </nav> </div> </div> </div> </div> </div--> <!-- mobile-menu-area-end --> <!-- mobile-menu-area-end -->
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Transaction_detail_model extends CI_Model { public $table = 'transaction_detail'; public $id = 'detail_ID'; public $order = 'DESC'; function __construct() { parent::__construct(); } // datatables function json() { $this->datatables->select('detail_ID, product_ID,transaction_ID, quantity,price,total_payment,'); $this->datatables->from('transaction_detail'); //add this line for join //$this->datatables->join('table2', 'transaction_detail.field = table2.field'); $this->datatables->add_column('action', anchor(site_url('transaction_detail/read/$1'),' <button type="button" class="btn btn-primary"> <span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> </button>')."".anchor(site_url('transaction_detail/update/$1'),' <button type="button" class="btn btn-success"> <span class="glyphicon glyphicon-edit" aria-hidden="true"></span> </button>')."".anchor(site_url('transaction_detail/delete/$1'),' <button type="button" class="btn btn-danger"> <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> </button>','onclick="javasciprt: return confirm(\'Anda yakin ingin menghapus data ini ?\')"'), 'detail_ID'); return $this->datatables->generate(); } // get all function get_all() { $this->db->order_by($this->id, $this->order); return $this->db->get($this->table)->result(); } // get data by id function get_by_id($id) { $this->db->where($this->id, $id); return $this->db->get($this->table)->row(); } // get total rows function total_rows($q = NULL) { $this->db->like('detail_ID', $q); $this->db->or_like('transaction_ID', $q); $this->db->or_like('product_ID', $q); $this->db->or_like('quantity', $q); $this->db->or_like('price', $q); $this->db->or_like('total_payment', $q); $this->db->from($this->table); return $this->db->count_all_results(); } // get data with limit and search function get_limit_data($limit, $start = 0, $q = NULL) { $this->db->order_by($this->id, $this->order); $this->db->like('detail_ID', $q); $this->db->or_like('transaction_ID', $q); $this->db->or_like('product_ID', $q); $this->db->or_like('quantity', $q); $this->db->or_like('price', $q); $this->db->or_like('total_payment', $q); $this->db->limit($limit, $start); return $this->db->get($this->table)->result(); } // insert data function insert($data) { $this->db->insert($this->table, $data); } // update data function update($id, $data) { $this->db->where($this->id, $id); $this->db->update($this->table, $data); } // delete data function delete($id) { $this->db->where($this->id, $id); $this->db->delete($this->table); } } /* End of file Transaction_detail_model.php */ /* Location: ./application/models/Transaction_detail_model.php */ /* Please DO NOT modify this information : */ /* Generated by Harviacode Codeigniter CRUD Generator 2017-09-30 20:47:17 */ /* http://harviacode.com */
<!-- ========================================================= * Material Dashboard 2 - v3.0.0 ========================================================= * Product Page: https://www.creative-tim.com/product/material-dashboard * Copyright 2021 Creative Tim (https://www.creative-tim.com) * Licensed under MIT (https://www.creative-tim.com/license) * Coded by Creative Tim ========================================================= * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="apple-touch-icon" sizes="76x76" href="../assets/img/apple-icon.png"> <link rel="icon" type="image/png" href="../assets/img/favicon.png"> <title> Login | Brodo </title> <!-- Fonts and icons --> <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900|Roboto+Slab:400,700" /> <!-- Nucleo Icons --> <link href="../assets/css/nucleo-icons.css" rel="stylesheet" /> <link href="../assets/css/nucleo-svg.css" rel="stylesheet" /> <!-- Font Awesome Icons --> <script src="https://kit.fontawesome.com/42d5adcbca.js" crossorigin="anonymous"></script> <!-- Material Icons --> <link href="https://fonts.googleapis.com/icon?family=Material+Icons+Round" rel="stylesheet"> <!-- CSS Files --> <link id="pagestyle" href="../assets/css/material-dashboard.css?v=3.0.0" rel="stylesheet" /> </head> <body class="bg-gray-200"> <main class="main-content mt-0"> <div class="page-header align-items-start min-vh-100" style="background-image: url('https://images.unsplash.com/photo-1497294815431-9365093b7331?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1950&q=80');"> <span class="mask bg-gradient-dark opacity-6"></span> <div class="container my-auto"> <div class="row"> <div class="col-lg-4 col-md-8 col-12 mx-auto"> <div class="card z-index-0 fadeIn3 fadeInBottom"> <div class="card-header p-0 position-relative mt-n4 mx-3 z-index-2"> <div class="bg-gradient-primary shadow-primary border-radius-lg py-3 pe-1"> <h4 class="text-white font-weight-bolder text-center mt-2 mb-0">Sign in</h4> </div> </div> <div class="card-body"> <form action="/login" method="POST" class="text-start"> @csrf <div class="input-group input-group-outline my-3"> {{-- <label class="form-label">Email</label> --}} <input type="email" name="email" id="email" value="{{old('email')}}" class="form-control" placeholder="Email"> </div> <div class="input-group input-group-outline mb-3"> {{-- <label class="form-label">Password</label> --}} <input type="password" name="password" id="password" class="form-control" placeholder="Password"> </div> <div class="text-center"> <input type="submit" name="submit" class="btn bg-gradient-primary w-100 my-4 mb-2" value="Sign In"> </div> </form> </div> </div> </div> </div> </div> </div> </main> </body> </html>
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bundle\TwigBundle; use Symfony\Bridge\Twig\TwigEngine as BaseEngine; use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference; use Symfony\Component\Templating\TemplateNameParserInterface; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Config\FileLocatorInterface; /** * This engine renders Twig templates. * * @author Fabien Potencier <fabien@symfony.com> */ class TwigEngine extends BaseEngine implements EngineInterface { protected $locator; /** * Constructor. * * @param \Twig_Environment $environment A \Twig_Environment instance * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance * @param FileLocatorInterface $locator A FileLocatorInterface instance */ public function __construct(\Twig_Environment $environment, TemplateNameParserInterface $parser, FileLocatorInterface $locator) { parent::__construct($environment, $parser); $this->locator = $locator; } /** * @deprecated since version 2.7, to be removed in 3.0. * Inject the escaping strategy on \Twig_Environment instead. */ public function setDefaultEscapingStrategy($strategy) { @trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0. Inject the escaping strategy in the Twig_Environment object instead.', E_USER_DEPRECATED); $this->environment->getExtension('escaper')->setDefaultStrategy($strategy); } /** * @deprecated since version 2.7, to be removed in 3.0. * Use the 'filename' strategy instead. */ public function guessDefaultEscapingStrategy($filename) { @trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0. Use the Twig_FileExtensionEscapingStrategy::guess method instead.', E_USER_DEPRECATED); return \Twig_FileExtensionEscapingStrategy::guess($filename); } /** * {@inheritdoc} */ public function render($name, array $parameters = array()) { try { return parent::render($name, $parameters); } catch (\Twig_Error $e) { if ($name instanceof TemplateReference) { try { // try to get the real file name of the template where the error occurred $e->setTemplateFile(sprintf('%s', $this->locator->locate($this->parser->parse($e->getTemplateFile())))); } catch (\Exception $ex) { } } throw $e; } } /** * {@inheritdoc} * * @throws \Twig_Error if something went wrong like a thrown exception while rendering the template */ public function renderResponse($view, array $parameters = array(), Response $response = null) { if (null === $response) { $response = new Response(); } $response->setContent($this->render($view, $parameters)); return $response; } }
<?php session_start(); require_once "functions.php"; $navbarItem = 'profile'; require "head.php"; include "navbar.php"; xssProtection(); // Connection to database $connection = connectDB(); // Query that get all data of the member (based on data given in URL) if (isset($_GET["username"])) { $query = $connection->prepare( "SELECT id,email,name,username,birthday,profile_photo_filename,cover_photo_filename,description FROM member WHERE username='" . $_GET['username'] . "'" ); } else { if (!isConnected()) { header("Location: login.php"); } else { $query = $connection->prepare( "SELECT id,email,name,username,birthday,profile_photo_filename,cover_photo_filename,description FROM member WHERE id=" . $_SESSION['id'] . " AND token='" . $_SESSION['token'] . "'" ); } } // Execute the query $query->execute(); // Fetch data with the query and get it as an associative array $result = $query->fetch(PDO::FETCH_ASSOC); if (isConnected()) { // Query that checks if the subscription already exist in database $follow = $connection->prepare("SELECT 1 FROM subscription WHERE member_following= :member_following AND member_followed= :member_followed "); //Execute $follow->execute([ "member_following" => $_SESSION["id"], "member_followed" => $result["id"] ]); // Empty if subscription doesn't exist $resultFollow = $follow->fetch(); } if (!$result) { die("This page doesn't exist"); } ?> <!-- Header - set the background image for the header in the line below --> <header class="py-5 bg-image-full" style="background-image: url('<?php if ($result["cover_photo_filename"] !== "cover.png") { echo "uploads/member/cover/" . $result["cover_photo_filename"]; } else { echo "https://unsplash.it/1900/1080?image=1076"; } ?>'); margin-bottom: 20px"> <?php if ($result["profile_photo_filename"] !== "photo.png") { ?> <img class="img-fluid d-block mx-auto" src=<?php echo "uploads/member/avatar/" . $result["profile_photo_filename"] ?> alt="" width=200 height="200"> <?php } else { ?> <img class="img-fluid d-block mx-auto" src="http://placehold.it/200x200&text=Logo" alt=""> <?php }?> <?php if (isConnected()) { // No query string: on my profile if (!isset($_GET["username"])) { echo '<a href="edit-profile.php" class="edit-button cover-buttons" style="color: #d6d6d6" title="Edit cover picture"><i class="fas fa-edit"></i></a>'; } else { // With query string if ($result["id"] === $_SESSION["id"]) { // On my profile echo '<a href="edit-profile.php" class="edit-button cover-buttons" style="color: #d6d6d6" title="Edit cover picture"><i class="fas fa-edit"></i></a>'; } elseif (empty($resultFollow)) { echo "<a href='script/followUser.php?id=" . $result["id"] . "&username=" . $result["username"] . "'><center><button type='button' class='btn btn-info'>Follow</button><center></a>"; } else { echo "<a href='script/unfollowUser.php?id=" . $result["id"] . "&username=" . $result["username"] . "'><center><button type='button' class='btn btn-danger'>Unfollow</button><center></a>"; } } } ?> </header> <center> <button type="button" class="btn btn-dark" data-toggle="modal" data-target="#modalFollowers"> Followers <span class="badge badge-light"><?php echo countFollower($result['id']); ?></span> </button> <button type="button" class="btn btn-dark" data-toggle="modal" data-target="#modalFollowing"> Following <span class="badge badge-light"> <?php echo countFollowing($result['id']); ?></span> </button> </center> <!-- Modal: Followers --> <div class="modal fade" id="modalFollowers" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLongTitle">followers: </h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> <?php $usernamefollowers = sqlSelectFetchAll('SELECT name,profile_photo_filename,username FROM member WHERE id IN(SELECT member_following FROM subscription WHERE member_followed=' . $result['id'] . ")"); foreach ($usernamefollowers as $follower) { echo "<div class='row'>"; echo "<div class='col-md-2'>"; echo "<img src='uploads/member/avatar/" . $follower["profile_photo_filename"] . "' alt='profile picture' height=50 width=50>"; echo "</div>"; echo "<div class='col-md-10'>"; echo "<a href='profile.php?username=" . $follower['username'] . "'>" . $follower['name'] . "<br></a>"; echo "</div>"; echo "</div>"; echo "<hr>"; } ?> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> </div> </div> </div> </div> <!-- Modal: Following --> <div class="modal fade" id="modalFollowing" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLongTitle">followings: </h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> <?php $usernamefollowing = sqlSelectFetchAll('SELECT name,profile_photo_filename,username FROM member WHERE id IN(SELECT member_followed FROM subscription WHERE member_following=' . $result['id'] . ")"); foreach ($usernamefollowing as $following) { echo "<div class='row'>"; echo "<div class='col-md-2'>"; echo "<img src='uploads/member/avatar/" . $following["profile_photo_filename"] . "' alt='profile picture' height=50 width=50>"; echo "</div>"; echo "<div class='col-md-10'>"; echo "<a href='profile.php?username=" . $following['username'] . "'>" . $following['name'] . "<br></a>"; echo "</div>"; echo "</div>"; echo "<hr>"; } ?> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> </div> </div> </div> </div> <div class="container-fluid"><?php successfulUpdateMessage(); ?></div> <!-- Content section --> <section class="py-5"> <div class="container"> <center> <h1><?php echo "{$result["name"]}"; ?></h1><br> <p class="alert alert-secondary"><?php if (!empty($result["description"]) && $result["description"] !== null) { echo $result["description"]; } else { echo "No description"; } ?></p> </center> </div> </section> <hr width="500px"> <!-- Content section --> <section class="py-5"> <div class="container"> <div class="row"> <div class="col-sm-12 col-md-6"> <h2><?php echo "{$result["username"]}'s tracks"; ?></h2> <br> <?php // The track number will start at 0 since we'll use it in an array $trackNumber = -1; $trackData = sqlSelectFetchAll("SELECT * FROM track WHERE member=" . $result["id"] . " ORDER BY publication_date DESC"); if (count($trackData) !== 0) { foreach ($trackData as $track) { // Increment track id for DOM $trackNumber++; // Get the number of listenings $listeningsQuery = $connection->prepare( "SELECT COUNT(*) as listenings FROM listening WHERE track=" . $track['id'] ); // Get the number of likes $likesQuery = $connection->prepare( "SELECT COUNT(*) as likes FROM likes WHERE track=" . $track['id'] ); $likesQuery->execute(); $listeningsQuery->execute(); $likesResult = $likesQuery->fetch(PDO::FETCH_ASSOC); $listenings = $listeningsQuery->fetch(PDO::FETCH_ASSOC); $likes = $likesResult['likes']; $listeningsNumber = $listenings['listenings']; if (isConnected()) { // Check if the track is liked by the user $isLikedQuery = $connection->prepare( "SELECT COUNT(*) as liked FROM likes WHERE track='" . $track['id'] . "' AND member='" . $_SESSION['id'] ."'" ); $isLikedQuery->execute(); $isLikedResult = $isLikedQuery->fetch(PDO::FETCH_ASSOC); $isLiked = $isLikedResult['liked']; } echo "<div class='col-lg-10 content-container' id='track-container-{$track['id']}'>"; if (isConnected()) { if (!isset($_GET["username"]) || (isset($_GET["username"]) && $result["id"] === $_SESSION["id"])) { echo "<h3><a href='track.php?id={$track['id']}'> {$track['title']}</a><a href='' style='color: #c8c8c8;' title='Add to a playlist' data-toggle='modal' data-target='#addToPlaylistModal-{$track['id']}'><i class='fas fa-plus fa-xs' style='margin-left: 10px;'></i></a>"; echo '<a href="" style="color: #c8c8c8;" title="Delete track" data-toggle="modal" data-target="#deleteTrackModal-' . $track["id"] . '">'; echo '<button type="button" class="btn btn-danger delete-button"><i class="fas fa-trash-alt"></i></button>'; echo '</a></h3>'; } } else { echo "<h3><a href='track.php?id={$track['id']}'> {$track['title']}</a><a href='' style='color: #c8c8c8;' title='Add to a playlist' data-toggle='modal' data-target='#addToPlaylistModal-{$track['id']}'><i class='fas fa-plus fa-xs' style='margin-left: 10px;'></i></a></h3>"; } echo "<div><img class='content-image' src='uploads/tracks/album_cover/{$track['photo_filename']}'></div>"; echo "<audio controls id='audio-track-$trackNumber' data-track-id='{$track['id']}'>"; echo "<source src='uploads/tracks/files/{$track['track_filename']}' type='audio/mpeg'>"; echo "</audio>"; echo "<p><i class='fas fa-calendar-alt'></i> {$track['publication_date']}</p>"; echo "<p>"; echo "<span class='track-listenings'><i class='fas fa-play'></i>"; echo "<span class='listening-number' id='listening-number-{$track['id']}'>$listeningsNumber</span>"; echo "</span>"; echo "<span class='track-likes' id='likes-{$track['id']}' onclick='likeTrack({$track['id']})'>"; echo "<i class='" . (($isLiked == 1) ? 'fas' : 'far') . " fa-heart'></i>"; echo "<span class='like-number' id='like-number-{$track['id']}'>$likes</span>"; echo "</span>"; echo "<p class='alert alert-secondary'>{$track['description']}</p>"; echo "</div>"; if (isConnected()) { echo "<!-- Add to playlist button Modal -->"; echo "<div class='modal fade' id='addToPlaylistModal-{$track['id']}' tabindex='-1' role='dialog' aria-labelledby='exampleModalCenterTitle' aria-hidden='true'>"; echo "<div class='modal-dialog modal-dialog-centered' role='document'>"; echo "<div class='modal-content'>"; echo "<div class='modal-header'>"; echo "<h5 class='modal-title' id='exampleModalLongTitle'>My playlists</h5>"; echo "<button type='button' class='close' data-dismiss='modal' aria-label='Close'>"; echo "<span aria-hidden='true'>&times;</span>"; echo "</button>"; echo "</div>"; echo "<div class='modal-body'>"; $getAllPlaylistsQuery = $connection->prepare( "SELECT * FROM playlist WHERE member='" . $_SESSION['id']. "'" ); $getAllPlaylistsQuery->execute(); $allPlaylists = $getAllPlaylistsQuery->fetchAll(PDO::FETCH_ASSOC); if (count($allPlaylists) === 0) { echo "<h3>No playlist created. <a href='newPlaylist.php'>Create one!</a></h3>"; } else { foreach ($allPlaylists as $playlist) { echo "<h3><a href='script/addToPlaylist.php?playlist_id=" . $playlist["id"] . "&track_id=" . $track['id'] . "'>" . $playlist["name"] . "</a></h3>"; echo "<hr>"; } } echo "</div>"; echo "<div class='modal-footer'>"; echo "<button type='button' class='btn btn-secondary' data-dismiss='modal'>Close</button>"; echo "</div>"; echo "</div>"; echo "</div>"; echo "</div>"; echo "<!-- Delete track button modal -->"; echo "<div class='modal fade' id='deleteTrackModal-{$track['id']}' tabindex='-1' role='dialog' aria-labelledby='exampleModalCenterTitle' aria-hidden='true'>"; echo "<div class='modal-dialog modal-dialog-centered' role='document'>"; echo "<div class='modal-content'>"; echo "<div class='modal-header'>"; echo "<h5 class='modal-title' id='exampleModalLongTitle'>Are you sure you want to delete the track?</h5>"; echo "<button type='button' class='close' data-dismiss='modal' aria-label='Close'>"; echo "<span aria-hidden='true'>&times;</span>"; echo "</button>"; echo "</div>"; echo "<div class='modal-body'>"; echo '<button type="button" class="btn btn-danger delete-button" data-dismiss="modal" onClick="deleteTrack(' . $track["id"] .')">Delete</button>'; echo "<button type='button' class='btn btn-secondary' data-dismiss='modal'>Close</button>"; echo "</div>"; echo "</div>"; echo "</div>"; echo "</div>"; } } } else { if (!isConnected()) { echo "<p>No track uploaded."; } elseif ($result["id"] === $_SESSION["id"]) { echo "<p>No track uploaded. <a href='newtrackForm.php'>Upload now!</a></p>"; } else { echo "<p>No track uploaded.</p>"; } } ?> </div> <div class="col-sm-12 col-md-6"> <div class="row"> <div class="col-sm-12"> <h2><?php echo "{$result["username"]}'s events"; ?></h2> <br> <?php $events = sqlSelectFetchAll("SELECT * FROM events WHERE member=" . $result["id"] . " ORDER BY publication_date DESC"); if (count($events) !== 0) { foreach ($events as $event) { echo "<center>"; echo "<h4><a href='event.php?id=" . $event["id"] . "'>" . $event["name"] . "</a></h4>"; echo "<p>" . $event["event_date"] . "</p>"; echo "</center>"; } } else { if (!isConnected()) { echo "<p>No event created."; } elseif ($result["id"] === $_SESSION["id"]) { echo "<p>No event created. <a href='newEvent.php'> Create now !</a></p>"; } else { echo "<p>No event created."; } } ?> </div> <div class="col-sm-12"> <h2><?php echo "{$result["username"]}'s posts"; ?></h2> <br> <?php $posts = sqlSelectFetchAll("SELECT * FROM post WHERE member=" . $result["id"] . " ORDER BY publication_date DESC"); if (count($posts) !== 0) { foreach ($posts as $post) { echo "<center>"; echo "<div>"; echo "<h4><a href='post.php?id=" . $post["id"] . "'>" . $result["username"] . "'" . "post" . "</a></h4>"; echo "<p class='alert alert-secondary'>" . $post["content"] . "</p>"; echo "<p><i class='fas fa-calendar-alt'></i> {$post["publication_date"]}</p>"; echo "</div>"; echo "</center>"; } } else { if (!isConnected()) { echo "<p>No post."; } elseif ($result["id"] === $_SESSION["id"]) { echo "<p>No post. <a href='newPost.php'> Post your annouce !</a></p>"; } else { echo "<p>No post."; } } ?> </div> </div> </div> </div> </div> </div> </div> </section> <?php unset($_SESSION["newTrackAdded"]); unset($_SESSION["post"]); ?> <?php include "footer.php" ?>
<?php class Tags extends Eloquent { protected $table = "tags"; protected $primaryKey = 'id'; public static function loadTags($id){ $info = Tags::Where('deleted','=','0') ->Where('id','=',$id) ->first(); return $info; }//End load city public static function loadProductByTag($info){ if(Auth::check()) $user_id = Auth::user()->id; else $user_id='1'; $data = Products::getWhereOfUser($user_id); $categories_id = ''; $type_id = ''; $district_id = ''; $city_id = ''; $street_id=''; $sortby = array(); $area= array(); $amount= array(); $sortby = Products::getSortBy($info['sortby']); $area = Products::getArea($info['area']); $amount = Products::getAmount($info['amount']); $categories_id = $info['category']; $type_id = $info['type']; $district_id = $info['district']; //$street_id = $info['street']; $city_id = $info['city']; $data = Products::Join('unit','unit.id','=','products.amount_unit_id') ->Join('district','district.id','=','products.district_id') ->Join('street','street.id','=','products.street_id') ->Join('categories','categories.id','=','products.categories_id') ->Join('city','city.id','=','products.city_id') ->Where('products.deleted','=','0') ->Where('products.user_id',$data['operator'],$data['user_id']) ->Where('products.types_id','like','%'.$type_id.'%') ->Where('products.categories_id','like','%'.$categories_id.'%') ->Where('products.district_id','like','%'.$district_id.'%') ->Where('products.street_id','like','%'.$street_id.'%') ->Where('products.city_id','like','%'.$city_id.'%') ->WhereBetween('products.area',array($area['fromarea'],$area['toarea'])) ->WhereBetween('products.amount',array($amount['fromamount'],$amount['toamount'])) ->orderBy(DB::raw($sortby['orderBy']),$sortby['typeorderby']) ->select('products.id as id','products.name as name','products.image as image','products.title as title','products.area as area','products.amount as amount','products.startdate as startdate', 'district.name as district','city.name as city','city.title as city_title','unit.name as amount_unit','categories.name as category_name','categories.title as category_title') ->get(); return $data; }//End load Products public static function loadTagCity(){ $info = Tags::Where('deleted','=','0') ->Where('district_id','=','') ->get(); return $info; }//End load Products }
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddFieldsToCloudMiningsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('cloud_minings', function (Blueprint $table) { // $table->string('logo')->nullable(); $table->longText('desc'); $table->string('depo_date')->nullable(); $table->string('start'); $table->string('website')->nullable(); $table->string('lang'); $table->integer('ref')->default(0); $table->longText('ref_about')->nullable(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('cloud_minings', function (Blueprint $table) { // $table->dropColumn('desc'); $table->dropColumn('depo_date'); $table->dropColumn('start'); $table->dropColumn('website'); $table->dropColumn('lang'); $table->dropColumn('ref'); $table->dropColumn('ref_about'); }); } }
@include('emails.layout.mailheader') <tr> <td style='color: #fff; font-weight: bolder; background-color: #00A4EF !important;' colspan='3' align='center'> {{$Subject}}</td> </tr> <tr> <td style='color: #000; background-color: #fff;' colspan='3' align='left'> <p> {{$Body}} </p> </td> </tr> @include('emails.layout.mailfooter')
<?php return [ 'Create bases' => 'Vytvořit základny', 'Please enter URL' => 'Prosím zadejte URL', 'Base has been created' => 'Základny vytvořeny', 'Base creation in progress ...' => 'Probíhá vytváření základny ...', 'Please be patient. ' => 'Prosím strpení.', 'Web' => 'Web', 'Administration' => 'Administrace', 'REST API' => 'REST API', 'PHP Jet Example Web' => 'PHP Jet Ukázkový web', 'PHP Jet Example Administration' => 'PHP Jet Ukázková administrace', 'PHP Jet Example REST API' => 'PHP Jet Ukázkové REST API', 'Something went wrong: %error%' => 'Něco se nepovedlo: %error%', ];
<?php return array( 'root' => array( 'pretty_version' => '1.0.0+no-version-set', 'version' => '1.0.0.0', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'reference' => NULL, 'name' => '__root__', 'dev' => true, ), 'versions' => array( '__root__' => array( 'pretty_version' => '1.0.0+no-version-set', 'version' => '1.0.0.0', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'reference' => NULL, 'dev_requirement' => false, ), 'guzzlehttp/guzzle' => array( 'pretty_version' => '6.5.5', 'version' => '6.5.5.0', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', 'aliases' => array(), 'reference' => '9d4290de1cfd701f38099ef7e183b64b4b7b0c5e', 'dev_requirement' => false, ), 'guzzlehttp/promises' => array( 'pretty_version' => '1.4.1', 'version' => '1.4.1.0', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/promises', 'aliases' => array(), 'reference' => '8e7d04f1f6450fef59366c399cfad4b9383aa30d', 'dev_requirement' => false, ), 'guzzlehttp/psr7' => array( 'pretty_version' => '1.8.3', 'version' => '1.8.3.0', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'aliases' => array(), 'reference' => '1afdd860a2566ed3c2b0b4a3de6e23434a79ec85', 'dev_requirement' => false, ), 'lullabot/amp' => array( 'pretty_version' => '2.0.1', 'version' => '2.0.1.0', 'type' => 'library', 'install_path' => __DIR__ . '/../lullabot/amp', 'aliases' => array(), 'reference' => '3d95d5fa8b2a72164fffdc120324371368a4ed1e', 'dev_requirement' => false, ), 'marc1706/fast-image-size' => array( 'pretty_version' => 'v1.1.6', 'version' => '1.1.6.0', 'type' => 'library', 'install_path' => __DIR__ . '/../marc1706/fast-image-size', 'aliases' => array(), 'reference' => '3a3a2b036be20f43fa06ce00dfa754df503e6684', 'dev_requirement' => false, ), 'masterminds/html5' => array( 'pretty_version' => '2.7.5', 'version' => '2.7.5.0', 'type' => 'library', 'install_path' => __DIR__ . '/../masterminds/html5', 'aliases' => array(), 'reference' => 'f640ac1bdddff06ea333a920c95bbad8872429ab', 'dev_requirement' => false, ), 'psr/http-message' => array( 'pretty_version' => '1.0.1', 'version' => '1.0.1.0', 'type' => 'library', 'install_path' => __DIR__ . '/../psr/http-message', 'aliases' => array(), 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', 'dev_requirement' => false, ), 'psr/http-message-implementation' => array( 'dev_requirement' => false, 'provided' => array( 0 => '1.0', ), ), 'querypath/querypath' => array( 'pretty_version' => '3.0.5', 'version' => '3.0.5.0', 'type' => 'library', 'install_path' => __DIR__ . '/../querypath/querypath', 'aliases' => array(), 'reference' => '6b8e2395fac61fac25bbe962f94def556cb85f7d', 'dev_requirement' => false, ), 'ralouphie/getallheaders' => array( 'pretty_version' => '3.0.3', 'version' => '3.0.3.0', 'type' => 'library', 'install_path' => __DIR__ . '/../ralouphie/getallheaders', 'aliases' => array(), 'reference' => '120b605dfeb996808c31b6477290a714d356e822', 'dev_requirement' => false, ), 'sabberworm/php-css-parser' => array( 'pretty_version' => '8.3.1', 'version' => '8.3.1.0', 'type' => 'library', 'install_path' => __DIR__ . '/../sabberworm/php-css-parser', 'aliases' => array(), 'reference' => 'd217848e1396ef962fb1997cf3e2421acba7f796', 'dev_requirement' => false, ), 'sebastian/diff' => array( 'pretty_version' => '4.0.4', 'version' => '4.0.4.0', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), 'reference' => '3461e3fccc7cfdfc2720be910d3bd73c69be590d', 'dev_requirement' => false, ), 'symfony/polyfill-intl-idn' => array( 'pretty_version' => 'v1.23.0', 'version' => '1.23.0.0', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-intl-idn', 'aliases' => array(), 'reference' => '65bd267525e82759e7d8c4e8ceea44f398838e65', 'dev_requirement' => false, ), 'symfony/polyfill-intl-normalizer' => array( 'pretty_version' => 'v1.23.0', 'version' => '1.23.0.0', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer', 'aliases' => array(), 'reference' => '8590a5f561694770bdcd3f9b5c69dde6945028e8', 'dev_requirement' => false, ), 'symfony/polyfill-php72' => array( 'pretty_version' => 'v1.23.0', 'version' => '1.23.0.0', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php72', 'aliases' => array(), 'reference' => '9a142215a36a3888e30d0a9eeea9766764e96976', 'dev_requirement' => false, ), ), );
<div> <button x-data="{ isModalOpen: @entangle('modalOpen') }" @click="isModalOpen = true" class="px-4 py-2 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> + Nuevo servicio </button> <!-- Modal backdrop. This what you want to place close to the closing body tag --> <div x-data="{ isModalOpen: @entangle('modalOpen') }" x-show="isModalOpen" x-transition:enter="transition ease-out duration-150" x-transition:enter-start="opacity-0" x-transition:enter-end="opacity-100" x-transition:leave="transition ease-in duration-150" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" class="fixed overflow-y-auto inset-0 z-30 flex items-end bg-black bg-opacity-50 sm:items-center sm:justify-center" > <!-- Modal --> <div class="absolute inset-y-0"> <div x-data="{ isModalOpen: @entangle('modalOpen') }" x-show="isModalOpen" x-transition:enter="transition ease-out duration-150" x-transition:enter-start="opacity-0 transform translate-y-1/2" x-transition:enter-end="opacity-100" x-transition:leave="transition ease-in duration-150" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0 transform translate-y-1/2" @click.away="isModalOpen = false" @keydown.escape="closeModal" class="w-full px-6 py-4 overflow-hidden bg-white rounded-t-lg dark:bg-gray-800 sm:rounded-lg sm:m-4 sm:max-w-xl" role="dialog" id="modal"> <!-- Remove header if you don't want a close icon. Use modal body to place modal tile. --> <header class="flex justify-end"> <button class="inline-flex items-center justify-center w-6 h-6 text-gray-400 transition-colors duration-150 rounded dark:hover:text-gray-200 hover: hover:text-gray-700" aria-label="close" x-data="{ isModalOpen: @entangle('modalOpen') }" @click="isModalOpen = false" > <svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20" role="img" aria-hidden="true" > <path d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" fill-rule="evenodd" ></path> </svg> </button> </header> <!-- Modal body --> <div class="mt-4 mb-6"> <!-- Modal title --> <p class="mb-2 text-lg font-semibold text-gray-700 dark:text-gray-300" > Registrar nuevo servicio </p> <!-- Modal description --> <p class="text-xs text-gray-700 dark:text-gray-400"> Revisa que el servicio no esté registrado ya </p> <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800" > <label class="block text-sm mb-2"> <span class="text-gray-700 dark:text-gray-400">Nombre</span> <input wire:model="name" name="name" type="text" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" placeholder="Escribe el nombre del servicio o producto " /> @error('name') <span class="mb-1 font-semibold text-red-600"> {{$message}} </span> @enderror </label> <label class="block text-sm mb-2"> <span class="text-gray-700 dark:text-gray-400">Precio</span> <input wire:model="price" name="price" type="number" min="10" step="5" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" placeholder="Escribe un correo electronico" /> @error('price') <span class="mb-1 font-semibold text-red-600"> {{$message}} </span> @enderror </label> </div> </div> <footer class="flex flex-col items-center justify-end px-6 py-3 -mx-6 -mb-4 space-y-4 sm:space-y-0 sm:space-x-6 sm:flex-row bg-gray-50 dark:bg-gray-800" > <span wire:loading wire:target="addBarber" class="text-white">Cargando . . .</span> <button x-data="{ isModalOpen: @entangle('modalOpen') }" @click="isModalOpen = false" class="w-full px-5 py-3 text-sm font-medium leading-5 dark:text-white text-gray-700 transition-colors duration-150 border border-gray-300 rounded-lg dark:text-gray-400 sm:px-4 sm:py-2 sm:w-auto active:bg-transparent hover:border-gray-500 focus:border-gray-500 active:text-gray-500 focus:outline-none focus:shadow-outline-gray" > Cancelar </button> <button wire:click="addService" class="w-full px-5 py-3 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg sm:w-auto sm:px-4 sm:py-2 active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" > Registrar </button> </footer> </div> </div> </div> <!-- End of modal backdrop --> </div>
<?php /* Plugin Name: WPSchoolPress Plugin URI: http://wpschoolpress.com Description: WPSchoolpress is a school management system plugin that makes school activities transparent to parents. For more information please visit our website. Version: 2.1.2 Author: WPSchoolPress Team Author URI: wpschoolpress.com Text Domain: WPSchoolPress Domain Path: languages @package WPSchoolPress */ // Exit if accessed directly if (!defined('ABSPATH')) exit; /** * Basic plugin definitions * * @package WPSchoolPress * @since 2.1.2 */ if (!defined('WPSP_PLUGIN_URL')) { define('WPSP_PLUGIN_URL', plugin_dir_url(__FILE__)); } if (!defined('WPSP_PLUGIN_PATH')) { define('WPSP_PLUGIN_PATH', plugin_dir_path(__FILE__)); } if (!defined('WPSP_PLUGIN_VERSION')) { define('WPSP_PLUGIN_VERSION', '2.1.2'); //Plugin version number } define('WPSP_PERMISSION_MSG', 'You don\'t have enough permission to access this page'); // Call the required files when plugin activate register_activation_hook(__FILE__, 'wpsp_activation'); function wpsp_activation() { include_once (WPSP_PLUGIN_PATH . 'lib/wpsp-activation.php'); } register_deactivation_hook( __FILE__, 'wpsp_deactivation'); function wpsp_deactivation() { include_once (WPSP_PLUGIN_PATH . 'lib/wpsp-deactivation.php'); } // add action to load plugin add_action('plugins_loaded', 'wpsp_plugins_loaded'); function wpsp_plugins_loaded() { $wpsp_lang_dir = dirname(plugin_basename(__FILE__)) . '/languages/'; load_plugin_textdomain('WPSchoolPress', false, $wpsp_lang_dir); // initialize settings of plugin Open required files for initialization require_once (WPSP_PLUGIN_PATH . 'lib/wpsp-ajaxworks.php'); require_once (WPSP_PLUGIN_PATH . 'lib/wpsp-ajaxworks-student.php'); require_once (WPSP_PLUGIN_PATH . 'lib/wpsp-ajaxworks-teacher.php'); require_once (WPSP_PLUGIN_PATH . 'wpsp-layout.php'); require_once (WPSP_PLUGIN_PATH . 'includes/wpsp-misc.php'); wpsp_get_setting(); global $wpsp_settings_data; global $wpsp_admin, $wpsp_public, $paytmClass, $paypalClass; // admin class handles most of functionalities of plugin include_once (WPSP_PLUGIN_PATH . 'wpsp-class-admin.php'); $wpsp_admin = new Wpsp_Admin(); $wpsp_admin->add_hooks(); // public class handles most of functionalities of plugin include_once (WPSP_PLUGIN_PATH . 'wpsp-class-public.php'); $wpsp_public = new Wpsp_Public(); $wpsp_public->add_hooks(); } add_action('admin_init', 'ajax_actions'); function ajax_actions() { add_action('wp_ajax_listdashboardschedule', 'wpsp_listdashboardschedule'); add_action('wp_ajax_StudentProfile', 'wpsp_StudentProfile'); add_action('wp_ajax_AddStudent', 'wpsp_AddStudent'); add_action('wp_ajax_UpdateStudent', 'wpsp_UpdateStudent'); add_action('wp_ajax_StudentPublicProfile', 'wpsp_StudentPublicProfile'); add_action('wp_ajax_ParentPublicProfile', 'wpsp_ParentPublicProfile'); add_action('wp_ajax_TeacherPublicProfile', 'wpsp_TeacherPublicProfile'); add_action('wp_ajax_bulkDelete', 'wpsp_BulkDelete'); add_action('wp_ajax_undoImport', 'wpsp_UndoImport'); add_action('wp_ajax_AddTeacher', 'wpsp_AddTeacher'); add_action('wp_ajax_AddParent', 'wpsp_AddParent'); add_action('wp_ajax_AddClass', 'wpsp_AddClass'); add_action('wp_ajax_UpdateClass', 'wpsp_UpdateClass'); add_action('wp_ajax_GetClass', 'wpsp_GetClass'); add_action('wp_ajax_DeleteClass', 'wpsp_DeleteClass'); add_action('wp_ajax_Updateregisterdeactive', 'wpsp_Updateregisterdeactive'); add_action('wp_ajax_Updateregisteractive', 'wpsp_Updateregisteractive'); add_action('wp_ajax_bulkaproverequest', 'wpsp_bulkaproverequest'); add_action('wp_ajax_bulkdisaproverequest', 'wpsp_bulkdisaproverequest'); add_action('wp_ajax_AddExam', 'wpsp_AddExam'); add_action('wp_ajax_UpdateExam', 'wpsp_UpdateExam'); add_action('wp_ajax_ExamInfo', 'wpsp_ExamInfo'); add_action('wp_ajax_DeleteExam', 'wpsp_DeleteExam'); add_action('wp_ajax_getStudentsList', 'wpsp_getStudentsList'); add_action('wp_ajax_AttendanceEntry', 'wpsp_AttendanceEntry'); add_action('wp_ajax_deleteAttendance', 'wpsp_DeleteAttendance'); add_action('wp_ajax_getStudentsAttendanceList', 'wpsp_getStudentsAttendanceList'); add_action('wp_ajax_getAbsentees', 'wpsp_GetAbsentees'); add_action('wp_ajax_getAbsentDates', 'wpsp_GetAbsentDates'); add_action('wp_ajax_getAttReport', 'wpsp_GetAttReport'); add_action('wp_ajax_AddSubject', 'wpsp_AddSubject'); add_action('wp_ajax_SubjectInfo', 'wpsp_SubjectInfo'); add_action('wp_ajax_UpdateSubject', 'wpsp_UpdateSubject'); add_action('wp_ajax_DeleteSubject', 'wpsp_DeleteSubject'); add_action('wp_ajax_subjectList', 'wpsp_SubjectList'); add_action('wp_ajax_save_timetable', 'wpsp_SaveTimetable'); add_action('wp_ajax_deletsloat', 'wpsp_DeleteTimetablesloat'); add_action('wp_ajax_deletTimetable', 'wpsp_DeleteTimetable'); add_action('wp_ajax_addMark', 'wpsp_AddMark'); add_action('wp_ajax_getMarksubject', 'wpsp_getMarksubject'); add_action('wp_ajax_GenSetting', 'wpsp_GenSetting'); add_action('wp_ajax_GenSettingsms', 'wpsp_GenSettingsms'); add_action('wp_ajax_GenSettingsocial', 'wpsp_GenSettingsocial'); add_action('wp_ajax_GenSettinglicensing', 'wpsp_GenSettinglicensing'); add_action('wp_ajax_addSubField', 'wpsp_AddSubField'); add_action('wp_ajax_updateSubField', 'wpsp_UpdateSubField'); add_action('wp_ajax_deleteSubField', 'wpsp_DeleteSubField'); add_action('wp_ajax_manageGrade', 'wpsp_ManageGrade'); add_action('wp_ajax_addEvent', 'wpsp_AddEvent'); add_action('wp_ajax_updateEvent', 'wpsp_UpdateEvent'); add_action('wp_ajax_deleteEvent', 'wpsp_DeleteEvent'); add_action('wp_ajax_listEvent', 'wpsp_ListEvent'); add_action('wp_ajax_deleteAllLeaves', 'wpsp_DeleteLeave'); add_action('wp_ajax_addLeaveDay', 'wpsp_AddLeaveDay'); add_action('wp_ajax_getLeaveDays', 'wpsp_GetLeaveDays'); add_action('wp_ajax_getClassYear', 'wpsp_GetClassYear'); add_action('wp_ajax_sendMessage', 'wpsp_SendMessage'); add_action('wp_ajax_sendSubMessage', 'wpsp_sendSubMessage'); add_action('wp_ajax_viewMessage', 'wpsp_ViewMessage'); add_action('wp_ajax_deleteMessage', 'wpsp_DeleteMessage'); add_action('wp_ajax_photoUpload', 'wpsp_UploadPhoto'); add_action('wp_ajax_deletePhoto', 'wpsp_DeletePhoto'); add_action('wp_ajax_DeleteStudent', 'wpsp_DeleteStudent'); add_action('wp_ajax_DeleteTeacher', 'wpsp_DeleteTeacher'); // Teacher modules add_action('wp_ajax_getTeachersList', 'wpsp_getTeachersList'); add_action('wp_ajax_TeacherAttendanceEntry', 'wpsp_TeacherAttendanceEntry'); add_action('wp_ajax_TeacherAttendanceDelete', 'wpsp_TeacherAttendanceDelete'); add_action('wp_ajax_TeacherAttendanceView', 'wpsp_TeacherAttendanceView'); add_action('wp_ajax_UpdateTeacher', 'wpsp_UpdateTeacher'); // Notification modules add_action('wp_ajax_deleteNotify', 'wpsp_deleteNotify'); add_action('wp_ajax_getNotify', 'wpsp_getNotifyInfo'); // Change Password add_action('wp_ajax_changepassword', 'wpsp_changepassword'); // Import Dummy data add_action('wp_ajax_ImportContents', 'wpsp_Import_Dummy_contents'); } // Get error content and update function wpsp_save_error() { update_option('plugin_error', ob_get_contents()); } add_action('activated_plugin', 'wpsp_save_error'); //Show Link Plugin Page function wpsp_add_plugin_links($links) { $plugin_links = array( '<a href="admin.php?page=WPSchoolPress"><strong style="color: #11967A; display: inline;">' . __('Settings', 'WPSchoolPress-123') . '</strong></a>' ); return array_merge($plugin_links, $links); } add_filter('plugin_action_links_' . plugin_basename(__FILE__) , 'wpsp_add_plugin_links', 20); // Change login page logo url function wp_wp_login_url() { return home_url(); } add_filter( 'login_headerurl', 'wp_wp_login_url' ); ?>
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category Zend * @package Zend_Service_Amazon * @subpackage SimpleDb * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ /** * @see Zend_Service_Amazon_Abstract */ require_once 'Zend/Service/Amazon/Abstract.php'; /** * @see Zend_Service_Amazon_SimpleDb_Response */ require_once 'Zend/Service/Amazon/SimpleDb/Response.php'; /** * @see Zend_Service_Amazon_SimpleDb_Page */ require_once 'Zend/Service/Amazon/SimpleDb/Page.php'; /** * @see Zend_Service_Amazon_SimpleDb_Attribute */ require_once 'Zend/Service/Amazon/SimpleDb/Attribute.php'; /** * @see Zend_Service_Amazon_SimpleDb_Exception */ require_once 'Zend/Service/Amazon/SimpleDb/Exception.php'; /** * @see Zend_Crypt_Hmac */ require_once 'Zend/Crypt/Hmac.php'; /** * @category Zend * @package Zend_Service_Amazon * @subpackage SimpleDb * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract { /* Notes */ // TODO SSL is required /** * The HTTP query server */ protected $_sdbEndpoint = 'sdb.amazonaws.com/'; /** * Period after which HTTP request will timeout in seconds */ protected $_httpTimeout = 10; /** * The API version to use */ protected $_sdbApiVersion = '2009-04-15'; /** * Signature Version */ protected $_signatureVersion = '2'; /** * Signature Encoding Method */ protected $_signatureMethod = 'HmacSHA256'; /** * Create Amazon SimpleDB client. * * @param string $access_key Override the default Access Key * @param string $secret_key Override the default Secret Key * @param string $region Sets the AWS Region * @return void */ public function __construct($accessKey, $secretKey) { parent::__construct($accessKey, $secretKey); $this->setEndpoint("https://" . $this->_sdbEndpoint); } /** * Set SimpleDB endpoint to use * * @param string|Zend_Uri_Http $endpoint * @return Zend_Service_Amazon_SimpleDb */ public function setEndpoint($endpoint) { if(!($endpoint instanceof Zend_Uri_Http)) { $endpoint = Zend_Uri::factory($endpoint); } if(!$endpoint->valid()) { require_once 'Zend/Service/Amazon/SimpleDb/Exception.php'; throw new Zend_Service_Amazon_SimpleDb_Exception("Invalid endpoint supplied"); } $this->_endpoint = $endpoint; return $this; } /** * Get SimpleDB endpoint * * @return Zend_Uri_Http */ public function getEndpoint() { return $this->_endpoint; } /** * Get attributes API method * * @param string $domainName Domain name within database * @param string */ public function getAttributes( $domainName, $itemName, $attributeName = null ) { $params = array(); $params['Action'] = 'GetAttributes'; $params['DomainName'] = $domainName; $params['ItemName'] = $itemName; if (isset($attributeName)) { $params['AttributeName'] = $attributeName; } $response = $this->_sendRequest($params); $document = $response->getSimpleXMLDocument(); $attributeNodes = $document->GetAttributesResult->Attribute; // Return an array of arrays $attributes = array(); foreach($attributeNodes as $attributeNode) { $name = (string)$attributeNode->Name; $valueNodes = $attributeNode->Value; $data = null; if (is_array($valueNodes) && !empty($valueNodes)) { $data = array(); foreach($valueNodes as $valueNode) { $data[] = (string)$valueNode; } } elseif (isset($valueNodes)) { $data = (string)$valueNodes; } if (isset($attributes[$name])) { $attributes[$name]->addValue($data); } else { $attributes[$name] = new Zend_Service_Amazon_SimpleDb_Attribute($itemName, $name, $data); } } return $attributes; } /** * Push attributes * * @param string $domainName * @param string $itemName * @param array|Traverable $attributes * @param array $replace * @return void */ public function putAttributes( $domainName, $itemName, $attributes, $replace = array() ) { $params = array(); $params['Action'] = 'PutAttributes'; $params['DomainName'] = $domainName; $params['ItemName'] = $itemName; $index = 0; foreach ($attributes as $attribute) { $attributeName = $attribute->getName(); foreach ($attribute->getValues() as $value) { $params['Attribute.' . $index . '.Name'] = $attributeName; $params['Attribute.' . $index . '.Value'] = $value; // Check if it should be replaced if(array_key_exists($attributeName, $replace) && $replace[$attributeName]) { $params['Attribute.' . $index . '.Replace'] = 'true'; } $index++; } } // Exception should get thrown if there's an error $response = $this->_sendRequest($params); } /** * Add many attributes at once * * @param array $items * @param string $domainName * @param array $replace * @return void */ public function batchPutAttributes($items, $domainName, array $replace = array()) { $params = array(); $params['Action'] = 'BatchPutAttributes'; $params['DomainName'] = $domainName; $itemIndex = 0; foreach ($items as $name => $attributes) { $params['Item.' . $itemIndex . '.ItemName'] = $name; $attributeIndex = 0; foreach ($attributes as $attribute) { // attribute value cannot be array, so when several items are passed // they are treated as separate values with the same attribute name foreach($attribute->getValues() as $value) { $params['Item.' . $itemIndex . '.Attribute.' . $attributeIndex . '.Name'] = $attribute->getName(); $params['Item.' . $itemIndex . '.Attribute.' . $attributeIndex . '.Value'] = $value; if (isset($replace[$name]) && isset($replace[$name][$attribute->getName()]) && $replace[$name][$attribute->getName()] ) { $params['Item.' . $itemIndex . '.Attribute.' . $attributeIndex . '.Replace'] = 'true'; } $attributeIndex++; } } $itemIndex++; } $response = $this->_sendRequest($params); } /** * Delete attributes * * @param string $domainName * @param string $itemName * @param array $attributes * @return void */ public function deleteAttributes($domainName, $itemName, array $attributes = array()) { $params = array(); $params['Action'] = 'DeleteAttributes'; $params['DomainName'] = $domainName; $params['ItemName'] = $itemName; $attributeIndex = 0; foreach ($attributes as $attribute) { foreach ($attribute->getValues() as $value) { $params['Attribute.' . $attributeIndex . '.Name'] = $attribute->getName(); $params['Attribute.' . $attributeIndex . '.Value'] = $value; $attributeIndex++; } } $response = $this->_sendRequest($params); return true; } /** * List domains * * @param int $maxNumberOfDomains * @param int $nextToken * @return array 0 or more domain names */ public function listDomains($maxNumberOfDomains = 100, $nextToken = null) { $params = array(); $params['Action'] = 'ListDomains'; $params['MaxNumberOfDomains'] = $maxNumberOfDomains; if (null !== $nextToken) { $params['NextToken'] = $nextToken; } $response = $this->_sendRequest($params); $domainNodes = $response->getSimpleXMLDocument()->ListDomainsResult->DomainName; $data = array(); foreach ($domainNodes as $domain) { $data[] = (string)$domain; } $nextTokenNode = $response->getSimpleXMLDocument()->ListDomainsResult->NextToken; $nextToken = (string)$nextTokenNode; $nextToken = (trim($nextToken) === '') ? null : $nextToken; return new Zend_Service_Amazon_SimpleDb_Page($data, $nextToken); } /** * Retrieve domain metadata * * @param string $domainName Name of the domain for which metadata will be requested * @return array Key/value array of metadatum names and values. */ public function domainMetadata($domainName) { $params = array(); $params['Action'] = 'DomainMetadata'; $params['DomainName'] = $domainName; $response = $this->_sendRequest($params); $document = $response->getSimpleXMLDocument(); $metadataNodes = $document->DomainMetadataResult->children(); $metadata = array(); foreach ($metadataNodes as $metadataNode) { $name = $metadataNode->getName(); $metadata[$name] = (string)$metadataNode; } return $metadata; } /** * Create a new domain * * @param string $domainName Valid domain name of the domain to create * @return boolean True if successful, false if not */ public function createDomain($domainName) { $params = array(); $params['Action'] = 'CreateDomain'; $params['DomainName'] = $domainName; $response = $this->_sendRequest($params); return $response->getHttpResponse()->isSuccessful(); } /** * Delete a domain * * @param string $domainName Valid domain name of the domain to delete * @return boolean True if successful, false if not */ public function deleteDomain($domainName) { $params = array(); $params['Action'] = 'DeleteDomain'; $params['DomainName'] = $domainName; $response = $this->_sendRequest($params); return $response->getHttpResponse()->isSuccessful(); } /** * Select items from the database * * @param string $selectExpression * @param null|string $nextToken * @return Zend_Service_Amazon_SimpleDb_Page */ public function select($selectExpression, $nextToken = null) { $params = array(); $params['Action'] = 'Select'; $params['SelectExpression'] = $selectExpression; if (null !== $nextToken) { $params['NextToken'] = $nextToken; } $response = $this->_sendRequest($params); $xml = $response->getSimpleXMLDocument(); $attributes = array(); foreach ($xml->SelectResult->Item as $item) { $itemName = (string)$item->Name; foreach ($item->Attribute as $attribute) { $attributeName = (string)$attribute->Name; $values = array(); foreach ($attribute->Value as $value) { $values[] = (string)$value; } $attributes[$itemName][$attributeName] = new Zend_Service_Amazon_SimpleDb_Attribute($itemName, $attributeName, $values); } } $nextToken = (string)$xml->NextToken; return new Zend_Service_Amazon_SimpleDb_Page($attributes, $nextToken); } /** * Quote SDB value * * Wraps it in '' * * @param string $value * @return string */ public function quote($value) { // wrap in single quotes and convert each ' inside to '' return "'" . str_replace("'", "''", $value) . "'"; } /** * Quote SDB column or table name * * Wraps it in `` * @param string $name * @return string */ public function quoteName($name) { if (preg_match('/^[a-z_$][a-z0-9_$-]*$/i', $name) == false) { throw new Zend_Service_Amazon_SimpleDb_Exception("Invalid name: can contain only alphanumeric characters, \$ and _"); } return "`$name`"; } /** * Sends a HTTP request to the SimpleDB service using Zend_Http_Client * * @param array $params List of parameters to send with the request * @return Zend_Service_Amazon_SimpleDb_Response * @throws Zend_Service_Amazon_SimpleDb_Exception */ protected function _sendRequest(array $params = array()) { // UTF-8 encode all parameters and replace '+' characters foreach ($params as $name => $value) { unset($params[$name]); $params[utf8_encode($name)] = $value; } $params = $this->_addRequiredParameters($params); try { /* @var $request Zend_Http_Client */ $request = self::getHttpClient(); $request->resetParameters(); $request->setConfig(array( 'timeout' => $this->_httpTimeout )); $request->setUri($this->getEndpoint()); $request->setMethod(Zend_Http_Client::POST); foreach ($params as $key => $value) { $params_out[] = rawurlencode($key)."=".rawurlencode($value); } $request->setRawData(join('&', $params_out), Zend_Http_Client::ENC_URLENCODED); $httpResponse = $request->request(); } catch (Zend_Http_Client_Exception $zhce) { $message = 'Error in request to AWS service: ' . $zhce->getMessage(); throw new Zend_Service_Amazon_SimpleDb_Exception($message, $zhce->getCode()); } $response = new Zend_Service_Amazon_SimpleDb_Response($httpResponse); $this->_checkForErrors($response); return $response; } /** * Adds required authentication and version parameters to an array of * parameters * * The required parameters are: * - AWSAccessKey * - SignatureVersion * - Timestamp * - Version and * - Signature * * If a required parameter is already set in the <tt>$parameters</tt> array, * it is overwritten. * * @param array $parameters the array to which to add the required * parameters. * * @return array */ protected function _addRequiredParameters(array $parameters) { $parameters['AWSAccessKeyId'] = $this->_getAccessKey(); $parameters['SignatureVersion'] = $this->_signatureVersion; $parameters['Timestamp'] = gmdate('c'); $parameters['Version'] = $this->_sdbApiVersion; $parameters['SignatureMethod'] = $this->_signatureMethod; $parameters['Signature'] = $this->_signParameters($parameters); return $parameters; } /** * Computes the RFC 2104-compliant HMAC signature for request parameters * * This implements the Amazon Web Services signature, as per the following * specification: * * 1. Sort all request parameters (including <tt>SignatureVersion</tt> and * excluding <tt>Signature</tt>, the value of which is being created), * ignoring case. * * 2. Iterate over the sorted list and append the parameter name (in its * original case) and then its value. Do not URL-encode the parameter * values before constructing this string. Do not use any separator * characters when appending strings. * * @param array $parameters the parameters for which to get the signature. * @param string $secretKey the secret key to use to sign the parameters. * * @return string the signed data. */ protected function _signParameters(array $paramaters) { $data = "POST\n"; $data .= $this->getEndpoint()->getHost() . "\n"; $data .= "/\n"; uksort($paramaters, 'strcmp'); unset($paramaters['Signature']); $arrData = array(); foreach ($paramaters as $key => $value) { $value = urlencode($value); $value = str_replace("%7E", "~", $value); $value = str_replace("+", "%20", $value); $arrData[] = urlencode($key) . '=' . $value; } $data .= implode('&', $arrData); require_once 'Zend/Crypt/Hmac.php'; $hmac = Zend_Crypt_Hmac::compute($this->_getSecretKey(), 'SHA256', $data, Zend_Crypt_Hmac::BINARY); return base64_encode($hmac); } /** * Checks for errors responses from Amazon * * @param Zend_Service_Amazon_SimpleDb_Response $response the response object to * check. * * @return void * * @throws Zend_Service_Amazon_SimpleDb_Exception if one or more errors are * returned from Amazon. */ private function _checkForErrors(Zend_Service_Amazon_SimpleDb_Response $response) { $xpath = new DOMXPath($response->getDocument()); $list = $xpath->query('//Error'); if ($list->length > 0) { $node = $list->item(0); $code = $xpath->evaluate('string(Code/text())', $node); $message = $xpath->evaluate('string(Message/text())', $node); throw new Zend_Service_Amazon_SimpleDb_Exception($message, 0, $code); } } }
<?php use App\Http\Controllers\MovieController; use Illuminate\Support\Facades\Route; /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ Route::get("/","MovieController@index"); Route::get("/drama","MovieController@category"); Route::get("/kids","MovieController@category"); Route::get("/tv_show","MovieController@category"); Route::get("/detail","MovieController@detail");
<script type = "text/javascript"> //---JPaiva-30-07-2018----------------ACTUALIZAR----------------------------- $('#update').click(function (e) { e.preventDefault(); console.log("entro..."); //var data = $('#myForm').serializeArray(); //data.push({name: 'tienn2t', value: 'love'}); var formData = new FormData(); formData.append('url_imagen', $('#avatarInput')[0].files[0]); //console.log(data); $.ajax({ beforeSend: function (xhr) { var token = $('meta[name="csrf-token"]').attr('content'); if (token) { return xhr.setRequestHeader('X-CSRF-TOKEN', token); } }, url: "{{ url('/carrusel/actualizar') }}" + '?' + $('#myForm').serialize(), method: "POST", data: formData, processData: false, contentType: false }).done(function (data) { console.log(data); if (data.success) //$avatarImage.attr('src', data.path); window.location = "{{ url('/carrusel') }}"; }).fail(function () { alert('La imagen subida no tiene un formato correcto'); }); }); </script>
<?php /* * interfaces_wireless.php * * part of pfSense (https://www.pfsense.org) * Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate) * Copyright (c) 2010 Erik Fonnesbeck * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ##|+PRIV ##|*IDENT=page-interfaces-wireless ##|*NAME=Interfaces: Wireless ##|*DESCR=Allow access to the 'Interfaces: Wireless' page. ##|*MATCH=interfaces_wireless.php* ##|-PRIV require_once("guiconfig.inc"); init_config_arr(array('wireless', 'clone')); $a_clones = &$config['wireless']['clone']; function clone_inuse($num) { global $config, $a_clones; $iflist = get_configured_interface_list(true); foreach ($iflist as $if) { if ($config['interfaces'][$if]['if'] == $a_clones[$num]['cloneif']) { return true; } } return false; } if ($_POST['act'] == "del") { /* check if still in use */ if (clone_inuse($_POST['id'])) { $input_errors[] = gettext("This wireless clone cannot be deleted because it is assigned as an interface."); } else { pfSense_interface_destroy($a_clones[$_POST['id']]['cloneif']); unset($a_clones[$_POST['id']]); write_config(); header("Location: interfaces_wireless.php"); exit; } } $pgtitle = array(gettext("Interfaces"), gettext("Wireless")); $shortcut_section = "wireless"; include("head.inc"); if ($input_errors) { print_input_errors($input_errors); } $tab_array = array(); $tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php"); $tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php"); $tab_array[] = array(gettext("Wireless"), true, "interfaces_wireless.php"); $tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php"); $tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php"); $tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php"); $tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php"); $tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php"); $tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php"); $tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php"); display_top_tabs($tab_array); ?> <div class="panel panel-default"> <div class="panel-heading"><h2 class="panel-title"><?=gettext('Wireless Interfaces')?></h2></div> <div class="panel-body"> <div class="table-responsive"> <table class="table table-striped table-hover table-condensed table-rowdblclickedit"> <thead> <tr> <th><?=gettext("Interface"); ?></th> <th><?=gettext("Mode"); ?></th> <th><?=gettext("Description"); ?></th> <th><?=gettext("Actions"); ?></th> </tr> </thead> <tbody> <?php $i = 0; foreach ($a_clones as $clone) { ?> <tr> <td> <?=htmlspecialchars($clone['cloneif'])?> </td> <td> <?= $wlan_modes[$clone['mode']]; ?> </td> <td> <?=htmlspecialchars($clone['descr'])?> </td> <td> <a class="fa fa-pencil" title="<?=gettext('Edit WiFi interface')?>" href="interfaces_wireless_edit.php?id=<?=$i?>"></a> <a class="fa fa-trash" title="<?=gettext('Delete WiFi interface')?>" href="interfaces_wireless.php?act=del&amp;id=<?=$i?>" usepost></a> </td> </tr> <?php $i++; } ?> </tbody> </table> </div> </div> </div> <nav class="action-buttons"> <a href="interfaces_wireless_edit.php" class="btn btn-success btn-sm"> <i class="fa fa-plus icon-embed-btn"></i> <?=gettext("Add")?></a> </nav> <?php include("foot.inc");
<?php namespace App\Bridge\WithBridge\Realization; use App\Bridge\Entities\Product; use App\Bridge\WithBridge\Interfaces\WidgetRealizationInterface; class ProductWidgetRealization implements WidgetRealizationInterface { private $entity; public function __construct(Product $product) { $this->entity = $product; } public function getId() { return $this->entity->id; } public function getTitle() { return $this->entity->name; } public function getDescription() { return $this->entity->description; } }
<?php namespace Alahaxe\HealthCheckBundle\Service\Reporter; use Alahaxe\HealthCheck\Contracts\CheckStatusInterface; abstract class AbstractReporter implements ReporterInterface { /** * @inheritDoc */ public function calculateHttpCode(array $checkStatuses):int { return (int) max(array_map(static function (CheckStatusInterface $checkStatus):int { return $checkStatus->getHttpStatus(); }, $checkStatuses)); } }
<?php use Illuminate\Support\Facades\Route; /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ Route::get('/', function () { return view('welcome'); }); Route::resource('food', App\Http\Controllers\FoodController::class); Auth::routes(); Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home'); Route::resource('menus', App\Http\Controllers\MenuController::class);
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Sistema de Cadastro - PHP + MySQL</title> <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet"> <link rel="stylesheet" href="css/bulma.min.css" /> <link rel="stylesheet" type="text/css" href="css/login.css"> </head> <body> <section class="hero is-success is-fullheight"> <div class="hero-body"> <div class="container has-text-centered"> <div class="column is-4 is-offset-4"> <h3 class="title has-text-grey">Sistema de Cadastro</h3> <div class="notification is-success"> <p>Cadastro efetuado!</p> <p>Faça login informando o seu usuário e senha <a href="login.php">aqui</a></p> </div> <div class="notification is-info"> <p>O usuário escolhido já existe. Informe outro e tente novamente.</p> </div> <div class="box"> <form action="cadastrar.php" method="POST"> <div class="field"> <div class="control"> <input name="nome" type="text" class="input is-large" placeholder="Nome" autofocus> </div> </div> <div class="field"> <div class="control"> <input name="usuario" type="text" class="input is-large" placeholder="Usuário"> </div> </div> <div class="field"> <div class="control"> <input name="senha" class="input is-large" type="password" placeholder="Senha"> </div> </div> <button type="submit" class="button is-block is-link is-large is-fullwidth">Cadastrar</button> </form> </div> </div> </div> </div> </section> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <title>Requerimiento de ByS {{$requerimiento->codigoCedepas}}</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <style> .notaDeGeneracion { font-size: 12px; color: rgb(168, 168, 168); } html { /* Arriba | Derecha | Abajo | Izquierda */ margin: 50pt 60pt 50pt 70pt; font-family: Candara, Calibri, Segoe, "Segoe UI", Optima, Arial, sans-serif; } #principal { /*background-color: rgb(161, 51, 51);*/ word-wrap: break-word;/* para que el texto no salga del div*/ } thead { font-size: large; } tbody{ font-size: 13px; } table{ border-collapse: collapse; } th{ border: 1px solid black; border-collapse: collapse; padding: 3px; } td { border: 1px solid black; border-collapse: collapse; padding: 1px; } </style> </head> <body> <div id="principal" style="width: 635px; height: 750px"> <table style="width:100%"> <thead style="width:100%"> <tr> <th style="height: 70px; float: left" colspan="2"> <div style="height: 5px"></div> <img src="{{App\Configuracion::getRutaImagenCedepasPNG()}}" height="100%"> </th> <th style="text-align: center" colspan="2">{{$requerimiento->codigoCedepas}}</th> </tr> <tr> <th colspan="4" style="text-align: center; background-color: rgb(0, 102, 205); color: white"> REQUERIMIENTO DE BIENES Y SERVICIOS </th> </tr> </thead> <tbody> <tr> <td style="font-weight: bold;">Fecha y Hora Emisión:</td> <td colspan="1">{{$requerimiento->formatoFechaHoraEmision()}}</td> <td style="font-weight: bold;">Proyecto:</td> <td colspan="1">{{$requerimiento->getProyecto()->nombre}}</td> </tr> <tr> <td style="font-weight: bold;">Colaborador/a:</td> <td colspan="1">{{$requerimiento->getEmpleadoSolicitante()->getNombreCompleto()}}</td> <td style="font-weight: bold;">Cód Colab:</td> <td colspan="1">{{$requerimiento->getEmpleadoSolicitante()->codigoCedepas}}</td> </tr> </tbody> </table> <div style="width: 100%; height: 8px;"></div> <table style="width:100%"> <tbody style="width:100%; font-size: 11px;"> <tr> <td colspan="4">Solicito abastecernos de los bienes / servicios que se detallan a continuación:</td> </tr> <tr style="font-weight: bold; background-color:rgb(238, 238, 238);"> <td style="width: 70px; text-align: center;">Cantidad</td> <td style="width: 80px; text-align: center;">Unidad de medida</td> <td style="text-align: center;">Descripción del bien o servicio</td> <td style="width: 90px; text-align: center;">Código</td> </tr> @foreach ($listaItems as $item) <tr> <td style="text-align: right">{{$item->cantidad}}</td> <td>{{$item->getNombreTipoUnidad()}}</td> <td>{{$item->descripcion}}</td> <td style="text-align: left;">{{$item->codigoPresupuestal}}</td> </tr> @endforeach </table> <div style="width: 100%; height: 8px;"></div> <table style="width:100%"> <tbody style="width:100%; border: 0;"> <tr> <td style="width: 100px; border: 0;">Solicitado por:</td> <td style="border: 0;">{{$requerimiento->getEmpleadoSolicitante()->getNombreCompleto()}}</td> </tr> <tr> <td style="border: 0;">Aprobado por:</td> <td style="border: 0;"> @if(!is_null($requerimiento->codEmpleadoEvaluador)) {{$requerimiento->getEmpleadoEvaluador()->getNombreCompleto()}} @endif </td> </tr> <tr> <td style="border: 0;">Autorizado por:</td> <td style="border: 0;"> @if(!is_null($requerimiento->codEmpleadoAdministrador)) Ana Cecilia Angulo Alva @endif </td> </tr> </tbody> </table> <div style="width: 100%; height: 8px;"></div> <table style="width:100%"> <tbody style="width:100%"> <tr> <td colspan="2"> <p> <b>JUSTIFICACIÓN DEL REQUERIMIENTO:</b><br> {{$requerimiento->justificacion}} </p> </td> </tr> <tr> <td style="font-weight: bold; width:30%">Cuenta Bancaria Proveedor:</td> <td >{{$requerimiento->cuentaBancariaProveedor}}</td> </tr> </tbody> </table> <div class="notaDeGeneracion"> *Vista PDF generada por el sistema gestion.cedepas.org el {{App\Fecha::getFechaHoraActual()}} por {{App\Empleado::getEmpleadoLogeado()->getNombreCompleto()}} </div> </div> </body> </html>
<?php namespace EnsahBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class EtudiantControllerTest extends WebTestCase { public function testSignup() { $client = static::createClient(); $crawler = $client->request('GET', '/signup'); } public function testLogin() { $client = static::createClient(); $crawler = $client->request('GET', '/login'); } public function testPasswordforgotten() { $client = static::createClient(); $crawler = $client->request('GET', 'password-forgotten'); } }
<?php //defined('BASEPATH') OR exit('No direct script access allowed'); namespace App\Controllers; class Login extends BaseController { //public function costruct public function __construct() { } public function index() { echo view('login_template/header'); echo view('login_template/main_header'); echo view('login'); echo view('login_template/footer'); } }
<?php /** * @author Olle Törnström olle@studiomediatech.com * @since 2.0 * @created 2009-05-13 */ require_once ('classes/class.InstallAdmin.php'); require_once ('classes/class.BaseInstallation.php'); require_once ('classes/class.Installation.php'); require_once ('classes/class.InstallStorage.php');
<?php // config $config['base_url'] = 'http://localhost/ci-app/peoples/index'; $config['num_links'] = 5; // styling $config['full_tag_open'] = '<nav><ul class="pagination justify-content-center">'; $config['full_tag_close'] = '</ul></nav>'; $config['first_link'] = 'First'; $config['first_tag_open'] = '<li class="page-item">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Last'; $config['last_tag_open'] = '<li class="page-item">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = '&raquo'; $config['next_tag_open'] = '<li class="page-item">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '&laquo'; $config['prev_tag_open'] = '<li class="page-item">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="page-item active"><a class="page-link" href="#">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li class="page-item">'; $config['num_tag_close'] = '</li>'; $config['attributes'] = array('class' => 'page-link');
@extends('adminlte::page') @section('title', "Adicionar detalhes ao {$plan->name}") @section('content_header') <div class="row"> <div class="col-sm-9 form-group"> <h1>Adicionar detalhes ao {{ $plan->name }}</h1> </div> </div> @stop @section('content') <div class="card"> <div class="card-header"> <nav aria-label="breadcrumb"> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="{{ route('admin.index')}}">Dashboard</a></li> <li class="breadcrumb-item"><a href="{{ route('plans.index') }}">Planos</a></li> <li class="breadcrumb-item"><a href="{{ route('plans.show', $plan->url) }}">{{ $plan->name }}</a></li> <li class="breadcrumb-item "><a href="{{ route('plans.details.index', $plan->url) }}">Detalhes</a></li> <li class="breadcrumb-item active" aria-current="page"><a href="{{ route('plans.details.create', $plan->url) }}" class="active">Novo</a></li> </ol> </nav> </div> <div class="card-body"> <form action="{{ route('plans.details.store', $plan->url) }}" method="post" class="form"> @include('admin.pages.plans.details._partials.form') </form> </div> <div class="card-footer"> @include('admin.includes.copyright') </div> </div> @stop
<!-- Modal --> <div class="modal fade" id="modal-form" tabindex="-1" role="dialog" aria-labelledby="modal-form"> <div class="modal-dialog" role="document"> <form action="" method="post" class="form-horizontal"> @csrf @method('post') <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" ></h4> </div> <div class="modal-body"> <div class="form-group row"> <label for="id_kategori" class="col-md-3 col-md-offset-1 control-label">Kategori</label> <div class="col-md-6"> <select name="id_kategori" id="id_kategori" class="form-control"> <option value="">Pilih Kategori</option> @foreach ($kategori as $key => $item) <option value="{{ $key }}">{{ $item }}</option> @endforeach </select> <span class="help-block with-errors"></span> </div> </div> <div class="form-group row"> <label for="sub_kategori" class="col-md-3 col-md-offset-1 control-label">Sub Kategori</label> <div class="col-md-6"> <input type="text" name="sub_kategori" id="id_subkategori" class="form-control" required autofocus> <span class="help-block with-errors"></span> </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-primary">Save</button> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> </div> </div> </form> </div> </div>
<!DOCTYPE html> <html> <head> <title>@yield('title', 'Hjc app')</title> </head> <body> @yield('content') </body> </html>
--TEST-- imap_utf8() tests --SKIPIF-- <?php if (!extension_loaded("imap")) print "skip"; ?> --FILE-- <?php var_dump(imap_utf8("")); var_dump(imap_utf8(1)); var_dump(imap_utf8(array(1,2))); var_dump(imap_utf8("test")); echo "Done\n"; ?> --EXPECTF-- string(0) "" string(1) "1" Warning: imap_utf8() expects parameter 1 to be string, array given in %s on line %d NULL string(4) "%s" Done
<?php namespace Site\View\Cell; use Cake\View\Cell; /** * Testimonials cell */ class TestimonialsCell extends Cell { /** * List of valid options that can be passed into this * cell's constructor. * * @var array */ protected $_validCellOptions = []; /** * Default display method. * * @return void */ public function display($element = null) { $this->set('element', $element); $this->loadModel('Testimonials'); $testimonials = $this->Testimonials->find('all')->where(['status' => 1]); $this->set('testimonials', $testimonials->all()); } }
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; class CreatePostsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::defaultStringLength(191); // Create table for storing roles Schema::create('posts', function (Blueprint $table) { $table->increments('id'); $table->integer('author_id'); $table->integer('category_id')->nullable(); $table->string('title'); $table->string('seo_title')->nullable(); $table->text('excerpt'); $table->text('body'); $table->string('image')->nullable(); $table->string('slug')->unique(); $table->text('meta_description'); $table->text('meta_keywords'); $table->enum('status', ['PUBLISHED', 'DRAFT', 'PENDING'])->default('DRAFT'); $table->boolean('featured')->default(0); $table->timestamps(); //$table->foreign('author_id')->references('id')->on('users'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('posts'); } }
<div class="content"> <div class="row"> <div class="col-md-12"> <div class="card"> <div class="card-header"> <h4 class="card-title"> Cari Praktikan</h4> </div> <div class="card-body"> <div class="toolbar"> <div class="input-wrap"> <form action="<?=base_url()?>index.php/dosen/search" class="form-box d-flex justify-content-between" method="GET"> <input type="text" placeholder="Masukkan nama atau nim praktikan" class="form-control" name="key" style=" height: 42px;margin-top: 10px;margin-right: 10px;"> <button type="submit" class="btn search-btn btn-info btn-icon" style="width:40px;height:40px;"><i class="nc-icon nc-zoom-split" style="font-size:25px;"></i></button> </form> </div> <br/> </div> <div class="table-responsive-sm"> <table id="datatable" class="table table-bordered" cellspacing="0" width="100%"> <thead> <tr> <th width="35">No</th> <th class="disabled-sorting" width="60">Gambar</th> <th width="300">Nama</th> <th width="100">Nim</th> <th width="100">Angkatan</th> <th class="disabled-sorting text-right">Detail</th> </tr> </thead> <tbody> <?php $i=1; if(isset($data)){foreach ($data as $row): ?> <tr><td class="text-center"><?=$i++?></td> <td class="text-center"><img src="https://portal.usu.ac.id/photos/<?=$row->nim?>.jpg" height="100" alt="gambar tidak tersedia"></td> <td><?= $row->nama ?></td> <td><?= $row->nim ?></td> <td><?= $row->angkatan ?></td> <td class="text-right"> <a href="#" class="btn btn-info btn-link btn-icon" onclick="showAjaxModal('<?php echo base_url();?>index.php/dosen/search/detail/<?=$row->nim?>');"> <i class="fa fa-search-plus"></i> </a> </td> </tr> <?php endforeach; }?> </tbody> </table> </div> </div> </div> </div> </div> </div> <script type="text/javascript"> $(document).ready(function() { $('#datatable').DataTable({ "pagingType": "full_numbers", "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] ], responsive: true, language: { search: "_INPUT_", searchPlaceholder: "Search records", } }); var table = $('#datatable').DataTable(); // Edit record table.on('click', '.edit', function() { $tr = $(this).closest('tr'); var data = table.row($tr).data(); alert('You press on Row: ' + data[0] + ' ' + data[1] + ' ' + data[2] + '\'s row.'); }); // Delete a record table.on('click', '.remove', function(e) { $tr = $(this).closest('tr'); table.row($tr).remove().draw(); e.preventDefault(); }); //Like record table.on('click', '.like', function() { alert('You clicked on Like button'); }); }); </script> <script src="<?=base_url()?>assets/js/plugins/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
<?php namespace App\Listeners\Followers; use App\Models\User; class AddFollower { /** * Create the event listener. * * @return void */ public function __construct() { // } /** * Handle the event. * * @param object $event * @return void */ public function handle($event) { /** @var User $user */ $user = $event->user; $user->profile()->increment('follower_count'); $user->save(); } }
<?php declare(strict_types=1); namespace Finance\Tests\Helper; use Bassix\Finance\Helper\TaxHelper; use PHPUnit\Framework\TestCase; /** * @covers \Bassix\Finance\Helper\TaxHelper */ class TaxHelperTest extends TestCase { public function testGetNetAmount(): void { foreach ($this->getAmountCases() as $row => $case) { $amount = TaxHelper::getNetMoney($case['unitAmount'], $case['taxRate'], $case['currency'], $case['quantity'], $case['hasTax']); self::assertEquals($amount->getCurrency()->getCode(), $case['currency'], sprintf('The test at row "%s" expects currency "%s" if currency "%s" is given!', $row, $case['currency'], $case['currency'])); self::assertEquals($amount->getAmount(), $case['netAmount'], sprintf('The test at row "%s" expects net amount "%s" if amount "%s" with tax rate "%s" is given!', $row, $case['netAmount'], $case['unitAmount'], $case['taxRate'])); } } public function testGetGrossAmount(): void { foreach ($this->getAmountCases() as $row => $case) { $amount = TaxHelper::getGrossMoney($case['unitAmount'], $case['taxRate'], $case['currency'], $case['quantity'], $case['hasTax']); self::assertEquals($amount->getCurrency()->getCode(), $case['currency'], sprintf('The test at row "%s" expects currency "%s" if currency "%s" is given!', $row, $case['currency'], $case['currency'])); self::assertEquals($amount->getAmount(), $case['grossAmount'], sprintf('The test at row "%s" expects gross amount "%s" if amount "%s" with tax rate "%s" is given!', $row, $case['netAmount'], $case['unitAmount'], $case['taxRate'])); } } public function testGetTaxAmount(): void { foreach ($this->getAmountCases() as $row => $case) { $amount = TaxHelper::getTaxMoney($case['unitAmount'], $case['taxRate'], $case['currency'], $case['quantity'], $case['hasTax']); self::assertEquals($amount->getCurrency()->getCode(), $case['currency'], sprintf('The test at row "%s" expects currency "%s" if currency "%s" is given!', $row, $case['currency'], $case['currency'])); self::assertEquals($amount->getAmount(), $case['taxAmount'], sprintf('The test at row "%s" expects tax amount "%s" if amount "%s" with tax rate "%s" is given!', $row, $case['taxAmount'], $case['unitAmount'], $case['taxRate'])); } } private function getAmountCases(): array { return [ 0 => ['unitAmount' => 0, 'taxRate' => 0, 'currency' => 'EUR', 'quantity' => 0, 'hasTax' => false, 'netAmount' => 0, 'grossAmount' => 0, 'taxAmount' => 0], 1 => ['unitAmount' => 0, 'taxRate' => 0, 'currency' => 'EUR', 'quantity' => 0, 'hasTax' => true, 'netAmount' => 0, 'grossAmount' => 0, 'taxAmount' => 0], 2 => ['unitAmount' => 100, 'taxRate' => 0, 'currency' => 'EUR', 'quantity' => 1, 'hasTax' => false, 'netAmount' => 100, 'grossAmount' => 100, 'taxAmount' => 0], 3 => ['unitAmount' => 100, 'taxRate' => 19, 'currency' => 'EUR', 'quantity' => 2, 'hasTax' => true, 'netAmount' => 168.0672, 'grossAmount' => 200, 'taxAmount' => 31.9327], 4 => ['unitAmount' => 99.9999, 'taxRate' => 19, 'currency' => 'EUR', 'quantity' => 1, 'hasTax' => true, 'netAmount' => 84.0335, 'grossAmount' => 99.9999, 'taxAmount' => 15.9663], 5 => ['unitAmount' => 99.9999, 'taxRate' => 19.5, 'currency' => 'GBP', 'quantity' => 1, 'hasTax' => true, 'netAmount' => 83.6819, 'grossAmount' => 99.9999, 'taxAmount' => 16.3179], 6 => ['unitAmount' => 83.6819, 'taxRate' => 19.5, 'currency' => 'GBP', 'quantity' => 1, 'hasTax' => false, 'netAmount' => 83.6819, 'grossAmount' => 99.9998, 'taxAmount' => 16.3179], 7 => ['unitAmount' => 0.99, 'taxRate' => 16, 'currency' => 'GBP', 'quantity' => 1, 'hasTax' => true, 'netAmount' => 0.8534, 'grossAmount' => 0.99, 'taxAmount' => 0.1365], 8 => ['unitAmount' => 0.99, 'taxRate' => 16, 'currency' => 'USD', 'quantity' => 15, 'hasTax' => false, 'netAmount' => 14.85, 'grossAmount' => 17.226, 'taxAmount' => 2.376], ]; } }
<?php declare(strict_types=1); namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\ORM\Annotation as ORM; use Doctrine\ORM\AbstractQuery; /** * @group DDC-2306 */ class DDC3170Test extends \Doctrine\Tests\OrmFunctionalTestCase { /** * {@inheritDoc} */ protected function setUp() { parent::setUp(); $this->schemaTool->createSchema( [ $this->em->getClassMetadata(DDC3170AbstractEntityJoined::class), $this->em->getClassMetadata(DDC3170ProductJoined::class), $this->em->getClassMetadata(DDC3170AbstractEntitySingleTable::class), $this->em->getClassMetadata(DDC3170ProductSingleTable::class), ] ); } /** * Tests that the discriminator column is correctly read from the meta mappings when fetching a * child from an inheritance mapped class. * * The simple object hydration maps the type field to a field alias like type2. This mapping needs * to be considered when loading the discriminator column's value from the SQL result. * * {@see \Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator::hydrateRowData()} */ public function testIssue() { $productJoined = new DDC3170ProductJoined(); $productSingleTable = new DDC3170ProductSingleTable(); $this->em->persist($productJoined); $this->em->persist($productSingleTable); $this->em->flush(); $this->em->clear(); $result = $this->em->createQueryBuilder() ->select('p') ->from(DDC3170ProductJoined::class, 'p') ->getQuery() ->getResult(AbstractQuery::HYDRATE_SIMPLEOBJECT); self::assertCount(1, $result); self::assertContainsOnly(DDC3170ProductJoined::class, $result); $result = $this->em->createQueryBuilder() ->select('p') ->from(DDC3170ProductSingleTable::class, 'p') ->getQuery() ->getResult(AbstractQuery::HYDRATE_SIMPLEOBJECT); self::assertCount(1, $result); self::assertContainsOnly(DDC3170ProductSingleTable::class, $result); } } /** * @ORM\Entity * @ORM\InheritanceType("JOINED") * @ORM\DiscriminatorColumn(name="type", type="string") * @ORM\DiscriminatorMap({"product" = DDC3170ProductJoined::class}) */ abstract class DDC3170AbstractEntityJoined { /** @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue */ public $id; } /** * @ORM\Entity */ class DDC3170ProductJoined extends DDC3170AbstractEntityJoined { } /** * @ORM\Entity * @ORM\InheritanceType("SINGLE_TABLE") * @ORM\DiscriminatorColumn(name="type", type="string") * @ORM\DiscriminatorMap({"product" = DDC3170ProductSingleTable::class}) */ abstract class DDC3170AbstractEntitySingleTable { /** @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue */ public $id; } /** * @ORM\Entity */ class DDC3170ProductSingleTable extends DDC3170AbstractEntitySingleTable { }
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Input; use App\Http\Requests; use App\Http\Controllers\Controller; use App\Customer; use App\PO; use App\Periode; use App\SJKirim; use App\IsiSJKirim; use App\Reference; use App\Transaksi; use App\TransaksiHilang; use App\History; use App\Invoice; use App\InvoiceKirim; use App\InvoicePisah; use App\Inventory; use Session; use DB; use Auth; class SJKirimController extends Controller { public function __construct() { $this->middleware(function ($request, $next){ if(Auth::check()&&(Auth::user()->access=='Administrator'||Auth::user()->access=='PPNAdmin'||Auth::user()->access=='NonPPNAdmin'||Auth::user()->access=='Purchasing'||Auth::user()->access=='SuperPurchasing')) $this->access = array("index", "create", "create2", "create3", "show", "edit", "qtertanda"); else $this->access = array(""); return $next($request); }); } public function index(){ $sum = IsiSJKirim::select([ 'isisjkirim.SJKir', DB::raw('sum(isisjkirim.QTertanda) AS qttd') ]) ->groupBy('isisjkirim.SJKir'); if(Auth::user()->access == 'Administrator'||Auth::user()->access=='SuperPurchasing'){ $sjkirim = SJKirim::select([ 'qttd', 'sjkirim.*', 'project.Project', 'customer.Company', ]) ->leftJoin('pocustomer', 'sjkirim.Reference', '=', 'pocustomer.Reference') ->leftJoin('project', 'pocustomer.PCode', '=', 'project.PCode') ->leftJoin('customer', 'project.CCode', '=', 'customer.CCode') ->leftJoin(DB::raw(sprintf( '(%s) AS T1', $sum->toSql() )), function($join){ $join->on('T1.SJKir', '=', 'sjkirim.SJKir'); }) ->orderBy('sjkirim.id', 'asc') ->get(); }else if(Auth::user()->access == 'PPNAdmin'){ $sjkirim = SJKirim::select([ 'qttd', 'sjkirim.*', 'project.Project', 'customer.Company', ]) ->leftJoin('pocustomer', 'sjkirim.Reference', '=', 'pocustomer.Reference') ->leftJoin('project', 'pocustomer.PCode', '=', 'project.PCode') ->leftJoin('customer', 'project.CCode', '=', 'customer.CCode') ->leftJoin(DB::raw(sprintf( '(%s) AS T1', $sum->toSql() )), function($join){ $join->on('T1.SJKir', '=', 'sjkirim.SJKir'); }) ->where('PPN', 1) ->orderBy('sjkirim.id', 'asc') ->get(); }else if(Auth::user()->access == 'NonPPNAdmin'){ $sjkirim = SJKirim::select([ 'qttd', 'sjkirim.*', 'project.Project', 'customer.Company', ]) ->leftJoin('pocustomer', 'sjkirim.Reference', '=', 'pocustomer.Reference') ->leftJoin('project', 'pocustomer.PCode', '=', 'project.PCode') ->leftJoin('customer', 'project.CCode', '=', 'customer.CCode') ->leftJoin(DB::raw(sprintf( '(%s) AS T1', $sum->toSql() )), function($join){ $join->on('T1.SJKir', '=', 'sjkirim.SJKir'); }) ->where('PPN', 0) ->orderBy('sjkirim.id', 'asc') ->get(); } if(in_array("index", $this->access)){ return view('pages.sjkirim.indexs') ->with('url', 'sjkirim') ->with('sjkirims', $sjkirim) ->with('top_menu_sel', 'menu_sjkirim') ->with('page_title', 'Surat Jalan Kirim') ->with('page_description', 'Index'); }else return redirect()->back(); } public function create(){ $reference = Reference::find(Input::get('id')); $maxperiode = Transaksi::leftJoin('po', 'transaksi.POCode', '=', 'po.POCode') ->where('Reference', $reference->Reference) ->max('Periode'); $po = Transaksi::leftJoin('po', 'transaksi.POCode', '=', 'po.POCode') ->where('transaksi.Reference', $reference->Reference) ->where('po.Periode', $maxperiode) ->first(); $min = $po->Tgl; $sjkirim = SJKirim::select([ DB::raw('MAX(sjkirim.id) AS maxid') ]) ->first(); if(in_array("create", $this->access)){ return view('pages.sjkirim.create') ->with('url', 'sjkirim') ->with('reference', $reference) ->with('min', $min) ->with('sjkirim', $sjkirim) ->with('top_menu_sel', 'menu_sjkirim') ->with('page_title', 'Surat Jalan Kirim') ->with('page_description', 'Create'); }else return redirect()->back(); } public function getCreate2(Request $request, $id){ Session::put('SJKir', $request->SJKir); Session::put('Tgl', $request->Tgl); Session::put('JS', $request->JS); Session::put('Reference', $request->Reference); $JS = Session::get('JS'); $Reference = Session::get('Reference'); $referenceid = Reference::where('pocustomer.id', $id) ->first(); $transaksis = Transaksi::select([ 'transaksi.*', 'po.Tgl as tglpo', 'po.POCode', 'project.Project', ]) ->leftJoin('pocustomer', 'transaksi.Reference', '=', 'pocustomer.Reference') ->leftJoin('po', 'transaksi.POCode', '=', 'po.POCode') ->leftJoin('project', 'pocustomer.PCode', '=', 'project.PCode') ->where('transaksi.Reference', $Reference) ->where('transaksi.JS', $JS) ->orderBy('transaksi.id', 'asc') ->get(); $isisjkirim = IsiSJKirim::select([ DB::raw('MAX(isisjkirim.id) AS maxid') ]) ->first(); $sjkirim = SJKirim::select([ DB::raw('MAX(sjkirim.id) AS maxid') ]) ->first(); if(in_array("create2", $this->access)){ return view('pages.sjkirim.create2') ->with('url', 'sjkirim') ->with('referenceid', $referenceid) ->with('transaksis', $transaksis) ->with('isisjkirim', $isisjkirim) ->with('sjkirim', $sjkirim) ->with('top_menu_sel', 'menu_sjkirim') ->with('page_title', 'Surat Jalan Kirim') ->with('page_description', 'Choose'); }else return redirect()->back(); } public function getCreate3(Request $request, $id){ $input = Input::only('checkbox'); $purchases = $input['checkbox']; foreach ($purchases as $key => $purchases) { $Purchase[] = $input['checkbox'][$key]; } $Tgl = Session::get('Tgl'); $Reference = Session::get('Reference'); $referenceid = Reference::where('pocustomer.id', $id) ->first(); $transaksis = Transaksi::select([ 'transaksi.*', 'inventory.Type', 'inventory.Kumbang', 'project.Project', ]) ->leftJoin('pocustomer', 'transaksi.Reference', '=', 'pocustomer.Reference') ->leftJoin('inventory', 'transaksi.ICode', '=', 'inventory.Code') ->leftJoin('project', 'pocustomer.PCode', '=', 'project.PCode') ->where('transaksi.Reference', $Reference) ->whereIn('transaksi.Purchase', $Purchase) ->orderBy('transaksi.id', 'asc') ->get(); $last_sjkirim = SJKirim::max('id'); $last_isisjkirim = IsiSJKirim::max('id'); $last_periode = Periode::max('id'); $maxperiode = Periode::where('Reference', $Reference)->max('Periode'); $maxisisjkir = IsiSJKirim::max('IsiSJKir'); $ECont = Periode::where('Reference', $Reference) //->whereIn('Purchase', $Purchase) //->whereRaw('(SELECT MAX(Periode) FROM periode WHERE Reference = ?)', $Reference) ->where('Periode', $maxperiode) ->first(); $end = str_replace('/', '-', $Tgl); $end2 = strtotime("-1 day +1 month", strtotime($end)); $end3 = date("d/m/Y", $end2); if(count($ECont)==0){ $tglE = $end3; $periode = 1; }else{ $tglE = $ECont->E; $periode = $ECont->Periode; } if(in_array("create3", $this->access)){ return view('pages.sjkirim.create3') ->with('url', 'sjkirim') ->with('tglE', $tglE) ->with('periode', $periode) ->with('referenceid', $referenceid) ->with('transaksis', $transaksis) ->with('last_sjkirim', $last_sjkirim) ->with('last_isisjkirim', $last_isisjkirim) ->with('last_periode', $last_periode) ->with('maxperiode', $maxperiode) ->with('maxisisjkir', $maxisisjkir) ->with('top_menu_sel', 'menu_sjkirim') ->with('page_title', 'Surat Jalan Kirim') ->with('page_description', 'Item'); }else return redirect()->back(); } public function store(Request $request){ $SJKir = Session::get('SJKir'); $Tgl = Session::get('Tgl'); $JS = Session::get('JS'); $Reference = Session::get('Reference'); $sjkirim = SJKirim::Create([ 'id' => $request['sjkirimid'], 'SJKir' => $SJKir, 'Tgl' => $Tgl, 'Reference' => $Reference, 'NoPolisi' => $request['NoPolisi'], 'Sopir' => $request['Sopir'], 'Kenek' => $request['Kenek'], 'Keterangan' => $request['Keterangan'], 'FormMuat' => $request['FormMuat'], ]); $input = Input::all(); $isisjkirims = $input['isisjkirimid']; foreach ($isisjkirims as $key => $isisjkirim) { $isisjkirim = new IsiSJKirim; $isisjkirim->id = $input['isisjkirimid'][$key]; $isisjkirim->IsiSJKir = $input['IsiSJKir'][$key]; $isisjkirim->QKirim = $input['QKirim'][$key]; $isisjkirim->Warehouse = $input['Warehouse'][$key]; $isisjkirim->Purchase = $input['Purchase'][$key]; $isisjkirim->SJKir = $SJKir; $isisjkirim->save(); } $periodes = $input['isisjkirimid']; foreach ($periodes as $key => $periodes) { $periodes = new Periode; $periodes->id = $input['periodeid'][$key]; $periodes->Periode = $input['Periode']; $periodes->S = $Tgl; $periodes->E = $input['tglE']; $periodes->IsiSJKir = $input['IsiSJKir'][$key]; $periodes->Reference = $Reference; $periodes->Purchase = $input['Purchase'][$key]; $periodes->Deletes = $input['JS'][$key]; $periodes->save(); } $transaksis = $input['id']; foreach ($transaksis as $key => $transaksi) { $transaksi = Transaksi::find($transaksis[$key]); $transaksi->QSisaKirInsert = $input['QSisaKirInsert'][$key]-$input['QKirim'][$key]; $transaksi->save(); } $data = Invoice::where('Reference', $Reference) ->where('Periode', $input['Periode']) ->where('JSC', $JS)->first(); $data->update(['Times' => $data->Times + 1]); $data = InvoicePisah::where('Reference', $Reference) ->where('POCode', $input['POCode'][0]) ->where('Periode', $input['Periode']) ->where('JSC', $JS)->first(); $data->update(['Times' => $data->Times + 1]); $inventories = $input['ICode']; foreach ($inventories as $key => $inventory) { if($input['Warehouse'][$key] == 'Kumbang'){ $warehouse = 'Kumbang'; }elseif($input['Warehouse'][$key] == 'BulakSereh'){ $warehouse = 'BulakSereh'; }elseif($input['Warehouse'][$key] == 'Legok'){ $warehouse = 'Legok'; }elseif($input['Warehouse'][$key] == 'CitraGarden'){ $warehouse = 'CitraGarden'; } $data = Inventory::where('Code', $input['ICode'][$key]) ->first(); $data->update([$warehouse => $data->$warehouse - $input['QKirim'][$key]]); } //insert to invoice based on sj kirim //get last periode if exist $maxperiode = Periode::where('Reference', $Reference) ->max('Periode'); if(isset($maxperiode)) $periode = $maxperiode; else $periode = 1; //get first count for periode that start from 1 after new year if exist $firstcount = Invoice::where('Reference', $Reference) ->where('Periode', $maxperiode) ->first(); if(isset($firstcount)) $count = $firstcount->Count; else $count = 1; //get termin if exist $firsttermin = Invoice::where('Reference', $Reference) ->first(); if(isset($firsttermin)) $termin = $firsttermin->Termin; else $termin = 0; $PPN = Customer::leftJoin('project', 'customer.CCode', '=', 'project.CCode') ->leftJoin('pocustomer', 'project.PCode', '=', 'pocustomer.PCode') ->where('Reference', $Reference) ->first()->PPN; $abjad = InvoiceKirim::where('Reference', $Reference)->max('Abjad'); if($abjad==0) $x = 1; else $x = $abjad+1; if($x==1)$y='';else if($x==2)$y='A';else if($x==3)$y='B';else if($x==4)$y='C';else if($x==5)$y='D';else if($x==6)$y='E';else if($x==7)$y='F';else if($x==8)$y='G';else if($x==9)$y='H';else if($x==10)$y='I';else if($x==11)$y='J';else if($x==12)$y='K';else if($x==13)$y='L';else if($x==14)$y='M';else if($x==15)$y='N';else if($x==16)$y='O';else if($x==17)$y='P';else if($x==18)$y='Q';else if($x==19)$y='R';else if($x==20)$y='S';else if($x==21)$y='T';else if($x==22)$y='U';else if($x==23)$y='V';else if($x==24)$y='W';else if($x==25)$y='X';else if($x==26)$y='Y';else if($x==27)$y='Z'; $last_invoicekirim = InvoiceKirim::max('id')+1; $invoicekirim = new InvoiceKirim; $invoicekirim->id = $last_invoicekirim; if($JS=="Sewa"){ $invoicekirim->Invoice = $SJKir.$y."/".$count."/".substr($Tgl, 3, -5).substr($Tgl, 6)."/BDN"; }else{ $invoicekirim->Invoice = $SJKir.$y."/".substr($Tgl, 3, -5)."/".substr($Tgl, 6); } $invoicekirim->JSC = $JS; $invoicekirim->Tgl = $Tgl; $invoicekirim->Reference = $Reference; $invoicekirim->Periode = $input['Periode']; $invoicekirim->PPN = $PPN; $invoicekirim->Count = $count; $invoicekirim->Termin = $termin; $invoicekirim->Times = 1; $invoicekirim->SJKir = $SJKir; $invoicekirim->Abjad = $x; $invoicekirim->save(); $history = new History; $history->User = Auth::user()->name; $history->History = 'Create SJKirim on SJKir '.$SJKir; $history->save(); Session::forget('SJKir'); Session::forget('Tgl'); Session::forget('JS'); Session::forget('Reference'); return redirect()->route('sjkirim.show', $request['sjkirimid']); } public function show($id){ $sjkirim = SJKirim::select([ 'sjkirim.*', 'sjkirim.id as sjkirid', 'pocustomer.id as pocusid', ]) ->leftJoin('pocustomer', 'sjkirim.Reference', '=', 'pocustomer.Reference') ->where('sjkirim.id', $id) ->first(); $isisjkirims = IsiSJKirim::select([ 'isisjkirim.*', 'sjkirim.*', 'periode.Periode', 'transaksi.*', 'project.*', 'customer.*' ]) ->leftJoin('sjkirim', 'isisjkirim.SJKir', '=', 'sjkirim.SJKir') ->leftJoin('periode', 'isisjkirim.IsiSJKir', '=', 'periode.IsiSJKir') ->leftJoin('transaksi', 'isisjkirim.Purchase', '=', 'transaksi.Purchase') ->leftJoin('pocustomer', 'transaksi.Reference', '=', 'pocustomer.Reference') ->leftJoin('project', 'pocustomer.PCode', '=', 'project.PCode') ->leftJoin('customer', 'project.CCode', '=', 'customer.CCode') ->where('isisjkirim.SJKir', $sjkirim->SJKir) ->groupBy('periode.IsiSJKir') ->orderBy('isisjkirim.id', 'asc') ->get(); $isisjkirim = $isisjkirims->first(); $jumlah = $isisjkirims->sum('QTertanda'); $periode = Periode::leftJoin('isisjkirim', 'periode.IsiSJKir', '=', 'isisjkirim.IsiSJKir') ->where('isisjkirim.SJKir', $sjkirim->SJKir) ->whereRaw('(periode.Deletes = "Sewa" OR periode.Deletes = "Jual")') ->first(); $maxperiode = Periode::where('Reference', $sjkirim->Reference) ->max('Periode'); if($periode->Periode == $maxperiode){ $qttdcheck = 0; }else{ $qttdcheck = 1; } $transaksihilangs = TransaksiHilang::select('transaksihilang.*', 'transaksi.Barang') ->leftJoin('transaksi', 'transaksihilang.Purchase', '=', 'transaksi.Purchase') ->where('SJ', $sjkirim->SJKir) ->where('SJType', 'Kirim') ->get(); if(in_array("show", $this->access)){ return view('pages.sjkirim.show') ->with('url', 'sjkirim') ->with('sjkirim', $sjkirim) ->with('isisjkirim', $isisjkirim) ->with('isisjkirims', $isisjkirims) ->with('jumlah', $jumlah) ->with('qttdcheck', $qttdcheck) ->with('transaksihilangs', $transaksihilangs) ->with('top_menu_sel', 'menu_sjkirim') ->with('page_title', 'Surat Jalan Kirim') ->with('page_description', 'View'); }else return redirect()->back(); } public function edit($id){ $sjkirim = SJKirim::find($id); $maxperiode = Transaksi::leftJoin('po', 'transaksi.POCode', '=', 'po.POCode') ->where('Reference', $sjkirim->Reference) ->max('Periode'); $po = Transaksi::leftJoin('po', 'transaksi.POCode', '=', 'po.POCode') ->where('transaksi.Reference', $sjkirim->Reference) ->where('po.Periode', $maxperiode) ->first(); $min = $po->Tgl; $isisjkirims = IsiSJKirim::select([ 'isisjkirim.id as isisjkirimid', 'isisjkirim.*', 'sjkirim.*', 'transaksi.id as transaksiid', 'transaksi.*', 'inventory.*', 'project.Project', ]) ->leftJoin('sjkirim', 'isisjkirim.SJKir', '=', 'sjkirim.SJKir') ->leftJoin('transaksi', 'isisjkirim.Purchase', '=', 'transaksi.Purchase') ->leftJoin('pocustomer', 'transaksi.Reference', '=', 'pocustomer.Reference') ->leftJoin('inventory', 'transaksi.ICode', '=', 'inventory.Code') ->leftJoin('project', 'pocustomer.PCode', '=', 'project.PCode') ->where('isisjkirim.SJKir', $sjkirim->SJKir) ->orderBy('isisjkirim.id', 'asc') ->get(); if(in_array("edit", $this->access)){ return view('pages.sjkirim.edit') ->with('url', 'sjkirim') ->with('sjkirim', $sjkirim) ->with('isisjkirims', $isisjkirims) ->with('min', $min) ->with('top_menu_sel', 'menu_sjkirim') ->with('page_title', 'Surat Jalan Kirim') ->with('page_description', 'Edit'); }else return redirect()->back(); } public function update(Request $request, $id){ $sjkirim = SJKirim::find($id); $sjkirim->Tgl = $request['Tgl']; $sjkirim->NoPolisi = $request['NoPolisi']; $sjkirim->Sopir = $request['Sopir']; $sjkirim->Kenek = $request['Kenek']; $sjkirim->FormMuat = $request['FormMuat']; $sjkirim->Keterangan = $request['Keterangan']; $sjkirim->save(); $isisjkirim = IsiSJKirim::where('isisjkirim.SJKir', $sjkirim -> SJKir)->orderBy('id', 'asc'); $purchase = $isisjkirim->pluck('Purchase'); $warehouses = $isisjkirim->pluck('isisjkirim.Warehouse'); $qkirim = $isisjkirim->pluck('QKirim'); $input = Input::all(); $inventories = $input['ICode']; foreach ($inventories as $key => $inventory) { if($input['Warehouse'][$key] == 'Kumbang'){ $warehouse = 'Kumbang'; }elseif($input['Warehouse'][$key] == 'BulakSereh'){ $warehouse = 'BulakSereh'; }elseif($input['Warehouse'][$key] == 'Legok'){ $warehouse = 'Legok'; }elseif($input['Warehouse'][$key] == 'CitraGarden'){ $warehouse = 'CitraGarden'; } if($warehouses[$key] == 'Kumbang'){ $warehouse2 = 'Kumbang'; }elseif($warehouses[$key] == 'BulakSereh'){ $warehouse2 = 'BulakSereh'; }elseif($warehouses[$key] == 'Legok'){ $warehouse2 = 'Legok'; }elseif($warehouses[$key] == 'CitraGarden'){ $warehouse2 = 'CitraGarden'; } if($warehouse==$warehouse2){ $data = Inventory::where('Code', $input['ICode'][$key]) ->first(); $data->update([$warehouse => $data->$warehouse + $qkirim[$key] - $request['QKirim'][$key]]); }else{ $data = Inventory::where('Code', $input['ICode'][$key]) ->first(); $data->update([$warehouse => $data->$warehouse - $request['QKirim'][$key], $warehouse2 => $data->$warehouse2 + $qkirim[$key]]); } } $transaksis = $input['transaksiid']; foreach ($transaksis as $key => $transaksi) { $transaksi = Transaksi::find($transaksis[$key]); $transaksi->QSisaKirInsert = $transaksi->QSisaKirInsert+$input['QKirim2'][$key]-$input['QKirim'][$key]; $transaksi->save(); } $periode = Periode::select('periode.*') ->leftJoin('isisjkirim', 'periode.IsiSJKir', '=', 'isisjkirim.IsiSJKir') ->where('isisjkirim.SJKir', $sjkirim->SJKir); $periodeid = $periode->pluck('id'); $periodes = $periodeid; foreach ($periodes as $key => $periode) { $periode = Periode::find($periodes[$key]); $periode->S = $input['Tgl']; $periode->save(); } $isisjkirims = $input['isisjkirimid']; foreach ($isisjkirims as $key => $isisjkirim) { $isisjkirim = IsiSJKirim::find($isisjkirims[$key]); $isisjkirim->QKirim = $input['QKirim'][$key]; $isisjkirim->Warehouse = $input['Warehouse'][$key]; $isisjkirim->save(); } $history = new History; $history->User = Auth::user()->name; $history->History = 'Update SJKirim on SJKir '.$sjkirim->SJKir; $history->save(); return redirect()->route('sjkirim.show', $id); } public function getQTertanda($id){ $sjkirim = SJKirim::find($id); $parameter = IsiSJKirim::select([ 'periode.Periode', 'periode.Reference', ]) ->leftJoin('periode', 'isisjkirim.IsiSJKir', '=', 'periode.IsiSJKir') ->where('isisjkirim.SJKir', $sjkirim->SJKir) ->groupBy('periode.IsiSJKir') ->first(); $Tgl = Periode::select([ 'periode.S', ]) ->leftJoin('isisjkirim', 'periode.IsiSJKir', '=', 'isisjkirim.IsiSJKir') ->where('periode.Reference', $parameter->Reference) ->where('periode.Periode', $parameter->Periode) ->where('isisjkirim.SJKir', $sjkirim->SJKir) ->first(); $periode = Periode::select([ 'periode.id', 'periode.E', ]) ->leftJoin('isisjkirim', 'periode.IsiSJKir', '=', 'isisjkirim.IsiSJKir') ->where('periode.Reference', $parameter->Reference) ->where('periode.Periode', $parameter->Periode) ->first(); $isisjkirims = IsiSJKirim::select([ 'isisjkirim.*', 'transaksi.id as transaksiid', 'transaksi.Barang', 'transaksi.JS', 'transaksi.QSisaKir', 'project.Project', ]) ->leftJoin('transaksi', 'isisjkirim.Purchase', '=', 'transaksi.Purchase') ->leftJoin('pocustomer', 'transaksi.Reference', '=', 'pocustomer.Reference') ->leftJoin('project', 'pocustomer.PCode', '=', 'project.PCode') ->where('isisjkirim.SJKir', $sjkirim->SJKir) ->orderBy('isisjkirim.id', 'asc') ->get(); if(in_array("qtertanda", $this->access)){ return view('pages.sjkirim.qtertanda') ->with('url', 'sjkirim') ->with('sjkirim', $sjkirim) ->with('isisjkirims', $isisjkirims) ->with('Tgl', $Tgl) ->with('periode', $periode) ->with('top_menu_sel', 'menu_sjkirim') ->with('page_title', 'Surat Jalan Kirim') ->with('page_description', 'QTertanda'); }else return redirect()->back(); } public function postQTertanda(Request $request, $id){ $sjkirim = SJKirim::find($id); $input = Input::all(); $transaksis = $request->transaksiid; foreach ($transaksis as $key => $transaksi) { $transaksi = Transaksi::find($transaksis[$key]); $transaksi->QSisaKir = $transaksi->QSisaKir+$input['QTertanda2'][$key]-$input['QTertanda'][$key]; $transaksi->QSisaKem = $transaksi->QSisaKem-$input['QTertanda2'][$key]+$input['QTertanda'][$key]; $transaksi->save(); } Transaksi::where('JS', 'Jual')->update(['QSisaKem' => '0']); $isisjkirims = $request->id; foreach ($isisjkirims as $key => $isisjkirim) { $isisjkirim = IsiSJKirim::find($isisjkirims[$key]); $isisjkirim->QTertanda = $input['QTertanda'][$key]; $isisjkirim->QSisaKemInsert = $input['QTertanda'][$key]; $isisjkirim->QSisaKem = $input['QTertanda'][$key]; $isisjkirim->save(); } $isisjkirimjualid = IsiSJKirim::leftJoin('transaksi', 'isisjkirim.Purchase', '=', 'transaksi.Purchase')->where('transaksi.JS', 'Jual')->pluck('isisjkirim.id'); IsiSJKirim::whereIn('id', $isisjkirimjualid)->update(['QSisaKemInsert' => '0', 'QSisaKem' => '0']); $periode = Periode::select('periode.*') ->leftJoin('isisjkirim', 'periode.IsiSJKir', '=', 'isisjkirim.IsiSJKir') ->where('isisjkirim.SJKir', $sjkirim->SJKir) ->whereRaw('(periode.Deletes = "Sewa" OR periode.Deletes = "Jual")'); $periodeid = $periode->pluck('id'); $TglMax = str_replace('/', '-', $input['Tgl']); $TglMax2 = strtotime("+1 month -1 day", strtotime($TglMax)); $TglMax3 = date("d/m/Y", $TglMax2); if($periode->first()->id == $input['periodeid']){ $TglMax4 = $TglMax3; }else{ $TglMax4 = $input['E']; } $periodes = $periodeid; foreach ($periodes as $key => $periode) { $periode = Periode::find($periodes[$key]); $periode->Quantity = $input['QTertanda'][$key]; $periode->S = $input['Tgl']; $periode->E = $TglMax4; $periode->save(); } return redirect()->route('sjkirim.show', $id); } public function getSJ($id){ $phpWord = new \PhpOffice\PhpWord\PhpWord(); $sjkirim = SJKirim::find($id); $reference = Reference::leftJoin('project', 'pocustomer.PCode', 'project.PCode') ->leftJoin('customer', 'project.CCode', 'customer.CCode') ->where('Reference', $sjkirim->Reference) ->first(); $isisjkirims = IsiSJKirim::leftJoin('transaksi', 'isisjkirim.Purchase', '=', 'transaksi.Purchase') ->where('isisjkirim.SJKir', $sjkirim->SJKir) ->orderBy('isisjkirim.id', 'asc') ->get(); $sjkirim = IsiSJKirim::leftJoin('sjkirim', 'isisjkirim.SJKir', '=', 'sjkirim.SJKir') ->leftJoin('transaksi', 'isisjkirim.Purchase', '=', 'transaksi.Purchase') ->leftJoin('pocustomer', 'transaksi.Reference', '=', 'pocustomer.Reference') ->leftJoin('project', 'pocustomer.PCode', '=', 'project.PCode') ->leftJoin('customer', 'project.CCode', '=', 'customer.CCode') ->where('sjkirim.SJKir', $sjkirim->SJKir) ->first(); $document = $phpWord->loadTemplate(public_path('/template/SJ.docx')); $document->setValue('Company', ''.$sjkirim->Company.''); $document->setValue('PCode', ''.$sjkirim->PCode.''); $document->setValue('Project', ''.$sjkirim->Project.''); $document->setValue('ProjAlamat', ''.$sjkirim->ProjAlamat.''); $document->setValue('Customer', ''.$sjkirim->Customer.''); $document->setValue('CustPhone', ''.$sjkirim->CustPhone.''); $document->setValue('SJKir', $sjkirim->SJKir); $document->setValue('Tanggal', ''.date("d/m/Y").''); $document->setValue('JS', $sjkirim->JS); $document->setValue('NoPolisi', $sjkirim->NoPolisi); $document->setValue('Keterangan', $sjkirim->Keterangan); $document->setValue('FormMuat', $sjkirim->FormMuat); $document->setValue('Sopir', $sjkirim->Sopir); $document->setValue('Kenek', $sjkirim->Kenek); foreach ($isisjkirims as $key => $isisjkirim) { $key2 = $key+1; $document->setValue('Key'.$key, ''.$key2.''); $document->setValue('Barang'.$key, ''.$isisjkirim->Barang.''); $document->setValue('Quantity'.$key, ''.$isisjkirim->QKirim.' PCS'); } for($x=0;$x<20;$x++){ $document->setValue('Key'.$x, ''); $document->setValue('Barang'.$x, ''); $document->setValue('Quantity'.$x, ''); } $user = substr(gethostbyaddr($_SERVER['REMOTE_ADDR']), 0, -3); if($reference->PPN==1) if($sjkirim->JS=='Jual') $path = sprintf("C:\Users\Public\Documents\PPN\JUAL\SJ\SJ_"); else $path = sprintf("C:\Users\Public\Documents\PPN\SEWA\SJ\SJ_"); else if($sjkirim->JS=='Jual') $path = sprintf("C:\Users\Public\Documents\NON PPN\JUAL\SJ\SJ_"); else $path = sprintf("C:\Users\Public\Documents\NON PPN\SEWA\SJ\SJ_"); $clear = str_replace("/","_",$sjkirim->SJKir); $download = sprintf('SJ_%s.docx', $clear); //save as a random file in temp file $temp_file = tempnam(sys_get_temp_dir(), 'PHPWord'); $document->saveAs($temp_file); // Your browser will name the file "myFile.docx" // regardless of what it's named on the server header("Content-Disposition: attachment; filename=$download"); //readfile($temp_file); // or echo file_get_contents($temp_file); unlink($temp_file); // remove temp file //Session::flash('message', 'Downloaded to Server Public Documents file name SJ_'.$download); //return redirect()->route('sjkirim.show', $id); } public function destroy(Request $request, $id){ $sjkirim = SJKirim::find($id); $isisjkirim = IsiSJKirim::leftJoin('transaksi', 'isisjkirim.Purchase', '=', 'transaksi.Purchase') ->where('isisjkirim.SJKir', $sjkirim->SJKir); $transaksiid = $isisjkirim->pluck('transaksi.id'); $warehouses = $isisjkirim->pluck('isisjkirim.Warehouse'); $qkirim = $isisjkirim->pluck('isisjkirim.QKirim'); $qtertanda = $isisjkirim->pluck('isisjkirim.QTertanda'); $qsisakeminsert = $isisjkirim->pluck('isisjkirim.QSisaKemInsert'); $icode = $isisjkirim->pluck('ICode'); $pocode = $isisjkirim->pluck('POCode'); $JS = $isisjkirim->first()->JS; $inventories = $icode; foreach ($inventories as $key => $inventory) { if($warehouses[$key] == 'Kumbang'){ $warehouse = 'Kumbang'; }elseif($warehouses[$key] == 'BulakSereh'){ $warehouse = 'BulakSereh'; }elseif($warehouses[$key] == 'Legok'){ $warehouse = 'Legok'; }elseif($warehouses[$key] == 'CitraGarden'){ $warehouse = 'CitraGarden'; } $data = Inventory::where('Code', $icode[$key]) ->first(); $data->update([$warehouse => $data->$warehouse + $qkirim[$key]]); } $data = Invoice::where('Reference', $sjkirim->Reference) ->where('Periode', $request->Periode) ->where('JSC', $JS)->first(); $data->update(['Times' => $data->Times - 1]); $data = InvoicePisah::where('Reference', $sjkirim->Reference) ->where('Periode', $request->Periode) ->whereIn('POCode', $pocode) ->where('JSC', $JS)->first(); $data->update(['Times' => $data->Times - 1]); $transaksis = $transaksiid; foreach ($transaksis as $key => $transaksi) { $transaksi = Transaksi::find($transaksis[$key]); $transaksi->QSisaKirInsert = $transaksi->QSisaKirInsert+$qkirim[$key]; $transaksi->QSisaKir = $transaksi->QSisaKir+$qtertanda[$key]; $transaksi->QSisaKem = $transaksi->QSisaKem-$qsisakeminsert[$key]; $transaksi->save(); } $periode = Periode::select('periode.*') ->leftJoin('isisjkirim', 'periode.IsiSJKir', '=', 'isisjkirim.IsiSJKir') ->where('isisjkirim.SJKir', $sjkirim->SJKir) ->whereRaw('(periode.Deletes = "Sewa" OR periode.Deletes = "Jual")'); $periodeid = $periode->pluck('id'); Periode::whereIn('id', $periodeid)->delete(); DB::statement('ALTER TABLE periode auto_increment = 1;'); IsiSJKirim::where('SJKir', $sjkirim->SJKir)->delete(); DB::statement('ALTER TABLE isisjkirim auto_increment = 1;'); SJKirim::destroy($id); DB::statement('ALTER TABLE sjkirim auto_increment = 1;'); $history = new History; $history->User = Auth::user()->name; $history->History = 'Delete SJKirim on SJKir '.$sjkirim->SJKir; $history->save(); Session::flash('message', 'Delete is successful!'); return redirect()->route('sjkirim.index'); } }
<?php namespace Database\Factories; use App\Customer; use App\Vehicle; use App\VehicleModel; use Carbon\Carbon; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; class VehicleFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = Vehicle::class; /** * Define the model's default state. * * @return array */ public function definition() { $model = VehicleModel::factory()->create(); return [ 'customer_id' => Customer::factory()->create()->id, 'vehicle_type_id' => $model->vehicle_type_id, 'vehicle_make_id' => $model->vehicle_make_id, 'vehicle_model_id' => $model->id, 'year' => Carbon::now()->format('Y'), ]; } }
<?php namespace App\Http\Controllers\Frontend; use App\foundationPost; use Illuminate\Http\Request; use App\Http\Controllers\Controller; class welcomeController extends Controller { public function getWelcome() { $foundationPost=foundationPost::orderBy('id','desc')->paginate(3); return view('frontend.welcome',compact('foundationPost')); } }
<script type="text/javascript"> $(function () { var MODE = "add"; var tableTransact = $("#table-transact").DataTable({ processing: true, serverSide: true, sPaginationType: "full_numbers", bPaginate: true, lengthMenu: [[20, 50, -1], [20, 50, "All"]], serverMethod: "POST", "ajax":{ url: __HOSTAPI__ + "/Setting", type: "POST", data: function(d) { d.request = "get_transact_entry"; }, headers:{ Authorization: "Bearer " + <?php echo json_encode($_SESSION["token"]); ?> }, dataSrc:function(response) { var returnedData = []; if(response == undefined || response.response_package == undefined) { returnedData = []; } else { returnedData = response.response_package.response_data; } console.log(returnedData); response.draw = parseInt(response.response_package.response_draw); response.recordsTotal = response.response_package.recordsTotal; response.recordsFiltered = response.response_package.recordsFiltered; return returnedData; } }, autoWidth: false, language: { search: "", searchPlaceholder: "Cari Nomor Order" }, "columns" : [ { "data" : null, render: function(data, type, row, meta) { return "<h5 class=\"autonum\">" + row.autonum + "</h5>"; } }, { "data" : null, render: function(data, type, row, meta) { return row.identifier; } }, { "data" : null, render: function(data, type, row, meta) { return ""; } }, { "data" : null, render: function(data, type, row, meta) { return "<div class=\"btn-group wrap_content\" role=\"group\" aria-label=\"Basic example\">" + "<button penjamin=\"" + row.uid_penjamin + "\" type=\"button\" id=\"order_lab_" + row.uid + "\" class=\"btn btn-info btn-sm btn-detail-verif\" data-toggle='tooltip' title='Detail'>" + "<span><i class=\"fa fa-search\"></i> Detail</span>" + "</a>" + "</div>"; } } ] }); $("#btnTambahTransact").click(function () { MODE = "add"; $("#modal-large-title").prepend("Add "); $("#modal-transact").modal("show"); }); }); </script> <div id="modal-transact" class="modal fade" role="dialog" aria-labelledby="modal-large-title" aria-hidden="true" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog modal-lg" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="modal-large-title">Transact Print</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> <div class="row"> <div class="form-group col-md-5"> <label for="txt_identifier">Identifier:</label> <input type="text" class="form-control" id="txt_identifier" /> </div> <div class="form-group col-md-7"> <label for="txt_target">Target:</label> <input type="text" class="form-control" id="txt_target" /> </div> <!--div class="col-md-6"> <label for="txt_module">Module:</label> <div class="input-group mb-3"> <select class="form-control" id="txt_module" aria-describedby="basic-addon2"></select> <div class="input-group-append" style="padding: 0 10px"> <button class="btn btn-info" type="button"> <span> <i class="fa fa-plus-circle"></i> Tambah </span> </button> </div> </div> </div--> <div class="col-lg-11"> <h5>Modul Terkait</h5> </div> <div class="col-lg-1"> <button class="btn btn-info" type="button" id="btnTambahModule"> <span> <i class="fa fa-plus-circle"></i> Tambah </span> </button> </div> <div class="col-md-12"> <br /> <table class="table table-bordered largeDataType" id="table-pegawai-module"> <thead class="thead-dark"> <tr> <th class="wrap_content">No</th> <th>Module</th> <th>Jabatan - Pegawai</th> <th class="wrap_content">Aksi</th> </tr> </thead> <tbody></tbody> </table> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-success" id="btn_verif_all"> <span> <i class="fa fa-save"></i> Submit </span> </button> <button type="button" class="btn btn-danger" data-dismiss="modal"> <span> <i class="fa fa-ban"></i> Kembali </span> </button> </div> </div> </div> </div>
<?php namespace App\Http\Controllers\admin; use App\Http\Requests; use App\Http\Controllers\Controller; use App\model\Froller; use Illuminate\Http\Request; use Session; use DB; class FrollersController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\View\View */ public function index() { $frollers = Froller::paginate(25); return view('admin.frollers.index', compact('frollers')); } /** * Show the form for creating a new resource. * * @return \Illuminate\View\View */ public function create() { return view('admin.frollers.create'); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function store(Request $request) { $requestData = $request->all(); $finishId=$request->finishId; Froller::create($requestData); $frollers=DB::table('frollers') ->join('rollers','rollers.roller_id','=','frollers.rollerId') ->where('frollers.finishId','=',$finishId)->get(); return $frollers; } /** * Display the specified resource. * * @param int $id * * @return \Illuminate\View\View */ public function show($id) { $froller = Froller::findOrFail($id); return view('admin.frollers.show', compact('froller')); } /** * Show the form for editing the specified resource. * * @param int $id * * @return \Illuminate\View\View */ public function edit($id) { $froller = Froller::findOrFail($id); return view('admin.frollers.edit', compact('froller')); } /** * Update the specified resource in storage. * * @param int $id * @param \Illuminate\Http\Request $request * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function update($id, Request $request) { $requestData = $request->all(); $froller = Froller::findOrFail($id); $froller->update($requestData); Session::flash('flash_message', 'Froller updated!'); return redirect('admin/frollers'); } /** * Remove the specified resource from storage. * * @param int $id * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function destroy($id) { $data=DB::table('frollers')->where('frollers.froller_id','=',$id)->first(); $finishId=$data->finishId; Froller::destroy($id); $frollers=DB::table('frollers') ->join('rollers','rollers.roller_id','=','frollers.rollerId') ->where('frollers.finishId','=',$finishId)->get(); return $frollers; } }
<?php /** * 用户验证器 */ namespace app\admin\validate; use think\Validate; class User extends Validate { protected $rule = [ 'username' => 'require|max:25', 'username' => 'unique:ucenter_member', 'email' => 'email', ]; protected $message = [ 'username.require' => '用户名必须', 'username.unique' => '用户名已存在', 'email' => '邮箱格式错误', ]; protected $scene = [ 'add' => ['username','email'], 'edit' => ['email'], ]; }
<?php return array ( 'failed' => 'Estas credenciales no coinciden con nuestros registros.', 'throttle' => 'Demasiados intentos de inicio de sesión. Inténtalo de nuevo en :seconds segundos.', ) ?>
<?php declare(strict_types=1); /* * This file is part of the Yasumi package. * * Copyright (c) 2015 - 2021 AzuyaLabs * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @author Sacha Telgenhof <me@sachatelgenhof.com> */ namespace Yasumi\Provider\Austria; use Yasumi\Exception\InvalidDateException; use Yasumi\Exception\UnknownLocaleException; use Yasumi\Provider\Austria; /** * Provider for all holidays in Lower Austria (Austria). * * @see https://en.wikipedia.org/wiki/Lower_Austria */ class LowerAustria extends Austria { /** * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective * country or sub-region. */ public const ID = 'AT-3'; /** * Initialize holidays for Lower Austria (Austria). * * @throws InvalidDateException * @throws \InvalidArgumentException * @throws UnknownLocaleException * @throws \Exception */ public function initialize(): void { parent::initialize(); // Add custom holidays. $this->calculateStLeopoldsDay(); } }
@include('inc.header') <div class="container"> <form method="POST" action="{{ url('/insert') }}"> {{csrf_field()}} @if(count($errors) >0 ) @foreach($errors->all() as $error) <div class="alert alert-danger"> {{$error}} </div> @endforeach @endif <div class="form-group"> <label for="exampleFormControlInput1">Name</label> <input type="text" name="name" class="form-control"> </div> <div class="form-group"> <label for="exampleFormControlInput1">Description</label> <input type="text" name="description" class="form-control"> </div> <div class="form-group"> <label for="exampleFormControlInput1">Release Date</label> <input type="date" name="release_date" class="form-control"> </div> <div class="form-group"> <label for="exampleFormControlSelect1">Rating</label> <select class="form-control" name="rating"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select> </div> <div class="form-group"> <label for="exampleFormControlInput1">Ticket Price ($)</label> <input type="text" class="form-control" name="ticket_price"> </div> <div class="form-group"> <label for="exampleFormControlInput1">Country</label> <input type="text" class="form-control" name="country"> </div> <div class="form-group"> <label for="exampleFormControlSelect2">Genre (You can select multiple Genre)</label> <select multiple class="form-control" name="genre[]"> <option>Sci-Fi</option> <option>Action</option> <option>Drama</option> <option>Cartoon</option> <option>Comedy</option> <option>Crime</option> </select> </div> <input type="submit" value="Submit"> </form> <a href="{{url('/')}}">Home Page</a> </div> @include('inc.footer')
<?php // this page holds all user written functions to be accesed // database connections must be included within the function //This function will check for empty input on registration test informnation function CheckEmptyRegistrationInput($Input, $Field){ if(empty($Input)){ $_SESSION['InvaliRegistrationMessage'] = "Please Fill Out The " . $Field . " Field"; header('Location: register.php'); exit(); } } //This function will generate a random key for user registration and password reset function GenerateRandomKey($length = 20) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } Function SearchStockIndex($SearchString){ //include database connection include ('connection.php'); //cleaning search input $SearchString = mysqli_escape_string($conn, $SearchString); //Search all fields for the substring and dump results to table, $SearchSQL = " SELECT * FROM StockInfo.Stock_Symbol_Index WHERE Symbol LIKE '%" . $SearchString . "%' OR NAME LIKE '%" . $SearchString . "%' OR Sector LIKE '%" . $SearchString . "%' OR Industry LIKE '%" . $SearchString . "%' LIMIT 500"; //Execute SQL Query $SearchResult = mysqli_query($conn, $SearchSQL); if ($SearchResult->num_rows > 0) { echo ' <div class="row"> <div class="col-lg-12"> <div class="panel-body"> <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example"> <thead> <tr> <th>Symbol</th> <th>Name</th> <th>Sector</th> <th>Industry</th> </tr> </thead> <tbody>'; while($row = $SearchResult->fetch_assoc()) { echo " <tr> <td>" . $row['Symbol'] . "</td> <td><a href='stockpage.php?Symbol=" . $row['Symbol'] . "'>" . $row['Name'] . "</a></td> <td><a href='search.php?SearchString=" . $row['Sector'] . "'>" . $row['Sector'] . "</a></td> <td><a href='search.php?SearchString=" . $row['Industry'] . "'>" . $row['Industry'] . "</a></td> </tr>"; } echo ' </tbody> </table> </div> </div> </div>'; } else { $SearchSQLNothing = " SELECT * FROM StockInfo.Stock_Symbol_Index LIMIT 500"; //Execute SQL Query $SearchResultNothing = mysqli_query($conn, $SearchSQLNothing); if ($SearchResultNothing->num_rows > 0){ echo ' <h3>No matching search results</h3>'; echo ' <div class="row"> <div class="col-lg-12"> <div class="panel-body"> <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example"> <thead> <tr> <th>Symbol</th> <th>Name</th> <th>Sector</th> <th>Industry</th> </tr> </thead> <tbody>'; while($row = $SearchResultNothing->fetch_assoc()) { echo ' <tr> <td><a href="../pages/stockpage.php?Symbol='.$row["Symbol"].'">'.$row["Symbol"].'</a></td> <td>'.$row["Name"].'</td> <td>'.$row["Sector"].'</td> <td>'.$row["Industry"].'</td> </tr>'; } echo ' </tbody> </table> </div> </div> </div>'; } } } //This function will show the last 10 day stock pricces and changes Function FetchLastTenDaysChart($StockSymbol){ // include connections page include('connection.php'); //Counter to skip the 11th day $SkipCounter = 0; $Output = array(); //Query to show the last 11days of close prices $ShowLastTenSQL = "SELECT atr_Stock_id, DATE_FORMAT(timestamp, '%m-%d-%y') as 'timestamp', Open, High, Low, Close FROM StockInfo.Time_Series_Daily WHERE Timestamp > (SELECT DISTINCT Timestamp FROM StockInfo.Time_Series_Daily WHERE atr_stock_id ='" . $StockSymbol . "' ORDER BY Timestamp DESC LIMIT 1 offset 11) AND atr_Stock_id = '" . $StockSymbol . "' order by atr_stock_id ASC, Timestamp ASC"; $SearchResult = mysqli_query($conn, $ShowLastTenSQL); if ($SearchResult->num_rows > 0){ echo" <table class='table table-hover'> <thead> <tr> <th>Date</th> <th>Price ($)</th> <th>Change</th> <th>Percent</th> </tr> </thead> <tbody>"; while($row = $SearchResult->fetch_assoc()) { //Skipping the 11th day if ($SkipCounter <> 0) { //Computing difference between previous day and current day $Difference = round($row['Close'] - $PreviousClose,2); //Computing percent difference between previous day and current day $PDifference = round((($Difference / $PreviousClose) * 100),2) . "%"; array_push($Output,(string)substr($row['timestamp'], 0, 10)); array_push($Output,(string)$row['Close']); array_push($Output,(string)$Difference); array_push($Output,(string)$PDifference); //Storing close value for previous day. $PreviousClose = $row['Close']; }else{ $PreviousClose = $row['Close']; } //Counter to skip the 11th day $SkipCounter = $SkipCounter +1; } for($i=39; $i >= 3; $i-=4){ // Date, Price, Change, Percent echo " <tr> <td>" . $Output[$i-3] . "</td> <td>" . $Output[$i-2] . "</td> "; if ($Output[$i-1] > 0) { echo" <td style='color:#28a745'>" . $Output[$i-1] . "</td> <td style='color:#28a745'> <i class='fa fa-lg fa-caret-up'> </i> " . abs($Output[$i]) . "%</td> </tr>"; } elseif ($Output[$i-1] < 0) { echo" <td style='color:#dc3545'>" . $Output[$i-1] . "</td> <td style='color:#dc3545'> <i class='fa fa-lg fa-caret-down'> </i> " . abs($Output[$i]) . "%</td> </tr>"; } elseif ($Output[$i-1] == 0) { echo" <td style='color:#337ab7'>" . $Output[$i-1] . "</td> <td style='color:#337ab7'> <i class='fa fa-lg fa-minus'> </i> " . abs($Output[$i]) . "%</td> </tr>"; } } echo " </tbody> </table>"; } } //This function will output top five gains of stocks //As of not it does not show subscribed stocks Function ShowMostGains(){ include('connection.php'); //Query to show most gain $ShowMostGainsSQL = " SELECT c.atr_stock_id, c.Close, c.Timestamp, (c.Close - y.Close) as 'Change', ROUND((((c.Close / y.Close) -1 ) * 100),2) as 'ClosePercentChange' FROM StockInfo.Time_Series_Daily as c INNER JOIN ( SELECT atr_stock_id, timestamp, Close FROM StockInfo.Time_Series_Daily WHERE Timestamp = (SELECT DISTINCT Timestamp from StockInfo.Time_Series_Daily ORDER BY Timestamp DESC LIMIT 1 OFFSET 1) ) as y on c.atr_stock_id = y.atr_stock_id WHERE c.Timestamp = (SELECT DISTINCT Timestamp from StockInfo.Time_Series_Daily order by Timestamp DESC LIMIT 1 ) AND (c.Close - y.Close) > 0 ORDER BY ClosePercentChange DESC limit 5"; $SearchResult = mysqli_query($conn, $ShowMostGainsSQL); if ($SearchResult->num_rows > 0){ echo"<table class='table table-hover'> <thead> <tr> <th>Stock</th> <th>Price ($)</th> <th>Change</th> <th>Percent</th> </tr> </thead> <tbody>"; while($row = $SearchResult->fetch_assoc()) { echo " <tr> <td>" . $row['atr_stock_id'] . "</td> <td>" . $row['Close'] . "</td>"; if ($row['Change']> 0) { echo" <td style='color:#28a745'>" . $row['Change']. "</td> <td style='color:#28a745'> <i class='fa fa-lg fa-caret-up'> </i> " . $row['ClosePercentChange']. "% </td> </tr>"; } elseif ($row['Change']< 0) { echo" <td style='color:#dc3545'>" . $row['Change']. "</td> <td style='color:#dc3545'> <i class='fa fa-lg fa-caret-down'> </i> " . $row['ClosePercentChange']. "% </td> </tr>"; } elseif ($row['Change']== 0) { echo" <td style='color:#337ab7'>" . $row['Change']. "</td> <td style='color:#337ab7'> <i class='fa fa-lg fa-minus'> </i> " . $row['ClosePercentChange']. "% </td> </tr>"; } //Counter to skip the 11th day $SkipCounter = $SkipCounter +1; } echo " </tbody> </table>"; } } //This function will output top five gains of stocks //As of not it does not show subscribed stocks Function ShowMostLosses(){ include('connection.php'); //Query to show most gain $ShowMostLossesSQL = " SELECT c.atr_stock_id, c.Close, c.Timestamp, (c.Close - y.Close) as 'Change', ROUND((((c.Close / y.Close) -1 ) * 100),2) as 'ClosePercentChange' FROM StockInfo.Time_Series_Daily as c INNER JOIN ( SELECT atr_stock_id, timestamp, Close FROM StockInfo.Time_Series_Daily WHERE Timestamp = (SELECT DISTINCT Timestamp from StockInfo.Time_Series_Daily ORDER BY Timestamp DESC LIMIT 1 OFFSET 1) ) as y on c.atr_stock_id = y.atr_stock_id WHERE c.Timestamp = (SELECT DISTINCT Timestamp from StockInfo.Time_Series_Daily order by Timestamp DESC LIMIT 1 ) AND (c.Close - y.Close) < 0 ORDER BY ClosePercentChange ASC limit 5"; $SearchResultLosses = mysqli_query($conn, $ShowMostLossesSQL); if ($SearchResultLosses->num_rows > 0){ echo"<table class='table table-hover'> <thead> <tr> <th>Stock</th> <th>Price ($)</th> <th>Change</th> <th>Percent</th> </tr> </thead> <tbody>"; while($row = $SearchResultLosses->fetch_assoc()) { echo " <tr> <td>" . $row['atr_stock_id'] . "</td> <td>" . $row['Close'] . "</td>"; if ($row['Change']> 0) { echo" <td style='color:#28a745'>" . $row['Change']. "</td> <td style='color:#28a745'> <i class='fa fa-lg fa-caret-up'> </i> " . $row['ClosePercentChange']. "% </td> </tr>"; } elseif ($row['Change']< 0) { echo" <td style='color:#dc3545'>" . $row['Change']. "</td> <td style='color:#dc3545'> <i class='fa fa-lg fa-caret-down'> </i> " . $row['ClosePercentChange']. "% </td> </tr>"; } elseif ($row['Change']== 0) { echo" <td style='color:#337ab7'>" . $row['Change']. "</td> <td style='color:#337ab7'> <i class='fa fa-lg fa-minus'> </i> " . $row['ClosePercentChange']. "</td> </tr>"; } //Counter to skip the 11th day $SkipCounter = $SkipCounter +1; } echo " </tbody> </table>"; } else{ echo "fail"; echo $ShowMostLossesSQL; } } //This function will output top moving stocks //As of not it does not show subscribed stocks Function ShowMostMoving(){ include('connection.php'); //Query to show most gain $ShowMostMovingSQL = " SELECT c.atr_stock_id, ROUND((c.Volume/1000000),2) as 'Volume', c.Timestamp, ROUND(((c.Volume - y.Volume)/1000000),2) as 'Change', ROUND((((c.Volume / y.Volume) -1 ) * 100)/1000,2) as 'VolumePercentChange' FROM StockInfo.Time_Series_Daily as c INNER JOIN ( SELECT atr_stock_id, timestamp, Volume FROM StockInfo.Time_Series_Daily WHERE Timestamp = (SELECT DISTINCT Timestamp from StockInfo.Time_Series_Daily ORDER BY Timestamp DESC LIMIT 1 OFFSET 1) ) as y on c.atr_stock_id = y.atr_stock_id WHERE c.Timestamp = (SELECT DISTINCT Timestamp from StockInfo.Time_Series_Daily order by Timestamp DESC LIMIT 1 ) ORDER BY (c.Volume - y.Volume) DESC limit 5 "; $ShowMostMovingResults = mysqli_query($conn, $ShowMostMovingSQL); if ($ShowMostMovingResults->num_rows > 0){ echo"<table class='table table-hover'> <thead> <tr> <th>Stock</th> <th>Volume</th> <th>Change</th> <th>Percent</th> </tr> </thead> <tbody>"; while($row = $ShowMostMovingResults->fetch_assoc()) { echo " <tr> <td>" . $row['atr_stock_id'] . "</td> <td>" . $row['Volume'] . " M </td>"; if ($row['Change']> 0) { echo" <td style='color:#337ab7'>" . $row['Change']. " M </td> <td style='color:#337ab7'> <i class='fa fa-lg fa-caret-up'> </i> " . $row['VolumePercentChange']. " K </td> </tr>"; } elseif ($row['Change']< 0) { echo" <td style='color:#337ab7'>" . $row['Change']. " M </td> <td style='color:#337ab7'> <i class='fa fa-lg fa-caret-down'> </i> " . $row['VolumeePercentChange']. " K </td> </tr>"; } elseif ($row['Change']== 0) { echo" <td style='color:#337ab7'>" . $row['Change']. " M </td> <td style='color:#337ab7'> <i class='fa fa-lg fa-minus'> </i> " . $row['VolumePercentChange']. " K </td> </tr>"; } //Counter to skip the 11th day $SkipCounter = $SkipCounter +1; } echo " </tbody> </table>"; } else{ echo "fail"; echo $ShowMostMovingResults; } } //This function will output graph of chosen stock //Assumes graphing resources are included in page above Function StockGraph($StockSymbol){ include('connection.php'); $sql = "SELECT * FROM StockInfo.Time_Series_Daily WHERE StockInfo.Time_Series_Daily.atr_stock_id ='".$StockSymbol."' ORDER BY Time_Series_Daily.Timestamp ASC"; $result = mysqli_query($conn, $sql); if ($result -> num_rows > 0) { //Chartdiv style echo ' <style> #chartdiv { height : 85vh; } </style> '; //Original colors of amchart example //"fillColors": "#7f8da9", //"negativeFillColors": "#db4c3c" //1st half of chart script echo ' <!-- Chart code --> <script> var chart = AmCharts.makeChart( "chartdiv", { "type": "serial", "theme": "none", "dataDateFormat":"YYYY-MM-DD", "valueAxes": [ { "position": "left" } ], "graphs": [ { "id": "g1", "balloonText": "High:<b>[[high]]</b><br>Open:<b>[[open]]</b><br>Close:<b>[[close]]</b><br>Low:<b>[[low]]</b><br>", "closeField": "close", "fillColors": "#28a745", "highField": "high", "lineColor": "#28a745", "lineAlpha": 1, "lowField": "low", "fillAlphas": 0.9, "negativeFillColors": "#dc3545", "negativeLineColor": "#dc3545", "openField": "open", "title": "Price:", "type": "candlestick", "valueField": "close" } ], "chartScrollbar": { "graph": "g1", "graphType": "line", "scrollbarHeight": 30 }, "chartCursor": { "valueLineEnabled": true, "valueLineBalloonEnabled": true }, "categoryField": "date", "categoryAxis": { "parseDates": true }, "dataProvider": [ { '; //Stock data $var = 0; while($row = $result->fetch_assoc()) { if ($var == 0) { echo '"date": "'.substr($row['Timestamp'], 0, -9).'",'; echo '"open": "'.$row['Open'].'",'; echo '"high": "'.$row['High'].'",'; echo '"low": "'.$row['Low'].'",'; echo '"close": "'.$row['Close'].'"'; } else { echo '}, {'; echo '"date": "'.substr($row['Timestamp'], 0, -9).'",'; echo '"open": "'.$row['Open'].'",'; echo '"high": "'.$row['High'].'",'; echo '"low": "'.$row['Low'].'",'; echo '"close": "'.$row['Close'].'"'; } $var++; } echo '} ],'; //2nd-half of chart script echo ' "export": { "enabled": true, "position": "bottom-right" } } ); chart.addListener( "rendered", zoomChart ); zoomChart(); // this method is called when chart is first inited as we listen for "dataUpdated" event function zoomChart() { // different zoom methods can be used - zoomToIndexes, zoomToDates, zoomToCategoryValues chart.zoomToIndexes( chart.dataProvider.length - 40, chart.dataProvider.length - 1 ); } </script> '; //Chart Div echo ' <div id="chartdiv"></div> '; } } //This function will output sparkline of chosen stock //Assumes graphing resources are included in page above Function StockSparkline($StockSymbol){ include('connection.php'); $sql = "SELECT * FROM StockInfo.Time_Series_Daily WHERE StockInfo.Time_Series_Daily.atr_stock_id ='".$StockSymbol."' ORDER BY Time_Series_Daily.Timestamp ASC LIMIT 10"; $result = mysqli_query($conn, $sql); if ($result -> num_rows > 0) { //Chartdiv style echo ' <style> #chartdiv { width: 100%; height: 500px; } </style> '; //1st half of chart script echo ' <script> AmCharts.makeChart( "'.$StockSymbol.'Graph", { "type": "serial", "theme": "light", "dataProvider": [ { '; //Stock data $var = 1; while($row = $result->fetch_assoc()) { if ($var == 1) { echo '"day": '.$var.','; echo '"value": '.$row['Close']; } else { echo '}, {'; echo '"day": '.$var.','; echo '"value": '.$row['Close']; } $var++; } echo '} ],'; //2nd-half of chart script echo ' "categoryField": "day", "autoMargins": false, "marginLeft": 0, "marginRight": 5, "marginTop": 0, "marginBottom": 0, "graphs": [ { "valueField": "value", "bulletField": "bullet", "showBalloon": false, "lineColor": "#a9ec49" } ], "valueAxes": [ { "gridAlpha": 0, "axisAlpha": 0 } ], "categoryAxis": { "gridAlpha": 0, "axisAlpha": 0, "startOnAxis": true } } ); </script> '; //Chart Div echo ' <div class="chart-block" style="display: block; margin-left: auto;margin-right: auto;"> <div id="'.$StockSymbol.'Graph" style="vertical-align: middle; display: inline-block; width: 100%; height: 50px;"></div> </div> '; } } Function PotentialGains($initialMoney, $numberOfDays, $commission, $stockSymbol) { include('../resources/connection.php'); $finalSellPrice; $stock = 0; $money = $initialMoney; $sql = "SELECT * FROM ( SELECT * FROM StockInfo.Simulation WHERE StockInfo.Simulation.Symbol = '".$stockSymbol."' ORDER BY StockInfo.Simulation.Timestamp DESC LIMIT ".$numberOfDays." ) AS tmp ORDER BY Timestamp ASC"; unset($_SESSION['array1']); unset($_SESSION['array2']); unset($_SESSION['array3']); unset($_SESSION['array4']); unset($_SESSION['array5']); $array1 = array(); //Date $array2 = array(); //Close $array3 = array(); //Buy/Sell $array4 = array(); //Stock $array5 = array(); //Money $result = mysqli_query($conn, $sql); if ($result -> num_rows > 0) { while($row = $result->fetch_assoc()) { //Final Decision is to BUY if ($row['Final_Decision'] == "Buy") { //Have enough money to buy if ($money >= $row['Close']) { $effectiveRate = (1 + $commission) * $row['Close']; $tempStock = floor($money / $effectiveRate); $money = $money - ($tempStock * $effectiveRate); $stock = $stock + $tempStock; array_push($array1, substr($row['Timestamp'],5,5)); array_push($array2, $row['Close']); array_push($array3, $row['Final_Decision']); array_push($array4, $stock); array_push($array5, $money); } } //Final Decision is to SELL if ($row['Final_Decision'] == "Sell") { //Own stock to sell if ($stock > 0) { $effectiveRate = (1 - $commission) * $row['Close']; $money = $money + ($stock * $effectiveRate); $stock = 0; array_push($array1, substr($row['Timestamp'],5,5)); array_push($array2, $row['Close']); array_push($array3, $row['Final_Decision']); array_push($array4, $stock); array_push($array5, $money); } } $finalSellPrice = $row['Close']; } } $effectiveRate = (1 - $commission) * $finalSellPrice; $total = $money + ($stock * $effectiveRate); $percent = 100 * (($total / $initialMoney) - 1); $_SESSION['array1'] = $array1; $_SESSION['array2'] = $array2; $_SESSION['array3'] = $array3; $_SESSION['array4'] = $array4; $_SESSION['array5'] = $array5; return $percent; } Function MarketGains($initialMoney, $numberOfDays, $commission, $stockSymbol) { include('../resources/connection.php'); $finalSellPrice; $stock = 0; $money = $initialMoney; $sql = "SELECT * FROM ( SELECT * FROM StockInfo.Simulation WHERE StockInfo.Simulation.Symbol = '".$stockSymbol."' ORDER BY StockInfo.Simulation.Timestamp DESC LIMIT ".$numberOfDays." ) AS tmp ORDER BY Timestamp ASC"; $result = mysqli_query($conn, $sql); if ($result -> num_rows > 0) { while($row = $result->fetch_assoc()) { if ($money >= $row['Close']) { $effectiveRate = (1 + $commission) * $row['Close']; $tempStock = floor($money / $effectiveRate); $money = $money - ($tempStock * $effectiveRate); $stock = $stock + $tempStock; } $finalSellPrice = $row['Close']; } } $effectiveRate = (1 - $commission) * $finalSellPrice; $total = $money + ($stock * $effectiveRate); $percent = 100 * (($total / $initialMoney) - 1); return $percent; } Function MaximumGains($initialMoney, $numberOfDays, $commission, $stockSymbol) { include('../resources/connection.php'); $finalSellPrice; $stock = 0; $money = $initialMoney; $sql1 = "SET @rownr1 = 0"; $sql2 = "SET @rownr2 = 0"; $sql3 = " SELECT tmp1.Symbol, tmp1.Close1 as 'Close1' ,tmp1.Timestamp1, (@rownr1 := @rownr1 + 1) AS rowNumber, tmp2.Close2 , tmp2.Timestamp2 FROM ( SELECT tmp1.Symbol, tmp1.Close as 'Close1' ,tmp1.Timestamp as 'Timestamp1', (@rownr1 := @rownr1 + 1) AS rowNumber FROM StockInfo.Simulation as tmp1 WHERE tmp1.Symbol = '".$stockSymbol."' ORDER BY tmp1.Timestamp DESC LIMIT ".$numberOfDays." ) as tmp1 INNER JOIN ( SELECT Symbol, Close as 'Close2', Timestamp as 'Timestamp2', (@rownr2 := @rownr2 + 1) AS rowNumber FROM StockInfo.Simulation WHERE StockInfo.Simulation.Symbol = '".$stockSymbol."' ORDER BY StockInfo.Simulation.Timestamp DESC LIMIT ".$numberOfDays." OFFSET 1 ) AS tmp2 ON tmp1.rowNumber = tmp2.rowNumber ORDER BY tmp1.Timestamp1 ASC "; $conn->query($sql1); $conn->query($sql2); $result3 = mysqli_query($conn, $sql3); if ($result3 -> num_rows > 0) { while($row = $result3->fetch_assoc()) { if ($row['Close2'] < $row['Close1']) { if ($money >= $row['Close2']) { $effectiveRate = (1 + $commission) * $row['Close2']; $tempStock = floor($money / $effectiveRate); $money = $money - ($tempStock * $effectiveRate); $stock = $stock + $tempStock; } } if ($row['Close2'] > $row['Close1']) { if ($stock > 0) { $effectiveRate = (1 - $commission) * $row['Close2']; $money = $money + ($stock * $effectiveRate); $stock = 0; } } $finalSellPrice = $row['Close2']; } } $effectiveRate = (1 - $commission) * $finalSellPrice; $total = $money + ($stock * $effectiveRate); $percent = 100 * (($total / $initialMoney) - 1); return $percent; } //this function will determine what button to output for the sub/unsub button Function ShowSubUnsubIcon(){ include('../resources/connection.php'); //check if user is already subbd to this stock $CheckIfSubbedSQL = "SELECT * FROM UserCredentials.tbl_stock_subs WHERE atr_username='" . $_SESSION['username'] . "' AND atr_stock_id='" . $_GET['Symbol'] . "';"; $CheckSubResults = mysqli_query($conn, $CheckIfSubbedSQL); if ($CheckSubResults->num_rows > 0){ echo " <button type='button' class='btn btn-success btn-outline btn-circle btn-l pull-right' data-toggle='modal' data-target='#submodal' style='margin-top:6px;;'><i class='fa fa-check fa-lg'></i> </button> <div class='modal fade' id='submodal' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true' style='display: none;'> <div class='modal-dialog'> <div class='modal-content'> <div class='modal-header'> <h3 class='modal-title' id='myModalLabel'>Unsubscribe from stock</h3> </div> <div class='modal-body'> This stock will be removed from your subscribed stock carousel </div> <div class='modal-footer'> <form action='../resources/unsubtostock.php' method='POST' id='form1'> <input type='hidden' name='Symbol' value = '" . $_GET['Symbol'] . "'> </form> <button type='button' class='btn btn-default' data-dismiss='modal'>Cancel</button> <button type='submit'class='btn btn-success' form='form1' Value='Sumbit'>Okay</button> </div> </div> </div> </div>"; } else{ //at this point user is not subbed, but there still may be stock info here //check this stock exsits but user isnt subbed $CheckIfStockExists = "SELECT * FROM StockInfo.Time_Series_Daily WHERE atr_stock_id='" . $_GET['Symbol'] . "';"; $CheckIfStockExistsResults = mysqli_query($conn, $CheckIfStockExists); if ($CheckIfStockExistsResults->num_rows > 0){ echo " <button type='button' class='btn btn-success btn-outline btn-circle btn-l pull-right' data-toggle='modal' data-target='#submodal' style='margin-top:6px;;'><i class='fa fa-plus fa-lg'></i> </button> <div class='modal fade' id='submodal' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true' style='display: none;'> <div class='modal-dialog'> <div class='modal-content'> <div class='modal-header'> <h3 class='modal-title' id='myModalLabel'>Subscribe to stock</h3> </div> <div class='modal-body'> This stock will be added to your subscribed stock carousel </div> <div class='modal-footer'> <form action='../resources/subtostock.php' method='POST' id='form1'> <input type='hidden' name='Symbol' value = '" . $_GET['Symbol'] . "'> </form> <button type='button' class='btn btn-default' data-dismiss='modal'>Cancel</button> <button type='submit'class='btn btn-success' form='form1' Value='Submit'>Okay</button> </div> </div> </div> </div> "; } else{ //at this point we dont hold stock info for this item, which means the user isnt subbed $_SESSION['Subscribe'] = true; echo " <button type='button' class='btn btn-success btn-outline btn-circle btn-l pull-right' data-toggle='modal' data-target='#submodal' style='margin-top:6px'><i class='fa fa-refresh fa-spin fa-lg'></i> </button> <div class='modal fade' id='submodal' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true' style='display: none;'> <div class='modal-dialog'> <div class='modal-content'> <div class='modal-header'> <h3 class='modal-title' id='myModalLabel'>Subscribe to stock</h3> </div> <div class='modal-body'> Subscribe to this stock to view detailed information? </div> <div class='modal-footer'> <form action='../resources/subtostock.php' method='POST' id='form1'> <input type='hidden' name='Symbol' value = '" . $_GET['Symbol'] . "'> </form> <a href='search.php'><button type='button' class='btn btn-default' data-dismiss='modal'>Cancel</button></a> <button type='submit'class='btn btn-success' form='form1' Value='Sumbit'>Okay</button> </div> </div> </div> </div> "; } } } Function ShowCompanyInformation($Symbol){ include('connection.php'); $FetchStockMetaInfo = "SELECT Sector, Industry FROM StockInfo.Stock_Symbol_Index WHERE Symbol='" . $Symbol . "';"; $FetchStockMetaResults = mysqli_query($conn, $FetchStockMetaInfo); if ($FetchStockMetaResults->num_rows > 0){ while($row = $FetchStockMetaResults->fetch_assoc()) { echo "<p style='font-size:12px'><b style='font-weight:bold'>Industry: </b>" . $row['Industry'] . "</p>"; echo "<p style='font-size:12px'><b style='font-weight:bold'>Sector: </b>" . $row['Sector'] . "</p>"; } } } Function ShowRssFeedNews($Topic){ $Topicleaned=str_replace(' ','%20', $Topic); echo $test2; $googlersssource = "https://news.google.com/news/rss/search/section/q/" . $Topicleaned . "/" . $Topicleaned . "?hl=en&gl=US&ned=us"; $xml = simplexml_load_file($googlersssource); for($itemcounter = 0; $itemcounter < 10; $itemcounter++){ $title = $xml->channel->item[$itemcounter]->title; $href = $xml->channel->item[$itemcounter]->link; $date = $xml->channel->item[$itemcounter]->pubDate; echo " <li> <div class='chat-body clearfix'> <div class='header'> <a href='" . $href . "'><strong class='primary-font'>" . $title . "</strong></a> <small class='text-muted'><br> <i class='fa fa-clock-o fa-fw'></i>" . $date . " </small> </div> </div> </li>"; } } Function ShowSubbedStocks() { include ('connection.php'); $GetSubbedStocksSQL = " SELECT c.atr_stock_id, c.Close, c.Timestamp, n.Name, ROUND((c.Close - y.Close), 2) as 'Change', ROUND((((c.Close / y.Close) -1 ) * 100),2) as 'ClosePercentChange' FROM StockInfo.Time_Series_Daily as c INNER JOIN ( SELECT atr_stock_id, timestamp, Close FROM StockInfo.Time_Series_Daily WHERE Timestamp = (SELECT DISTINCT Timestamp from StockInfo.Time_Series_Daily ORDER BY Timestamp DESC LIMIT 1 OFFSET 1) ) as y on c.atr_stock_id = y.atr_stock_id INNER JOIN ( SELECT DISTINCT atr_stock_id FROM UserCredentials.tbl_stock_subs WHERE atr_username = '" . $_SESSION['username'] . "' ) as s on c.atr_stock_id= s.atr_stock_id INNER JOIN StockInfo.Stock_Symbol_Index as n ON c.atr_stock_id = n.Symbol WHERE c.Timestamp = (SELECT DISTINCT Timestamp from StockInfo.Time_Series_Daily order by Timestamp DESC LIMIT 1 ) ORDER BY ClosePercentChange;"; $GetSubbedStocksResults = mysqli_query($conn, $GetSubbedStocksSQL); if ($GetSubbedStocksResults->num_rows > 0) { while ($row = $GetSubbedStocksResults->fetch_assoc()) { echo " <div class='panel panel-default' style='margin-bottom:10px'> <a href='stockpage.php?Symbol=" . $row['atr_stock_id'] . "'> <div style='width: 100%' class='panel-heading'> <div class='row'>"; // <div class='col-xs-4'> // <i class='fa fa-bar-chart fa-4x' style='margin-top: 32px; display: block; text-align: center'></i> // </div> StockSparkline($row['atr_stock_id']); echo " <div class='col-xs-8' style='padding-left: 10%'> <div class='h5'><b>" . $row['Name'] . "</b> </div> <div style='font-size:90%';> Price ($): " . $row['Close'] . " </div> <div style='font-size:90%';> Change: " . $row['Change'] . " </div> <div style='margin-bottom: 3px; font-size:90%'> Percent: " . $row['ClosePercentChange'] . " </div> </div> </div> </div> </a> </div>"; } } } ?>
<?php $params = require(__DIR__ . '/params.php'); $config = [ 'id' => 'basic', 'language' => 'es-MX', 'sourceLanguage' => 'en-US', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'components' => [ 'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 'cookieValidationKey' => 'FwKjcMt4ursURPInZhNBJFj7YBuRAo76', ], 'cache' => [ 'class' => 'yii\caching\FileCache', ], 'user' => [ 'identityClass' => 'app\models\User', 'enableAutoLogin' => true, ], 'errorHandler' => [ 'errorAction' => 'site/error', ], 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', // send all mails to a file by default. You have to set // 'useFileTransport' to false and configure a transport // for the mailer to send real emails. 'useFileTransport' => true, ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], ], ], 'db' => require(__DIR__ . '/db.php'), 'urlManager' => [ 'enablePrettyUrl' => false, 'showScriptName' => false, 'rules' => [ ], ], 'i18n' => [ 'translations' => [ '*' => [ 'class' => 'yii\i18n\PhpMessageSource', 'basePath' => '@app/messages', // if advanced application, set @frontend/messages 'sourceLanguage' => 'es-MX', 'fileMap' => [ //'main' => 'main.php', ], ], ], ], ], 'controllerMap' => [ 'batch' => [ 'class' => 'schmunk42\giiant\commands\BatchController', 'overwrite' => true, 'modelNamespace' => 'app\\models', 'crudTidyOutput' => true, ] ], 'params' => $params, ]; if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = [ 'class' => 'yii\debug\Module', // uncomment the following to add your IP if you are not connecting from localhost. //'allowedIPs' => ['127.0.0.1', '::1'], ]; $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', // uncomment the following to add your IP if you are not connecting from localhost. //'allowedIPs' => ['127.0.0.1', '::1'], ]; } return $config;
<?php namespace App\Models\System\Log; use Illuminate\Database\Eloquent\Model; class LeadLog extends Model { protected $table = 'ex_lead_logs'; protected $fillable = ['ex_lead_id', 'log_id']; public function log() { return $this->belongsTo('App\Models\System\Log\Log', 'log_id'); } }
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateDeliverisTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('deliveris', function (Blueprint $table) { $table->id(); $table->string('nombre'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('deliveris'); } }
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Sale extends MY_Controller { public function __construct() { parent::__construct(); // Your own constructor code $this->load->database(); $this->load->helper('login_helper'); $this->load->model("product_model"); } public function index() { $data["products"] = $this->product_model->get_products(); $data["isCartPage"] = false; $this->load->view("frontend/index",$data); } public function cart() { $data["products"] = $this->product_model->get_products(); $data["isCartPage"] = true; $this->load->view("frontend/cart",$data); } public function add_to_cart() { $product_id = $this->input->post("product_id"); $data = $this->product_model->get_product_by_id($product_id); echo json_encode($data); } }
<!DOCTYPE html> <html> <head> <title>Update payment type</title> <link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> <script type="text/javascript" src="js/jquery-3.2.1.js"></script> <script type="text/javascript" src="js/bootstrap.min.js"></script> <link href="https:tps://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"> <script src="ht//fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700" rel="stylesheet"></script> </head> <body> <div class="backbg container-fluid"> <div class="row"> <div class="col-md-3"></div> <div class="col-md-6 register"> <h3>Payment type</h3> <form method="post" action="{{route('saveUpdatePtype')}}"> {{csrf_field()}} <input type="hidden" name="p_t_id" value="{{$post->p_t_id}}"> <div class="form-group"> <label for="status">Payment Type:</label> <input type="text" class="form-control" id="p_type" name="p_type" value="{{$post->p_type}}"> </div> <button type="submit" class="btnreg">Submit</button> </form> </div> <div class="col-md-3"></div> </div> </div> </body> </html>
<header class="main-header"> <a href="<?php echo base_url().'client/beranda'; ?>" class="logo"> <span class="logo-mini">DPPKB</span> <span class="logo-lg"><b>DPPKB-</b>XXX</span> </a> <nav class="navbar navbar-static-top"> <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"> <span class="sr-only">Toggle navigation</span> </a> <div class="navbar-custom-menu"> <ul class="nav navbar-nav"> <li class="dropdown user user-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <?php $id_client = $this->session->userdata('ses_id'); $q = $this->db->query("SELECT foto,nama,username,DATE_FORMAT(last_login,'%H:%i:%s') AS last_login_time, DATE_FORMAT(last_login,'%Y-%m-%d') AS last_login FROM tb_client WHERE id_client='$id_client'"); $c = $q->row_array(); ?> <img src="<?php echo base_url().'assets/img/avatar/client/'.$c['foto']; ?>" class="user-image" alt=""> <span class="hidden-xs"><?php echo ucfirst($c['nama']); ?></span> &emsp;<i class="fa fa-caret-down"></i> </a> <ul class="dropdown-menu"> <li class="user-header"> <img src="<?php echo base_url().'assets/img/avatar/client/'.$c['foto']; ?>" class="img-circle" alt=""> <p> <small><?php echo ucfirst($c['nama']); ?></small> <small><i>Last login : <?php echo longdate_indo($c['last_login']); ?> <?php echo $c['last_login_time']; ?> </i></small> </p> </li> <li class="user-footer"> <div class="pull-left"> <a href="<?php echo base_url().'client/client/edit_profilku'; ?>" class="btn btn-default btn-flat"><i class="fa fa-user"> Edit Profil</i></a> </div> <div class="pull-right"> <a href="<?php echo base_url().'login_admin/system/login/logout'; ?>" class="btn btn-default btn-flat"><i class="fa fa-sign-out"> Sign Out</i></a> </div> </li> </ul> </li> </ul> </div> </nav> </header>
<?php use \App\Http\Controllers\BlogController; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="icon" href="{{ url('/')}}/public/frontend/images/fevi.png" sizes="16x16"> <title>Blogs |Motoblockchain</title> <!-- font --> <link href="https://fonts.googleapis.com/css?family=Titillium+Web:300,400,600,700" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- bootstrap cdn css --> <!-- slider footer --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.0.0-beta.3/assets/owl.carousel.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- End slider footer --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <link rel="stylesheet" href="{{ url('/')}}/public/frontend/css/style.css"> <link rel="stylesheet" href="{{ url('/')}}/public/frontend/css/animate.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.1.1/assets/owl.carousel.min.css"> <link rel="stylesheet" href="{{ url('/')}}/public/css/style.css"> <link rel="stylesheet" href="{{ url('/')}}/public/css/blog-description.css"> </head> <body class="animated fadeIn"> <!-- header start --> @include('common.header') <!-- header close --> <div class="automobile-main-wrapper"> <div class="automobile-subheader" style="background: #fff;"> <div class="automobile-subheader-image"> <span class="automobile-dark-transparent"></span> <div class="container"> <div class="row"> <div class="col-md-12"> <!-- <span>Our Blog</span>--> <h1>Our Blog</h1> </div> </div> </div> </div> <div class="container"> <div class="row"> <div class="col-md-12"> <ul class="automobile-breadcrumb"> <li><a href="{{ url('/')}}">Home</a> <i class="fa fa-long-arrow-right" aria-hidden="true"></i></li> <li><a href="{{ url('/')}}">Blogs</a> <i class="fa fa-long-arrow-right" aria-hidden="true"></i></li> <li class="automobile-color"> Search Result</li> </ul> </div> </div> </div> </div> <!--Content--> <div class="automobile-main-content"> <!--// Main Section \\--> <div class="automobile-main-section"> <div class="container"> <div class="row"> <!--// SideBaar \\--> <aside class="col-md-3"> <!--// Widget Search \\--> <div class="widget widget_search"> <form method="GET" > <label>Find Your Search:</label> {{ csrf_field() }} <input type="text" placeholder="Search" name="search_item" id="search_item" required> <input type="hidden" name="base_url" id="base_url" value="{{ url('/')}}" required> <label> <input type="submit" id="search_btn" value=""> </label> </form> </div> <!--// Widget Video Post \\--> <!--// Widget Video Post \\--> <!--// Widget Recent Post \\--> <div class="widget widget_recent_post"> <div class="automobile-widget-heading"><h2>Recent Posts</h2><i class="fa fa-angle-down"></i></div> <ul> @foreach($recent_blogs as $recent) <li><a href="{{ url('/blog-description'.'/'.$recent->id.'/'.$recent->slug)}}"> {{ $recent->title}}</a></li> @endforeach </ul> </div> <!--// Widget Recent Post \\--> <!--// Widget Recent Post \\--> <div class="widget widget_archive"> <div class="automobile-widget-heading"><h2>TAGS</h2><i class="fa fa-angle-down"></i></div> @foreach($blog_tags as $tag) <a href="{{ url('/')}}/search-blog/{{ $tag->id }}"><span class="badge badge-warning">{{ $tag->tag_name}},</span> </a> @endforeach </div> <!--// Widget Recent Post \\--> <!--// Widget Trading Post \\--> <div class="widget widget_trading_post"> <div class="automobile-widget-heading"><h2>Top 5 posts</h2><i class="fa fa-angle-down"></i></div> <ul> @php $i=1; @endphp @foreach($random_blogs as $random) <li> <figure><a href="{{ url('/blog-description'.'/'.$random->id.'/'.$random->slug)}}"><img src="{{url('/')}}/public/images/blog_images/{{$random->id}}/{{$random->blog_img}}" alt=""></a><span class="automobile-bgcolor"> {{ $i++ }} </span></figure> <div class="widget-trading-post-text"> <p style="margin-block-start: 0em; "><a href="{{ url('/blog-description'.'/'.$random->id.'/'.$random->slug)}}"> {{$random->title }} </a></p> <p style="margin-block-start: 0em; "><a href="{{ url('/blog-description'.'/'.$random->id.'/'.$random->slug)}}" class="video-post-btn automobile-color"><i class="icon-arrows-1"></i>Read More</a></p> </div> </li> @endforeach </ul> </div> </aside> <!--// SideBaar \\--> <div class="col-md-9"> <div class="automobile-blog automobile-medium-blog"> <ul class="row"> @if(count($blogs) > 0) @foreach($blogs as $blog) <li class="col-md-12"> <figure><a href="{{ url('/') }}/blog-description/{{$blog->id}}/{{$blog->slug}}"><img src="{{ url('/')}}/public/images/blog_images/{{$blog->id}}/{{$blog->blog_img}}" alt=""></a></figure> <div class="automobile-medium-blog-text"> <div class="automobile-social-tag"> <i class="automobile-color fa fa-folder-open"></i> <?php $tagss = $blog->tags ; $myArray = explode(',', $tagss); foreach($myArray as $my_Array){ ?> <a href="{{ url('/')}}/search-blog/{{ $my_Array }}"> {{ @BlogController::tag_name($my_Array) }}, </a> <?php } ?> </div> <ul class="automobile-blog-post-comment"> <li> <i class="automobile-color fa fa-clock-o"></i> <small>{{ date(' jS F', strtotime($blog->created_at) ) }}</small> </li> </ul> <h4><a href="{{ url('/') }}/blog-description/{{$blog->id}}/{{$blog->slug}}">{{ $blog->title}}</a></h4> <p><?php echo substr($blog->blog_content, 0, 100); ?>..</p> <a href="{{ url('/') }}/blog-description/{{$blog->id}}/{{$blog->slug}}" class="automobile-read-btn">read article</a> </div> </li> @endforeach @else <li class="col-md-12"> <br> <center><h2>No Blogs Found</h2></center> </li> @endif <li class="col-sm-12"> <div class="automobile-section-heading"><h2 class="automobile-color">Related Posts</h2></div> </li> @if(count($recent_blogs)) @foreach($recent_blogs_bottom as $recent) <li class="col-md-12"> <figure><a href="{{ url('/') }}/blog-description/{{$recent->id}}/{{$recent->slug}}"><img src="{{ url('/')}}/public/images/blog_images/{{$recent->id}}/{{$recent->blog_img}}" alt=""></a></figure> <div class="automobile-medium-blog-text"> <div class="automobile-social-tag"> <i class="automobile-color fa fa-folder-open"></i> <?php $tagss = $recent->tags ; $myArray = explode(',', $tagss); foreach($myArray as $my_Array){ ?> <a href="{{ url('/')}}/search-blog/{{ $my_Array }}"> {{ @BlogController::tag_name($my_Array) }}, </a> <?php } ?> </div> <ul class="automobile-blog-post-comment"> <li> <i class="automobile-color fa fa-clock-o"></i> <small> {{ date(' jS F', strtotime($recent->created_at) ) }}</small> </li> </ul> <h4><a href="#">{{ $recent->title}}</a></h4> <p><?php echo substr($blog->blog_content, 0, 100); ?>..</p> <a href="{{ url('/') }}/blog-description/{{$recent->id}}/{{$recent->slug}}" class="automobile-read-btn">read article</a> </div> </li> @endforeach @endif </ul> </div> <!--// Pagination \\--> <div class="automobile-pagination"> <span style="padding-top:10px"> <small class="automobile-color">{{ $blogs->links() }}</small></span> </div> <!--// Pagination \\--> </div> </div> </div> </div> <!--// Main Section \\--> </div> <!--// Main Content \\--> <!--End--> </div> <div class="clearfix"></div> <!-- footer start --> @include('common.footer') <!-- footer close --> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.0.0-beta.3/owl.carousel.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.js"></script> <script> $('.owl-carousel').owlCarousel({ autoplay: true, autoplayHoverPause: true, loop: true, margin: 20, responsiveClass: true, nav: true, loop: true, responsive: { 0: { items: 1 }, 568: { items: 2 }, 600: { items: 3 }, 1000: { items: 4 } } }) $(document).ready(function() { $('.popup-youtube, .popup-text').magnificPopup({ disableOn: 320, type: 'image', mainClass: 'mfp-fade', removalDelay: 160, preloader: false, fixedContentPos: true }); }); $(document).ready(function() { $('.popup-text').magnificPopup({ type: 'inline', preloader: false, focus: '#name', callbacks: { beforeOpen: function() { if ($(window).width() < 700) { this.st.focus = false; } else { this.st.focus = '#name'; } }, buildControls: function() { this.contentContainer.append(this.arrowLeft.add(this.arrowRight)); } } }); }); </script> <script> $("#search_btn").click(function(event) { event.preventDefault(); var search = $('#search_item').val(); var base_url = $('#base_url').val(); var url = base_url+"/search-blog/"+search; //alert(url); window.location.href = url; }); </script> </body> </html>
<?php declare(strict_types=1); /* * This file is part of the Doctrine Behavioral Extensions package. * (c) Gediminas Morkevicius <gediminas.morkevicius@gmail.com> http://www.gediminasm.org * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Gedmo\Tests\Translatable\Issue; use Doctrine\Common\EventManager; use Doctrine\ORM\Query; use Gedmo\Tests\Tool\BaseTestCaseORM; use Gedmo\Tests\Translatable\Fixture\Issue138\Article; use Gedmo\Translatable\Entity\Translation; use Gedmo\Translatable\Query\TreeWalker\TranslationWalker; use Gedmo\Translatable\TranslatableListener; /** * These are tests for translatable behavior * * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com> */ final class Issue138Test extends BaseTestCaseORM { public const ARTICLE = Article::class; public const TRANSLATION = Translation::class; public const TREE_WALKER_TRANSLATION = TranslationWalker::class; private $translatableListener; protected function setUp(): void { parent::setUp(); $evm = new EventManager(); $this->translatableListener = new TranslatableListener(); $this->translatableListener->setTranslatableLocale('en'); $this->translatableListener->setDefaultLocale('en'); $this->translatableListener->setTranslationFallback(true); $evm->addEventSubscriber($this->translatableListener); $this->getDefaultMockSqliteEntityManager($evm); } public function testIssue138(): void { $this->populate(); $dql = 'SELECT a FROM '.self::ARTICLE.' a'; $dql .= " WHERE a.title LIKE '%foo%'"; $q = $this->em->createQuery($dql); $q->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, self::TREE_WALKER_TRANSLATION); // array hydration $this->translatableListener->setTranslatableLocale('en_us'); //die($q->getSQL()); $result = $q->getArrayResult(); static::assertCount(1, $result); static::assertSame('Food', $result[0]['title']); } protected function getUsedEntityFixtures(): array { return [ self::ARTICLE, self::TRANSLATION, ]; } private function populate(): void { $repo = $this->em->getRepository(self::ARTICLE); $food = new Article(); $food->setTitle('Food'); $food->setTitleTest('about food'); $citron = new Article(); $citron->setTitle('Citron'); $citron->setTitleTest('something citron'); $this->em->persist($food); $this->em->persist($citron); $this->em->flush(); $this->translatableListener->setTranslatableLocale('lt_lt'); $food->setTitle('Maistas'); $food->setTitleTest('apie maista'); $citron->setTitle('Citrina'); $citron->setTitleTest('kazkas citrina'); $this->em->persist($food); $this->em->persist($citron); $this->em->flush(); $this->em->clear(); } }
{{"HII"}}
@extends("layouts.global") @section("title") Batching Edit @endsection @section("css") <link href="{{ asset('eatio/vendor/datatables/css/jquery.dataTables.min.css') }}" rel="stylesheet"> <link href="{{ asset('eatio/vendor/bootstrap-select/dist/css/bootstrap-select.min.css') }}" rel="stylesheet"> @endsection @section("content") <div class="row"> <div class="col-xl-6 col-lg-12"> <div class="card"> <div class="card-header"> <h4 class="card-title">DATA BATCHING</h4> </div> <div class="card-body" style="margin-top: -25px"> <div class="basic-form"> <form action="{{ route('batching.store') }}" method="POST"> @csrf <div class="form-group row"> <label class="col-sm-3 col-form-label h3">No Batch</label> <div class="col-sm-8"> <input type="text" id="no_batch" name="no_batch" class="form-control border border-light bg-light" value="{{ 'BATCH-'.$no_batch }}" readonly> </div> </div> <div class="form-group row"> <label class="col-sm-3 col-form-label h5">Tanggal</label> <div class="col-sm-8"> <input type="date" name="tanggal_batch" id="tanggal_batch" class="form-control border border-light" required> </div> </div> <button type="submit" class="btn btn-success h-50">SAVE</button> </form> <hr> </div> </div> </div> </div> @endsection
<?php include 'common/header.php'; ?> <div class="container"> <div class="row"> <div class="col-md-3"> <br> <br> <br> <div class="list-group"> <h3>Streams</h3> <?php foreach ($streams->result_array() as $stream): ?> <?php $get_stream = explode(',' , $stream['course_degrees']); ?> <?php for ($i=0; $i <count($get_stream) ; $i++) { ?> <?php $stream_data[] = $get_stream[$i]; ?> <?php } ?> <?php endforeach ?> <?php foreach (get_streams($stream_data) as $mystream): ?> <div class="list-group-item checkbox"> <label><input type="radio" class="common_seleter streams" name="streams" value="<?php echo $mystream['id'] ?>"> <?php echo $mystream['degree_name'] ?> </label> </div> <?php endforeach ?> </div> <div class="list-group"> <h3>Cities</h3> <?php foreach ($cities->result_array() as $city): ?> <?php $city_id[] = $city['city']; ?> <?php endforeach ?> <?php foreach (get_filter_city($city_id) as $mycity): ?> <div class="list-group-item checkbox"> <label><input type="radio" class="common_seleter cities" name="cities" value="<?php echo $mycity['id'] ?>"> <?php echo $mycity['name'] ?> </label> </div> <?php endforeach ?> </div> </div> <div class="col-md-9"> <br> <br> <h3 align="center"> ALL COLLEGES</h3> <br> <br> <div align="center" id="pagination_link"> </div> <br> <br> <div class="row filter_data"> </div> </div> </div> </div> <!-------------------========footer---=========================== --> <style type="text/css"> #loading{ background: url(https://media3.giphy.com/media/3oEjI6SIIHBdRxXI40/giphy.gif?cid=ecf05e4796bf566bca7bcf31afe39ba7a3643c1f98fdd5ff&rid=giphy.gif) no-repeat center; height: 150px; width: 100%; } </style> <?php include 'common/footer.php'; ?> <script type="text/javascript"> $(document).ready(function () { filter_data(1); function filter_data(page) { $('.filter_data').html("<div id='loading'></div>"); var action = 'fetch_data'; var streams = get_filter('streams'); var cities = get_filter('cities'); jQuery.ajax({ url : '<?php echo base_url() ?>home/fetch_data/'+page, method: 'POST', dataType: 'JSON', data : {action: action , streams : streams , cities : cities}, success: function(data) { $('.filter_data').html(data.college_list); $('#pagination_link').html(data.pagination_link); } }) } function get_filter(class_name) { var filters = []; $('.'+ class_name +':checked').each(function () { filters.push($(this).val()); }) ; return filters; } $(document).on('click' , '.pagination li a' , function(e) { e.preventDefault(); var page = $(this).data('ci-pagination-page'); filter_data(page); }) $('.common_seleter').click(function(){ filter_data(1) }) }) </script>
--TEST-- ReflectionFunction constructor errors --CREDITS-- Robin Fernandes <robinf@php.net> Steve Seear <stevseea@php.net> --FILE-- <?php try { $a = new ReflectionFunction(array(1, 2, 3)); echo "exception not thrown.".PHP_EOL; } catch (TypeError $re) { echo "Ok - ".$re->getMessage().PHP_EOL; } try { $a = new ReflectionFunction('nonExistentFunction'); } catch (ReflectionException $e) { echo $e->getMessage().PHP_EOL; } try { $a = new ReflectionFunction(); } catch (TypeError $re) { echo "Ok - ".$re->getMessage().PHP_EOL; } try { $a = new ReflectionFunction(1, 2); } catch (TypeError $re) { echo "Ok - ".$re->getMessage().PHP_EOL; } try { $a = new ReflectionFunction([]); } catch (TypeError $re) { echo "Ok - ".$re->getMessage().PHP_EOL; } ?> --EXPECT-- Ok - ReflectionFunction::__construct(): Argument #1 ($function) must be of type Closure|string, array given Function nonExistentFunction() does not exist Ok - ReflectionFunction::__construct() expects exactly 1 argument, 0 given Ok - ReflectionFunction::__construct() expects exactly 1 argument, 2 given Ok - ReflectionFunction::__construct(): Argument #1 ($function) must be of type Closure|string, array given
<?php class Statsm extends CI_Model { function __construct() { parent::__construct(); $this->uid = $this->session ? $this->session->userdata('uid') : "0"; } function delete($nid) { return $this->db->delete('u_nutrition', array('nid' => $nid)); } function update($nid, $data) { return $this->db->update('u_nutrition', $data, "nid = '".$nid."'"); } function add($data) { $this->db->insert('u_nutrition', $data); return $this->db->insert_id(); } function get_overall_cals($date) { $query_raw = "select * from u_nutrition, u_workouts where u_nutrition.n_date = '".$date."' and u_workouts.pa_date = '".$date."' and u_id = '".$uid."'"; $query = $this->db->query($query_raw); if ($query) { $result = $query->result(); } else { $result = null; } return $result; } function get_nutrition_cals($date = null, $nid = null) { if ($date != null) { $date_sql = " u_nutrition.n_date = '".$date."' and "; } else { $date_sql = ""; } if ($this->uid != null) { $uid_sql = " u_id = '".$this->uid."' and "; } else { $uid_sql = ""; } if ($nid != null) { $nid_sql = " nid = '".$nid."' and "; } else { $nid_sql = ""; } $query_raw = "select u_nutrition.*, f_names.n, f_servings.s, f_servings.sid from u_nutrition left join f_names on f_names.fid = u_nutrition.fid left join f_servings on f_servings.sid = u_nutrition.sid where ".$date_sql." ".$uid_sql." ".$nid_sql." 1=1 order by u_nutrition.n_datetime desc"; $query = $this->db->query($query_raw); if ($query) { $result = $query->result(); } else { $result = null; } return $result; } function get_workout($date = null, $w_id = null) { if ($date != null) { $date_sql = " u_workouts.pa_date = '".$date."' and "; } else { $date_sql = ""; } if ($this->uid != null) { $uid_sql = " u_id = '".$this->uid."' and "; } else { $uid_sql = ""; } if ($w_id != null) { $w_id_sql = " w_id = '".$w_id."' and "; } else { $w_id_sql = ""; } $query_raw = "select u_workouts.*, pactivities.pa_txt from u_workouts left join pactivities on pactivities.pa_id = u_workouts.pa_id where ".$date_sql." ".$uid_sql." ".$w_id_sql." 1=1 order by u_workouts.w_datetime desc"; $query = $this->db->query($query_raw); if ($query) { $result = $query->result(); } else { $result = null; } return $result; } function get_all_nutrients($fid) { $query_raw = "select f_nutrients.*, f_nutrients_definitions.Units, f_nutrients_definitions.NutrDesc from f_nutrients left join f_nutrients_definitions on f_nutrients_definitions.Nutr_No = f_nutrients.nid where f_nutrients.fid = '".$fid."'"; $query = $this->db->query($query_raw); if ($query) { $result = $query->result(); } else { $result = null; } return $result; } function get_nutrition_log_item($date, $fid) { $query_raw = "select u_nutrition.*, f_names.n, f_servings.s, f_servings.sid from u_nutrition left join f_names on f_names.fid = u_nutrition.fid left join f_servings on f_servings.sid = u_nutrition.sid where u_nutrition.n_date = '".$date."' and u_id = '".$this->uid."' and u_nutrition.fid='".$fid."' order by u_nutrition.n_datetime desc"; $query = $this->db->query($query_raw); if ($query) { $result = $query->result(); } else { $result = null; } return $result; } function get_nutrition_cals2($date) { $query_raw = "select *, f_names.* from u_nutrition left join f_names on f_names.fid = u_nutrition.fid where u_nutrition.n_date = '".$date."' and u_id = '".$this->uid."'"; $query = $this->db->query($query_raw); if ($query) { $result = $query->result(); } else { $result = null; } return $result; } function get_workout_cals($date) { $query_raw = "select * from u_workouts where u_workouts.pa_date = '".$date."' and u_id = '".$this->uid."'"; $query = $this->db->query($query_raw); if ($query) { $result = $query->result(); } else { $result = null; } return $result; } }
@extends('layouts.app') @section('content') <div> <div class ="row"> <a class="btn btn-primary" href="crear" > Crear Patologia</a> </div> </br> <div class = "row"> <div class="contianer"> <table class="table table-responsive table-striped table-hover"> <thead> <tr> <th>#</th> <th>Nombre De Patología</th> <th>Tipo De Terapia</th> <th>Acciones</th> </tr> </thead> <tbody> @foreach ($patologias as $Patologia) <tr> <th>{{ $Patologia->id }}</th> <td>{{ $Patologia->Nombre_Patologia }}</td> <td>{{ $Patologia->terapia->Nombre}}</td> <td> <div class="btn-group" role="group" aria-label="..."> <a href="modificar/{{$Patologia->id}}"> <i class="text-info material-icons">edit</i> </a> </div> </td> </tr> @endforeach </tbody> </table> </div> {{ $patologias->links() }} </div> </div> @endsection
<?php namespace app\controllers; use Yii; use yii\web\Controller; use yii\filters\AccessControl; use yii\web\Response; use yii\filters\VerbFilter; use budyaga\users\models\User; class SiteController extends Controller{ /** * {@inheritdoc} */ public function behaviors(){ return [ 'access' => [ 'class' => AccessControl::className(), 'only' => ['logout','changepass'], 'rules' => [ [ 'actions' => ['logout','changepass'], 'allow' => true, 'roles' => ['@'], ], ], ], 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [ 'logout' => ['post'], ], ], ]; } /** * @inheritdoc */ public function actions() { return [ 'error' => [ 'class' => 'yii\web\ErrorAction', ], 'captcha' => [ 'class' => 'yii\captcha\CaptchaAction', 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, ], ]; } public function actionIndex(){ return $this->render('index'); } public function actionChangepass(){ $error=null; $message=null; if(Yii::$app->request->post('change')!=null){ $pass = Yii::$app->request->post('password'); $confirm = Yii::$app->request->post('confirm'); if($pass==null||trim($pass)==''||$confirm==null||trim($confirm)==''){ $error = "Пароль и подтверждение не могут быть пустыми"; }else if(trim($pass)!=trim($confirm)){ $error = "Пароль и подтверждение должны совпадать"; }else{ $us=User::findOne(Yii::$app->user->identity->id); if($us!=null){ $us->setPassword($pass); if($us->save()){ $message="Пароль успешно обновлен"; }else{ $error = "Невозможно обновить пароль"; } } } } return $this->render('form',['error'=>$error,'message'=>$message]); } }
<?php namespace VicFlora\Entities\Map; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity() * @ORM\Table(name="vicflora_taxa", schema="maps") */ class VicfloraTaxon { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue * @var integer */ protected $id; /** * @ORM\Column(length=40, unique=true) * @var string */ protected $scientificNameId; /** * @ORM\Column(length=40) * @var string */ protected $acceptedNameUsageId; /** * @ORM\Column(length=40) * @var string */ protected $speciesId; /** * @ORM\Column(length=128) * @var string */ protected $scientificName; /** * @ORM\Column(length=128, nullable=true) * @var string */ protected $scientificNameAuthorship; /** * @ORM\Column(length=32, nullable=true) * @var string */ protected $taxonRank; /** * @ORM\Column(length=128, nullable=true) * @var string */ protected $acceptedNameUsage; /** * @ORM\Column(length=32, nullable=true) * @var string */ protected $acceptedNameUsageTaxonRank; /** * @ORM\Column(length=32, nullable=true) * @var string */ protected $kingdom; /** * @ORM\Column(length=32, nullable=true) * @var string */ protected $phylum; /** * @ORM\Column(length=32, nullable=true) * @var string */ protected $class; /** * @ORM\Column(length=32, nullable=true) * @var string */ protected $order; /** * @ORM\Column(length=32, nullable=true) * @var string */ protected $family; /** * @ORM\Column(length=32, nullable=true) * @var string */ protected $genus; /** * @ORM\Column(length=96, nullable=true) * @var string */ protected $specificEpithet; /** * @ORM\Column(length=96, nullable=true) * @var string */ protected $infraspecificEpithet; /** * @ORM\Column(length=32, nullable=true) * @var string */ protected $occurrenceStatus; /** * @ORM\Column(length=32, nullable=true) * @var string */ protected $establishmentMeans; /** * @ORM\Column(type="datetimetz") * @var datetime */ protected $timestampCreated; }
<?php /** * Copyright (c) 2015-present, Facebook, Inc. All rights reserved. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to * use, copy, modify, and distribute this software in source code or binary * form for use in connection with the web services and APIs provided by * Facebook. * * As with any software that integrates with the Facebook platform, your use * of this software is subject to the Facebook Developer Principles and * Policies [http://developers.facebook.com/policy/]. This copyright notice * shall be included in all copies or substantial portions of the software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * */ namespace FacebookAds\Object\Fields; use FacebookAds\Enum\AbstractEnum; /** * This class is auto-generated. * * For any issues or feature requests related to this class, please let us know * on github and we'll fix in our codegen framework. We'll not be able to accept * pull request for this class. * */ class CatalogSubVerticalListFields extends AbstractEnum { const APPLIANCES = 'appliances'; const BABY_FEEDING = 'baby_feeding'; const BABY_TRANSPORT = 'baby_transport'; const BEAUTY = 'beauty'; const BEDDING = 'bedding'; const CAMERAS = 'cameras'; const CAMERAS_AND_PHOTOS = 'cameras_and_photos'; const CELL_PHONES_AND_SMART_WATCHES = 'cell_phones_and_smart_watches'; const CLEANING_SUPPLIES = 'cleaning_supplies'; const CLO_OFFER = 'clo_offer'; const CLOTHING = 'clothing'; const CLOTHING_ACCESSORIES = 'clothing_accessories'; const COMPUTER_COMPONENTS = 'computer_components'; const COMPUTERS_AND_TABLETS = 'computers_and_tablets'; const COMPUTERS_LAPTOPS_AND_TABLETS = 'computers_laptops_and_tablets'; const DIAPERING_AND_POTTY_TRAINING = 'diapering_and_potty_training'; const DIGITAL_PRODUCT_OFFER = 'digital_product_offer'; const ELECTRONIC_ACCESSORIES_AND_CABLES = 'electronic_accessories_and_cables'; const ELECTRONICS_ACCESSORIES = 'electronics_accessories'; const FURNITURE = 'furniture'; const HEALTH = 'health'; const HOME = 'home'; const HOME_GOODS = 'home_goods'; const HOUSEHOLD_AND_CLEANING_SUPPLIES = 'household_and_cleaning_supplies'; const JEWELRY = 'jewelry'; const LARGE_APPLIANCES = 'large_appliances'; const LOCAL_SERVICE_BUSINESS_ITEM = 'local_service_business_item'; const LOCAL_SERVICE_BUSINESS_RESTAURANT = 'local_service_business_restaurant'; const LOYALTY_OFFER = 'loyalty_offer'; const MEETUP_SPACE = 'meetup_space'; const NURSERY = 'nursery'; const PRINTERS_AND_SCANNERS = 'printers_and_scanners'; const PRINTERS_SCANNERS_AND_FAX_MACHINES = 'printers_scanners_and_fax_machines'; const PRODUCT_DISCOUNT = 'product_discount'; const PROJECTORS = 'projectors'; const SHOES = 'shoes'; const SHOES_AND_FOOTWEAR = 'shoes_and_footwear'; const SOFTWARE = 'software'; const TELEVISIONS_AND_MONITORS = 'televisions_and_monitors'; const TEST_CHILD_SUB_VERTICAL = 'test_child_sub_vertical'; const TEST_GRAND_CHILD_SUB_VERTICAL = 'test_grand_child_sub_vertical'; const TEST_SUB_VERTICAL = 'test_sub_vertical'; const TEST_SUB_VERTICAL_ALIAS = 'test_sub_vertical_alias'; const TEST_SUB_VERTICAL_DATA_OBJECT = 'test_sub_vertical_data_object'; const THIRD_PARTY_ELECTRONICS = 'third_party_electronics'; const THIRD_PARTY_TOYS_AND_GAMES = 'third_party_toys_and_games'; const TOYS = 'toys'; const TOYS_AND_GAMES = 'toys_and_games'; const TVS_AND_MONITORS = 'tvs_and_monitors'; const VEHICLE_MANUFACTURER = 'vehicle_manufacturer'; const VIDEO_GAME_CONSOLES_AND_VIDEO_GAMES = 'video_game_consoles_and_video_games'; const VIDEO_GAMES_AND_CONSOLES = 'video_games_and_consoles'; const VIDEO_PROJECTORS = 'video_projectors'; const WATCHES = 'watches'; public function getFieldTypes() { return array( 'appliances' => 'Object', 'baby_feeding' => 'Object', 'baby_transport' => 'Object', 'beauty' => 'Object', 'bedding' => 'Object', 'cameras' => 'Object', 'cameras_and_photos' => 'Object', 'cell_phones_and_smart_watches' => 'Object', 'cleaning_supplies' => 'Object', 'clo_offer' => 'Object', 'clothing' => 'Object', 'clothing_accessories' => 'Object', 'computer_components' => 'Object', 'computers_and_tablets' => 'Object', 'computers_laptops_and_tablets' => 'Object', 'diapering_and_potty_training' => 'Object', 'digital_product_offer' => 'Object', 'electronic_accessories_and_cables' => 'Object', 'electronics_accessories' => 'Object', 'furniture' => 'Object', 'health' => 'Object', 'home' => 'Object', 'home_goods' => 'Object', 'household_and_cleaning_supplies' => 'Object', 'jewelry' => 'Object', 'large_appliances' => 'Object', 'local_service_business_item' => 'Object', 'local_service_business_restaurant' => 'Object', 'loyalty_offer' => 'Object', 'meetup_space' => 'Object', 'nursery' => 'Object', 'printers_and_scanners' => 'Object', 'printers_scanners_and_fax_machines' => 'Object', 'product_discount' => 'Object', 'projectors' => 'Object', 'shoes' => 'Object', 'shoes_and_footwear' => 'Object', 'software' => 'Object', 'televisions_and_monitors' => 'Object', 'test_child_sub_vertical' => 'Object', 'test_grand_child_sub_vertical' => 'Object', 'test_sub_vertical' => 'Object', 'test_sub_vertical_alias' => 'Object', 'test_sub_vertical_data_object' => 'Object', 'third_party_electronics' => 'Object', 'third_party_toys_and_games' => 'Object', 'toys' => 'Object', 'toys_and_games' => 'Object', 'tvs_and_monitors' => 'Object', 'vehicle_manufacturer' => 'Object', 'video_game_consoles_and_video_games' => 'Object', 'video_games_and_consoles' => 'Object', 'video_projectors' => 'Object', 'watches' => 'Object', ); } }
<?php include('koneksi.php'); require 'vendor/autoload.php'; error_reporting(0); date_default_timezone_set("Asia/Jakarta"); use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Reader\Csv; use PhpOffice\PhpSpreadsheet\Reader\Xlsx; $file_mimes = array('application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); if(isset($_FILES['berkas_excel']['name']) && in_array($_FILES['berkas_excel']['type'], $file_mimes)) { $arr_file = explode('.', $_FILES['berkas_excel']['name']); $extension = end($arr_file); if('csv' == $extension) { $reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); } else { $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); } $spreadsheet = $reader->load($_FILES['berkas_excel']['tmp_name']); $sheetData = $spreadsheet->getActiveSheet()->toArray(); for($i = 1;$i < count($sheetData);$i++) { $kode_status = $sheetData[$i]['1']; $status = $sheetData[$i]['2']; $tgl = $sheetData[$i]['3']; $tanggal = date('d-m-Y', strtotime($tgl)); $projection = $sheetData[$i]['4']; // Cek Apakah Data Sudah Ada Sebelumnya $q_cek = "SELECT * FROM tbl_cashoutproj WHERE kode_status='$kode_status' AND tanggal='$tanggal'"; $res_cek = mysqli_query($koneksi, $q_cek); $cek = mysqli_num_rows($res_cek); $data = mysqli_fetch_array($res_cek); if($cek>0){ //kalo data sudah ada sebelumnya $proj_sebelumnya = $data['projection']; $proj_tambahan = $projection; $proj_baru = $proj_sebelumnya + $proj_tambahan; // Data Lama Akan Ditambahkan Dengan Yang Baru mysqli_query($koneksi, "UPDATE tbl_cashoutproj SET projection=$proj_baru WHERE kode_status='$kode_status' AND tanggal='$tanggal'"); // Masukan Detail Data mysqli_query($koneksi, "insert into tbl_cashoutproj_d(kode_status, status, tanggal, projection) values ('$kode_status','$status','$tanggal', $projection)"); }else{ // Masukan Data mysqli_query($koneksi, "insert into tbl_cashoutproj(kode_status, status, tanggal, projection) values ('$kode_status','$status','$tanggal', $projection)"); // Masukan Detail Data mysqli_query($koneksi, "insert into tbl_cashoutproj_d(kode_status, status, tanggal, projection) values ('$kode_status','$status','$tanggal', $projection)"); } } // Redirect Di Server 10.20.0.30 // echo '<script> // alert("Data Berhasil Diupload");window.location="http://10.20.0.30/Pro-Cashflow/input_cashout"; // </script>'; // Redirect Di Laptop Local // echo '<script> // alert("Data Berhasil Diupload");window.location="http://localhost:8056/Pro-Cashflow/input_cashout"; // </script>'; // Redirect Di Server 10.20.1.201 (Yang Ada Domain nya) echo '<script> alert("Data Berhasil Diupload");window.location="http://10.20.0.30/Pro-Cashflow/input_cashout"; </script>'; } ?>
<?php function getAllowedDomains() { global $config; $filename = __DIR__.'/regions/'.$config->teacherInterface->domainCountryCode.'/domains.json'; if (is_readable($filename)) { $domains = json_decode(file_get_contents($filename)); return $domains->domains; } else { return array(); } }
<?php class IndexAction extends Action { // 首页 public function index() { $Form = M("Form"); // 按照id排序显示前5条记录 $list = $Form->order('id desc')->limit(3)->select(); $this->list = $list; $this->display(); } // 检查标题是否可用 public function checkTitle($title='') { if (!empty($title)) { $Form = M("Form"); if ($Form->getByTitle($title)) { $this->error('标题已经存在'); } else { $this->success('标题可以使用!'); } } else { $this->error('标题必须'); } } // 处理表单数据 public function insert() { $Form = D("Form"); if ($vo = $Form->create()) { if (false !== $Form->add()) { $vo['create_time'] = date('Y-m-d H:i:s', $vo['create_time']); $vo['content'] = nl2br($vo['content']); $this->ajaxReturn($vo, '表单数据保存成功!', 1); } else { $this->error('数据写入错误!'); } } else { $this->error($Form->getError()); } } }
<?php $formStem = $block->getFormStem(); $options = $block->getOptions(); ?> <div class="neatline-id"> <?php echo $this->formLabel("{$formStem}[options][neatline-id]", __('Select a Neatline')); echo $this->formSelect("{$formStem}[options][neatline-id]", @$options['neatline-id'], array(), get_table_options('NeatlineExhibit')); ?> </div>
<?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; class UpdateTeamRequest extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return true; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'name' => 'required|min:3' ]; } }
<?php /** .------------------------------------------------------------------- * | Software: [HDCMS framework] * | Site: www.hdcms.com * |------------------------------------------------------------------- * | Author: 向军 <2300071698@qq.com> * | WeChat: aihoudun * | Copyright (c) 2012-2019, www.houdunwang.com. All Rights Reserved. * '-------------------------------------------------------------------*/ namespace hdphp\session; /** * 文件处理 * Class FileHandler * @package hdphp\session * @author 向军 */ class FileHandler implements AbSession { //执行SESSION控制 public function make() { //创建目录 if ( ! is_dir( ROOT_PATH . '/storage/session' ) ) { mkdir( ROOT_PATH . '/storage/session', 0755, TRUE ); } //设置session保存目录 session_save_path( ROOT_PATH . '/storage/session' ); } }
<?php use Illuminate\Database\Seeder; class CustomCommandsSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { DB::table('custom_commands')->insert([ 'serverid' => PHP_INT_MAX, 'commandid' => str_random(8), 'response' => str_random(32), 'description' => str_random(32) ]); DB::table('custom_commands')->insert([ 'serverid' => PHP_INT_MAX, 'commandid' => str_random(16), 'response' => str_random(32), 'description' => str_random(32) ]); } }
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateCoursesTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('courses', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name_en'); $table->string('name_ar'); $table->softDeletes(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('courses'); } }
<?php declare(strict_types=1); /* * This file is part of the Geocoder package. * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @license MIT License */ namespace Geocoder\Provider\TomTom\Tests; use Geocoder\Collection; use Geocoder\IntegrationTest\BaseTestCase; use Geocoder\Location; use Geocoder\Query\GeocodeQuery; use Geocoder\Query\ReverseQuery; use Geocoder\Provider\TomTom\TomTom; class TomTomTest extends BaseTestCase { protected function getCacheDir() { return __DIR__.'/.cached_responses'; } public function testGetName() { $provider = new TomTom($this->getMockedHttpClient(), 'api_key'); $this->assertEquals('tomtom', $provider->getName()); } public function testGeocodeWithAddress() { $this->expectException(\Geocoder\Exception\InvalidServerResponse::class); $provider = new TomTom($this->getMockedHttpClient(), 'api_key'); $provider->geocodeQuery(GeocodeQuery::create('Tagensvej 47, 2200 København N')); } public function testGeocodeWithRealAddress() { $provider = new TomTom($this->getHttpClient($_SERVER['TOMTOM_MAP_KEY']), $_SERVER['TOMTOM_MAP_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('Tagensvej 47, 2200 København N')->withLocale('en-GB')); $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); $this->assertInstanceOf('\Geocoder\Model\Address', $result); $this->assertEqualsWithDelta(55.70, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(12.5529, $result->getCoordinates()->getLongitude(), 0.001); $this->assertNull($result->getBounds()); $this->assertEquals(47, $result->getStreetNumber()); $this->assertEquals('Tagensvej', $result->getStreetName()); $this->assertEquals(2200, $result->getPostalCode()); $this->assertEquals('Copenhagen', $result->getLocality()); $this->assertCount(0, $result->getAdminLevels()); $this->assertEquals('Denmark', $result->getCountry()->getName()); $this->assertEquals('DK', $result->getCountry()->getCode()); $this->assertNull($result->getTimezone()); } public function testGeocodeWithRealAddressWithFrenchLocale() { $provider = new TomTom($this->getHttpClient($_SERVER['TOMTOM_MAP_KEY']), $_SERVER['TOMTOM_MAP_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('Tagensvej 47, 2200 København N')->withLocale('fr-FR')); $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); $this->assertInstanceOf('\Geocoder\Model\Address', $result); } public function testGeocodeWithLocalhostIPv4() { $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); $this->expectExceptionMessage('The TomTom provider does not support IP addresses, only street addresses.'); $provider = new TomTom($this->getMockedHttpClient(), 'api_key'); $provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); } public function testGeocodeWithLocalhostIPv6() { $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); $this->expectExceptionMessage('The TomTom provider does not support IP addresses, only street addresses.'); $provider = new TomTom($this->getMockedHttpClient(), 'api_key'); $provider->geocodeQuery(GeocodeQuery::create('::1')); } public function testGeocodeWithIPv4() { $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); $this->expectExceptionMessage('The TomTom provider does not support IP addresses, only street addresses.'); $provider = new TomTom($this->getMockedHttpClient(), 'api_key'); $provider->geocodeQuery(GeocodeQuery::create('74.200.247.59')); } public function testGeocodeWithIPv6() { $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); $this->expectExceptionMessage('The TomTom provider does not support IP addresses, only street addresses.'); $provider = new TomTom($this->getMockedHttpClient(), 'api_key'); $provider->geocodeQuery(GeocodeQuery::create('::ffff:74.200.247.59')); } public function testWithoutApiKey() { $this->expectException(\Geocoder\Exception\InvalidCredentials::class); $this->expectExceptionMessage('No API key provided'); new TomTom($this->getMockedHttpClient(), ''); } public function testReverse() { $this->expectException(\Geocoder\Exception\InvalidServerResponse::class); $provider = new TomTom($this->getMockedHttpClient(), 'api_key'); $provider->reverseQuery(ReverseQuery::fromCoordinates(1, 2)); } public function testReverseError400() { $error400 = <<<'JSON' { "errorText": "Error parsing 'language': Language tag 'en-ES' not supported", "detailedError": { "code": "BadRequest", "message": "Error parsing 'language': Language tag 'en-ES' not supported", "target": "language" }, "httpStatusCode": 400 } JSON; $provider = new TomTom($this->getMockedHttpClient($error400), 'api_key'); $result = $provider->reverseQuery(ReverseQuery::fromCoordinates(1, 2)); $this->assertInstanceOf(Collection::class, $result); $this->assertEquals(0, $result->count()); } public function testReverseWithRealCoordinates() { if (!isset($_SERVER['TOMTOM_MAP_KEY'])) { $this->markTestSkipped('You need to configure the TOMTOM_MAP_KEY value in phpunit.xml'); } $provider = new TomTom($this->getHttpClient($_SERVER['TOMTOM_MAP_KEY']), $_SERVER['TOMTOM_MAP_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(48.86321648955345, 2.3887719959020615)); $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); $this->assertInstanceOf('\Geocoder\Model\Address', $result); $this->assertEqualsWithDelta(48.86323, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(2.38877, $result->getCoordinates()->getLongitude(), 0.001); $this->assertNull($result->getBounds()); $this->assertEquals('Avenue Gambetta', $result->getStreetName()); $this->assertNull($result->getPostalCode()); $this->assertEquals('Paris', $result->getLocality()); $this->assertEquals('20e Arrondissement Paris', $result->getSubLocality()); $this->assertCount(0, $result->getAdminLevels()); $this->assertEquals('France', $result->getCountry()->getName()); $this->assertEquals('FR', $result->getCountry()->getCode()); $this->assertNull($result->getTimezone()); } public function testGeocodeWithRealCoordinates() { if (!isset($_SERVER['TOMTOM_MAP_KEY'])) { $this->markTestSkipped('You need to configure the TOMTOM_MAP_KEY value in phpunit.xml'); } $provider = new TomTom($this->getHttpClient($_SERVER['TOMTOM_MAP_KEY']), $_SERVER['TOMTOM_MAP_KEY']); $results = $provider->reverseQuery(ReverseQuery::fromCoordinates(56.5231, 10.0659)); $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); $this->assertInstanceOf('\Geocoder\Model\Address', $result); $this->assertEqualsWithDelta(56.52435, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(10.06744, $result->getCoordinates()->getLongitude(), 0.001); $this->assertNull($result->getBounds()); $this->assertEquals(16, $result->getStreetNumber()); $this->assertEquals('Stabelsvej', $result->getStreetName()); $this->assertNull($result->getPostalCode()); $this->assertEquals('Spentrup', $result->getLocality()); $this->assertEquals('Spentrup', $result->getSubLocality()); $this->assertCount(0, $result->getAdminLevels()); $this->assertEquals('Denmark', $result->getCountry()->getName()); $this->assertEquals('DK', $result->getCountry()->getCode()); $this->assertNull($result->getTimezone()); } }
<?php /** * Copyright 2016 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * For instructions on how to run the full sample: * * @see https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/speech/api/README.md */ namespace Google\Cloud\Samples\Speech; # [START transcribe_sync] use Google\Cloud\ServiceBuilder; /** * Transcribe an audio file using Google Cloud Speech API * Example: * ``` * transcribe_sync('/path/to/audiofile.wav'); * ```. * * @param string $audioFile path to an audio file. * * @return string the text transcription */ function transcribe_sync($audioFile, $options = []) { $builder = new ServiceBuilder(); $speech = $builder->speech(); $results = $speech->recognize( fopen($audioFile, 'r'), $options ); print_r($results); } # [END transcribe_sync]
<?php namespace Spatie\Honeypot; use Illuminate\Support\Facades\View; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Spatie\Honeypot\SpamResponder\SpamResponder; class HoneypotServiceProvider extends ServiceProvider { public function boot() { if ($this->app->runningInConsole()) { $this->publishes([ __DIR__.'/../config/honeypot.php' => config_path('honeypot.php'), ], 'config'); $this->publishes([ __DIR__.'/../resources/views' => base_path('resources/views/vendor/honeypot'), ], 'views'); } $this->loadViewsFrom(__DIR__.'/../resources/views', 'honeypot'); View::composer('honeypot::honeypotFormFields', HoneypotViewComposer::class); Blade::directive('honeypot', function () { return "<?php echo view('honeypot::honeypotFormFields'); ?>"; }); $this->app->bind(SpamResponder::class, config('honeypot.respond_to_spam_with')); } public function register() { $this->mergeConfigFrom(__DIR__.'/../config/honeypot.php', 'honeypot'); } }
<?php /** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Sales\Block\Adminhtml; /** * Adminhtml sales transactions block * * @author Magento Core Team <core@magentocommerce.com> */ class Transactions extends \Magento\Backend\Block\Widget\Grid\Container { /** * Constructor * * @return void */ protected function _construct() { $this->_controller = 'adminhtml_transactions'; $this->_blockGroup = 'Magento_Sales'; $this->_headerText = __('Transactions'); parent::_construct(); $this->buttonList->remove('add'); } }
<?php namespace common\models; use yii\helpers\ArrayHelper; /** * This is the model class for table "user_rank". * * @property string $id * @property string $name * @property integer $score * @property string $discount * @property integer $status * * @property User[] $users */ class UserRank extends \yii\db\ActiveRecord { /** * @inheritdoc */ public static function tableName() { return '{{%user_rank}}'; } /** * @inheritdoc */ public function rules() { return [ [['name', 'score', 'discount', 'status'], 'required'], [['score', 'status'], 'integer'], [['discount'], 'number'], [['name'], 'string', 'max' => 30], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'name' => '等级名称', 'score' => '分值', 'discount' => '折扣', 'status' => '状态', ]; } /** * 获取类别的下拉菜单 * @return type */ public static function dropDown(){ $data = self::find()->asArray()->all(); $data_list = ArrayHelper::map($data, 'id', 'name'); return $data_list; } /** * @return \yii\db\ActiveQuery */ public function getUsers() { return $this->hasMany(User::className(), ['r_id' => 'id']); } }
<?php declare(strict_types = 1); return new \PHPStan\Reflection\Native\NativeFunctionReflection( 'udm_find', [ new \PHPStan\Reflection\Native\NativeParameterReflection( 'agent', false, PHPStan\Type\MixedType::__set_state(array( 'isExplicitMixed' => false, )), false, false ), new \PHPStan\Reflection\Native\NativeParameterReflection( 'query', false, PHPStan\Type\StringType::__set_state(array()), false, false ), ], false, PHPStan\Type\ResourceType::__set_state(array()) );
<div class="modal fade text-left" id="addTimeKeeper" tabindex="-1" role="dialog" aria-labelledby="myModalLabel17" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered modal-lg" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="myModalLabel17">Schedule</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <form action="{{ route('store-timekeeper') }}" method="POST" id="newModalForm"> <input type="hidden" id="timepeeper_id" name="timepeeper_id"> @csrf <div class="modal-body"> <section id="multiple-column-form"> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-body"> @if ($errors->any()) <div class="alert alert-danger"> <ul> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif <div class="row"> <div class="col-md-12 col-12"> <label for="">Select Employee</label> <div class="form-group"> <select class="form-control" name="employee_id" id="employee_id" aria-label="Default select example" required> <option value="{{ old('employee_id') }}" disabled selected hidden>Please Choose...</option> @foreach ($employees as $employee) <option value="{{ $employee->id }}"> {{ $employee->fname }}</option> @endforeach </select> </div> </div> <div class="col-md-12 col-12"> <label for="">Select Client</label> <div class="form-group"> <select class="form-control" name="client_id" id="client-select" aria-label="Default select example" required> <option value="" disabled selected hidden>Please Choose... </option> @foreach ($clients as $client) <option value="{{ $client->id }}">{{ $client->cname }} </option> @endforeach </select> </div> </div> <div class="col-md-12 col-12"> <label for="">Select Project</label> <div class="form-group"> <select class="form-control" name="project_id" id="project-select" aria-label="Default select example" required> <option value="" disabled selected hidden>Please Choose... </option> @foreach ($projects as $project) <option value="{{ $project->id }}">{{ $project->pName }} </option> @endforeach </select> </div> </div> <div class="col-md-12 col-12"> <label for="email-id-column">Roaster Date<span class="text-danger">*</span></label> <div class="form-group"> <input type="text" readonly id="roaster_date" name="roaster_date" class="form-control" placeholder="DD-MM-YYYY" required /> </div> </div> <div class="col-md-6 col-12"> <label for="email-id-column">Shift Start<span class="text-danger">*</span></label> <div class="form-group"> <input type="text" readonly id="shift_start" name="shift_start" class="form-control reactive" placeholder="Start" required /> <span id="shift_start_error" class="text-danger text-small"></span> </div> </div> <div class="col-md-6 col-12"> <label for="email-id-column">Shift Ends Date & Time<span class="text-danger">*</span></label> <div class="form-group"> <input type="text" readonly id="shift_end" name="shift_end" class="form-control reactive" placeholder="End" required /> <span id="shift_end_error" class="text-danger"></span> </div> </div> <div class="col-md-6 col-12"> <label for="email-id-column">Duration<span class="text-danger">*</span></label> <div class="form-group"> <input type="text" id="duration" name="duration" class="form-control" placeholder="Duration" id="days" readonly="readonly" /> </div> </div> <div class="col-md-6 col-12"> <label for="email-id-column">Amount Per Hour<span class="text-danger">*</span></label> <div class="form-group"> <input type="number" id="rate" name="ratePerHour" class="form-control reactive" placeholder="0" required /> </div> </div> <div class="col-md-12 col-12"> <label for="email-id-column">Amount<span class="text-danger">*</span></label> <div class="form-group"> <input type="text" id="amount" name="amount" class="form-control" placeholder="0" readonly="readonly" /> </div> </div> <div class="col-md-12 col-12"> <label for="">Select Job Type</label> <div class="form-group"> <select class="form-control" name="job_type_id" id="job" aria-label="Default select example" required> <option value="" disabled selected hidden>Please Choose... </option> @foreach ($job_types as $job_type) <option value="{{ $job_type->id }}"> {{ $job_type->name }} </option> @endforeach </select> </div> </div> <div class="col-md-12 col-6"> <label for="">Select Roaster Status</label> <div class="form-group"> <select class="form-control" name="roaster_status_id" id="roaster" aria-label="Default select example" required> <option value="" disabled selected hidden>Please Choose... </option> @foreach ($roaster_status as $row) <option value="{{ $row->id }}">{{ $row->name }} </option> @endforeach </select> </div> </div> <div class="col-md-12 col-12"> <label for="email-id-column">Remarks<span class="text-danger">*</span></label> <div class="form-group"> <input type="text" name="remarks" id="remarks" class="form-control" placeholder="remarks" /> </div> </div> </div> </div> </div> </div> </div> </section> </div> <div class="modal-footer"> <button type="button" class="btn btn-success timekeer-btn">Submit</button> <button type="button" class="btn btn-outline-dark" data-dismiss="modal">Discard</button> </div> </form> </div> </div> </div>
<?php namespace app\api\controller; use think\Controller; use think\Db; use think\facade\Session; use think\Request; class My extends Base { /** * 认证状态及信用卡数量 * @Author tw * @Date 2018-09-18 * @return [type] [description] */ public function index() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $user = $this->user;//base 用户数据 $user_card = Db::name('user_card')->where(['card_uid'=>$user['user_id'],'card_type'=>1,'card_blocked'=>0])->order('card_state desc')->count(); return json(['error'=>0,'msg'=>'成功','real'=>$user['user_real'],'user_card'=>$user_card]); } /** * 修改密码 * @Author tw * @Date 2018-09-11 * @return [type] [description] */ public function password() { if($this->request->isPost()) { $post = input('post.'); $user = $this->user;//base 用户数据 $uid = $user['user_id']; $password = $post['keywords'];//旧密码 $new_password = $post['new_keywords'];//新密码 if(md5($password) != $user['user_password']) { return json(['error'=>1,'msg'=>'旧密码错误']); } $up = Db::name('user')->where(['user_id'=>$uid])->update(['user_password'=>md5($new_password)]); if(empty($up)) { return json(['error'=>1,'msg'=>'修改失败']); } //发送短信 ###### ###### return json(['error'=>0,'msg'=>'密码修改成功,请重新登录']); }else{ return json(['error'=>1,'msg'=>'非法请求']); } } /** * 意见反馈 * @Author tw * @Date 2018-09-11 * @return [type] [description] */ public function feedback() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $data['feedback_uid'] = $this->uid;//用户id $data['feedback_title'] = $post['title'];//问题标题 $data['feedback_body'] = $post['body'];//内容 $data['feedback_name'] = $post['name'];//联系人姓名 $data['feedback_phone'] = $post['phone'];//电话 $data['feedback_state'] = 1; $data['feedback_time'] = time(); if(empty(Db::name('feedback')->insert($data))) { return json(['error'=>1,'msg'=>'反馈失败']); } return json(['error'=>0,'msg'=>'反馈成功']); } /** * 获取分类 * @Author tw * @Date 2018-09-11 * @return [type] [description] */ public function article_type() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $list = Db::name('article_type')->field('type_id,type_name')->select(); if(empty($list)) { return json(['error'=>1,'msg'=>'获取失败']); } foreach($list as $k=>$v){ $list[$k]['typeico'] = '/uploads/images/articletype/articletype_'.$v['type_id'].'.png'; } return json(['error'=>0,'msg'=>'获取成功','data'=>$list]); } /** * 文章列表 * @Author tw * @Date 2018-09-11 * @return [type] [description] */ public function article() { $getdata = array(); $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id $type = $post['type'];//分类id $page = $post['page'];//第几页 $list = Db::name('article')->where(['article_type'=>$type,'article_use'=>1])->field('article_id,article_title,article_type,article_img,article_time')->paginate(10,false,['query'=> $getdata]); foreach($list as $k=>$v){ $data = array(); $data = $v; $data['article_img'] = 'http://'.$_SERVER['HTTP_HOST'].$data['article_img']; $list->offsetSet($k,$data); } if(empty($list)) { return json(['error'=>1,'msg'=>'获取失败']); } return json(['error'=>0,'msg'=>'获取成功','data'=>$list]); } /** * 文章详情 * @Author tw * @Date 2018-09-11 * @return [type] [description] */ public function article_detail() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id $id = $post['id'];//文章id $article = Db::name('article')->where(['article_id'=>$id])->field('article_id,article_title,article_body,article_type,article_img,article_time')->find(); if(empty($article)) { return json(['error'=>1,'msg'=>'获取失败']); } $article['article_img'] = 'http://'.$_SERVER['HTTP_HOST'].$article['article_img']; $article['article_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/Index/Iframe/article?id='.$article['article_id']; return json(['error'=>0,'msg'=>'获取成功','data'=>$article]); } /** * 热门问题 * @Author tw * @Date 2018-09-11 * @return [type] [description] */ public function hotproblems(){ $getdata = array(); $list = Db::name('article')->where(['article_use'=>1])->field('article_id,article_title')->order('article_click desc')->limit(10)->select(); if(empty($list)){ return json(['error'=>1,'msg'=>'获取失败']); } return json(['error'=>0,'msg'=>'获取成功','data'=>$list]); } /** * 实名认证 * @Author tw * @Date 2018-09-12 * @return [type] [description] */ public function real() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $user = $this->user; $uid = $user['user_id']; //身份证号码 $idcard = '0'; if($user['user_idcard']) { $idcard = '1'; } //身份证照片 $idcard_img = '0'; if($user['user_idcard_z'] && $user['user_idcard_f']) { $idcard_img = '1'; } //结算卡 $card = '0'; $user_card = Db::name('user_card')->where(['card_uid'=>$uid,'card_type'=>2,'card_blocked'=>0])->find(); if($user_card) { $card = '1'; } $real_sum = $idcard + $idcard_img + $card; if($user['user_real'] != 1) { return json(['error'=>0,'msg'=>'未认证','idcard'=>$idcard,'idcard_img'=>$idcard_img,'card'=>$card,'real'=>0,'real_sum'=>$real_sum]); } return json(['error'=>0,'msg'=>'已认证','idcard'=>$idcard,'idcard_img'=>$idcard_img,'card'=>$card,'real'=>1,'real_sum'=>$real_sum]); } /** * 身份认证 * @Author tw * @Date 2018-09-12 * @return [type] [description] */ public function authentication() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id $user_name = $post['user_name'];//用户姓名 $user_idcard = strtoupper($post['user_idcard']);//身份证 // $user_idcard_z = $post['user_idcard_z'];//身份证正 // $user_idcard_f = $post['user_idcard_f'];//身份证反 //判断是否激活 $ra = Db::name('User')->where('user_id',$this->uid)->value('user_isactivation'); if($ra==1){ return json(['error'=>1,'msg'=>'你还未激活,请先进行激活']); } //待写验证接口 $result = UsernameIs($user_idcard,$user_name); if(!$result){ return json(['error'=>1,'msg'=>'身份证与姓名不符']); } $iscard = Db::name('user')->where('user_idcard',$user_idcard)->where('user_state',0)->find(); if($iscard){ return json(['error'=>1,'msg'=>'此身份证已被注册使用']); } $data['user_name'] = $user_name;//用户姓名 $data['user_idcard'] = $user_idcard;//身份证 // $data['user_idcard_z'] = $user_idcard_z;//身份证正面 // $data['user_idcard_f'] = $usr_idcard_f;//身份证反面 $data['user_real'] = 0; $up = Db::name('user')->where(['user_id'=>$uid])->update($data); if(empty($up)) { return json(['error'=>1,'msg'=>'认证失败']); } return json(['error'=>0,'msg'=>'认证成功']); } /** * 照片认证 * @Author tw * @Date 2018-09-12 * @return [type] [description] */ public function authephotoation() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id $user_idcard_z = $post['user_idcard_z'];//身份证正 $user_idcard_f = $post['user_idcard_f'];//身份证反 $user_hand_img = $post['user_hand_img'];//身份证手持照 if(!isset($user_idcard_z) || !isset($user_idcard_f)){ return json(['error'=>1,'msg'=>'请上传完整照片']); } //待写验证接口 $data['user_idcard_z'] = $user_idcard_z;//身份证正面 $data['user_idcard_f'] = $user_idcard_f;//身份证反面 $data['user_hand_img'] = $user_hand_img;//身份证手持照 $data['user_real'] = 1; $up = Db::name('user')->where(['user_id'=>$uid])->update($data); if(empty($up)) { return json(['error'=>1,'msg'=>'认证失败']); } return json(['error'=>0,'msg'=>'认证成功']); } /** * 银行卡认证 * @Author tw * @Date 2018-09-12 * @return [type] [description] */ public function card() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id // $smscode = $post['smscode'];//验证码 取消验证码 $phone = $post['phone'];//银行预留手机号 $bank_id = $post['bank_id'];//银行id $card_no = myTrim($post['card_no']);//银行卡号 $type = $post['type']?$post['type']:'2';//1信用卡 2储蓄卡 $region = isset($post['region'])?$post['region']:'';//地区 region = 省-市-区 if(empty($bank_id)) { return json(['error'=>1,'msg'=>'请选择对应银行']); } // $province = isset($post['province'])?$post['province']:'';//省 // $city = isset($post['city'])?$post['city']:'';//市 // $district = isset($post['district'])?$post['district']:'';//区 if($type==1) { $limit = $post['limit'];//信用额度 $cvn = $post['cvn'];//CVN码 $exp_date = $post['exp_date'];//卡有效期(月/年) $account_day = $post['account_day'];//帐单日 $repayment_day = $post['repayment_day'];//还款日 $user_card = Db::name('user_card')->where(['card_uid'=>$uid,'card_type'=>2,'card_blocked'=>0])->find(); if(empty($user_card)) { return json(['error'=>1,'msg'=>'请先添加结算卡']); } $BankType = BankType($user_card['card_no']); if($BankType['showapi_res_body']['showapi_res_error']!=0){ return json(['error'=>1,'msg'=>'添加失败,请稍后重试,错误代码-'.$uid]); } if($BankType['showapi_res_body']['area']) { $region = $BankType['showapi_res_body']['area']; $region = explode('-', $region); $province = $region[0];//省 $city = $region[1];//市 $district = '';//区*/ } else { $province = $user_card['card_province'];//省 $city = $user_card['card_city'];//市 $district = $user_card['card_district'];//区*/ } } elseif ($type==2) { if(empty($this->user['user_hand_img'])) { // return json(['error'=>1,'msg'=>'请补全身份证手持照']); } $card_img1 = $post['card_img1'];//卡正面 $card_img2 = $post['card_img2'];//卡反面 // if(empty($card_img1)) // { // return json(['error'=>1,'msg'=>'请上传卡正面照片']); // } // if(empty($card_img2)) // { // return json(['error'=>1,'msg'=>'请上传卡反面照片']); // } if(empty($region)){ return json(['error'=>1,'msg'=>'请选择所在区域']); } $region = explode('-', $region); $province = $region[0];//省 $city = $region[1];//市 $district = '';//区 } $branch = $post['branch'];//支行 $user = Db::name('user')->where(['user_id'=>$uid])->find(); if(empty($user) || $user['user_state']==1) { return json(['error'=>1,'msg'=>'用户不存在']); } if($user['user_real']<>1) { return json(['error'=>1,'msg'=>'用户未实名']); } $idcard = $user['user_idcard']; //用户身份证 $name = $user['user_name']; //用户姓名 if(Db::name('user_card')->where(['card_uid'=>$uid,'card_no'=>$card_no,'card_blocked'=>0])->find()) { return json(['error'=>1,'msg'=>'重复绑定']); } //待写四要素验证接口 $result = proving($card_no,$name,$idcard,$phone); if($result['showapi_res_body']['code']!=0) { return json(['error'=>1,'msg'=>'银行卡要素'.$result['showapi_res_body']['msg']]); } //首次注册用户赠送积分 $config = require CACHE_PATH.'system.php'; $userintegral = Db::name('UserCard')->where('card_uid',$this->uid)->select(); if(empty($userintegral) && $config['CACHE_PATH']!=0){ $upda = Db::name('User')->where('user_id',$this->uid)->setInc('user_integral',$config['CACHE_PATH']); $upde = Db::name('User')->where('user_id',$this->uid)->setInc('user_total_integral',$config['CACHE_PATH']); $va = array(); $va['integral_uid'] = $this->uid; $va['integral_type'] = 1; $va['integral_point'] = $config['CACHE_PATH']; $va['integral_surplus'] = $user['user_integral']+$config['CACHE_PATH']; $va['integral_time'] = time(); $addin = Db::name('UserIntegral')->insert($va); if(!$upda || !$upde || !$addin){ return json(['error'=>1,'msg'=>'赠送积分失败!']); } } $data['card_uid'] = $uid;//用户id $data['card_no'] = $card_no;//银行卡号 $data['card_name'] = $name; //用户名 $data['card_phone'] = $phone;//银行预留手机号 $data['card_bank_id'] = $bank_id;//银行id $data['card_type'] = $type;//1信用卡 2储蓄卡 if($type==1) { $data['card_credit_limit'] = $limit;//信用额度 $data['card_cvn'] = $cvn;//CVN码 $data['card_exp_date'] = $exp_date;//卡有效期(月/年) $data['card_account_day'] = $account_day;//帐单日 $data['card_repayment_day'] = $repayment_day;//还款日 } $data['card_img1'] = $card_img1;//卡正面 $data['card_img2'] = $card_img2;//卡反面 $data['card_state'] = 0; $data['card_branch'] = $branch;//支行 $data['card_province'] = $province;//省 $data['card_city'] = $city;//市 $data['card_district'] = $district;//市 $data['card_time'] = time();//时间 $isCard = Db::name('user_card')->where('card_no',$data['card_no'])->where('card_blocked',0)->find(); if($isCard){ return json(['error'=>1,'msg'=>'此银行卡已经存在']); } $insert = Db::name('user_card')->insert($data); if(empty($insert)) { sendsms($phone,11,'绑卡失败!'); return json(['error'=>1,'msg'=>'绑卡失败']); } sendsms($phone,11,'绑卡成功!'); return json(['error'=>0,'msg'=>'绑卡成功']); } /** * 卡详情 * @Author tw * @Date 2018-09-18 * @return [type] [description] */ public function card_info() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id $cid = $post['cid'];//银行卡id $type = isset($post['type'])?$post['type']:2;//1信用卡 2储蓄卡 if($type==2 && empty($cid)) { $cid = Db::name('user_card')->where(['card_blocked'=>0,'card_uid'=>$uid,'card_type'=>$type])->order('card_id desc')->value('card_id'); } $card = Db::name('user_card')->alias('c') ->join('bank_list b','b.list_id=c.card_bank_id','LEFT') ->where(['card_id'=>$cid,'card_uid'=>$uid]) ->find(); if(empty($card)) { return json(['error'=>1,'msg'=>'没有卡信息']); } $card['list_logo'] = 'http://'.$_SERVER['HTTP_HOST'].$card['list_logo']; $card['card_img1'] = 'http://'.$_SERVER['HTTP_HOST'].$card['card_img1']; $card['card_img2'] = 'http://'.$_SERVER['HTTP_HOST'].$card['card_img2']; // $card['card_no'] = '**** **** ****'.substr($card['card_no'],strlen($card['card_no'])-4); return json(['error'=>0,'msg'=>'成功','data'=>$card]); } /** * 编辑 卡 * @Author tw * @Date 2018-09-18 * @return [type] [description] */ public function card_edit() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $user = $this->user;//用户 $uid = $this->uid;//用户id $cid = $post['cid'];//银行卡id $phone = $post['phone'];//银行预留手机号 $type = isset($post['type'])?$post['type']:'2';//1信用卡 2储蓄卡 $region = isset($post['region'])?$post['region']:'';//地区 region = 省-市-区 $branch = isset($post['branch'])?$post['branch']:'';//支行 //$province = $post['province'];//省 //$city = $post['city'];//市 $idcard = $user['user_idcard']; //用户身份证 $name = $user['user_name']; //用户姓名 if($type==1) { $limit = $post['limit'];//信用额度 $cvn = $post['cvn'];//CVN码 $exp_date = $post['exp_date'];//卡有效期(月/年) $account_day = $post['account_day'];//帐单日 $repayment_day = $post['repayment_day'];//还款日 } elseif($type==2) { $bank_id = $post['bank_id'];//银行id $card_no = myTrim($post['card_no']);//银行卡号 $result = proving($card_no,$name,$idcard,$phone); if($result['showapi_res_body']['code']!=0) { return json(['error'=>1,'msg'=>'银行卡要素'.$result['showapi_res_body']['msg']]); } $card_img1 = $post['card_img1'];//卡正面 $card_img2 = $post['card_img2'];//卡反面 if(empty($card_img1)) { // return json(['error'=>1,'msg'=>'请上传卡正面照片']); } if(empty($card_img2)) { // return json(['error'=>1,'msg'=>'请上传卡反面照片']); } } $card = Db::name('user_card')->where(['card_id'=>$cid,'card_uid'=>$uid])->find(); if(empty($card) || $card['card_type'] != $type) { return json(['error'=>1,'msg'=>'没有卡信息']); } $where['card_id'] = $cid;//银行卡id $where['card_uid'] = $uid;//用户id $data['card_phone'] = $phone;//银行预留手机号 if($type==1) { $data['card_credit_limit'] = $limit;//信用额度 $data['card_cvn'] = $cvn;//CVN码 $data['card_exp_date'] = $exp_date;//卡有效期(月/年) $data['card_account_day'] = $account_day;//帐单日 $data['card_repayment_day'] = $repayment_day;//还款日 } elseif($type==2) { //拆分地区 if(empty($region)) { return json(['error'=>1,'msg'=>'请选择所在区域']); } $region = explode('-', $region); $province = $region[0];//省 $city = $region[1];//市 //$district = $region[2];//区 $data['card_no'] = $card_no;//银行卡号 $data['card_bank_id'] = $bank_id;//银行id $data['card_branch'] = $branch;//支行 $data['card_province'] = $province;//省 $data['card_city'] = $city;//市 } $data['card_img1'] = $post['card_img1'];//卡正面 $data['card_img2'] = $post['card_img2'];//卡反面 $data['card_time'] = time();//时间 $up = Db::name('user_card')->where($where)->update($data); if(empty($up)) { return json(['error'=>1,'msg'=>'修改失败']); } $cards = Db::name('payment_card')->where('card_cid',$cid)->where('card_uid',$uid)->select(); if($cards) { foreach ($cards as $k => $v) { $payment_controller = Db::name('payment')->where('payment_id',$v['card_pay_id'])->value('payment_controller'); $result = Controller('pay/'.$payment_controller)->update_fee($v['card_pay_id'],$uid); // if($result['error'] != 0) // { // return json(['error'=>1,'msg'=>'修改失败,请联系管理']); // } } } return json(['error'=>0,'msg'=>'修改成功']); } /** * 删除银行卡 * @Author tw * @Date 2018-09-18 * @return [type] [description] */ public function card_del() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id $cid = $post['cid'];//卡id $where['card_id'] = $cid; $where['card_uid'] = $uid; $card = Db::name('user_card')->where($where)->find(); if(empty($card)) { return json(['error'=>1,'msg'=>'银行卡不存在']); } elseif($card['card_state'] != 0 && $card['card_type']==1) { return json(['error'=>1,'msg'=>'计划中执行中,停止后可删除']); } elseif($card['card_type']==2) { return json(['error'=>1,'msg'=>'结算卡不能解绑']); } $type = 1; $cards = Db::name('payment_card')->where('card_cid',$cid)->where('card_uid',$uid)->select(); if($card) { foreach ($cards as $k => $v) { $payment_controller = Db::name('payment')->where('payment_id',$v['card_pay_id'])->value('payment_controller'); $result = Controller('pay/'.$payment_controller)->unbind_card($v['card_pay_id'],$uid,$cid); if($result['error'] != 0) { $type = 0; } } } if($type==1) { $del = Db::name('user_card')->where(['card_id'=>$cid])->delete(); } else { $del = Db::name('user_card')->where(['card_id'=>$cid])->update(['card_blocked'=>1]); } if(empty($del)) { return json(['error'=>1,'msg'=>'解绑失败']); } return json(['error'=>0,'msg'=>'解绑成功']); } /** * 我的积分 * @Author tw * @Date 2018-09-13 */ public function integral() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id $user = Db::name('user')->where(['user_id'=>$uid])->field('user_total_integral,user_integral')->find(); if (empty($user)) { return json(['error'=>1,'msg'=>'获取积分错误']); } return json(['error'=>0,'msg'=>'成功','data'=>$user]); } /** * 积分明细 * @Author tw * @Date 2018-09-13 */ public function integral_list() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id $user_integral = Db::name('user_integral')->where(['integral_uid'=>$uid])->paginate(10,false); if (empty($user_integral)) { return json(['error'=>1,'msg'=>'获取积分错误']); } return json(['error'=>0,'msg'=>'成功','data'=>$user_integral]); } /** * 我的银行卡 * @Author tw * @Date 2018-09-15 * @return [type] [description] */ public function card_list() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id $where['card_uid'] = $uid; $where['card_type'] = 1; $where['card_blocked'] = 0; // $where['mission_state'] = 0; $list = Db::name('user_card')->alias('c') ->field('card_id,card_uid,card_bank_id,card_no,card_repayment_day,card_state,list_name,list_code,list_logo') ->join('bank_list b','b.list_id=c.card_bank_id','LEFT') ->where($where) ->order('card_state desc') ->select(); foreach ($list as $key => $value) { $list[$key]['card_no'] = formatBankCardNo($value['card_no']); $list[$key]['card_type'] = '贷记卡'; $list[$key]['card_real'] = '已认证'; $list[$key]['list_logo'] = 'http://'.$_SERVER['HTTP_HOST'].$value['list_logo']; $mission = Db::name('mission')->where('mission_cid',$value['card_id'])->where('mission_state',1)->order('mission_id desc')->find(); $list[$key]['mission_id'] = $mission['mission_id']?:0; if($mission) { $list[$key]['card_state_name'] = '还款中'; $list[$key]['mission_money'] = $mission['mission_money']?:0; $list[$key]['mission_end_time'] = date('m-d', strtotime($mission['mission_end_time']));//计划结束日期 } else { $list[$key]['card_state_name'] = '未还款'; $list[$key]['mission_money'] = 0; $list[$key]['mission_end_time'] = '';//计划结束日期 } $list[$key]['mission_end_time_name'] = '计划结束日期'; $list[$key]['mission_pay_time_name'] = '还款日'; if($value['card_repayment_day'] < date("d",time())){ $BeginDate=date('Y-m-01', strtotime(date("Y-m-d"))); $is_yue = date('m',time()); if($is_yue == '01'){ $list[$key]['mission_pay_time'] = date("m-d",strtotime(date("y-").date( "m-", strtotime("first day of next month" )).$value['card_repayment_day'])); }else{ $list[$key]['mission_pay_time'] = date("m-d",strtotime(date("y-").date("m-",strtotime("+1 month")).$value['card_repayment_day'])); } $list[$key]["remainingday"] = date('d', strtotime("$BeginDate +1 month -1 day"))-date("d",time())+$value['card_repayment_day']; }else{ $list[$key]['mission_pay_time'] = date("m-",time()).$value['card_repayment_day']; $list[$key]["remainingday"] = $value['card_repayment_day']-date("d",time()); } } if(empty($list)) { return json(['error'=>1,'msg'=>'没有信用卡','count'=>count($list)]); } return json(['error'=>0,'msg'=>'成功','count'=>count($list),'data'=>$list]); } /** * 申请代理状态 * @Author tw * @Date 2018-09-17 * @return [type] [description] */ public function agent() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id $agent = Db::name('agent')->where(['agent_uid'=>$uid])->find(); if(empty($agent)) { return json(['error'=>0,'msg'=>'可申请','apply'=>1]); } elseif($agent['agent_state']==0) { return json(['error'=>0,'msg'=>'已经是代理','apply'=>0]); } elseif($agent['agent_state']==1) { return json(['error'=>0,'msg'=>'代理已冻结','apply'=>0]); } elseif($agent['agent_state']==2) { return json(['error'=>0,'msg'=>'资料已提交,等待审核','apply'=>0]); } elseif($agent['agent_state']==3) { return json(['error'=>0,'msg'=>'代理申请,已被拒绝','apply'=>1]); } } /** * 申请代理 * @Author tw * @Date 2018-09-15 * @return [type] [description] */ public function apply_agent() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id if(Db::name('agent')->where(['agent_uid'=>$uid])->find()) { return json(['error'=>1,'msg'=>'不能重复申请']); } $name = $post['name'];//姓名 $company = $post['company'];//公司 $city = $post['city'];//申请代理城市 $phone = $post['phone'];//手机号 //数据添加 $data['agent_uid'] = $uid; $data['agent_name'] = $name; $data['agent_phone'] = $phone; $data['agent_city'] = $city; $data['agent_company'] = $company; $data['agent_time'] = time(); $data['agent_ip'] = get_client_ip6(); $data['agent_state'] = 2; $res = Db::name('agent')->insertGetId($data); if(empty($res)){ return json(['error'=>1,'msg'=>'申请失败']); }else{ return json(['error'=>0,'msg'=>'提交成功,等待审核']); } } /** * 代理信息 * @Author tw * @Date 2018-09-17 * @return [type] [description] */ public function agent_info() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id $agent = Db::name('agent')->field('agent_id,agent_uid,agent_name,agent_phone,agent_city,agent_company')->where(['agent_uid'=>$uid])->find(); if(empty($agent)){ return json(['error'=>1,'msg'=>'代理商不存在']); }else{ return json(['error'=>0,'msg'=>'成功','data'=>$agent]); } } /** * 申请代理修改 * @Author tw * @Date 2018-09-15 * @return [type] [description] */ public function agent_edit() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid;//用户id $agent_id = $post['agent_id']; $agent = Db::name('agent')->where(['agent_id'=>$agent_id])->find(); if(empty($agent_id)) { return json(['error'=>1,'msg'=>'申请代理信息不存在']); } elseif($agent['agent_state']==0) { return json(['error'=>1,'msg'=>'已通过申请,不能修改']); } elseif($agent['agent_state']==1) { return json(['error'=>1,'msg'=>'代理已冻结,不能修改']); } $name = $post['name'];//姓名 $company = $post['company'];//公司 $city = $post['city'];//申请代理城市 $phone = $post['phone'];//手机号 $data['agent_uid'] = $uid; $data['agent_name'] = $name; $data['agent_phone'] = $phone; $data['agent_city'] = $city; $data['agent_company'] = $company; $data['agent_time'] = time(); $data['agent_ip'] = get_client_ip6(); $data['agent_state'] = 2; $res = Db::name('agent')->where(['agent_id'=>$agent_id])->update($data); if(empty($res)){ return json(['error'=>1,'msg'=>'修改失败']); }else{ return json(['error'=>0,'msg'=>'修改成功,等待审核']); } } /** * 用户费率 * @Author tw * @Date 2018-09-14 * @return [type] [description] */ public function rate() { if($this->request->isPost()) { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'参数错误']); } $uid = $this->uid; $user = Db::name('user')->where(['user_id'=>$uid])->find(); if(empty($user)) { return json(['error'=>1,'msg'=>'会员不存在']); } $rate = Db::name('rate')->where(['rate_type_id'=>$user['user_type_id']])->order('rate_type asc')->select(); if(empty($rate)) { return json(['error'=>1,'msg'=>'费率模板不存在']); } foreach ($rate as $key => $value) { $user_rate = Db::name('user_rate')->where(['rate_uid'=>$uid,'rate_type'=>$value['rate_type']])->find(); $data['rate_rate'] = $value['rate_rate']; $data['rate_close_rate'] = $value['rate_close_rate']; $data['rate_time'] = time(); if($user_rate) { Db::name('user_rate')->where(['rate_id'=>$user_rate['rate_id']])->update($data); continue; } $data['rate_uid'] = $uid; $data['rate_type'] = $value['rate_type']; Db::name('user_rate')->insert($data); } return json(['error'=>0,'msg'=>'成功']); }else{ return json(['error'=>1,'msg'=>'非法请求']); } } /** * 变更结算卡 * [Rate description] */ public function chagcard(){ $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid; //用户id $crdid = $post['crdid']; // 用户银行卡ID $phone = $post['phone']; //银行预留手机号 $bank_id = $post['bank_id']; //银行ID $card_no = myTrim($post['card_no']); //银行卡号 $type = '2'; //储蓄卡 $province = $post['province']; //省 $city = $post['city']; //市 $branch = $post['branch']; //支行 $user = Db::name('user')->where(['user_id'=>$uid])->find(); if(empty($user) || $user['user_state']==1){ return json(['error'=>1,'msg'=>'用户不存在']); } if($user['user_real']<>1){ return json(['error'=>1,'msg'=>'用户未实名']); } $idcard = $user['user_idcard']; //用户身份证 if(Db::name('user_card')->where(['card_uid'=>$uid,'card_no'=>$card_no,'card_blocked'=>0])->find()) { return json(['error'=>1,'msg'=>'重复绑定']); } //待写四要素验证接口(检测银行信息是否无误!) $data['card_id'] = $crdid; $data['card_uid'] = $uid; //用户id $data['card_no'] = $card_no; //银行卡号 $data['card_name'] = $name; //用户名 $data['card_phone'] = $phone; //银行预留手机号 $data['card_bank_id'] = $bank_id; //银行id $data['card_type'] = '2'; //储蓄卡 $data['card_state'] = 0; // 状态正常 $data['card_province'] = $province;//省 $data['card_city'] = $city;//市 $updata = Db::name('user_card')->update($data); if(empty($updata)) { return json(['error'=>1,'msg'=>'变更失败']); } return json(['error'=>0,'msg'=>'变更成功']); } /** * 个人资料 * @Author tw * @Date 2018-09-17 * @return [type] [description] */ public function info() { $config = require CACHE_PATH.'system.php'; $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid; if(empty($uid)) { return json(['error'=>1,'msg'=>'失败']); } $list = Db::name('User as u') ->join('UserType t','u.user_type_id=t.type_id') ->where('u.user_id',$uid) ->find(); unset($list['user_password']); if(!$list['user_name']){ $list['user_name'] = '未认证'; } $list['config_activation'] = $config['USER_ACTIVATION']; $list['config_activmoney'] = $config['USER_ACTIVATION_TYPE']; $list['user_img'] = $list['user_img']?'http://'.$_SERVER['HTTP_HOST'].$list['user_img']:getconfig('SITE_LOGO'); $list['user_idcard_z'] = $list['user_idcard_z']?'http://'.$_SERVER['HTTP_HOST'].$list['user_idcard_z']:''; $list['user_idcard_f'] = $list['user_idcard_f']?'http://'.$_SERVER['HTTP_HOST'].$list['user_idcard_f']:''; $list['user_hand_img'] = $list['user_hand_img']?'http://'.$_SERVER['HTTP_HOST'].$list['user_hand_img']:''; if(!empty($list)) { return json(['error'=>0,'msg'=>'成功','data'=>$list]); }else{ return json(['error'=>1,'msg'=>'失败']); } } /** * 查询会员是否是代理商及配置 * @Author tw * @Date 2018-09-17 * @return [type] [description] */ public function Agency() { if($this->request->isPost()) { $config = require CACHE_PATH.'system.php'; $data = Db::name('AgentRecord') ->where('agent_user_id',$this->uid) ->where('agent_recode_state','in',array('0','1')) ->find(); $date = array(); $user = $this->user; $date['tel'] = $config['SITE_TEL']; if(empty($data)) { $date['phone'] = $user['user_phone']; return json(['error'=>0,'msg'=>'请求成功','data'=>$date]); }else{ $date['type'] = $data['agent_recode_state']; return json(['error'=>1,'msg'=>'您已是代理商','data'=>$date]); } }else{ return json(['error'=>1,'msg'=>'非法请求']); } } /** * 代理商申请入驻 * @Author tw * @Date 2018-09-17 * @return [type] [description] */ public function AgentAdmission() { if($this->request->isPost()) { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'参数错误']); } $agent_recode_phone = $post['phone']; $list = Db::name('AgentRecord') ->where('agent_user_id',$this->uid) ->where('agent_recode_phone',$agent_recode_phone) ->find(); if(!empty($list)) { return json(['error'=>1,'msg'=>'手机号已被注册']); } $data = array(); $data['agent_user_id'] = $this->uid; $data['agent_recode_city'] = $post['city']; $data['agent_recode_name'] = $post['name']; $data['agent_recode_company'] = isset($post['company'])?$post['company']:''; $data['agent_recode_phone'] = $agent_recode_phone; $data['agent_recode_state'] = 0; $data['agent_recode_time'] = time(); if(Db::name('AgentRecord')->insert($data)) { return json(['error'=>0,'msg'=>'申请成功']); }else{ return json(['error'=>1,'msg'=>'申请失败']); } }else{ return json(['error'=>1,'msg'=>'非法请求']); } } /** * 帮助中心 * @Author tw * @Date 2018-09-17 * @return [type] [description] */ public function issue() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $type = input('get.type',0); $hot = input('get.hot',0); $where = array(); if($type) { $where['type'] = $type; } if($hot) { $where['hot'] = 1; } $list = Db::name('issue')->where($where)->paginate(10,false); if(empty($list)) { return json(['error'=>1,'msg'=>'没有相关资料']); } return json(['error'=>0,'msg'=>'成功','data'=>$list]); } /** * 帮助中心 分类 * @Author tw * @Date 2018-09-17 */ public function issue_type() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $where = array(); $where['type_status'] = 0; $list = Db::name('issue_type')->where($where)->select(); foreach ($list as $key => $value) { $list[$key]['type_icon'] = 'http://'.$_SERVER['HTTP_HOST'].$value['type_icon']; } if(empty($list)) { return json(['error'=>1,'msg'=>'没有分类']); } return json(['error'=>0,'msg'=>'成功','data'=>$list]); } /** * 银行列表 * @Author tw * @Date 2018-09-18 * @return [type] [description] */ public function bank_list() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $list = Db::name('bank_list')->select(); return json(['error'=>0,'msg'=>'成功','data'=>$list]); } /** * 获取银行名称 * @Author tw * @Date 2018-09-18 * @return [type] [description] */ public function get_bank_id() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $card_no = myTrim($post['card_no']); $result = Controller('Bank')->get_bank($card_no); if(empty($result) or $result['error']==1){ return json(['error'=>1,'msg'=>$result['msg']]); }else{ $result['id'] = $result['bankid']; } $bank = Db::name('bank_list')->where(['list_id'=>$result['id']])->find(); if(empty($bank)) { return json(['error'=>1,'msg'=>'暂时不支持该银行']); } $bank['list_logo'] = 'http://'.$_SERVER['HTTP_HOST'].$bank['list_logo']; return json(['error'=>0,'msg'=>'成功','data'=>$bank]); } /** * 用户头像修改 * @Author tw * @Date 2018-09-18 * @return [type] [description] */ public function user_img() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } $uid = $this->uid; $img = $post['img']; if(empty($img)) { return json(['error'=>1,'msg'=>'参数错误']); } // file_put_contents('log/'.date("Ymd",time()).'.log', var_export($_POST, true), FILE_APPEND); // $image = base64_decode($img); // $img_path = 'uploads/images/'.date("Ymd",time()).'/'.uniqid().'.jpg'; // if(empty(file_put_contents($img_path,$image))) // { // return json(['error'=>1,'msg'=>'头像上传失败']); // } $up = Db::name('user')->where(['user_id'=>$uid])->update(['user_img'=>$img]); if(!$up) { return json(['error'=>1,'msg'=>'上传失败']); } return json(['error'=>0,'msg'=>'上传成功']); } /** * 分享 * @Author tw * @Date 2018-09-18 * @return [type] [description] */ public function share() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'非法请求']); } //去判断用户是否实名了 $User = Db::name('User')->where('user_id',$this->uid)->find(); if(empty($User)) { return json(['error'=>1,'msg'=>'用户不存在']); } if($User['user_real']!=1) { return json(['error'=>1,'msg'=>'用户未实名,请先实名认证']); } $uid = $this->uid; $user = $this->user; $url = 'http://'.$_SERVER['HTTP_HOST'].'/?id='.$user['user_code']; return json(['error'=>0,'msg'=>'成功','url'=>$url]); } public function sharecode(){ //去判断用户是否实名了 $User = Db::name('User')->where('user_id',$this->uid)->find(); if(empty($User)) { return json(['error'=>1,'msg'=>'用户不存在']); } if($User['user_real']!=1) { return json(['error'=>1,'msg'=>'用户未实名,请先实名认证']); } $img = Db::name('img')->where('img_type',1)->where('img_start_switch',1)->find(); if(!$img){ return json(['error'=>1,'msg'=>'推广素材不存在']); } $upload_path = 'uploads/qrcode/promoteuser';//存放二维码海报推广路径 $create_path = $upload_path.'/'.$img['img_id'].'_'.$this->uid.'.png'; //判断服务器文件是否存在已经生成 if (file_exists($create_path)) { return json(['error'=>0,'msg'=>'请求成功','imgurl'=>'http://'.$_SERVER["SERVER_NAME"].'/'.$create_path]); }else{ //生成的网址 $urls = 'http://'.$_SERVER["SERVER_NAME"].'?id='.$this->uid; $thumb_qrcode = 'uploads/qrcode/promoteuser/thumb_template/'.$this->uid.'.png';//推广二维码的地址 if (!file_exists($thumb_qrcode)) { //不存在的话直接生成二维码然后进行合成 getQRcode($urls,'uploads/qrcode/promoteuser/thumb_template',$this->uid); } $user_name = '12312312'; $user_logo = 'public/static/images/default_img_url/logocode.png';//平台logo地址 $shop_logo = '';//店铺logo $user_headimg = $this->user['user_img'];//头像没有的话给个默认url $path =$thumb_qrcode;//存放位置 为空是直接显示图片 //定位 根据 左上像素值 $data = array(); $data['background'] = 'public'.$img['img_url']; $data['nick_font_color'] = '#00ffff'; $data['nick_font_size'] = '30'; $data['is_logo_show'] = '0'; $data['header_left'] = '80'; $data['header_top'] = '455'; $data['name_left'] = '137'; $data['name_top'] = '469'; $data['logo_left'] = '100'; $data['logo_top'] = '67'; $data['code_left'] = '85'; $data['code_top'] = '158'; showUserQecode($upload_path, $path, $thumb_qrcode, $user_headimg, $shop_logo, $user_name, $data, $create_path); return json(['error'=>0,'msg'=>'请求成功','imgurl'=>'http://'.$_SERVER["SERVER_NAME"].'/'.$create_path]); } } /** * 我的费率 * [Rate description] */ public function UserRate(){ if($this->request->isPost()){ $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'参数错误']); } $list = Db::name('UserRate')->where(['rate_uid'=>$this->uid])->select(); if(empty($list)){ return json(['error'=>1,'msg'=>'获取失败']); }else{ return json(['error'=>0,'msg'=>'获取成功','data'=>$list]); } }else{ return json(['error'=>1,'msg'=>'非法请求']); } } /** * 会员权益 */ public function Membership(){ $config = require CACHE_PATH.'system.php'; if($this->request->isPost()) { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'参数错误']); } $UserType = ClassRates(); if(empty($UserType)) { return json(['error'=>1,'msg'=>'查无会员权益']); } $h = array(); $s = array(); foreach ($UserType as $key => $val) { if($val['type_fee']==0 && $val['type_free_count']==0 && $val['type_free_amount']==0) { unset($val); } unset($val['type_free_count']); unset($val['type_free_amount']); //判断是百分比还是固定值返 1百分比 0固定值 if($config['USER_DISTRI_TYPE_CZ']==1) { if($val['type_id'] == '2'){ $val['money_z'] = $val['type_fee'] * ($config['USER_DISTRI_TYPE_CZ_1']/100); $val['money_j'] = $val['type_fee'] * ($config['USER_DISTRI_TYPE_CZ_2']/100); if($val['type_profit'] == 1) { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_1']/100).'%'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_2']/100).'%'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_1']/100).'%'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_2']/100).'%'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_1']).'元'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_2']).'元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_1']).'元'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_2']).'元'; } } }elseif($val['type_profit'] == 2) { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_V_1']/100).'%'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_V_2']/100).'%'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_V_1']/100).'%'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_V_2']/100).'%'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_V_1']).'元'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_V_2']).'元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_V_1']).'元'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_V_2']).'元'; } } }else { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = '0 %'; $val['rate_h_j'] = '0 %'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = '0 %'; $val['rate_s_j'] = '0 %'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = '0 元'; $val['rate_h_j'] = '0 元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = '0 元'; $val['rate_s_j'] = '0 元'; } } } }elseif($val['type_id'] == '8'){ $val['money_z'] = $val['type_fee'] * ($config['USER_DISTRI_TYPE_CZ_1']/100); $val['money_j'] = $val['type_fee'] * ($config['USER_DISTRI_TYPE_CZ_2']/100); if($val['type_profit'] == 1) { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_1']/100).'%'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_2']/100).'%'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_1']/100).'%'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_2']/100).'%'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_1']).'元'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_2']).'元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_1']).'元'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_2']).'元'; } } }elseif($val['type_profit'] == 2) { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_V_1']/100).'%'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_V_2']/100).'%'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_V_1']/100).'%'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_V_2']/100).'%'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_V_1']).'元'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_V_2']).'元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_V_1']).'元'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_V_2']).'元'; } } }else { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = '0 %'; $val['rate_h_j'] = '0 %'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = '0 %'; $val['rate_s_j'] = '0 %'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = '0 元'; $val['rate_h_j'] = '0 元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = '0 元'; $val['rate_s_j'] = '0 元'; } } } }elseif($val['type_id'] == '1'){ $val['money_z'] = $val['type_fee'] * ($config['USER_DISTRI_TYPE_CZ_1']/100); $val['money_j'] = $val['type_fee'] * ($config['USER_DISTRI_TYPE_CZ_2']/100); if($val['type_profit'] == 1) { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_1']/100).'%'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_2']/100).'%'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_1']/100).'%'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_2']/100).'%'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_1']).'元'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_2']).'元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_1']).'元'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_2']).'元'; } } }elseif($val['type_profit'] == 2) { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_V_1']/100).'%'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_V_2']/100).'%'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_V_1']/100).'%'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_V_2']/100).'%'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_V_1']).'元'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_V_2']).'元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_V_1']).'元'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_V_2']).'元'; } } }else{ if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = '0 %'; $val['rate_h_j'] = '0 %'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = '0 %'; $val['rate_s_j'] = '0 %'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = '0 元'; $val['rate_h_j'] = '0 元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = '0 元'; $val['rate_s_j'] = '0 元'; } } } } }else{ if($val['type_id'] == '2'){ $val['money_z'] = $config['USER_DISTRI_TYPE_CZ_1']; $val['money_j'] = $config['USER_DISTRI_TYPE_CZ_2']; if($val['type_profit'] == 1) { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_1']/100).'%'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_2']/100).'%'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_1']/100).'%'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_2']/100).'%'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_1']).'元'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_2']).'元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_1']).'元'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_2']).'元'; } } }elseif($val['type_profit'] == 2) { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_V_1']/100).'%'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_V_2']/100).'%'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_V_1']/100).'%'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_V_2']/100).'%'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_V_1']).'元'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_V_2']).'元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_V_1']).'元'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_V_2']).'元'; } } }else { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = '0 %'; $val['rate_h_j'] = '0 %'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = '0 %'; $val['rate_s_j'] = '0 %'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = '0 元'; $val['rate_h_j'] = '0 元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = '0 元'; $val['rate_s_j'] = '0 元'; } } } }elseif($val['type_id'] == '8'){ $val['money_z'] = $config['USER_DISTRI_TYPE_CZ_1']; $val['money_j'] = $config['USER_DISTRI_TYPE_CZ_2']; if($val['type_profit'] == 1) { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_1']/100).'%'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_2']/100).'%'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_1']/100).'%'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_2']/100).'%'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_1']).'元'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_2']).'元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_1']).'元'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_2']).'元'; } } }elseif($val['type_profit'] == 2) { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_V_1']/100).'%'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_V_2']/100).'%'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_V_1']/100).'%'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_V_2']/100).'%'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_V_1']).'元'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_V_2']).'元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_V_1']).'元'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_V_2']).'元'; } } }else { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = '0 %'; $val['rate_h_j'] = '0 %'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = '0 %'; $val['rate_s_j'] = '0 %'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = '0 元'; $val['rate_h_j'] = '0 元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = '0 元'; $val['rate_s_j'] = '0 元'; } } } }elseif($val['type_id'] == '1'){ $val['money_z'] = $config['USER_DISTRI_TYPE_CZ_1']; $val['money_j'] = $config['USER_DISTRI_TYPE_CZ_2']; if($val['type_profit'] == 1) { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_1']/100).'%'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_2']/100).'%'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_1']/100).'%'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_2']/100).'%'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_1']).'元'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_2']).'元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_1']).'元'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_2']).'元'; } } }elseif($val['type_profit'] == 2) { if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_V_1']/100).'%'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_V_2']/100).'%'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_V_1']/100).'%'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_V_2']/100).'%'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = ($config['USER_DISTRI_MODE_HK_V_1']).'元'; $val['rate_h_j'] = ($config['USER_DISTRI_MODE_HK_V_2']).'元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = ($config['USER_DISTRI_MODE_SK_V_1']).'元'; $val['rate_s_j'] = ($config['USER_DISTRI_MODE_SK_V_2']).'元'; } } }else{ if($config['USER_DISTRI_TYPE'] ==1) { if($val['rate_type']==1) { $val['rate_h_z'] = '0 %'; $val['rate_h_j'] = '0 %'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = '0 %'; $val['rate_s_j'] = '0 %'; } }else { if($val['rate_type']==1) { $val['rate_h_z'] = '0 元'; $val['rate_h_j'] = '0 元'; }elseif($val['rate_type']==2) { $val['rate_s_z'] = '0 元'; $val['rate_s_j'] = '0 元'; } } } } } $val['own_s'] = $config['POINTS_RECEIVABLES'].'元'; $val['own_h'] = $config['POINTS_REPAYMENT'].'元'; $val['handle'] = $config['USER_CRARD_TYPE_CZ_1'].'%'; $val['netloan'] = $config['USER_LOAN_TYPE_CZ_1'].'%'; if($val['rate_type']==1) { $h[] = $val; } if($val['rate_type']==2){ $s[] = $val; } } $Receivables = array(); $Receivables['sk'] = $s; $Receivables['hk'] = $h; if(!empty($Receivables)) { return json(['error'=>0,'msg'=>'成功','data'=>$Receivables]); }else{ return json(['error'=>1,'msg'=>'查询失败']); } }else{ return json(['error'=>1,'msg'=>'非法请求']); } } /* * 获取分润 * 2018年10月11日15:57:37 * 刘媛媛 */ public function getbonus(){ $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'获取分润错误']); } $uid = $this->uid; $count = array(); $count['money'] = $this->user['user_moeny']; $userCount = Db::name('user')->where('user_pid',$uid)->select(); $count['puser'] = count($userCount); /*$count['countuser'] = 0; if($userCount>0){ foreach($userCount as $uk=>$uv){ $count['countuser'] += count(getuserlevel($uv['user_id'],false)); } $count['countuser']-=$count['puser']; }*/ $count['countuser'] = count(getuserlower($uid,false,2)); //分润状态 1升级分润 2收款分润 3还款分润 4 交易分润 5贷款分润 6 办信用卡分润 7其他分润 $list = Db::name('userBonuslog')->where('blog_user',$this->uid)->where('blog_state',0)->select(); $count['money_1']=0; $count['count_1']=0; $count['money_2']=0; $count['count_2']=0; $count['money_3']=0; $count['count_3']=0; $count['money_4']=0; $count['count_4']=0; $count['money_5']=0; $count['count_5']=0; $count['money_6']=0; $count['count_6']=0; $count['money_7']=0; $count['count_7']=0; $count['coutmoney'] =0; foreach ($list as $k=>$v){ $count['coutmoney'] +=$v['blog_money']; switch ($v['blog_type']) { case 1: # 升级分润 $count['money_1'] += $v['blog_money']; $count['count_1'] ++; break; case 2: # 收款分润 $count['money_2'] += $v['blog_money']; $count['count_2'] ++; break; case 3: # 还款分润 $count['money_3'] += $v['blog_money']; $count['count_3'] ++; break; case 4: # 交易分润 $count['money_4'] += $v['blog_money']; $count['count_4'] ++; break; case 5: # 贷款分润 $count['money_5'] += $v['blog_money']; $count['count_5'] ++; break; case 6: # 办信用卡分润 $count['money_6'] += $v['blog_money']; $count['count_6'] ++; break; case 7: # 其他分润 $count['money_7'] += $v['blog_money']; $count['count_7'] ++; break; } } return json(['error'=>0,'msg'=>'请求成功','data'=>$count]); } /** * 解绑卡片 * @Author tw * @Date 2018-10-16 * @return [type] [description] */ public function unbind_card() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'参数错误']); } $pay_id = $post['pay_id'];//支付通道id $cid = $post['cid'];//银行卡id $uid = $this->uid;//用户id $payment_controller = Db::name('payment')->where('payment_id',$pay_id)->value('payment_controller'); if(empty($payment_controller)) { return json(['error'=>1,'msg'=>'通道不存在']); } $result = Controller($payment_controller)->unbind_card($pay_id,$uid,$cid); return json($result); } /** * 获取用户下级用户 * @Author tw * @return [type] [description] */ public function user_lower() { $post = input('post.'); if(empty($post)) { return json(['error'=>1,'msg'=>'参数错误']); } $type = $post['type'];//银行卡id if(empty($type)) { $type = 3; } $uid = $this->uid;//用户id $user_id=getuserlower($uid,false,$type); $list = Db::name('user')->field('user_id,user_name,user_phone,user_time')->where('user_state',0)->whereIn('user_id',$user_id)->order('user_id desc')->paginate(15,false); if(empty($list)) { return json(['error'=>1,'msg'=>'参数错误']); } if($list->toArray()) { //0未启动 1还款中 2已还完 3还款失败 foreach($list as $k=>$v){ $data = array(); $data = $v; // $data['user_name'] = hide_str($v['user_name'],1,-1); if(empty($data['user_name'])) { $data['user_name'] = '未实名'; } // $data['user_phone'] = hide_tel($v['user_phone']); $data['user_time'] = date('Y-m-d',$v['user_time']); $list->offsetSet($k,$data); } } return json(['error'=>0,'msg'=>'成功','data'=>$list]); } }
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class AreaProductStock extends Model { use HasFactory; protected $table = 'area_product_stock'; protected $primaryKey = null; public $incrementing = false; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'id_product', 'id_area', 'stock', 'on_the_way', 'on_production', 'preorder', 'total', ]; public function area(){ return $this->belongsTo('App\Models\Area','id_area','id'); } public function product(){ return $this->belongsTo('App\Models\Product','id_product','id'); } }
@extends('layouts.app') @section('page_title') التبرعات @endsection @section('small_title') تبرع @endsection @section('content') <!-- Main content --> <section class="content"> <!-- Default box --> <div class="box"> <div class="box-header with-border"> <h3 class="box-title">قائمه التبرعات</h3> <div class="box-tools pull-right"> <button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse"> <i class="fa fa-minus"></i></button> <button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove"> <i class="fa fa-times"></i></button> </div> </div> <div class="box-body"> @if(count($records)) <div class="box"> <div class="box-body"> <div id="example1_wrapper" class="dataTables_wrapper form-inline dt-bootstrap"> {{-- <div class="row">--}} {{-- <div class="col-sm-6">--}} {{-- <div id="example1_filter" class="dataTables_filter"><label>Search:<input--}} {{-- type="search" class="form-control input-sm" placeholder=""--}} {{-- aria-controls="example1"></label></div>--}} {{-- </div>--}} {{-- </div>--}} @include('flash::message') <br> <div class="row"> <div class="col-sm-12"> <div class="table-responsive"> <table class="table table-bordered table-striped"> <thead> <tr role="row"> <th>#</th> <th>الاسم</th> <th>العمر</th> <th>نوع الفصيله</th> <th>عدد اكياس الدم</th> <th>اسم المستشفى</th> <th>مكان المستشفى</th> <th>المدينه</th> <th>رقم الهاتف</th> <th>الملاحظات</th> <th>العميل</th> <th class="text-center">عرض طلب التبرع</th> <th class="text-center">حذف</th> </tr> </thead> <tbody> @foreach($records as $record) <tr> <td>{{$loop->iteration}}</td> <td>{{$record->name}}</td> <td>{{$record->age}}</td> <td>{{$record->brood_type_id}}</td> <td>{{$record->number_of_blood_bags}}</td> <td>{{$record->hospital_name}}</td> <td>{{$record->lat}} , {{$record->lng}}</td> <td>{{$record->city->name}}</td> <td>{{$record->number_phone}}</td> <td>{{$record->notes}}</td> <td>{{$record->client->name}}</td> <td class="text-center"> {!! Form::open([ 'action' => ['DonationController@show',$record->id], 'method' => 'get' ]) !!} <button type="submit" class="btn btn-success btn-xs"><i class="fa fa-address-book"></i></button> {!! Form::close() !!} </td> <td class="text-center"> {!! Form::open([ 'action' => ['DonationController@destroy',$record->id], 'method' => 'delete' ]) !!} {{-- <button type="submit" class="btn btn-danger btn-xs"><i class="fa fa-trash-o"></i></button>--}} <button class="member" type="submit" onclick="return confirm('Are you sure?')"><i class="fa fa-trash-o"></i></button> {!! Form::close() !!} </td> </tr> @endforeach </tbody> </table> </div> </div> </div> </div> </div> <!-- /.box-body --> </div> <div class="text-center">{{$records->links()}}</div> @else <div class="alert alert-danger"> No Data </div> @endif </div> </div> <!-- /.box --> </section> <!-- /.content --> @endsection