Пример #1
0
 /**
  * Load survey security screen.
  *
  * @param int|string $iSurveyID
  * @return void
  * @todo Export HTML to view
  */
 public function index($iSurveyID)
 {
     $aData = array();
     $aData['surveyid'] = $iSurveyID = sanitize_int($iSurveyID);
     $aViewUrls = array();
     $imageurl = Yii::app()->getConfig('adminimageurl');
     if (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveysecurity', 'read')) {
         $this->getController()->error('Access denied');
         return;
     }
     $aData['sidemenu']['state'] = false;
     $oSurvey = Survey::model()->findByPk($iSurveyID);
     $surveyinfo = $oSurvey->surveyinfo;
     $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
     $aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/' . $iSurveyID;
     // Close button
     $aBaseSurveyPermissions = Permission::model()->getSurveyBasePermissions();
     $userList = getUserList('onlyuidarray');
     // Limit the user list for the samegrouppolicy
     App()->getClientScript()->registerPackage('jquery-tablesorter');
     $this->registerScriptFile('ADMIN_SCRIPT_PATH', 'surveypermissions.js');
     $surveysecurity = "<div id='edit-permission' class='side-body " . getSideBodyClass(false) . "'>";
     $surveysecurity .= App()->getController()->renderPartial('/admin/survey/breadcrumb', array('oSurvey' => $oSurvey, 'active' => gT("Survey permissions")), true, false);
     $surveysecurity .= "<h3>" . gT("Survey permissions") . "</h3>\n";
     $surveysecurity .= '<div class="row"><div class="col-lg-12 content-right">';
     $result2 = Permission::model()->getUserDetails($iSurveyID);
     if (count($result2) > 0) {
         $surveysecurity .= "" . "<table class='surveysecurity table table-striped'><thead>" . "<tr>\n" . "<th>" . gT("Action") . "</th>\n" . "<th>" . gT("Username") . "</th>\n" . "<th>" . gT("User group") . "</th>\n" . "<th>" . gT("Full name") . "</th>\n";
         foreach ($aBaseSurveyPermissions as $sPermission => $aSubPermissions) {
             $surveysecurity .= "<th>" . $aSubPermissions['title'] . "</th>\n";
         }
         $surveysecurity .= "</tr></thead>\n";
         // Foot first
         if (Yii::app()->getConfig('usercontrolSameGroupPolicy') == true) {
             $authorizedGroupsList = getUserGroupList(NULL, 'simplegidarray');
         }
         $surveysecurity .= "<tbody>\n";
         $row = 0;
         foreach ($result2 as $PermissionRow) {
             // TODO: Filter this in SQL query.
             if (!in_array($PermissionRow['uid'], $userList)) {
                 continue;
             }
             $result3 = UserInGroup::model()->with('users')->findAll('users.uid = :uid', array(':uid' => $PermissionRow['uid']));
             foreach ($result3 as $resul3row) {
                 if (Yii::app()->getConfig('usercontrolSameGroupPolicy') == false || in_array($resul3row->ugid, $authorizedGroupsList)) {
                     $group_ids[] = $resul3row->ugid;
                 }
             }
             if (isset($group_ids) && $group_ids[0] != NULL) {
                 $group_ids_query = implode(",", $group_ids);
                 unset($group_ids);
                 $result4 = UserGroup::model()->findAll("ugid IN ({$group_ids_query})");
                 foreach ($result4 as $resul4row) {
                     $group_names[] = $resul4row->name;
                 }
                 if (count($group_names) > 0) {
                     $group_names_query = implode(", ", $group_names);
                 }
             }
             //                  else {break;} //TODO Commented by lemeur
             $surveysecurity .= "<tr>\n";
             $surveysecurity .= "<td class='col-xs-1'>\n";
             if (Permission::model()->hasSurveyPermission($iSurveyID, 'surveysecurity', 'update')) {
                 if ($PermissionRow['uid'] != Yii::app()->user->getId() || Permission::model()->hasGlobalPermission('superadmin', 'read')) {
                     $surveysecurity .= CHtml::form(array("admin/surveypermission/sa/set/surveyid/{$iSurveyID}"), 'post', array('style' => "display:inline;")) . "<button type='submit' class='btn btn-default btn-xs'><span class='glyphicon glyphicon-pencil text-success' data-toggle='tooltip' title='" . gT("Edit permissions") . "'></span></button>" . "<input type='hidden' name='action' value='setsurveysecurity' />" . "<input type='hidden' name='user' value='{$PermissionRow['users_name']}' />" . "<input type='hidden' name='uid' value='{$PermissionRow['uid']}' />" . "</form>\n";
                 }
             }
             if (Permission::model()->hasSurveyPermission($iSurveyID, 'surveysecurity', 'delete')) {
                 $deleteUrl = App()->createUrl("admin/surveypermission/sa/delete/surveyid/" . $iSurveyID, array('action' => 'delsurveysecurity', 'user' => $PermissionRow['users_name'], 'uid' => $PermissionRow['uid']));
                 $deleteConfirmMessage = gT("Are you sure you want to delete this entry?");
                 $surveysecurity .= "<a data-target='#confirmation-modal' data-toggle='modal' data-message='{$deleteConfirmMessage}' data-href='{$deleteUrl}' type='submit' class='btn-xs btn btn-default'>\n                        <span class='glyphicon glyphicon-trash text-warning' data-toggle='tooltip' title='" . gT("Delete") . "'></span>\n                        </a>";
             }
             $surveysecurity .= "</td>\n";
             $surveysecurity .= "<td>{$PermissionRow['users_name']}</td>\n" . "<td>";
             if (isset($group_names) > 0) {
                 $surveysecurity .= $group_names_query;
             } else {
                 $surveysecurity .= "&#8211;";
             }
             unset($group_names);
             $surveysecurity .= "</td>\n" . "<td>\n{$PermissionRow['full_name']}</td>\n";
             //Now show the permissions
             foreach ($aBaseSurveyPermissions as $sPKey => $aPDetails) {
                 unset($aPDetails['img']);
                 unset($aPDetails['description']);
                 unset($aPDetails['title']);
                 $iCount = 0;
                 $iPermissionCount = 0;
                 $sTooltip = "";
                 foreach ($aPDetails as $sPDetailKey => $sPDetailValue) {
                     if ($sPDetailValue && Permission::model()->hasSurveyPermission($iSurveyID, $sPKey, $sPDetailKey, $PermissionRow['uid']) && !($sPKey == 'survey' && $sPDetailKey == 'read')) {
                         $iCount++;
                         $sTooltip .= $sPDetailKey . ", ";
                     }
                     if ($sPDetailValue) {
                         $iPermissionCount++;
                     }
                 }
                 if ($sPKey == 'survey') {
                     $iPermissionCount--;
                 }
                 // Remove last ',' and make first char upper-case
                 $sTooltip = substr($sTooltip, 0, -2);
                 $sTooltip = ucfirst($sTooltip);
                 // Full icon = all permissions
                 if ($iCount == $iPermissionCount) {
                     $insert = "<div data-toggle='tooltip' data-title='" . $sTooltip . "' class=\"fa fa-check\">&nbsp;</div>";
                 } elseif ($iCount > 0) {
                     $insert = "<div data-toggle='tooltip' data-title='" . $sTooltip . "' class=\"fa fa-check mixed\">&nbsp;</div>";
                 } else {
                     $insert = "<div>&#8211;</div>";
                 }
                 $surveysecurity .= "<td class='text-center' >\n{$insert}\n</td>\n";
             }
             $surveysecurity .= "</tr>\n";
             $row++;
         }
         $surveysecurity .= "</tbody>\n" . "</table>\n";
     }
     if (Permission::model()->hasSurveyPermission($iSurveyID, 'surveysecurity', 'create')) {
         $surveysecurity .= CHtml::form(array("admin/surveypermission/sa/adduser/surveyid/{$iSurveyID}"), 'post', array('class' => "form44")) . "<br/><br/><ul class='list-unstyled'>\n" . "<li><label class='col-sm-1 col-md-offset-2 text-right control-label' for='uidselect'>" . gT("User") . ": </label>\n                 <div class='col-sm-4'>\n                <select id='uidselect' name='uid'  class='form-control'>\n" . getSurveyUserList(false, false, $iSurveyID) . "</select></div>\n" . "<input style='width: 15em;' class='btn btn-default' type='submit' value='" . gT("Add user") . "'  onclick=\"if (document.getElementById('uidselect').value == -1) { alert('" . gT("Please select a user first", "js") . "'); return false;}\"/>" . "<input type='hidden' name='action' value='addsurveysecurity' />" . "</li></ul></form>\n";
         $surveysecurity .= CHtml::form(array("admin/surveypermission/sa/addusergroup/surveyid/{$iSurveyID}"), 'post', array('class' => "form44")) . "<ul class='list-unstyled'><li>\n" . "<label  class='col-sm-1 col-md-offset-2  text-right control-label'  for='ugidselect'>" . gT("User group") . ": </label>\n                <div class='col-sm-4'>\n                <select id='ugidselect' name='ugid'  class='form-control'>\n" . getSurveyUserGroupList('htmloptions', $iSurveyID) . "</select></div>\n" . "<input style='width: 15em;' class='btn btn-default'  type='submit' value='" . gT("Add user group") . "' onclick=\"if (document.getElementById('ugidselect').value == -1) { alert('" . gT("Please select a user group first", "js") . "'); return false;}\" />" . "<input type='hidden' name='action' value='addusergroupsurveysecurity' />\n" . "</li></ul></form>";
     }
     $aData['sidemenu']['state'] = false;
     $surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
     $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
     $aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/' . $iSurveyID;
     // Close button
     $surveysecurity .= '</div></div></div>';
     $aViewUrls['output'] = $surveysecurity;
     $this->_renderWrappedTemplate('authentication', $aViewUrls, $aData);
 }
Пример #2
0
 /**
  * Load survey security screen.
  * @param mixed $surveyid
  * @return void
  */
 function index($surveyid)
 {
     $aData['surveyid'] = $surveyid = sanitize_int($surveyid);
     $aViewUrls = array();
     $clang = Yii::app()->lang;
     $imageurl = Yii::app()->getConfig('adminimageurl');
     if (hasSurveyPermission($surveyid, 'survey', 'read')) {
         $aBaseSurveyPermissions = Survey_permissions::model()->getBasePermissions();
         $this->getController()->_js_admin_includes(Yii::app()->getConfig('generalscripts') . 'jquery/jquery.tablesorter.min.js');
         $this->getController()->_js_admin_includes(Yii::app()->getConfig('adminscripts') . 'surveysecurity.js');
         $result2 = Survey_permissions::model()->getUserDetails($surveyid);
         $surveysecurity = "<div class='header ui-widget-header'>" . $clang->gT("Survey permissions") . "</div>\n" . "<table class='surveysecurity'><thead>" . "<tr>\n" . "<th>" . $clang->gT("Action") . "</th>\n" . "<th>" . $clang->gT("Username") . "</th>\n" . "<th>" . $clang->gT("User group") . "</th>\n" . "<th>" . $clang->gT("Full name") . "</th>\n";
         foreach ($aBaseSurveyPermissions as $sPermission => $aSubPermissions) {
             $surveysecurity .= "<th><img src=\"{$imageurl}{$aSubPermissions['img']}_30.png\" alt=\"<span style='font-weight:bold;'>" . $aSubPermissions['title'] . "</span><br />" . $aSubPermissions['description'] . "\" /></th>\n";
         }
         $surveysecurity .= "</tr></thead>\n";
         // Foot first
         if (Yii::app()->getConfig('usercontrolSameGroupPolicy') == true) {
             $authorizedGroupsList = getUserGroupList(NULL, 'simplegidarray');
         }
         $surveysecurity .= "<tbody>\n";
         if (count($result2) > 0) {
             //    output users
             $row = 0;
             foreach ($result2 as $PermissionRow) {
                 $result3 = User_in_groups::model()->with('users')->findAll('users.uid = :uid', array(':uid' => $PermissionRow['uid']));
                 foreach ($result3 as $resul3row) {
                     if (Yii::app()->getConfig('usercontrolSameGroupPolicy') == false || in_array($resul3row->ugid, $authorizedGroupsList)) {
                         $group_ids[] = $resul3row->ugid;
                     }
                 }
                 if (isset($group_ids) && $group_ids[0] != NULL) {
                     $group_ids_query = implode(",", $group_ids);
                     unset($group_ids);
                     $result4 = User_groups::model()->findAll("ugid IN ({$group_ids_query})");
                     foreach ($result4 as $resul4row) {
                         $group_names[] = $resul4row->name;
                     }
                     if (count($group_names) > 0) {
                         $group_names_query = implode(", ", $group_names);
                     }
                 }
                 //                  else {break;} //TODO Commented by lemeur
                 $surveysecurity .= "<tr>\n";
                 $surveysecurity .= "<td>\n";
                 $surveysecurity .= CHtml::form(array("admin/surveypermission/sa/set/surveyid/{$surveyid}"), 'post', array('style' => "display:inline;")) . "<input type='image' src='{$imageurl}edit_16.png' alt='" . $clang->gT("Edit permissions") . "' />" . "<input type='hidden' name='action' value='setsurveysecurity' />" . "<input type='hidden' name='user' value='{$PermissionRow['users_name']}' />" . "<input type='hidden' name='uid' value='{$PermissionRow['uid']}' />" . "</form>\n";
                 $surveysecurity .= CHtml::form(array("admin/surveypermission/sa/delete/surveyid/{$surveyid}"), 'post', array('style' => "display:inline;")) . "<input type='image' src='{$imageurl}/token_delete.png' alt='" . $clang->gT("Delete") . "' onclick='return confirm(\"" . $clang->gT("Are you sure you want to delete this entry?", "js") . "\")' />" . "<input type='hidden' name='action' value='delsurveysecurity' />" . "<input type='hidden' name='user' value='{$PermissionRow['users_name']}' />" . "<input type='hidden' name='uid' value='{$PermissionRow['uid']}' />" . "</form>";
                 $surveysecurity .= "</td>\n";
                 $surveysecurity .= "<td>{$PermissionRow['users_name']}</td>\n" . "<td>";
                 if (isset($group_names) > 0) {
                     $surveysecurity .= $group_names_query;
                 } else {
                     $surveysecurity .= "---";
                 }
                 unset($group_names);
                 $surveysecurity .= "</td>\n" . "<td>\n{$PermissionRow['full_name']}</td>\n";
                 //Now show the permissions
                 foreach ($aBaseSurveyPermissions as $sPKey => $aPDetails) {
                     unset($aPDetails['img']);
                     unset($aPDetails['description']);
                     unset($aPDetails['title']);
                     $iCount = 0;
                     $iPermissionCount = 0;
                     foreach ($aPDetails as $sPDetailKey => $sPDetailValue) {
                         if ($sPDetailValue && hasSurveyPermission($surveyid, $sPKey, $sPDetailKey, $PermissionRow['uid']) && !($sPKey == 'survey' && $sPDetailKey == 'read')) {
                             $iCount++;
                         }
                         if ($sPDetailValue) {
                             $iPermissionCount++;
                         }
                     }
                     if ($sPKey == 'survey') {
                         $iPermissionCount--;
                     }
                     if ($iCount == $iPermissionCount) {
                         $insert = "<div class=\"ui-icon ui-icon-check\">&nbsp;</div>";
                     } elseif ($iCount > 0) {
                         $insert = "<div class=\"ui-icon ui-icon-check mixed\">&nbsp;</div>";
                     } else {
                         $insert = "<div>&nbsp;</div>";
                     }
                     $surveysecurity .= "<td>\n{$insert}\n</td>\n";
                 }
                 $surveysecurity .= "</tr>\n";
                 $row++;
             }
         } else {
             $surveysecurity .= "<tr><td colspan='16'></td></tr>";
             //fix error on empty table
         }
         $surveysecurity .= "</tbody>\n" . "</table>\n" . CHtml::form(array("admin/surveypermission/sa/adduser/surveyid/{$surveyid}"), 'post', array('class' => "form44")) . "<ul>\n" . "<li><label for='uidselect'>" . $clang->gT("User") . ": </label><select id='uidselect' name='uid'>\n" . getSurveyUserList(false, false, $surveyid) . "</select>\n" . "<input style='width: 15em;' type='submit' value='" . $clang->gT("Add User") . "'  onclick=\"if (document.getElementById('uidselect').value == -1) { alert('" . $clang->gT("Please select a user first", "js") . "'); return false;}\"/>" . "<input type='hidden' name='action' value='addsurveysecurity' />" . "</li></ul></form>\n" . CHtml::form(array("admin/surveypermission/sa/addusergroup/surveyid/{$surveyid}"), 'post', array('class' => "form44")) . "<ul><li>\n" . "<label for='ugidselect'>" . $clang->gT("Groups") . ": </label><select id='ugidselect' name='ugid'>\n" . getSurveyUserGroupList('htmloptions', $surveyid) . "</select>\n" . "<input style='width: 15em;' type='submit' value='" . $clang->gT("Add user group") . "' onclick=\"if (document.getElementById('ugidselect').value == -1) { alert('" . $clang->gT("Please select a user group first", "js") . "'); return false;}\" />" . "<input type='hidden' name='action' value='addusergroupsurveysecurity' />\n" . "</li></ul></form>";
         $aViewUrls['output'] = $surveysecurity;
     } else {
         accessDenied();
     }
     $this->_renderWrappedTemplate('authentication', $aViewUrls, $aData);
 }
Пример #3
0
 /**
  * Load survey security screen.
  * @param mixed $surveyid
  * @return void
  */
 function index($surveyid)
 {
     $aData['surveyid'] = $iSurveyID = $surveyid = sanitize_int($surveyid);
     $imageurl = Yii::app()->getConfig('adminimageurl');
     if (Permission::model()->hasSurveyPermission($surveyid, 'surveysecurity', 'read')) {
         $aData['sidebar']['state'] = "close";
         $surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
         $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
         //$aData['surveybar']['savebutton']['form'] = 'frmeditgroup';
         $aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/' . $iSurveyID;
         $aBaseSurveyPermissions = Permission::model()->getSurveyBasePermissions();
         $userList = getUserList('onlyuidarray');
         // Limit the user list for the samegrouppolicy
         App()->getClientScript()->registerPackage('jquery-tablesorter');
         App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . "surveypermissions.js");
         $surveysecurity = '<div class="side-body" id="edit-permissions">';
         $surveysecurity .= "<h3>" . gT("Survey permissions") . "</h3>\n";
         $surveysecurity .= '<div class="row"><div class="col-lg-12 content-right">';
         $result2 = Permission::model()->getUserDetails($surveyid);
         if (count($result2) > 0) {
             $surveysecurity .= "" . "<table class='surveysecurity table table-striped'><thead>" . "<tr>\n" . "<th>" . gT("Action") . "</th>\n" . "<th>" . gT("Username") . "</th>\n" . "<th>" . gT("User group") . "</th>\n" . "<th>" . gT("Full name") . "</th>\n";
             foreach ($aBaseSurveyPermissions as $sPermission => $aSubPermissions) {
                 $surveysecurity .= "<th><img src=\"{$imageurl}{$aSubPermissions['img']}_30.png\" alt=\"<span style='font-weight:bold;'>" . $aSubPermissions['title'] . "</span><br />" . $aSubPermissions['description'] . "\" /></th>\n";
             }
             $surveysecurity .= "</tr></thead>\n";
             // Foot first
             if (Yii::app()->getConfig('usercontrolSameGroupPolicy') == true) {
                 $authorizedGroupsList = getUserGroupList(NULL, 'simplegidarray');
             }
             $surveysecurity .= "<tbody>\n";
             $row = 0;
             foreach ($result2 as $PermissionRow) {
                 if (in_array($PermissionRow['uid'], $userList)) {
                     $result3 = UserInGroup::model()->with('users')->findAll('users.uid = :uid', array(':uid' => $PermissionRow['uid']));
                     foreach ($result3 as $resul3row) {
                         if (Yii::app()->getConfig('usercontrolSameGroupPolicy') == false || in_array($resul3row->ugid, $authorizedGroupsList)) {
                             $group_ids[] = $resul3row->ugid;
                         }
                     }
                     if (isset($group_ids) && $group_ids[0] != NULL) {
                         $group_ids_query = implode(",", $group_ids);
                         unset($group_ids);
                         $result4 = UserGroup::model()->findAll("ugid IN ({$group_ids_query})");
                         foreach ($result4 as $resul4row) {
                             $group_names[] = $resul4row->name;
                         }
                         if (count($group_names) > 0) {
                             $group_names_query = implode(", ", $group_names);
                         }
                     }
                     //                  else {break;} //TODO Commented by lemeur
                     $surveysecurity .= "<tr>\n";
                     $surveysecurity .= "<td>\n";
                     if (Permission::model()->hasSurveyPermission($surveyid, 'surveysecurity', 'update')) {
                         if ($PermissionRow['uid'] != Yii::app()->user->getId() || Permission::model()->hasGlobalPermission('superadmin', 'read')) {
                             $surveysecurity .= CHtml::form(array("admin/surveypermission/sa/set/surveyid/{$surveyid}"), 'post', array('style' => "display:inline;")) . "<input type='image' src='{$imageurl}edit_16.png' alt='" . gT("Edit permissions") . "' />" . "<input type='hidden' name='action' value='setsurveysecurity' />" . "<input type='hidden' name='user' value='{$PermissionRow['users_name']}' />" . "<input type='hidden' name='uid' value='{$PermissionRow['uid']}' />" . "</form>\n";
                         }
                     }
                     if (Permission::model()->hasSurveyPermission($surveyid, 'surveysecurity', 'delete')) {
                         $surveysecurity .= CHtml::form(array("admin/surveypermission/sa/delete/surveyid/{$surveyid}"), 'post', array('style' => "display:inline;")) . "<input type='image' src='{$imageurl}/token_delete.png' alt='" . gT("Delete") . "' onclick='return confirm(\"" . gT("Are you sure you want to delete this entry?", "js") . "\")' />" . "<input type='hidden' name='action' value='delsurveysecurity' />" . "<input type='hidden' name='user' value='{$PermissionRow['users_name']}' />" . "<input type='hidden' name='uid' value='{$PermissionRow['uid']}' />" . "</form>";
                     }
                     $surveysecurity .= "</td>\n";
                     $surveysecurity .= "<td>{$PermissionRow['users_name']}</td>\n" . "<td>";
                     if (isset($group_names) > 0) {
                         $surveysecurity .= $group_names_query;
                     } else {
                         $surveysecurity .= "---";
                     }
                     unset($group_names);
                     $surveysecurity .= "</td>\n" . "<td>\n{$PermissionRow['full_name']}</td>\n";
                     //Now show the permissions
                     foreach ($aBaseSurveyPermissions as $sPKey => $aPDetails) {
                         unset($aPDetails['img']);
                         unset($aPDetails['description']);
                         unset($aPDetails['title']);
                         $iCount = 0;
                         $iPermissionCount = 0;
                         foreach ($aPDetails as $sPDetailKey => $sPDetailValue) {
                             if ($sPDetailValue && Permission::model()->hasSurveyPermission($surveyid, $sPKey, $sPDetailKey, $PermissionRow['uid']) && !($sPKey == 'survey' && $sPDetailKey == 'read')) {
                                 $iCount++;
                             }
                             if ($sPDetailValue) {
                                 $iPermissionCount++;
                             }
                         }
                         if ($sPKey == 'survey') {
                             $iPermissionCount--;
                         }
                         if ($iCount == $iPermissionCount) {
                             $insert = "<div class=\"ui-icon ui-icon-check\">&nbsp;</div>";
                         } elseif ($iCount > 0) {
                             $insert = "<div class=\"ui-icon ui-icon-check mixed\">&nbsp;</div>";
                         } else {
                             $insert = "<div>&nbsp;</div>";
                         }
                         $surveysecurity .= "<td>\n{$insert}\n</td>\n";
                     }
                     $surveysecurity .= "</tr>\n";
                     $row++;
                 }
             }
             $surveysecurity .= "</tbody>\n" . "</table>\n";
         } else {
         }
         if (Permission::model()->hasSurveyPermission($surveyid, 'surveysecurity', 'create')) {
             $surveysecurity .= CHtml::form(array("admin/surveypermission/sa/adduser/surveyid/{$surveyid}"), 'post', array('class' => "form44")) . "<br/><br/><ul class='list-unstyled'>\n" . "<li><label class='col-sm-1 col-md-offset-2 text-right control-label' for='uidselect'>" . gT("User") . ": </label>\n                     <div class='col-sm-4'>\n                    <select id='uidselect' name='uid'  class='form-control'>\n" . getSurveyUserList(false, false, $surveyid) . "</select></div>\n" . "<input style='width: 15em;' class='btn btn-default' type='submit' value='" . gT("Add user") . "'  onclick=\"if (document.getElementById('uidselect').value == -1) { alert('" . gT("Please select a user first", "js") . "'); return false;}\"/>" . "<input type='hidden' name='action' value='addsurveysecurity' />" . "</li></ul></form>\n";
             $surveysecurity .= CHtml::form(array("admin/surveypermission/sa/addusergroup/surveyid/{$surveyid}"), 'post', array('class' => "form44")) . "<ul class='list-unstyled'><li>\n" . "<label  class='col-sm-1 col-md-offset-2  text-right control-label'  for='ugidselect'>" . gT("User group") . ": </label>\n                    <div class='col-sm-4'>\n                    <select id='ugidselect' name='ugid'  class='form-control'>\n" . getSurveyUserGroupList('htmloptions', $surveyid) . "</select></div>\n" . "<input style='width: 15em;' class='btn btn-default'  type='submit' value='" . gT("Add user group") . "' onclick=\"if (document.getElementById('ugidselect').value == -1) { alert('" . gT("Please select a user group first", "js") . "'); return false;}\" />" . "<input type='hidden' name='action' value='addusergroupsurveysecurity' />\n" . "</li></ul></form>";
         }
         $aData['sidebar']['state'] = "close";
         $surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
         $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
         $aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/' . $iSurveyID;
         $surveysecurity .= '</div></div></div>';
         $aViewUrls['output'] = $surveysecurity;
     } else {
         $this->getController()->error('Access denied');
     }
     $this->_renderWrappedTemplate('authentication', $aViewUrls, $aData);
 }