diff --git a/application/controllers/ThemeOptionsController.php b/application/controllers/ThemeOptionsController.php index bbe6a04f37e..6992cfc707f 100644 --- a/application/controllers/ThemeOptionsController.php +++ b/application/controllers/ThemeOptionsController.php @@ -474,7 +474,7 @@ public function actionIndex() // White Bar with Buttons $aData['fullpagebar']['returnbutton'] = [ - 'url' => 'index', + 'url' => 'admin/index', 'text' => gT('Back'), ]; diff --git a/application/controllers/UserManagementController.php b/application/controllers/UserManagementController.php index ba24dba128f..4ba31aa57d2 100644 --- a/application/controllers/UserManagementController.php +++ b/application/controllers/UserManagementController.php @@ -343,7 +343,7 @@ public function actionDeleteConfirm() /** * Show some user detail and statistics * - * @param $userid int + * @param int $userid * @return string|null * @throws CException */ @@ -619,7 +619,7 @@ public function actionRenderUserImport(string $importFormat = 'csv') /** * Creates users from an uploaded CSV / JSON file * - * @param string importFormat - format of the imported file - Choice between csv / json + * @param string $importFormat - format of the imported file - Choice between csv / json * @return string * @throws CException */ @@ -888,6 +888,9 @@ public function actionBatchSendAndResetLoginData() $passwordManagement = new \LimeSurvey\Models\Services\PasswordManagement($oUser); $successData = $passwordManagement->sendPasswordLinkViaEmail(\LimeSurvey\Models\Services\PasswordManagement::EMAIL_TYPE_RESET_PW); $success = $successData['success']; + if (!$success) { + $aResults[$user]['error'] = sprintf(gT("Error: New password could not be sent to %s"), $oUser->email); + } $aResults[$user]['result'] = $success; } } diff --git a/application/controllers/UserRoleController.php b/application/controllers/UserRoleController.php index a676a91a3a9..df82822792f 100644 --- a/application/controllers/UserRoleController.php +++ b/application/controllers/UserRoleController.php @@ -68,10 +68,10 @@ public function actionIndex() /** * Returns the modal view for adding/editing a user role * - * @param null $ptid + * @param int $ptid (optional) * @throws CException */ - public function actionEditRoleModal($ptid = null) + public function actionEditRoleModal(?int $ptid = 0) { if (!Permission::model()->hasGlobalPermission('superadmin', 'read')) { Yii::app()->session['flashmessage'] = gT('You have no access to the role management!'); diff --git a/application/controllers/admin/quotas.php b/application/controllers/admin/quotas.php index ee9f069bff9..003752489ca 100644 --- a/application/controllers/admin/quotas.php +++ b/application/controllers/admin/quotas.php @@ -126,9 +126,13 @@ public function massiveAction() } } - public function index($iSurveyId, $quickreport = false) + /** + * Index + * @param int $iSurveyId + * @param bool $quickreport Default is false + */ + public function index(int $iSurveyId, bool $quickreport = false) { - $iSurveyId = sanitize_int($iSurveyId); $this->_checkPermissions($iSurveyId, 'read'); $aData = $this->_getData($iSurveyId); @@ -147,7 +151,7 @@ public function index($iSurveyId, $quickreport = false) $aData['title_bar']['title'] = $oSurvey->currentLanguageSettings->surveyls_title . " (" . gT("ID") . ":" . $iSurveyID . ")"; $aData['subaction'] = gT("Survey quotas"); - //$aData['surveybar']['active_survey_properties'] = 'quotas'; + // TODO: I dont think that is is needed anymore. Remove it. $aData['surveybar']['buttons']['view'] = true; $aData['surveybar']['active_survey_properties']['img'] = 'quota'; $aData['surveybar']['active_survey_properties']['txt'] = gT("Quotas"); @@ -170,9 +174,13 @@ public function index($iSurveyId, $quickreport = false) ), )); - //if there are quotas let's proceed $aViewUrls['output'] = ''; + + // TopBar + $aData['topBar']['name'] = 'surveyTopbar_view'; + $aData['topBar']['leftSideView'] = 'quotasTopbarLeft_view'; + if (!empty($oSurvey->quotas)) { $aData['output'] = ''; $aQuotaItems = array(); @@ -237,7 +245,6 @@ public function index($iSurveyId, $quickreport = false) } } else { // No quotas have been set for this survey - //$aViewUrls[] = 'viewquotasempty_view'; $aData['output'] = $this->getController()->renderPartial('/admin/quotas/viewquotasempty_view', $aData, true); } @@ -258,8 +265,11 @@ public function index($iSurveyId, $quickreport = false) } } - - public function insertquotaanswer($iSurveyId) + /** + * Insert Quota answer + * @param int $iSurveyId + */ + public function insertquotaanswer(int $iSurveyId) { $iSurveyId = sanitize_int($iSurveyId); $this->_checkPermissions($iSurveyId, 'update'); @@ -287,7 +297,11 @@ public function insertquotaanswer($iSurveyId) } } - public function delans($iSurveyId) + /** + * Delete answers + * @param int $iSurveyId + */ + public function delans(int $iSurveyId) { $iSurveyId = sanitize_int($iSurveyId); $this->_checkPermissions($iSurveyId, 'update'); @@ -301,7 +315,11 @@ public function delans($iSurveyId) self::_redirectToIndex($iSurveyId); } - public function delquota($iSurveyId) + /** + * Delete Quota + * @param int iSurveyId + */ + public function delquota(int $iSurveyId) { $this->requirePostRequest(); @@ -319,7 +337,11 @@ public function delquota($iSurveyId) self::_redirectToIndex($iSurveyId); } - function editquota($iSurveyId) + /** + * Edit Quota + * @param int iSurveyId + */ + function editquota(int $iSurveyId) { $iSurveyId = sanitize_int($iSurveyId); $oSurvey = Survey::model()->findByPk($iSurveyId); @@ -354,7 +376,6 @@ function editquota($iSurveyId) } } - $aData['oQuota'] = $oQuota; $aData['aQuotaLanguageSettings'] = array(); foreach ($oQuota->languagesettings as $languagesetting) { @@ -366,7 +387,6 @@ function editquota($iSurveyId) $aData['sidemenu']['state'] = false; $aData['title_bar']['title'] = $oSurvey->currentLanguageSettings->surveyls_title . " (" . gT("ID") . ":" . $iSurveyId . ")"; - //$aData['surveybar']['active_survey_properties'] = 'quotas'; $aData['surveybar']['closebutton']['url'] = 'admin/quotas/sa/index/surveyid/' . $iSurveyId; // Close button $aData['surveybar']['savebutton']['form'] = 'frmeditgroup'; $aData['topBar']['showSaveButton'] = true; @@ -412,7 +432,7 @@ public function new_answer($iSurveyId, $sSubAction = 'new_answer') foreach ($aQuestionAnswers as $aQACheck) { if (isset($aQACheck['rowexists'])) { - $x++; + $x++; } } @@ -431,7 +451,11 @@ public function new_answer($iSurveyId, $sSubAction = 'new_answer') $this->_renderWrappedTemplate('quotas', $aViewUrls, $aData); } - public function newquota($iSurveyId) + /** + * New Quota + * @param int iSurveyId + */ + public function newquota(int $iSurveyId) { $iSurveyId = sanitize_int($iSurveyId); $oSurvey = Survey::model()->findByPk($iSurveyId); @@ -451,7 +475,6 @@ public function newquota($iSurveyId) $oQuota = new Quota(); $oQuota->sid = $oSurvey->primaryKey; - if (isset($_POST['Quota'])) { $oQuota->attributes = $_POST['Quota']; if ($oQuota->save()) { @@ -461,7 +484,6 @@ public function newquota($iSurveyId) $oQuotaLanguageSetting->quotals_quota_id = $oQuota->primaryKey; $oQuotaLanguageSetting->quotals_language = $language; - //Clean XSS - Automatically provided by CI $oQuotaLanguageSetting->quotals_message = html_entity_decode($oQuotaLanguageSetting->quotals_message, ENT_QUOTES, "UTF-8"); // Fix bug with FCKEditor saving strange BR types @@ -503,13 +525,13 @@ public function newquota($iSurveyId) } /** - * + * Get Quota Answers * @param integer $iQuestionId * @param integer $iSurveyId * @param integer $iQuotaId * @return array */ - public function getQuotaAnswers($iQuestionId, $iSurveyId, $iQuotaId) + public function getQuotaAnswers(int $iQuestionId, int $iSurveyId, int $iQuotaId) { $iQuestionId = sanitize_int($iQuestionId); $iSurveyId = sanitize_int($iSurveyId); @@ -519,7 +541,6 @@ public function getQuotaAnswers($iQuestionId, $iSurveyId, $iQuotaId) $this->_checkPermissions($iSurveyId, 'read'); $oSurvey = Survey::model()->findByPk($iSurveyId); - $aQuestion = Question::model() ->with('questionl10ns', array('language' => $sBaseLang)) ->findByPk(array('qid' => $iQuestionId)); @@ -605,9 +626,10 @@ public function getQuotaAnswers($iQuestionId, $iSurveyId, $iQuotaId) /** * Renders template(s) wrapped in header and footer * - * @param string $sAction Current action, the folder to fetch views from - * @param string|array $aViewUrls View url(s) - * @param array $aData Data to be passed on. Optional. + * @param string $sAction Current action, the folder to fetch views from. Default is 'quotas'. + * @param string|array $aViewUrls View url(s) + * @param array $aData Data to be passed on. Optional. + * @param bool $sRenderFile Default is false. */ protected function _renderWrappedTemplate($sAction = 'quotas', $aViewUrls = array(), $aData = array(), $sRenderFile = false) { diff --git a/application/extensions/TopbarWidget/views/includes/quotasTopbarLeft_view.php b/application/extensions/TopbarWidget/views/includes/quotasTopbarLeft_view.php new file mode 100644 index 00000000000..7132c8135ab --- /dev/null +++ b/application/extensions/TopbarWidget/views/includes/quotasTopbarLeft_view.php @@ -0,0 +1,9 @@ + +', '_top')"> + + + + +"> + + \ No newline at end of file diff --git a/application/extensions/TopbarWidget/views/includes/tokensTopbarLeft_view.php b/application/extensions/TopbarWidget/views/includes/tokensTopbarLeft_view.php index 3175066a7bc..54b153084ca 100644 --- a/application/extensions/TopbarWidget/views/includes/tokensTopbarLeft_view.php +++ b/application/extensions/TopbarWidget/views/includes/tokensTopbarLeft_view.php @@ -168,3 +168,9 @@ + + + + + + diff --git a/application/views/admin/quotas/viewquotas_view.php b/application/views/admin/quotas/viewquotas_view.php index b2b26e92296..3b5f686ee79 100644 --- a/application/views/admin/quotas/viewquotas_view.php +++ b/application/views/admin/quotas/viewquotas_view.php @@ -81,12 +81,6 @@ 'header' => gT('Completed'), 'type' => 'raw', 'htmlOptions' => array('style' => 'vertical-align:top'), - // 'value'=>function($oQuota)use($oSurvey){ - // $completerCount =getQuotaCompletedCount($oSurvey->sid, $oQuota->id); - // $class = ($completerCount <= $oQuota->qlimit ? 'text-warning':null); - // $span = CHtml::tag('span',array('class'=>$class),$completerCount); - // return $span; - // }, 'footer' => $totalcompleted, ), array( @@ -139,11 +133,6 @@ getPrimaryKey());?> - " onClick="window.open('createUrl("admin/quotas/sa/index/surveyid/$surveyid/quickreport/y") ?>', '_top')" /> - 'submit', - 'class'=>'quota_new btn btn-default', - ));?> diff --git a/application/views/admin/super/fullpagebar_view.php b/application/views/admin/super/fullpagebar_view.php index 2c17cfcfe08..e6d437de9c1 100644 --- a/application/views/admin/super/fullpagebar_view.php +++ b/application/views/admin/super/fullpagebar_view.php @@ -9,6 +9,8 @@