Example #1
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Client::create([]);
     }
 }
 public function create()
 {
     if (isset($_POST['name']) && !empty($_POST['name'])) {
         $obj = new Client();
         $error = array();
         $obj->name = strip_tags($_POST['name']);
         $obj->addy = strip_tags($_POST['addy']);
         $obj->visible = $_POST['visible'];
         $obj->phone = $_POST['phone'];
         $obj->email = $_POST['email'];
         $obj->descr = $_POST['desc'];
         $obj->username = $_POST['username'];
         if ($_POST['password'] == $_POST['r_password']) {
             $obj->password = $_POST['password'];
         } else {
             array_push($error, "Password do not match");
         }
         if (empty($error)) {
             if ($obj->create()) {
                 return 1;
             } else {
                 return 2;
             }
         }
     }
 }
 /**
  * Store a newly created client in storage.
  *
  * @return Response
  */
 public function store($bookingId)
 {
     $user = Auth::user();
     $validator = Validator::make($data = Input::all(), Client::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $data['booking_id'] = $bookingId;
     if ($bookingdata = Client::create($data)) {
         $booking = Booking::getBookingData($bookingdata->booking_id);
         $pdf = PDF::loadView('emails/booking', array('booking' => $booking));
         $pdf->save(public_path() . '/temp-files/booking' . $booking->id . '.pdf');
         $emails = array('*****@*****.**', '*****@*****.**', '*****@*****.**');
         $ehi_users = User::getEhiUsers();
         Mail::send('emails/booking-mail', array('booking' => Booking::getBookingData($booking->id)), function ($message) use($booking, $emails, $ehi_users) {
             $message->attach(public_path() . '/temp-files/booking' . $booking->id . '.pdf')->subject('Amended Booking(Client Added): ' . $booking->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel')->bcc('*****@*****.**', 'Admin');
             foreach ($emails as $emailaddress) {
                 $message->to($emailaddress, 'Admin');
             }
             if (!empty($ehi_users)) {
                 foreach ($ehi_users as $ehi_user) {
                     $message->to($ehi_user->email, $ehi_user->first_name);
                 }
             }
         });
     }
     return Redirect::route('bookings.show', $bookingId);
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     Client::truncate();
     foreach (range(1, 10) as $index) {
         Client::create(['user_id' => 2, 'name' => $faker->name, 'email' => $faker->email, 'address_1' => $faker->streetAddress, 'city' => $faker->city, 'zip' => $faker->postcode, 'country_id' => 840, 'phone' => $faker->phoneNumber, 'web' => $faker->url]);
     }
 }
 function __construct()
 {
     // String is needed for the comparison
     if (getenv('FB_INSTANT_ARTICLES_DEVELOPMENT_MODE') === "false") {
         $development_mode = false;
     } else {
         $development_mode = true;
     }
     $this->client = Client::create(get_option('instant_articles_app_id'), get_option('instant_articles_app_secret'), get_option('instant_articles_page_token'), get_option('instant_articles_page_id'), $development_mode);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $rules = array('company' => 'required|min:3', 'firstname' => 'required|min:3', 'lastname' => 'required|min:3', 'email' => 'required|email|unique:clients', 'phone' => 'required|min:6|phone|unique:clients', 'address' => 'required|min:3');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         Client::create(Input::except('_token'));
         return Redirect::to('clients')->with('success', 'Client created successfully');
     } else {
         return Redirect::to('clients/create')->withErrors($validator)->withInput();
     }
 }
 public function run()
 {
     //se ingresa el libro de darwin
     //DB::statement("INSERT INTO lor_lecture (title, author, year, publisher, content, created_at, updated_at, deleted_at) VALUES ('El origen de las especies', 'Charles Darwin', '1859', 'Dominio publico', 'temas vivos.', NOW(),NOW(), NULL);");
     $user = User::create(array('profile' => 'super_admin', 'firstname' => 'Alexander Andres Londono Espejo', 'username' => 'admin', 'email' => '*****@*****.**', 'password' => Hash::make('admin')));
     $user->roles()->attach(1);
     $user->roles()->attach(2);
     $user->roles()->attach(3);
     $user->roles()->attach(4);
     $user->roles()->attach(5);
     $user->roles()->attach(6);
     $user->roles()->attach(7);
     $user->roles()->attach(8);
     $user->roles()->attach(9);
     $user->roles()->attach(10);
     $user->roles()->attach(11);
     $user->roles()->attach(12);
     $user->roles()->attach(13);
     $user->roles()->attach(14);
     $user->roles()->attach(15);
     $user->roles()->attach(16);
     $user->roles()->attach(17);
     $user->roles()->attach(18);
     $user->roles()->attach(19);
     $user->roles()->attach(20);
     $user->roles()->attach(21);
     $user->roles()->attach(22);
     $user->roles()->attach(23);
     $user->roles()->attach(24);
     $user->roles()->attach(25);
     $user->roles()->attach(26);
     $user->roles()->attach(27);
     $user->roles()->attach(28);
     $user->roles()->attach(29);
     $user->roles()->attach(30);
     $user->roles()->attach(31);
     $user->roles()->attach(32);
     $faker = Faker\Factory::create();
     $count_client = 50;
     foreach (range(1, $count_client) as $index) {
         $user = User::create(['firstname' => $faker->firstName, 'lastname' => $faker->lastName, 'username' => 'admin' . $index, 'email' => $faker->email, 'identification' => $faker->numberBetween(19999999, 99999999), 'password' => Hash::make('admin' . $index)]);
         //Ingreso datos de prueba de clientes
         $client = Client::create(['name' => $faker->company, 'address' => 'Caucasia Antioquia', 'enable' => 'SI']);
         //Ingreso datos de prueba de proveedores
         $provider = Provider::create(['name' => $faker->company, 'email' => $faker->email, 'telephone' => $faker->numberBetween(19999999, 99999999), 'country' => 'Colombia', 'department' => 'Antioquia', 'city' => 'Medellin', 'enable' => 'SI']);
         //Ingreso datos de prueba de costos
         $costs = Cost::create(['name' => $faker->company, 'type' => 'Otro', 'value' => $faker->numberBetween(1999, 99999), 'description' => $faker->company, 'resposible' => 'Alexander', 'enable' => 'SI']);
         //Ingreso datos de prueba de categoria
         $category = Category::create(['name' => $faker->company, 'description' => '', 'enable' => 'SI']);
         //Ingreso datos de prueba de productos
         $product = Product::create(['name' => $faker->company, 'description' => '', 'cost' => $faker->numberBetween(1999, 9999), 'value' => $faker->numberBetween(19999, 99999), 'enable' => 'SI']);
     }
 }
 function create($company_id = FALSE)
 {
     if ($_POST) {
         $config['upload_path'] = './files/media/';
         $config['encrypt_name'] = TRUE;
         $config['allowed_types'] = 'gif|jpg|png';
         $config['max_width'] = '180';
         $config['max_height'] = '180';
         $this->load->library('upload', $config);
         if ($this->upload->do_upload()) {
             $data = array('upload_data' => $this->upload->data());
             $_POST['userpic'] = $data['upload_data']['file_name'];
         } else {
             $error = $this->upload->display_errors('', ' ');
             if ($error != "You did not select a file to upload. ") {
                 $this->session->set_flashdata('message', 'error:' . $error);
                 redirect('clients');
             }
         }
         unset($_POST['send']);
         unset($_POST['userfile']);
         unset($_POST['file-name']);
         if (isset($_POST["access"])) {
             $_POST["access"] = implode(",", $_POST["access"]);
         } else {
             unset($_POST["access"]);
         }
         $_POST = array_map('htmlspecialchars', $_POST);
         $_POST["company_id"] = $company_id;
         $client = Client::create($_POST);
         $client->password = $client->set_password($_POST['password']);
         $client->save();
         if (!$client) {
             $this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_client_add_error'));
         } else {
             $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_client_add_success'));
             $company = Company::find($company_id);
             if (!isset($company->client->id)) {
                 $client = Client::last();
                 $company->update_attributes(array('client_id' => $client->id));
             }
         }
         redirect('clients/view/' . $company_id);
     } else {
         $this->view_data['clients'] = Client::find('all', array('conditions' => array('inactive=?', '0')));
         $this->view_data['modules'] = Module::find('all', array('order' => 'sort asc', 'conditions' => array('type = ?', 'client')));
         $this->view_data['next_reference'] = Client::last();
         $this->theme_view = 'modal';
         $this->view_data['title'] = $this->lang->line('application_add_new_contact');
         $this->view_data['form_action'] = 'clients/create/' . $company_id;
         $this->content_view = 'clients/_clients';
     }
 }
Example #9
0
function doInsert()
{
    if (isset($_POST['submit'])) {
        $CLIENTNAME = $_POST['name'];
        $SHORTNAME = $_POST['shortname'];
        $ADDRESS = $_POST['address'];
        $EMAIL = $_POST['email'];
        $TELEPHONE = $_POST['telephone'];
        $WEBSITE = $_POST['website'];
        $SECTOR = $_POST['sector'];
        $client = new Client();
        $client->client_name = $CLIENTNAME;
        $client->client_short_name = $SHORTNAME;
        $client->client_address = $ADDRESS;
        $client->client_email = $EMAIL;
        $client->client_Telephone = $TELEPHONE;
        $client->client_website = $WEBSITE;
        $client->client_sector = $SECTOR;
    }
    if ($CLIENTNAME == "") {
        message('Name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($SHORTNAME == "") {
        message('Short Name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($ADDRESS == "") {
        message('Address Name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($SECTOR == "") {
        message('Sector name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($WEBSITE == "") {
        message('Website is required!', "error");
        redirect('index.php?view=add');
    } elseif ($TELEPHONE == "") {
        message('Telephone is required!', "error");
        redirect('index.php?view=add');
    } elseif ($EMAIL == "") {
        message('Email is required!', "error");
        redirect('index.php?view=add');
    }
    $client->create();
    message('New client addedd successfully!', "success");
    redirect('index.php?view=list');
}
Example #10
0
function add_admin($pass)
{
    global $gbl, $sgbl, $login, $ghtml;
    $client = new Client(null, null, 'admin');
    $login = $client;
    $client->initThisDef();
    $client->priv->pserver_num = 'Unlimited';
    $client->priv->maindomain_num = 'Unlimited';
    $client->priv->vps_num = 'Unlimited';
    $client->priv->client_num = 'Unlimited';
    $client->ddate = time();
    $ddb = new Sqlite(null, "client");
    if (!$ddb->existInTable("nname", 'admin')) {
        if ($sgbl->dbg > 0) {
            $pass = '******';
            $res['contacemail'] = '*****@*****.**';
        }
        $res['password'] = crypt($pass);
        $res['cttype'] = 'admin';
        $res['cpstatus'] = 'on';
        if (if_demo()) {
            $res['email'] = "*****@*****.**";
        }
        $client->create($res);
        $client->driverApp = new client__sync(null, null, 'admin');
        $client->was();
        lxfile_mkdir("__path_client_root/{$client->nname}");
        lxfile_generic_chown("__path_client_root/{$client->nname}", "lxlabs");
    }
    $notif = new Notification(null, null, $client->getClName());
    $notif->initThisDef();
    $notif->dbaction = 'add';
    $notif->text_newaccountmessage = lfile_get_contents("__path_program_root/file/welcome.txt");
    $notif->parent_clname = $client->getClName();
    $notif->write();
    $display = new sp_SpecialPlay(null, null, $client->getClName());
    $display->initThisDef();
    $display->parent_clname = $client->getClName();
    $display->dbaction = 'add';
    $display->write();
}
Example #11
0
 function index()
 {
     $core_settings = Setting::first();
     if ($core_settings->registration != 1) {
         redirect('login');
     }
     if ($_POST) {
         $this->load->library('parser');
         $this->load->helper('file');
         $this->load->helper('notification');
         $client = Client::find_by_email($_POST['email']);
         if ($client->inactive == 1) {
             $client = FALSE;
         }
         $check_company = Company::find_by_name($_POST['name']);
         if (!$client && !$check_company && $_POST['name'] != "" && $_POST['email'] != "" && $_POST['password'] != "" && $_POST['firstname'] != "" && $_POST['lastname'] != "" && $_POST['confirmcaptcha'] != "") {
             $client_attr = array();
             $company_attr['name'] = $_POST['name'];
             $company_attr['website'] = $_POST['website'];
             $company_attr['phone'] = $_POST['phone'];
             $company_attr['mobile'] = $_POST['mobile'];
             $company_attr['address'] = $_POST['address'];
             $company_attr['zipcode'] = $_POST['zipcode'];
             $company_attr['city'] = $_POST['city'];
             $company_attr['country'] = $_POST['country'];
             $company_attr['province'] = $_POST['province'];
             $company_attr['vat'] = $_POST['vat'];
             $company_attr['reference'] = $core_settings->company_reference;
             $core_settings->company_reference = $core_settings->company_reference + 1;
             $core_settings->save();
             $company = Company::create($company_attr);
             if (!$company) {
                 $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_registration_error'));
                 redirect('register');
             }
             $lastclient = Client::last();
             $client_attr = array();
             $client_attr['email'] = $_POST['email'];
             $client_attr['firstname'] = $_POST['firstname'];
             $client_attr['lastname'] = $_POST['lastname'];
             $client_attr['phone'] = $_POST['phone'];
             $client_attr['mobile'] = $_POST['mobile'];
             $client_attr['address'] = $_POST['address'];
             $client_attr['zipcode'] = $_POST['zipcode'];
             $client_attr['city'] = $_POST['city'];
             $modules = Module::find('all', array('order' => 'sort asc', 'conditions' => array('type = ?', 'client')));
             $client_attr['access'] = "";
             foreach ($modules as $value) {
                 if ($value->name == "Projects" || $value->name == "Messages" || $value->name == "Tickets" || $value->name == "Invoices") {
                     $client_attr['access'] .= $value->id . ",";
                 }
             }
             $client_attr['company_id'] = $company->id;
             $client = Client::create($client_attr);
             if ($client) {
                 $client->password = $client->set_password($_POST['password']);
                 $client->save();
                 $company->client_id = $client->id;
                 $company->save();
                 $this->email->from($core_settings->email, $core_settings->company);
                 $this->email->to($client_attr['email']);
                 $this->email->subject($this->lang->line('application_your_account_has_been_created'));
                 $parse_data = array('link' => base_url() . 'login/', 'company' => $core_settings->company, 'company_reference' => $company->reference, 'logo' => '<img src="' . base_url() . '' . $core_settings->logo . '" alt="' . $core_settings->company . '"/>', 'invoice_logo' => '<img src="' . base_url() . '' . $core_settings->invoice_logo . '" alt="' . $core_settings->company . '"/>');
                 $email = read_file('./application/views/' . $core_settings->template . '/templates/email_create_account.html');
                 $message = $this->parser->parse_string($email, $parse_data);
                 $this->email->message($message);
                 $this->email->send();
                 send_notification($core_settings->email, $this->lang->line('application_new_client_has_registered'), $this->lang->line('application_new_client_has_registered') . ': <br><strong>' . $company_attr['name'] . '</strong><br>' . $client_attr['firstname'] . ' ' . $client_attr['lastname'] . '<br>' . $client_attr['email']);
                 $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_registration_success'));
                 redirect('login');
             } else {
                 $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_registration_error'));
                 redirect('login');
             }
         } else {
             $this->view_data['error'] = $this->lang->line('messages_email_already_taken');
             $this->theme_view = 'login';
             $this->content_view = 'auth/register';
             $this->view_data['form_action'] = 'register';
             $this->view_data['registerdata'] = $_POST;
         }
     } else {
         $this->view_data['error'] = 'false';
         $this->theme_view = 'login';
         $this->content_view = 'auth/register';
         $this->view_data['form_action'] = 'register';
     }
 }
Example #12
0
 private function seedTestUsersAndClients()
 {
     $resource_server = ResourceServer::first();
     // create users and clients ...
     User::create(array('identifier' => 'sebastian.marcet', 'external_identifier' => 13867, 'last_login_date' => gmdate("Y-m-d H:i:s", time())));
     $user = User::where('identifier', '=', 'sebastian.marcet')->first();
     OpenIdTrustedSite::create(array('user_id' => $user->id, 'realm' => 'https://www.test.com/', 'policy' => IAuthService::AuthorizationResponse_AllowForever));
     Client::create(array('app_name' => 'oauth2_test_app', 'app_description' => 'oauth2_test_app', 'app_logo' => null, 'client_id' => 'Jiz87D8/Vcvr6fvQbH4HyNgwTlfSyQ3x.openstack.client', 'client_secret' => 'ITc/6Y5N7kOtGKhg', 'client_type' => IClient::ClientType_Confidential, 'application_type' => IClient::ApplicationType_Web_App, 'user_id' => $user->id, 'rotate_refresh_token' => true, 'use_refresh_token' => true));
     Client::create(array('app_name' => 'oauth2.service', 'app_description' => 'oauth2.service', 'app_logo' => null, 'client_id' => '11z87D8/Vcvr6fvQbH4HyNgwTlfSyQ3x.openstack.client', 'client_secret' => '11c/6Y5N7kOtGKhg', 'client_type' => IClient::ClientType_Confidential, 'application_type' => IClient::ApplicationType_Service, 'user_id' => $user->id, 'rotate_refresh_token' => true, 'use_refresh_token' => true));
     Client::create(array('app_name' => 'oauth2_test_app_public', 'app_description' => 'oauth2_test_app_public', 'app_logo' => null, 'client_id' => 'Jiz87D8/Vcvr6fvQbH4HyNgwKlfSyQ3x.openstack.client', 'client_secret' => null, 'client_type' => IClient::ClientType_Public, 'application_type' => IClient::ApplicationType_JS_Client, 'user_id' => $user->id, 'rotate_refresh_token' => false, 'use_refresh_token' => false));
     Client::create(array('app_name' => 'oauth2_test_app_public_2', 'app_description' => 'oauth2_test_app_public_2', 'app_logo' => null, 'client_id' => 'Jiz87D8/Vcvr6fvQbH4HyNgwKlfSyQ2x.openstack.client', 'client_secret' => null, 'client_type' => IClient::ClientType_Public, 'application_type' => IClient::ApplicationType_JS_Client, 'user_id' => $user->id, 'rotate_refresh_token' => false, 'use_refresh_token' => false));
     Client::create(array('app_name' => 'resource_server_client', 'app_description' => 'resource_server_client', 'app_logo' => null, 'client_id' => 'resource.server.1.openstack.client', 'client_secret' => '123456789', 'client_type' => IClient::ClientType_Confidential, 'application_type' => IClient::ApplicationType_Service, 'resource_server_id' => $resource_server->id, 'rotate_refresh_token' => false, 'use_refresh_token' => false));
     $client_confidential = Client::where('app_name', '=', 'oauth2_test_app')->first();
     $client_public = Client::where('app_name', '=', 'oauth2_test_app_public')->first();
     $client_service = Client::where('app_name', '=', 'oauth2.service')->first();
     //attach scopes
     $scopes = ApiScope::get();
     foreach ($scopes as $scope) {
         $client_confidential->scopes()->attach($scope->id);
         $client_public->scopes()->attach($scope->id);
         $client_service->scopes()->attach($scope->id);
     }
     //add uris
     ClientAuthorizedUri::create(array('uri' => 'https://www.test.com/oauth2', 'client_id' => $client_confidential->id));
     //add uris
     ClientAllowedOrigin::create(array('allowed_origin' => 'https://www.test.com/oauth2', 'client_id' => $client_confidential->id));
     ClientAuthorizedUri::create(array('uri' => 'https://www.test.com/oauth2', 'client_id' => $client_public->id));
 }
Example #13
0
 protected function start()
 {
     $node = new Node();
     $node->create();
     $task = new Task();
     $task->create();
     $client = new Client();
     $hash = $client->create();
     $response = array("status" => "Running", 'ClientHash' => $hash);
     $this->response->out($response);
 }
Example #14
0
 /**
  * Create http client for request handle
  *
  * @param  array  $options
  * @return void
  */
 public static function createClient(array $options = [])
 {
     Client::create(array_merge($options, ['base_uri' => static::baseUri(), 'auth' => static::auth()]));
 }
 public function storeAllData()
 {
     $data = Session::pull('MyBookingData');
     if (Session::has('rate_box_details') || Session::has('transport_cart_box') || Session::has('predefined_transport') || Session::has('excursion_cart_details')) {
         if ($booking = Booking::create($data)) {
             $ehi_users = User::getEhiUsers();
             if (Auth::check()) {
                 //DB::table('booking_user')->insert(array('booking_id' => $booking->id, 'user_id' => $user->id));
                 if (Session::has('client-list')) {
                     $clients = Session::pull('client-list');
                     foreach ($clients as $client) {
                         $client['booking_id'] = $booking->id;
                         $client['gender'] === 'male' ? $client['gender'] = 1 : ($client['gender'] = 0);
                         Client::create($client);
                     }
                 }
                 $flight_data = [];
                 $flight_data['booking_id'] = $booking->id;
                 $flight_data['date'] = $data['date_arrival'];
                 $flight_data['time'] = $data['arrival_time'];
                 $flight_data['flight'] = $data['arrival_flight'];
                 $flight_data['flight_type'] = 1;
                 FlightDetail::create($flight_data);
                 //departure flight data
                 $flight_data['date'] = $data['date_departure'];
                 $flight_data['time'] = $data['departure_time'];
                 $flight_data['flight'] = $data['departure_flight'];
                 $flight_data['flight_type'] = 0;
                 FlightDetail::create($flight_data);
             }
             /**
              *  transport - custom trips
              */
             $a = 0;
             if (Session::has('transport_cart_box')) {
                 $custom_trips = Session::pull('transport_cart_box');
                 $a++;
                 $x = 1;
                 foreach ($custom_trips as $custom_trip) {
                     $custom_trip['from'] = date('Y-m-d H:i', strtotime($custom_trip['pick_up_date'] . ' ' . $custom_trip['pick_up_time_hour'] . ':' . $custom_trip['pick_up_time_minutes']));
                     $custom_trip['to'] = date('Y-m-d H:i', strtotime($custom_trip['drop_off_date'] . ' ' . $custom_trip['drop_off_time_hour'] . ':' . $custom_trip['drop_off_time_minutes']));
                     $custom_trip['reference_number'] = 'TR' . ($booking->reference_number * 1000 + $x++);
                     $custom_trip['booking_id'] = $booking->id;
                     $custom_trip['locations'] = $custom_trip['destination_1'] . ',' . $custom_trip['destination_2'] or '' . ',' . $custom_trip['destination_3'];
                     $custom_trip['amount'] = rand(100, 200);
                     CustomTrip::create($custom_trip);
                 }
             }
             /**
              *  predefined package bookings
              */
             if (Session::has('predefined_transport')) {
                 $a++;
                 $predefined_packages = Session::pull('predefined_transport');
                 foreach ($predefined_packages as $predefined_package) {
                     $package = [];
                     $package['transport_package_id'] = $predefined_package['predefine_id'];
                     $package['booking_id'] = $booking->id;
                     $package['pick_up_date_time'] = $predefined_package['check_in_date'];
                     $package['amount'] = TransportPackage::find($predefined_package['predefine_id'])->rate;
                     PredefinedTrip::create($package);
                 }
             }
             /**
              * Send Transportation Email to All EHI users
              */
             $pdf = PDF::loadView('emails/transport', array('booking' => $booking));
             $pdf->save('public/temp-files/transport' . $booking->id . '.pdf');
             //                if ($a > 0) {
             //                    Mail::send('emails/transport-mail', array(
             //                        'booking' => Booking::find($booking->id)
             //                    ), function ($message) use ($booking, $ehi_users) {
             //                        $message->attach('public/temp-files/transport.pdf')
             //                            ->subject('New Transfer : ' . $booking->reference_number)
             //                            ->from('*****@*****.**', 'SriLankaHotels.Travel')
             //                            ->bcc('*****@*****.**');
             //                        if (!empty($ehi_users))
             //                            foreach ($ehi_users as $ehi_user) {
             //                                $message->to($ehi_user->email, $ehi_user->first_name);
             //                            }
             //                    });
             //                }
             /**
              * Excursions
              */
             if (Session::has('excursion_cart_details')) {
                 $excursions = Session::pull('excursion_cart_details');
                 $x = 1;
                 foreach ($excursions as $excursion) {
                     $excursionBooking = ExcursionRate::with(array('city', 'excursion', 'excursionTransportType'))->where('city_id', $excursion['city_id'])->where('excursion_transport_type_id', $excursion['excursion_transport_type'])->where('excursion_id', $excursion['excursion'])->first();
                     $excursionBookingData = array('booking_id' => $booking->id, 'city_id' => $excursionBooking->city_id, 'excursion_transport_type_id' => $excursionBooking->excursion_transport_type_id, 'excursion_id' => $excursionBooking->excursion_id, 'unit_price' => $excursionBooking->rate, 'pax' => $excursion['excursion_pax'], 'date' => $excursion['excursion_date'], 'reference_number' => 'EX' . ($booking->reference_number * 1000 + $x++));
                     ExcursionBooking::create($excursionBookingData);
                 }
                 $pdf = PDF::loadView('emails/excursion', array('booking' => $booking));
                 $pdf->save('public/temp-files/excursions.pdf');
                 //                    Mail::send('emails/excursion-mail', array(
                 //                        'booking' => $booking
                 //                    ), function ($message) use ($booking, $ehi_users) {
                 //                        $message->attach('public/temp-files/excursions.pdf')
                 //                            ->subject('New Excursions : ' . $booking->reference_number)
                 //                            ->from('*****@*****.**', 'SriLankaHotels.Travel');
                 //
                 //                        $message->to('*****@*****.**', 'Excursions');
                 //                        $message->bcc('*****@*****.**', 'Admin');
                 //                        if (!empty($ehi_users))
                 //                            foreach ($ehi_users as $ehi_user) {
                 //                                $message->to($ehi_user->email, $ehi_user->first_name);
                 //                            }
                 //                    });
             }
             /**
              *  hotel bookings
              */
             if (Session::has('rate_box_details')) {
                 $bookings = Session::pull('rate_box_details');
                 $vouchers = Voucher::arrangeHotelBookingsVoucherwise($bookings, $booking->id);
                 foreach ($vouchers as $voucher) {
                     $created_voucher = Voucher::create($voucher);
                     for ($c = 0; $c < count($voucher) - 6; $c++) {
                         $voucher[$c]['voucher_id'] = $created_voucher->id;
                         $RoomBooking = RoomBooking::create($voucher[$c]);
                     }
                     // voucher
                     $pdf = PDF::loadView('emails/voucher', array('voucher' => $created_voucher));
                     $pdf->save('public/temp-files/voucher' . $created_voucher->id . '.pdf');
                     //                        $hotel_users = DB::table('users')->leftJoin('hotel_user', 'users.id', '=', 'hotel_user.user_id')
                     //                            ->where('hotel_user.hotel_id', $created_voucher->hotel_id)
                     //                            ->get();
                     //
                     //                        Mail::send('emails/voucher-mail', array(
                     //                            'voucher' => Voucher::find($created_voucher->id)
                     //                        ), function ($message) use ($booking, $hotel_users,$created_voucher) {
                     //                            $message->attach('public/temp-files/voucher'.$created_voucher->id.'.pdf')
                     //                                ->subject('Booking Voucher : ' . $booking->reference_number)
                     //                                ->from('*****@*****.**', 'SriLankaHotels.Travel')
                     //                                ->bcc('*****@*****.**', 'SriLankaHotels.Travel');
                     //                            if (!empty($hotel_users))
                     //                                foreach ($hotel_users as $hotel_user) {
                     //                                    $message->to($hotel_user->email, $hotel_user->first_name);
                     //                                }
                     //                        });
                 }
             }
             //Booking details
             //                $pdf = PDF::loadView('emails/booking', array('booking' => $booking));
             //                $pdf->save('public/temp-files/booking'.$booking->id.'.pdf');
             //
             $ehi_users = User::getEhiUsers();
             //
             $emails = array('*****@*****.**', '*****@*****.**', '*****@*****.**');
             //
             //                Mail::send('emails/booking-mail', array(
             //                    'booking' => Booking::getBookingData($booking->id)
             //                ), function ($message) use ($booking, $emails, $ehi_users) {
             //                    $message->attach('public/temp-files/booking'.$booking->id.'.pdf')
             //                        ->subject('New Booking: ' . $booking->reference_number)
             //                        ->from('*****@*****.**', 'SriLankaHotels.Travel')
             //                        ->bcc('*****@*****.**', 'Admin');
             //                    foreach ($emails as $emailaddress) {
             //                        $message->to($emailaddress, 'Admin');
             //                    }
             //
             //                    if (!empty($ehi_users)) {
             //                        foreach ($ehi_users as $ehi_user) {
             //                            $message->to($ehi_user->email, $ehi_user->first_name);
             //                        }
             //                    }
             //                });
             Invoice::create(array('booking_id' => $booking->id, 'amount' => Booking::getTotalBookingAmount($booking), 'count' => 1));
             //Invoice
             $pdf = PDF::loadView('emails/invoice', array('booking' => $booking));
             $pdf->save('public/temp-files/invoice' . $booking->id . '.pdf');
             $pdf = PDF::loadView('emails/service-voucher', array('booking' => $booking));
             $pdf->save('public/temp-files/service-voucher.pdf');
             //                if ($user = $booking->user) {
             //                    Mail::send('emails/invoice-mail', array(
             //                        'booking' => Booking::getBookingData($booking->id)
             //                    ), function ($message) use ($user, $booking, $emails) {
             //                        $message->subject('Booking Invoice : ' . $booking->reference_number)
             //                            ->attach('public/temp-files/invoice'.$booking->id.'.pdf');
             //                        $message->to($user->email, $user->first_name . ' ' . $user->last_name);
             //                        $message->to('*****@*****.**', 'Accounts');
             //                        if (!empty($ehi_users)) {
             //                            foreach ($ehi_users as $ehi_user) {
             //                                $message->to($ehi_user->email, $ehi_user->first_name);
             //                            }
             //                        }
             //
             //                    });
             //
             //                } else {
             //
             //                    Mail::send('emails/invoice-mail', array(
             //                        'booking' => Booking::getBookingData($booking->id)
             //                    ), function ($message) use ($booking, $emails) {
             //                        $message->to($booking->email, $booking->name)
             //                            ->subject('Booking Created : ' . $booking->reference_number)
             //                            ->attach('public/temp-files/invoice'.$booking->id.'.pdf');
             //                        $message->to('*****@*****.**', 'Accounts');
             //                        if (!empty($ehi_users)) {
             //                            foreach ($ehi_users as $ehi_user) {
             //                                $message->to($ehi_user->email, $ehi_user->first_name);
             //                            }
             //                        }
             //                    });
             //                }
             if (!Auth::check()) {
                 Session::flash('global', 'Emails have been sent to the Respective parties');
                 return View::make('pages.message');
             }
         }
         return $booking;
     } else {
         return Redirect::back();
     }
     return Redirect::route('bookings.index');
 }
Example #16
0
 /** @test */
 public function can_search_for_specific_question_fuzzy_match()
 {
     $interrogator = new Interrogator();
     $section = $interrogator->createSection('Section 1', [], 'MetricLoop\\Interrogator\\User', 1);
     $section2 = $interrogator->createSection('Section 2', [], 'MetricLoop\\Interrogator\\Client', 1);
     $group = $interrogator->createGroup('Group 1', $section, [], 1);
     $group2 = $interrogator->createGroup('Group 2', $section2, [], 1);
     $interrogator->createQuestion('Question 1', 1, $group, [], [], 1);
     $interrogator->createQuestion('Question 2', 2, $group, [], [], 1);
     $interrogator->createQuestion('Question 3', 3, $group, [], [], 1);
     $interrogator->createQuestion('Question 4', 4, $group, [], [], 1);
     $interrogator->createQuestion('Question 5', 5, $group, [], [], 1);
     $interrogator->createQuestion('Question 6', 6, $group, [], [], 1);
     $interrogator->createQuestion('Question 1', 1, $group2, [], [], 1);
     $interrogator->createQuestion('Question 2', 2, $group2, [], [], 1);
     $interrogator->createQuestion('Question 3', 3, $group2, [], [], 1);
     $interrogator->createQuestion('Question 4', 4, $group2, [], [], 1);
     $interrogator->createQuestion('Question 5', 5, $group2, [], [], 1);
     $interrogator->createQuestion('Question 6', 6, $group2, [], [], 1);
     $user = User::create(['name' => 'Ulysses User', 'email' => '*****@*****.**', 'current_team_id' => 1]);
     $client = Client::create(['name' => 'Carly Client', 'email' => '*****@*****.**', 'current_team_id' => 1]);
     $section = Section::where('class_name', get_class($user))->first();
     foreach ($section->groups as $group) {
         foreach ($group->questions as $question) {
             $user->answerQuestion($question, 'Test Answer');
         }
     }
     $section = Section::where('class_name', get_class($client))->first();
     foreach ($section->groups as $group) {
         foreach ($group->questions as $question) {
             $client->answerQuestion($question, 'Test Answer');
         }
     }
     $term = 'est Answe';
     $question = Question::first();
     $results = $interrogator->searchQuestion($term, get_class($user), $question, 1);
     $this->assertCount(1, $results);
 }
Example #17
0
<?php

include_once '../includes/Client.php';
$client = new Client();
if ($_REQUEST['ax'] == 'add-client') {
    $missing_information = false;
    foreach ($_REQUEST['data'] as $field) {
        if (empty($field)) {
            $missing_information = true;
        }
    }
    if (!$missing_information) {
        $result = $client->create($_REQUEST['data']);
    } else {
        http_response_code(200);
        header("Content-Type: application/json");
        echo json_encode(array('success' => false, 'message' => 'Please fill out all fields.'));
        exit;
    }
} elseif ($_REQUEST['ax'] == 'add-option') {
    $result = $client::getProjectInput($_REQUEST['data']['count']);
}
if ($result) {
    http_response_code(200);
    header("Content-Type: application/json");
    echo json_encode(array('success' => true, 'result' => $result));
    exit;
}
Example #18
0
 /**
  * Create a new Client.
  */
 public function __construct()
 {
     $this->client = Client::create();
 }
Example #19
0
 /**
  * @covers Dafiti\Datajet\Client::create
  * @covers Dafiti\Datajet\Client::__construct
  * @covers Dafiti\Datajet\Client::__get
  */
 public function testShouldCreateClient()
 {
     $client = Client::create();
     $this->assertInstanceOf('Dafiti\\Datajet\\Client', $client);
 }
 public function create()
 {
     if (isset($_POST['name']) && !empty($_POST['name'])) {
         $obj = new Client();
         $error = array();
         $obj->name = strip_tags($_POST['name']);
         $obj->addy = strip_tags($_POST['addy']);
         $obj->visible = $_POST['visible'];
         $obj->phone = $_POST['phone'];
         $obj->email = $_POST['email'];
         $obj->descr = $_POST['desc'];
         $obj->username = $_POST['username'];
         $phpFileUploadErrors = array(0 => 'There is no error, the file uploaded with success', 1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini', 2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form', 3 => 'The uploaded file was only partially uploaded', 4 => 'No file was uploaded', 6 => 'Missing a temporary folder', 7 => 'Failed to write file to disk.', 8 => 'A PHP extension stopped the file upload.');
         if (isset($_FILES['fupload']) && $_FILES['fupload']['error'] == 0) {
             //if file upload is set
             move_uploaded_file($_FILES['fupload']['tmp_name'], "../public/uploads/" . basename($_FILES['fupload']['name']));
             $image = new Imageresize();
             // an instance of image resize object
             $image->load("../public/uploads/" . basename($_FILES['fupload']['name']));
             //$image->image =;
             $image->resize(400, 400);
             $image->save("../public/uploads/" . basename($_FILES['fupload']['name']));
             //this section is needed to get the extension for image type in renaming the image
             if ($_FILES['fupload']['type'] == "image/gif") {
                 $ext = ".gif";
             }
             if ($_FILES['fupload']['type'] == "image/png") {
                 $ext = ".png";
             }
             if ($_FILES['fupload']['type'] == "image/jpeg") {
                 $ext = ".jpeg";
             }
             if ($_FILES['fupload']['type'] == "image/pjpeg") {
                 $ext = ".jpeg";
             }
             if ($_FILES['fupload']['type'] == "image/gif") {
                 $ext = ".gif";
             }
             if ($_FILES['fupload']['type'] == "image/jpg") {
                 $ext = ".jpg";
             }
             $new_name = uniqid() . "_" . time() . $ext;
             //new name for the image
             rename("../public/uploads/" . basename($_FILES['fupload']['name']), "../public/uploads/" . $new_name);
             $photo = $new_name;
             $obj->image = $photo;
         } else {
             //$applicant->img_url = $_REQUEST['imgvalue'];
             echo $phpFileUploadErrors[$_FILES['fupload']['error']];
             exit;
         }
         if ($_POST['password'] == $_POST['r_password']) {
             $obj->password = $_POST['password'];
         } else {
             array_push($error, "Password do not match");
         }
         if (empty($error)) {
             if ($obj->create()) {
                 $obj->main_id = Client::getID("CLT", $obj->id);
                 $obj->update();
                 return 1;
             } else {
                 return 2;
             }
         }
     }
 }
Example #21
0
 //Instanciation des managers d'entités
 $user = new User();
 $configuration = new Configuration();
 $right = new Right();
 $rank = new Rank();
 $section = new Section();
 $event = new Event();
 $client = new Client();
 //Création des tables SQL
 $configuration->create();
 $user->create();
 $right->create();
 $rank->create();
 $section->create();
 $event->create();
 $client->create();
 $configuration->put('UPDATE_URL', 'http://update.idleman.fr/yana?callback=?');
 $configuration->put('DEFAULT_THEME', 'default');
 $configuration->put('COOKIE_NAME', 'yana');
 $configuration->put('COOKIE_LIFETIME', '7');
 $configuration->put('VOCAL_ENTITY_NAME', 'YANA');
 $configuration->put('PROGRAM_VERSION', '3.0.6');
 $configuration->put('HOME_PAGE', 'index.php');
 $configuration->put('VOCAL_SENSITIVITY', '0.0');
 //Création du rang admin
 $rank = new Rank();
 $rank->setLabel('admin');
 $rank->save();
 //Déclaration des sections du programme
 $sections = array('event', 'vocal', 'user', 'plugin', 'configuration', 'admin');
 //Création des sections déclarées et attribution de tous les droits sur toutes ces sections pour l'admin
 /** @test */
 public function can_delete_and_cascade_sections_groups_and_questions()
 {
     $interrogator = new Interrogator();
     $section = $interrogator->createSection('Section 1', [], 'MetricLoop\\Interrogator\\User');
     $section2 = $interrogator->createSection('Section 2', [], 'MetricLoop\\Interrogator\\Client');
     $group = $interrogator->createGroup('Group 1', $section);
     $group2 = $interrogator->createGroup('Group 2', $section2);
     $group3 = $interrogator->createGroup('Group 2', $section2);
     $question = $interrogator->createQuestion('Question 1', 1, $group);
     $interrogator->createQuestion('Question 2', 2, $group);
     $interrogator->createQuestion('Question 3', 3, $group);
     $interrogator->createQuestion('Question 4', 4, $group);
     $interrogator->createQuestion('Question 5', 5, $group);
     $interrogator->createQuestion('Question 6', 6, $group);
     $interrogator->createQuestion('Question 1', 1, $group2);
     $interrogator->createQuestion('Question 2', 2, $group2);
     $interrogator->createQuestion('Question 3', 3, $group2);
     $interrogator->createQuestion('Question 4', 4, $group2);
     $interrogator->createQuestion('Question 5', 5, $group2);
     $interrogator->createQuestion('Question 6', 6, $group2);
     $interrogator->createQuestion('Question 1', 1, $group3);
     $interrogator->createQuestion('Question 2', 2, $group3);
     $interrogator->createQuestion('Question 3', 3, $group3);
     $interrogator->createQuestion('Question 4', 4, $group3);
     $interrogator->createQuestion('Question 5', 5, $group3);
     $interrogator->createQuestion('Question 6', 6, $group3);
     $user = User::create(['name' => 'Ulysses User', 'email' => '*****@*****.**']);
     $client = Client::create(['name' => 'Carly Client', 'email' => '*****@*****.**']);
     $section = Section::where('class_name', get_class($user))->first();
     foreach ($section->groups as $group) {
         foreach ($group->questions as $question) {
             $user->answerQuestion($question, 'Test Answer');
         }
     }
     $section = Section::where('class_name', get_class($client))->first();
     foreach ($section->groups as $group) {
         foreach ($group->questions as $question) {
             $client->answerQuestion($question, 'Test Answer');
         }
     }
     $questions = Question::all();
     $groups = Group::all();
     $sections = Section::all();
     $answers = Answer::all();
     $this->assertCount(18, $questions);
     $this->assertCount(18, $answers);
     $this->assertCount(3, $groups);
     $this->assertCount(2, $sections);
     $interrogator->deleteQuestion($question);
     $questions = Question::all();
     $groups = Group::all();
     $sections = Section::all();
     $answers = Answer::all();
     $this->assertCount(17, $questions);
     $this->assertCount(17, $answers);
     $this->assertCount(3, $groups);
     $this->assertCount(2, $sections);
     $interrogator->deleteGroup($group2);
     $questions = Question::all();
     $groups = Group::all();
     $sections = Section::all();
     $answers = Answer::all();
     $this->assertCount(11, $questions);
     $this->assertCount(11, $answers);
     $this->assertCount(2, $groups);
     $this->assertCount(2, $sections);
     $interrogator->deleteSection($section);
     $questions = Question::all();
     $groups = Group::all();
     $sections = Section::all();
     $answers = Answer::all();
     $this->assertCount(6, $questions);
     $this->assertCount(6, $answers);
     $this->assertCount(1, $groups);
     $this->assertCount(1, $sections);
 }
Example #23
0
    $c_contact_cellphone = trim($_POST['contact_cellphone']);
    $c_contact_telephone = trim($_POST['contact_telephone']);
    //Address
    $addressline = trim($_POST['addressline']);
    $city = trim($_POST['city']);
    $stateprovince = trim($_POST['stateprovince']);
    $countryregion = trim($_POST['countryregion']);
    $client = new Client();
    $client->c_first_name = $c_first_name;
    $client->c_middle_name = $c_middle_name;
    $client->c_last_name = $c_last_name;
    $client->c_age = $c_age;
    $client->c_email = $c_email;
    $client->c_contact_cellphone = $c_contact_cellphone;
    $client->c_contact_telephone = $c_contact_telephone;
    if ($client->create()) {
        $client_id = $database->insert_id();
    }
    $address = new Address();
    $address->c_id = $client_id;
    $address->addressline = $addressline;
    $address->city = $city;
    $address->stateprovince = $stateprovince;
    $address->countryregion = $countryregion;
    if ($address->create()) {
        redirect_to('index.php');
    }
} else {
    $c_first_name = "";
    $c_middle_name = "";
    $c_last_name = "";
 public function testMorph()
 {
     $user = User::create(array('name' => 'John Doe'));
     $client = Client::create(array('name' => 'Jane Doe'));
     $photo = Photo::create(array('url' => 'http://graph.facebook.com/john.doe/picture'));
     $photo = $user->photos()->save($photo);
     $this->assertEquals(1, $user->photos->count());
     $this->assertEquals($photo->id, $user->photos->first()->id);
     $user = User::find($user->_id);
     $this->assertEquals(1, $user->photos->count());
     $this->assertEquals($photo->id, $user->photos->first()->id);
     $photo = Photo::create(array('url' => 'http://graph.facebook.com/jane.doe/picture'));
     $client->photo()->save($photo);
     $this->assertNotNull($client->photo);
     $this->assertEquals($photo->id, $client->photo->id);
     $client = Client::find($client->_id);
     $this->assertNotNull($client->photo);
     $this->assertEquals($photo->id, $client->photo->id);
     $photo = Photo::first();
     $this->assertEquals($photo->imageable->name, $user->name);
     $user = User::with('photos')->find($user->_id);
     $relations = $user->getRelations();
     $this->assertTrue(array_key_exists('photos', $relations));
     $this->assertEquals(1, $relations['photos']->count());
     $photos = Photo::with('imageable')->get();
     $relations = $photos[0]->getRelations();
     $this->assertTrue(array_key_exists('imageable', $relations));
     $this->assertInstanceOf('User', $relations['imageable']);
     $relations = $photos[1]->getRelations();
     $this->assertTrue(array_key_exists('imageable', $relations));
     $this->assertInstanceOf('Client', $relations['imageable']);
 }
Example #25
0
     break;
 case $ACTION_clientView:
     if (isset($_GET["client"])) {
         $_SESSION["client"] = $_GET["client"];
     }
     break;
 case $ACTION_clientSave:
     if (isset($_POST["client"])) {
         $_SESSION["client"] = $_POST["client"];
     }
     $tempClient = new Client($_POST["client"], $_POST["client_name_field"], $_POST["client_address_field"]);
     $tempClient->save();
     break;
 case $ACTION_clientCreate:
     $tempClient = new Client($_POST["client_name_field"], $_POST["client_address_field"]);
     $tempClient->create();
     break;
 case $ACTION_clientDelete:
     $tempClient = new Client($_GET["client"]);
     $tempClient->delete();
     $_SESSION["client"] = -1;
     break;
 case $ACTION_changeRole:
     // besoin des faire des verif savoir si l'utilisateur a bien le droit de change de ce role
     if (isset($_GET["role"])) {
         $_SESSION["systemData"]->setUserRole($_GET["role"]);
     }
     break;
 case $ACTION_showResult:
     $listeResultat = null;
     if (isset($_POST["search_type_select"])) {
    public function parseClients($client) {

        //echo mb_convert_encoding($client[1], 'WINDOWS-1251', 'UTF-8');;
        $clientName = mb_convert_encoding($client[1], 'WINDOWS-1251', 'UTF-8');
        try {
            Client::create(array('name'=>$clientName, 'phone'=>$client[0]));    
            echo "name: ".$client[1]." phone: ".$client[0]." =========================================<br>";
        } catch (\exception $e) {
            if (empty($client[1]))
                $client[1] = 'EMPTY';                
            echo "Duplicate name: ".$client[1]." phone: ".$client[0]."<br>";
        }          

    }
 public function testDoubleSaveManyToMany()
 {
     $user = User::create(array('name' => 'John Doe'));
     $client = Client::create(array('name' => 'Admins'));
     $user->clients()->save($client);
     $user->clients()->save($client);
     $user->save();
     $this->assertEquals(1, $user->clients()->count());
     $this->assertEquals(array($user->_id), $client->user_ids);
     $this->assertEquals(array($client->_id), $user->client_ids);
     $user = User::where('name', 'John Doe')->first();
     $client = Client::where('name', 'Admins')->first();
     $this->assertEquals(1, $user->clients()->count());
     $this->assertEquals(array($user->_id), $client->user_ids);
     $this->assertEquals(array($client->_id), $user->client_ids);
     $user->clients()->save($client);
     $user->clients()->save($client);
     $user->save();
     $this->assertEquals(1, $user->clients()->count());
     $this->assertEquals(array($user->_id), $client->user_ids);
     $this->assertEquals(array($client->_id), $user->client_ids);
 }
Example #28
0
 $do = strtolower($_POST['do']);
 switch ($do) {
     case 'update':
         $client = new Client($_POST['client_id']);
         if ($client && $client->getId()) {
             if ($client->update($_POST, $errors)) {
                 $msg = _('Client profile updated successfully');
             } elseif (!$errors['err']) {
                 $errors['err'] = _('Error updating the user');
             }
         } else {
             $errors['err'] = _('Internal error');
         }
         break;
     case 'create':
         if ($uID = Client::create($_POST, $errors)) {
             $msg = sprintf(_('%s added successfully'), Format::htmlchars($_POST['client_firstname'] . ' ' . $_POST['client_lastname']));
         } elseif (!$errors['err']) {
             $errors['err'] = _('Unable to add the user. Internal error');
         }
         break;
     case 'mass_process':
         //ok..at this point..look WMA.
         if ($_POST['uids'] && is_array($_POST['uids'])) {
             $ids = implode(',', $_POST['uids']);
             $selected = count($_POST['uids']);
             if (isset($_POST['enable'])) {
                 $sql = 'UPDATE ' . CLIENT_TABLE . ' SET client_isactive=1 WHERE client_isactive=0 AND client_id IN(' . $ids . ')';
                 db_query($sql);
                 $msg = sprintf(_("%s of  %s selected users enabled"), db_affected_rows(), $selected);
             } elseif (isset($_POST['disable'])) {
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('clients')->delete();
     $testmodpack = Client::create(array('name' => 'TestClient', 'uuid' => '2ezf6f26-eb15-4ccb-9f0b-8z5ed2c72946'));
 }
Example #30
0
    if(isset($_GET['generate_manager_list'])){
	    $arr = get_managers_list();
		foreach($arr as $manager) if(trim($manager['name']) != '' && ($manager['access']==1 || $manager['access']==5)) $managers[] = $manager['id'].'[,]'.$manager['name'].' '.$manager['last_name'];
	    ////print_r($arr); 
		echo implode('[&]',$managers);
		exit;
	}
	if(isset($_POST['ajax_standart_window']) && $_POST['ajax_standart_window']=="create_client"){
		$arr_2['company'] = urldecode ($_POST['company']);
		$arr_2['dop_info'] = urldecode ($_POST['dop_info']);
		$arr_2['rate'] = $_POST['rate'];
		// если клиентов с таким именем не существует - добавляем нового
		if($clientClass->search_name($arr_2['company'])==0){		
		echo '{
	       "response":"1",
	       "id":"'.$clientClass->create($arr_2).'"
	      }';
		}else{		
		echo '{
	       "response":"2",
	       "text":"Клиент с таким именем уже содержится в базе Апельбурга."
	      }';
		}
		exit;
	}
    /////////////////////////////////////////////////////////////////////////////
	
    $quick_button = '<div class="quick_button_div" style="background:none"><a href="#" id="create_new_client" style="
  display: block;" class="button add">Добавить</a></div>';
	
	$_SESSION['view_type']['clients_list']  = isset($_GET['view']) ? $_GET['view'] :( isset($_SESSION['view_type']['clients_list']) ? $_SESSION['view_type']['clients_list'] :'ordinary');