public function goFilterAjax() { $validator = Validator::create(array('package' => 'min:3|max:1024', 'package_version' => 'min:3|max:255', 'brand' => 'min:3|max:255', 'os_version' => 'min:1|max:255', 'phone_model' => 'min:3|max:255', 'product' => 'min:3|max:255')); if ($validator->failed()) { return BootstrapUI::formResponse()->failedOn($validator); } $data = $validator->getParamsObj(); $params = array(); if ($data->package !== null) { $params['package'] = $data->package; } if ($data->package_version !== null) { $params['package_version'] = $data->package_version; } if ($data->brand !== null) { $params['brand'] = $data->brand; } if ($data->os_version !== null) { $params['os_version'] = $data->os_version; } if ($data->phone_model !== null) { $params['phone_model'] = $data->phone_model; } if ($data->product !== null) { $params['product'] = $data->product; } // the country is array if (Input::hasPost('country')) { $params['country'] = implode(',', array_values(Input::post('country'))); } if (sizeof($params) == 0) { return BootstrapUI::formResponse()->failed('You must define at least one criteria!'); } return BootstrapUI::formResponse()->redirect(Url::href('live-feed', 'filter', $params)); }
public function indexAjax() { $input = Input::requireParams('username'); $username = $input->username; $id = (int) $this->getUser('id'); $validator = Validator::create(array('username' => "required|unique:\\User,username,{$id},id", 'first_name' => 'max:80', 'last_name' => 'max:160', 'password' => 'min:5|max:32', 'password2' => 'identical:password', 'timezone' => 'required|max:80')); if ($validator->failed()) { return BootstrapUI::formResponse()->failedOn($validator); } $input = $validator->getParamsObj(); $user = User::fetchOne($this->getUser('id')); $userSessionData = Session::get('user'); $refresh = $user->timezone != $input->timezone; $user->username = $input->username; $user->first_name = $input->first_name; $user->last_name = $input->last_name; $user->timezone = $input->timezone; if ($input->password !== null && strlen($input->password) >= 5) { $user->pass = md5($input->password); } $user->save(); foreach ($user->getData() as $key => $value) { $userSessionData[$key] = $value; } Session::set('user', $userSessionData); if ($refresh) { return BootstrapUI::formResponse()->refresh(); } else { return BootstrapUI::formResponse(); } }
public function indexAjax() { return BootstrapUI::tableRemoteResponse()->search(array('name'))->column('name')->column('total', function ($value, $row) { return "<div class=\"text-right\">{$value}</div>"; })->column('action', function ($value, $row) { return \Bootstrap::anchor(\Bootstrap::icon('search'), \Koldy\Url::href('reports', 'search', array('provider_id' => $row['id'])))->title('Find reports sent from this provider')->asButton()->size('xs')->color('red'); })->resultSet(Provider::resultSet())->handle(); }
public function indexAjax() { return BootstrapUI::tableRemoteResponse()->search(array('country'))->column('flag', function ($value, $row) { return '<img src="' . \Koldy\Url::link('img/flag/' . $row['tld'] . '.png') . '" />'; })->column('tld')->column('country')->column('total', function ($value, $row) { return "<div class=\"text-right\">{$value}</div>"; })->column('action', function ($value, $row) { return \Bootstrap::anchor(\Bootstrap::icon('search'), \Koldy\Url::href('reports', 'search', array('country_id' => $row['id'])))->title('Find reports from this country')->asButton()->size('xs')->color('red'); })->resultSet(Country::resultSet())->handle(); }
public function findAnyAjax() { $stackTraceId = Input::post('stack_trace_id'); $total = Crash\Archive::count(array('stack_trace_id' => $stackTraceId)); if ($total > 0) { $random = rand(0, $total - 1); $records = Crash\Archive::query()->field('id')->where('stack_trace_id', $stackTraceId)->limit($random, 1)->fetchAllObj(); $id = $records[0]->id; return BootstrapUI::buttonRemoteResponse()->redirect(\Koldy\Url::href('report', $id)); } else { return BootstrapUI::buttonRemoteResponse()->disableButton()->text('No reports'); } }
public function stackTracesAjax() { $osVersionId = (int) Input::post('os_version_id'); if ($osVersionId <= 0) { Application::throwError(400, 'Bad request'); } $resultSet = new Stack\Trace\ResultSet\OsVersion(); $resultSet->setOsVersionId($osVersionId); return BootstrapUI::tableRemoteResponse()->primaryKey('stack_trace_id')->column('total', function ($value, $row) { return \Bootstrap::label($value)->color('red'); })->column('summary', function ($value, $row) { return "<pre class=\"text-danger\">{$value}</pre>"; })->column('action', function ($value, $row) use($osVersionId) { return \Bootstrap::anchor(\Bootstrap::icon('search'), \Koldy\Url::href('reports', 'search', array('os_version_id' => $osVersionId, 'stack_trace_id' => $row['stack_trace_id'])))->title('Find reports with this os_version and package')->asButton()->size('xs')->color('red'); })->resultSet($resultSet)->handle(); }
public function indexAjax() { $input = Input::requireParams('username', 'pass', 'r'); if (($user = User::auth($input->username, $input->pass)) !== false) { $sessionData = $user->getData(); $sessionData['previous_login'] = $user->last_login; $user->updateLoginStats(); $sessionData['last_login'] = gmdate('Y-m-d H:i:s'); Cookie::set('username', $input->username, time() + 3600 * 24 * 30); Log::info("User {$input->username} logged in with " . Request::userAgent()); // some stats $sessionData['stats'] = array('new_stack_traces' => \Stack\Trace::getNewCount($sessionData['previous_login'])); Session::set('user', $sessionData); return BootstrapUI::formResponse()->redirect(base64_decode($input->r)); } else { Log::info("Invalid auth for '{$input->username}' with '{$input->pass}'"); return BootstrapUI::formResponse()->failed('Wrong username or password'); } }
public function packageAction() { $content = array(); $panel = Bootstrap::panel('Filter')->collapsible(true); $form = BootstrapUI::form()->horizontal()->add(Bootstrap::textfield('name', null, 'name'))->addSubmit('Filter'); $panel->content($form); $content[] = Bootstrap::row()->add(12, $panel); return View::create('base')->with('title', 'Package reports')->with('content', $content); }
public function versionsAjax() { $packageId = (int) Input::post('package_id'); if ($packageId <= 0) { Application::throwError(400, 'Bad request'); } $resultSet = new Package\ResultSet\Version(); $resultSet->setPackageId($packageId, Input::post('last')); $timeFrom = $resultSet->getFromTime(); return BootstrapUI::tableRemoteResponse()->primaryKey('package_version_id')->column('total', function ($value, $row) { return \Bootstrap::label($value)->color('red'); })->column('name')->column('action', function ($value, $row) use($packageId, $timeFrom) { return \Bootstrap::anchor(\Bootstrap::icon('search'), \Koldy\Url::href('reports', 'search', array('package_version_id' => $row['package_version_id'], 'date_from' => \Misc::userDate('Y-m-d H:i:s', strtotime($timeFrom)))))->title('Find reports with this package version')->asButton()->size('xs')->color('red'); })->resultSet($resultSet)->handle(); }
/** * Actually add new user into database */ public function addUserAjax() { $validator = Validator::create(array('id' => 'is:0', 'username' => "required|min:2|max:32|unique:\\User,username", 'first_name' => 'max:255', 'last_name' => 'max:255', 'pass' => 'required|min:5|max:255', 'pass2' => 'identical:pass', 'account_type' => 'required', 'timezone' => 'required')); if ($validator->failed()) { return BootstrapUI::formResponse()->failedOn($validator); } $data = $validator->getParams(); unset($data['id'], $data['pass2']); $data['pass'] = md5($data['pass']); $user = User::create($data); if ($user === false) { Log::error('Can not create new user'); return BootstrapUI::formResponse()->failed('Something went wrong'); } return BootstrapUI::formResponse()->redirect(Url::href('system', 'users')); }
/** * Inject the dependencies */ public static function injectDependencies() { \BootstrapUI::addDependency(array('3rd/select2-3.4.3/select2.css', '3rd/select2-bootstrap3.css', '3rd/select2-3.4.3/select2.min.js', '3rd/select2-bind.js')); }