Added theme selector to edit user page
This commit is contained in:
parent
38d5ede7b5
commit
4cdd7256ef
|
@ -267,11 +267,12 @@ public function SendTestMail(Request $request)
|
||||||
$littlelink_description = $request->littlelink_description;
|
$littlelink_description = $request->littlelink_description;
|
||||||
$role = $request->role;
|
$role = $request->role;
|
||||||
$customBackground = $request->file('background');
|
$customBackground = $request->file('background');
|
||||||
|
$theme = $request->theme;
|
||||||
|
|
||||||
if ($request->password == '') {
|
if ($request->password == '') {
|
||||||
User::where('id', $id)->update(['name' => $name, 'email' => $email, 'littlelink_name' => $littlelink_name, 'littlelink_description' => $littlelink_description, 'role' => $role]);
|
User::where('id', $id)->update(['name' => $name, 'email' => $email, 'littlelink_name' => $littlelink_name, 'littlelink_description' => $littlelink_description, 'role' => $role, 'theme' => $theme]);
|
||||||
} else {
|
} else {
|
||||||
User::where('id', $id)->update(['name' => $name, 'email' => $email, 'password' => $password, 'littlelink_name' => $littlelink_name, 'littlelink_description' => $littlelink_description, 'role' => $role]);
|
User::where('id', $id)->update(['name' => $name, 'email' => $email, 'password' => $password, 'littlelink_name' => $littlelink_name, 'littlelink_description' => $littlelink_description, 'role' => $role, 'theme' => $theme]);
|
||||||
}
|
}
|
||||||
if (!empty($profilePhoto)) {
|
if (!empty($profilePhoto)) {
|
||||||
$profilePhoto->move(base_path('assets/img'), $id . '_' . time() . ".png");
|
$profilePhoto->move(base_path('assets/img'), $id . '_' . time() . ".png");
|
||||||
|
|
|
@ -63,10 +63,46 @@
|
||||||
<br>
|
<br>
|
||||||
</div><br>
|
</div><br>
|
||||||
|
|
||||||
<!--<div class="form-group col-lg-8">
|
<label>{{__('messages.Select theme')}}</label>
|
||||||
<label>Littlelink name </label>
|
<div class="form-group col-lg-8">
|
||||||
<input type="text" class="form-control" name="littlelink_name" value="{{ $user->id }}">
|
<select id="theme-select" style="margin-bottom: 40px;" class="form-control" name="theme" data-base-url="{{ url('') }}/@<?= Auth::user()->littlelink_name ?>">
|
||||||
</div>-->
|
<?php
|
||||||
|
if ($handle = opendir('themes')) {
|
||||||
|
while (false !== ($entry = readdir($handle))) {
|
||||||
|
if ($entry != "." && $entry != "..") {
|
||||||
|
if(file_exists(base_path('themes') . '/' . $entry . '/readme.md')){
|
||||||
|
$text = file_get_contents(base_path('themes') . '/' . $entry . '/readme.md');
|
||||||
|
$pattern = '/Theme Name:.*/';
|
||||||
|
preg_match($pattern, $text, $matches, PREG_OFFSET_CAPTURE);
|
||||||
|
if(sizeof($matches) > 0) {
|
||||||
|
$themeName = substr($matches[0][0],12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($user->theme != $entry and isset($themeName)){
|
||||||
|
echo '<option value="'.$entry.'" data-image="'.url('themes/'.$entry.'/screenshot.png').'">'.$themeName.'</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($user->theme != "default" and $user->theme != ""){
|
||||||
|
if(file_exists(base_path('themes') . '/' . $user->theme . '/readme.md')){
|
||||||
|
$text = file_get_contents(base_path('themes') . '/' . $user->theme . '/readme.md');
|
||||||
|
$pattern = '/Theme Name:.*/';
|
||||||
|
preg_match($pattern, $text, $matches, PREG_OFFSET_CAPTURE);
|
||||||
|
$themeName = substr($matches[0][0],12);
|
||||||
|
}
|
||||||
|
echo '<option value="'.$user->theme.'" data-image="'.url('themes/'.$user->theme.'/screenshot.png').'" selected>'.$themeName.'</option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<option value="default" data-image="'.url('themes/default/screenshot.png').'"';
|
||||||
|
if($user->theme == "default" or $user->theme == ""){
|
||||||
|
echo ' selected';
|
||||||
|
}
|
||||||
|
echo '>Default</option>';
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-lg-8">
|
<div class="form-group col-lg-8">
|
||||||
<label>{{__('messages.Page URL')}}</label>
|
<label>{{__('messages.Page URL')}}</label>
|
||||||
|
|
Loading…
Reference in New Issue