summaryrefslogtreecommitdiff
path: root/actions/userdesignsettings.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/userdesignsettings.php')
-rw-r--r--actions/userdesignsettings.php79
1 files changed, 78 insertions, 1 deletions
diff --git a/actions/userdesignsettings.php b/actions/userdesignsettings.php
index 1cf878000..e6caea3a1 100644
--- a/actions/userdesignsettings.php
+++ b/actions/userdesignsettings.php
@@ -121,6 +121,20 @@ class UserDesignSettingsAction extends DesignSettingsAction
}
/**
+ * Shows the design settings form
+ *
+ * @param Design $design a working design to show
+ *
+ * @return nothing
+ */
+
+ function showDesignForm($design)
+ {
+ $form = new UserDesignForm($this, $design, $this->submitaction);
+ $form->show();
+ }
+
+ /**
* Save or update the user's design settings
*
* @return void
@@ -128,6 +142,8 @@ class UserDesignSettingsAction extends DesignSettingsAction
function saveDesign()
{
+ $this->saveDesignPreferences();
+
foreach ($this->args as $key => $val) {
if (preg_match('/(#ho|ho)Td.*g/i', $val)) {
$this->sethd();
@@ -164,7 +180,8 @@ class UserDesignSettingsAction extends DesignSettingsAction
$tile = true;
}
- $user = common_current_user();
+ $user = common_current_user();
+
$design = $user->getDesign();
if (!empty($design)) {
@@ -282,4 +299,64 @@ class UserDesignSettingsAction extends DesignSettingsAction
$this->showForm(_('Enjoy your hotdog!'), true);
}
+ function saveDesignPreferences()
+ {
+ $viewdesigns = $this->boolean('viewdesigns');
+
+ $user = common_current_user();
+
+ $original = clone($user);
+
+ $user->viewdesigns = $viewdesigns;
+
+ $result = $user->update($original);
+
+ if ($result === false) {
+ common_log_db_error($user, 'UPDATE', __FILE__);
+ throw new ServerException(_('Couldn\'t update user.'));
+ }
+ }
+}
+
+class UserDesignForm extends DesignForm
+{
+ function __construct($out, $design, $actionurl)
+ {
+ parent::__construct($out, $design, $actionurl);
+ }
+
+ /**
+ * Legend of the Form
+ *
+ * @return void
+ */
+ function formLegend()
+ {
+ $this->out->element('legend', null, _('Design settings'));
+ }
+
+ /**
+ * Data elements of the form
+ *
+ * @return void
+ */
+
+ function formData()
+ {
+ $user = common_current_user();
+
+ $this->out->elementStart('ul', 'form_data');
+ $this->out->elementStart('li');
+ $this->out->checkbox('viewdesigns', _('View profile designs'),
+ - $user->viewdesigns, _('Show or hide profile designs.'));
+ $this->out->elementEnd('li');
+ $this->out->elementEnd('ul');
+
+ $this->out->elementEnd('fieldset');
+
+ $this->out->elementStart('fieldset');
+ $this->out->element('legend', null, _('Background file'));
+
+ parent::formData();
+ }
}