Quote:
Originally Posted by subnet_rx
Another quick question. I have certain surveys marked as hidden and inactive, yet they still show up for everyone on the Edit Survey menu. Is there a way to hide this entire menu if the usergroup doesn't have permission to edit any surveys?
|
Open classes/survey.class.php and find:
PHP Code:
$this->smarty->assign_by_ref('show',$show);
Add befor it:
PHP Code:
if($this->_hasPriv(EDIT_PRIV))
{ $show['edit_survey'] = TRUE; }
else
{ $show['edit_survey'] = FALSE; }
then open templates/Default/available_surveys.tpl and find:
HTML Code:
<tr>
<td class="panelsurround" align="center">
<div class="panel">
<div style="width:{$stylevar.formwidth}" align="{$stylevar.left}">
<fieldset class="fieldset">
<legend> Edit Surveys </legend>
<table cellpadding="0" cellspacing="{$stylevar.formspacer}" border="0" width="100%">
<tr>
<td>
<form class="indented_cell" method="get" action="{$conf.html}/survey.php?do=edit_survey">
<input type="hidden" name="do" value="edit_survey">
<input type="hidden" name="s" value="{$session.dbsessionhash}" />
Survey:
<select name="sid" size="1">
{section name="as" loop=$survey.all_surveys.sid}
<option value="{$survey.all_surveys.sid[as]}">{$survey.all_surveys.name[as]}</option>
{/section}
</select>
<input type="submit" name="submit" value="Edit Survey">
</form>
</td>
</tr>
</table>
</fieldset>
</div>
</div>
</td>
</tr>
And replace with this:
HTML Code:
{section name="create_link" show=$show.edit_survey}
<tr>
<td class="panelsurround" align="center">
<div class="panel">
<div style="width:{$stylevar.formwidth}" align="{$stylevar.left}">
<fieldset class="fieldset">
<legend> Edit Surveys </legend>
<table cellpadding="0" cellspacing="{$stylevar.formspacer}" border="0" width="100%">
<tr>
<td>
<form class="indented_cell" method="get" action="{$conf.html}/survey.php?do=edit_survey">
<input type="hidden" name="do" value="edit_survey">
<input type="hidden" name="s" value="{$session.dbsessionhash}" />
Survey:
<select name="sid" size="1">
{section name="as" loop=$survey.all_surveys.sid}
<option value="{$survey.all_surveys.sid[as]}">{$survey.all_surveys.name[as]}</option>
{/section}
</select>
<input type="submit" name="submit" value="Edit Survey">
</form>
</td>
</tr>
</table>
</fieldset>
</div>
</div>
</td>
</tr>
{/section}