Skip to content

Commit

Permalink
Merge branch 'task/zoho-L41-T351-reset-question-theme'
Browse files Browse the repository at this point in the history
  • Loading branch information
Trischi80 committed Feb 12, 2021
2 parents 372badb + 59fb34f commit c5c1953
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions application/controllers/ThemeOptionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,22 @@ public function actionCreate()
public function actionResetMultiple()
{
$aTemplates = json_decode(App()->request->getPost('sItems'));
$gridid = App()->request->getPost('gridvalue');
$gridid = App()->request->getPost('grididvalue');
$aResults = array();

if (Permission::model()->hasGlobalPermission('templates', 'updates')) {
if (Permission::model()->hasGlobalPermission('template', 'update')) {
foreach ($aTemplates as $template) {
$model = $this->loadModel($template, $gridid);

if ($gridid === 'questionthemes-grid') {
/** @var $model QuestionTheme */
$model = QuestionTheme::model()->findByPk($template);
$templatename = $model->name;
$templatefolder = $model->xml_path;
$aResults[$template]['title'] = $templatename;
$sQuestionThemeName = $model->importManifest($templatefolder);
$aResults[$template]['result'] = isset($sQuestionThemeName) ? true : false;
} elseif ($gridid === 'themeoptions-grid') {
$model = TemplateConfiguration::model()->findByPk($template);
$templatename = $model->template_name;
$aResults[$template]['title'] = $templatename;
$aResults[$template]['result'] = TemplateConfiguration::uninstall($templatename);
Expand All @@ -152,7 +154,8 @@ public function actionResetMultiple()
)
);
} else {
App()->setFlashMessage(gT("We are sorry but you don't have permissions to do this."), 'error');
//todo: this message gets never visible for the user ...
App()->setFlashMessage(gT("We are sorry but you don't have permissions to do this."), 'error');
}
}

Expand Down
4 changes: 2 additions & 2 deletions application/views/themeOptions/_selector.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
'modalType' => 'yes-no',
'keepopen' => 'yes',
'showSelected' => 'yes',
'selectedUrl' => App()->createUrl('themeOptions/renderSelectedItems/'),
'selectedUrl' => App()->createUrl('themeOptions/selectedItems/'),
'yes' => gT('Reset Themes'),
'no' => gT('Cancel'),
'sModalTitle' => gT('Reset theme'),
Expand All @@ -51,7 +51,7 @@
'modalType' => 'yes-no',
'keepopen' => 'yes',
'showSelected' => 'yes',
'selectedUrl' => App()->createUrl('themeOptions/renderSelectedItems/'),
'selectedUrl' => App()->createUrl('themeOptions/selectedItems/'),
'sModalTitle' => gT('Uninstall themes'),
'htmlModalBody' => gT('Are you sure you want to uninstall the selected themes?'),
)
Expand Down

0 comments on commit c5c1953

Please sign in to comment.