<img src='<?php 
        echo $sImageURL;
        ?>
delete_disabled.png' alt='<?php 
        $clang->eT("You don't have permission to delete this entry.");
        ?>
'/>
                    <?php 
    }
    if (hasFileUploadQuestion($surveyid)) {
        ?>
                    <a href='#' title='<?php 
        $clang->eT("Download files for this entry");
        ?>
' onclick="<?php 
        echo convertGETtoPOST('?action=browse&amp;subaction=all&amp;downloadfile=' . $id . '&amp;sid=' . $surveyid);
        ?>
" >
                        <img src='<?php 
        echo $sImageURL;
        ?>
download.png' alt='<?php 
        $clang->eT("Download files for this entry");
        ?>
' /></a>
                    <?php 
    }
    ?>

                <a href='<?php 
    echo $this->createUrl("admin/export/sa/exportresults/surveyid/{$surveyid}/id/{$id}");
Example #2
0
 public function getbuttons()
 {
     $url = Yii::app()->createUrl("/admin/questions/sa/view/surveyid/");
     $url .= '/' . $this->sid . '/gid/' . $this->gid . '/qid/' . $this->qid;
     $button = '<a class="btn btn-default" href="' . $url . '" role="button"><span class="glyphicon glyphicon-pencil" ></span></a>';
     $previewUrl = Yii::app()->createUrl("survey/index/action/previewquestion/sid/");
     $previewUrl .= '/' . $this->sid . '/gid/' . $this->gid . '/qid/' . $this->qid;
     $editurl = Yii::app()->createUrl("admin/questions/sa/editquestion/surveyid/{$this->sid}/gid/{$this->gid}/qid/{$this->qid}");
     $button = '<a class="btn btn-default open-preview"  data-toggle="tooltip" title="' . gT("Question preview") . '"  aria-data-url="' . $previewUrl . '" aria-data-sid="' . $this->sid . '" aria-data-gid="' . $this->gid . '" aria-data-qid="' . $this->qid . '" aria-data-language="' . $this->language . '" href="# role="button" ><span class="glyphicon glyphicon-eye-open"  ></span></a> ';
     if (Permission::model()->hasSurveyPermission($this->sid, 'surveycontent', 'update')) {
         $button .= '<a class="btn btn-default"  data-toggle="tooltip" title="' . gT("Edit question") . '" href="' . $editurl . '" role="button"><span class="glyphicon glyphicon-pencil" ></span></a>';
     }
     if (Permission::model()->hasSurveyPermission($this->sid, 'surveycontent', 'read')) {
         $button .= '<a class="btn btn-default"  data-toggle="tooltip" title="' . gT("Question summary") . '" href="' . $url . '" role="button"><span class="glyphicon glyphicon-list-alt" ></span></a>';
     }
     $oSurvey = Survey::model()->findByPk($this->sid);
     if ($oSurvey->active != "Y" && Permission::model()->hasSurveyPermission($this->sid, 'surveycontent', 'delete')) {
         $button .= '<a class="btn btn-default"  data-toggle="tooltip" title="' . gT("Delete") . '" href="#" role="button"
                         onclick="if (confirm(\' ' . gT("Deleting  will also delete any answer options and subquestions it includes. Are you sure you want to continue?", "js") . ' \' )){ ' . convertGETtoPOST(Yii::app()->createUrl("admin/questions/sa/delete/surveyid/{$this->sid}/gid/{$this->gid}/qid/{$this->qid}")) . '} ">
                             <span class="text-danger glyphicon glyphicon-trash"></span>
                         </a>';
     }
     return $button;
 }
Example #3
0
 /**
  * Generate tokens
  */
 function tokenify($iSurveyId)
 {
     $iSurveyId = sanitize_int($iSurveyId);
     $clang = $this->getController()->lang;
     if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update')) {
         Yii::app()->session['flashmessage'] = $clang->gT("You do not have sufficient rights to access this page.");
         $this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
     }
     // CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
     $bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
     if (!$bTokenExists) {
         self::_newtokentable($iSurveyId);
     }
     $aData['thissurvey'] = getSurveyInfo($iSurveyId);
     $aData['surveyid'] = $iSurveyId;
     if (!Yii::app()->request->getParam('ok')) {
         $this->_renderWrappedTemplate('token', array('tokenbar', 'message' => array('title' => $clang->gT("Create tokens"), 'message' => $clang->gT("Clicking 'Yes' will generate tokens for all those in this token list that have not been issued one. Continue?") . "<br /><br />\n" . "<input type='submit' value='" . $clang->gT("Yes") . "' onclick=\"" . convertGETtoPOST($this->getController()->createUrl("admin/tokens/sa/tokenify/surveyid/{$iSurveyId}", array('ok' => 'Y'))) . "\" />\n" . "<input type='submit' value='" . $clang->gT("No") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/sa/index/surveyid/{$iSurveyId}") . "', '_top')\" />\n" . "<br />\n")), $aData);
     } else {
         //get token length from survey settings
         $newtoken = TokenDynamic::model($iSurveyId)->createTokens($iSurveyId);
         $newtokencount = $newtoken['0'];
         $neededtokencount = $newtoken['1'];
         if ($neededtokencount > $newtokencount) {
             $aData['success'] = false;
             $message = sprintf($clang->ngT('Only %s token has been created.', 'Only %s tokens have been created.', $newtokencount), $newtokencount) . sprintf($clang->ngT('Need %s token.', 'Need %s tokens.', $neededtokencount), $neededtokencount);
         } else {
             $aData['success'] = true;
             $message = sprintf($clang->ngT('%s token has been created.', '%s tokens have been created.', $newtokencount), $newtokencount);
         }
         $this->_renderWrappedTemplate('token', array('tokenbar', 'message' => array('title' => $clang->gT("Create tokens"), 'message' => $message)), $aData);
     }
 }
} else {
    ?>
                <img src='<?php 
    echo $imageurl;
    ?>
blank.gif' alt='' width='40' height='20' />
                <?php 
}
if ($ugid && $grpresultcount > 0 && (Yii::app()->session['loginID'] == $grow['owner_id'] || hasGlobalPermission('USER_RIGHT_SUPERADMIN'))) {
    ?>

                <a href='#' onclick="if (confirm('<?php 
    $clang->eT("Are you sure you want to delete this entry?", "js");
    ?>
')) { <?php 
    echo convertGETtoPOST($this->createUrl('admin/usergroups/delete') . "?action=delusergroup&amp;ugid={$ugid}");
    ?>
}">
                    <img src='<?php 
    echo $imageurl;
    ?>
delete.png' alt='<?php 
    $clang->eT("Delete current user group");
    ?>
' name='DeleteUserGroup'  /></a>
                <?php 
} else {
    ?>
                <img src='<?php 
    echo $imageurl;
    ?>
            ?>
' role="button">

                        <span class="glyphicon glyphicon-pencil text-success"></span>
                        <?php 
            eT("Edit this entry");
            ?>
                    </a>
                    <?php 
            if (Permission::model()->hasSurveyPermission($surveyid, 'responses', 'delete') && isset($rlanguage)) {
                ?>
                    <a class="btn btn-default" href='#' role="button" onclick="if (confirm('<?php 
                eT("Are you sure you want to delete this entry?", "js");
                ?>
')) { <?php 
                echo convertGETtoPOST($this->createUrl("admin/dataentry/sa/delete/id/{$id}/sid/{$surveyid}"));
                ?>
}">
                        <span class="glyphicon glyphicon-trash text-warning"></span>
                        <?php 
                eT("Delete this entry");
                ?>
                    </a>
                    <?php 
            }
            ?>

                    <?php 
            if ($bHasFile) {
                ?>
                    <a class="btn btn-default" href='<?php 
} else {
    ?>
                <img src='<?php 
    echo $imageurl;
    ?>
blank.gif' alt='' width='40' height='20' />
                <?php 
}
if ($ugid && $grpresultcount > 0 && (Yii::app()->session['loginID'] == $grow['owner_id'] || hasGlobalPermission('USER_RIGHT_SUPERADMIN'))) {
    ?>

                <a href='#' onclick="if (confirm('<?php 
    $clang->eT("Are you sure you want to delete this entry?", "js");
    ?>
')) { <?php 
    echo convertGETtoPOST($this->createUrl('admin/usergroups/sa/delete/ugid/' . $ugid));
    ?>
}">
                    <img src='<?php 
    echo $imageurl;
    ?>
delete.png' alt='<?php 
    $clang->eT("Delete current user group");
    ?>
' name='DeleteUserGroup'  /></a>
                <?php 
} else {
    ?>
                <img src='<?php 
    echo $imageurl;
    ?>
            <a href='<?php 
echo $this->createUrl("admin/labels/sa/editlabelset/lid/" . $lid);
?>
'>
                <img src='<?php 
echo $sImageURL;
?>
edit.png' alt='<?php 
$clang->eT("Edit label set");
?>
'  /></a>
            <a href='#' onclick="if (confirm('<?php 
$clang->eT("Do you really want to delete this label set?", "js");
?>
')) { <?php 
echo convertGETtoPOST($this->createUrl("admin/labels/sa/process") . "?action=deletelabelset&amp;lid={$lid}");
?>
}" >
                <img src='<?php 
echo $sImageURL;
?>
delete.png'  alt='<?php 
$clang->eT("Delete label set");
?>
' /></a>
            <img src='<?php 
echo $sImageURL;
?>
separator.gif'  alt='' />
            <a href='<?php 
echo $this->createUrl("admin/export/sa/dumplabel/lid/{$lid}");
                </a>                  

                <a class="btn btn-default" href="#" role="button" id="save-button" onclick="window.open('<?php echo Yii::app()->getController()->createUrl("admin/statistics/sa/index/surveyid/$surveyid"); ?>', '_top')">
                    <span class="glyphicon glyphicon-refresh" aria-hidden="true"></span>
                    <?php eT("Clear"); ?>
                </a>                  

            <?php endif;?>            
            <?php if (isset($menu['view'])): ?>
                <?php if ($exist): ?>
                    <a class="btn btn-default" href='<?php echo $this->createUrl("admin/dataentry/sa/editdata/subaction/edit/surveyid/{$surveyid}/id/{$id}/lang/$rlanguage"); ?>' role="button">
                        <img src="<?php echo Yii::app()->getBaseUrl(true);?>/images/lime-icons/328637/edit.png" />
                        <?php eT("Edit this entry"); ?>
                    </a>
                    <?php if (Permission::model()->hasSurveyPermission($surveyid, 'responses', 'delete') && isset($rlanguage)): ?>
                    <a class="btn btn-default" href='#' role="button" onclick="if (confirm('<?php eT("Are you sure you want to delete this entry?", "js"); ?>')) { <?php echo convertGETtoPOST($this->createUrl("admin/dataentry/sa/delete/id/$id/sid/$surveyid")); ?>}">
                        <img src="<?php echo Yii::app()->getBaseUrl(true);?>/images/lime-icons/328637/delete.png" />
                        <?php eT("Delete this entry"); ?>
                    </a>          
                    <?php endif;?>

                    <?php if ($bHasFile): ?>
                    <a class="btn btn-default" href='<?php echo Yii::app()->createUrl("admin/responses",array("sa"=>"actionDownloadfiles","surveyid"=>$surveyid,"sResponseId"=>$id)); ?>' role="button" >
                        <img src="<?php echo Yii::app()->getBaseUrl(true);?>/images/lime-icons/328637/download.png"  class='downloadfile'/>
                        <?php eT("Delete this entry"); ?>
                    </a>          
                    <?php endif;?>   

                    <a class="btn btn-default" href='<?php echo $this->createUrl("admin/export/sa/exportresults/surveyid/$surveyid/id/$id"); ?>' role="button" >
                        <img src="<?php echo Yii::app()->getBaseUrl(true);?>/images/lime-icons/328637/export.png"  class='downloadfile'/>
                        <?php eT("Export this Response"); ?>
                     <li><?php $clang->eT("A deactivated survey is not accessible to participants (only a message appears that they are not permitted to see this survey).");?></li>
                     <li><?php $clang->eT("All questions, groups and parameters are editable again.");?></li>
                     <li><a title='<?php $clang->eT("Export survey results") ?>' href='<?php echo $this->createUrl('admin/export/exportresults/surveyid/'.$surveyid) ?>'>
                         <?php $clang->eT("You should export your responses before deactivating.");?>
                     </li>
                 </ul>
             </td>
         </tr><tr>
             <td>
                 <form method="post" action="<?php echo $this->createUrl("admin/survey/expire/surveyid/".$surveyid);?>">
                     <input type='submit' value='<?php $clang->eT("Expire survey"); ?>'/>
                 </form>
             </td>
             <td>
                 <form method="post" action="<?php echo $this->createUrl("admin/survey/deactivate/surveyid/".$surveyid);?>">
                     <input type='submit' value='<?php $clang->eT("Deactivate survey"); ?>' onclick="<?php echo convertGETtoPOST($this->createUrl("admin/survey/deactivate/".$surveyid)."?action=deactivate&amp;ok=Y&amp;sid=$surveyid"); ?>" />
                     <input type='hidden' value='Y' name='ok' />
                 </form>
             </td>
         </tr>
     </table>
 </div><br />
 <?php }
 else
 { ?>
 <br /><div class='messagebox ui-corner-all'>
     <div class='header ui-widget-header'><?php $clang->eT("Deactivate Survey"); echo "($surveyid)"; ?></div>
     <div class='successheader'><?php $clang->eT("Survey Has Been Deactivated"); ?>
     </div>
     <p>
     <?php $clang->eT("The responses to this survey are no longer available using LimeSurvey."); ?></p>
        $index = $fnames[$i]['index'];
        $metadata = $fnames[$i]['metadata'];
        $phparray = json_decode_ls($dtrow[$fnames[$i][0]], true);
        if (isset($phparray[$index])) {
            if ($metadata === "size") {
                ?>
                    <td align='center'><?php 
                echo rawurldecode((int) $phparray[$index][$metadata] . " KB");
                ?>
</td>
                    <?php 
            } else {
                if ($metadata === "name") {
                    ?>
                        <td><a href='#' onclick=" <?php 
                    echo convertGETtoPOST('?action=browse&amp;subaction=all&amp;downloadindividualfile=' . $phparray[$index][$metadata] . '&amp;fieldname=' . $fnames[$i][0] . '&amp;id=' . $dtrow['id'] . '&amp;sid=' . $surveyid);
                    ?>
" ><?php 
                    echo rawurldecode($phparray[$index][$metadata]);
                    ?>
</a></td>
                        <?php 
                } else {
                    ?>
                        <td><?php 
                    echo rawurldecode($phparray[$index][$metadata]);
                    ?>
</td>
                        <?php 
                }
            }
Example #11
0
<div class='menubar'>
    <div class='menubar-title ui-widget-header'>
        <strong><?php $clang->eT("Label Set"); ?>:</strong> <?php echo $row['label_name']; ?>
    </div>
    <div class='menubar-main'>
        <div class='menubar-left'>
            <img src='<?php echo $sImageURL; ?>blank.gif' width='40' height='16' alt='' />
            <img src='<?php echo $sImageURL; ?>separator.gif' alt='' />
            <a href='<?php echo $this->createUrl("admin/labels/editlabelset/lid/".$lid); ?>'>
                <img src='<?php echo $sImageURL; ?>edit.png' alt='<?php $clang->eT("Edit label set"); ?>'  /></a>
            <a href='#' onclick="if (confirm('<?php $clang->eT("Do you really want to delete this label set?","js"); ?>')) { <?php echo convertGETtoPOST($this->createUrl("admin/labels/process")."?action=deletelabelset&amp;lid=$lid"); ?>}" >
                <img src='<?php echo $sImageURL; ?>delete.png'  alt='<?php $clang->eT("Delete label set"); ?>' /></a>
            <img src='<?php echo $sImageURL; ?>separator.gif'  alt='' />
            <a href='<?php echo $this->createUrl("admin/export/dumplabel/lid/$lid");?>'>
                <img src='<?php echo $sImageURL; ?>dumplabel.png' alt='<?php $clang->eT("Export this label set"); ?>' /></a>
        </div>
        <div class='menubar-right'>
            <input type='image' src='<?php echo $sImageURL; ?>close.png' title='<?php $clang->eT("Close Window"); ?>' href="<?php echo $this->createUrl("admin/labels/view"); ?>" />
        </div>
    </div>
</div>
<p style='margin:0;font-size:1px;line-height:1px;height:1px;'>&nbsp;</p>
Example #12
0
        if (hasSurveyPermission($surveyid, 'surveyactivation', 'update') || HasSurveyPermission($surveyid, 'tokens','create'))
        {
            $clang->eT("If you initialise tokens for this survey then this survey will only be accessible to users who provide a token either manually or by URL.");
        ?><br /><br />

        <?php
            if ($thissurvey['anonymized'] == 'Y')
            {
                $clang->eT("Note: If you turn on the -Anonymized responses- option for this survey then LimeSurvey will mark your completed tokens only with a 'Y' instead of date/time to ensure the anonymity of your participants.");
            ?><br /><br />
            <?php
            }
            $clang->eT("Do you want to create a token table for this survey?");
        ?>
        <br /><br />
        <input type='submit' value='<?php $clang->eT("Initialise tokens"); ?>' onclick="<?php echo convertGETtoPOST($this->createUrl("admin/tokens/index/surveyid/$surveyid") . "?action=tokens&amp;sid=$surveyid&amp;createtable=Y"); ?>" />
        <input type='submit' value='<?php $clang->eT("No, thanks."); ?>' onclick="window.open('<?php echo$this->createUrl("admin/survey/view/surveyid/$surveyid"); ?>', '_top')" /></div>
    <?php
    }
    else
    {
        $clang->eT("You don't have the permission to activate tokens.");
    ?>
    <input type='submit' value='<?php $clang->eT("Back to main menu"); ?>' onclick="window.open('<?php echo $this->createUrl("admin/survey/view/surveyid/$surveyid"); ?>', '_top')" /></div>

    <?php
    }

    // Do not offer old postgres token tables for restore since these are having an issue with missing index
    if ($tcount > 0 && $databasetype != 'pgsql' && (hasSurveyPermission($surveyid, 'surveyactivation', 'update') || HasSurveyPermission($surveyid, 'tokens','delete')))
    {
                    <img src="<?php echo Yii::app()->getBaseUrl(true);?>/images/lime-icons/328637/invite.png" alt='<?php eT("Mail to all Members"); ?>'  />
                    <?php eT("Mail to all Members"); ?>
                </a>                
             <?php endif;?>

            <!-- Edit current user group -->
            <?php if(isset($usergroupbar['edit'])):?>
                <a class="btn btn-default" href="<?php echo $this->createUrl("admin/usergroups/sa/edit/ugid/".$ugid); ?>" role="button">
                    <img src="<?php echo Yii::app()->getBaseUrl(true);?>/images/lime-icons/328637/edit.png" alt='<?php eT("Edit current user group"); ?>'  />
                    <?php eT("Edit current user group"); ?>
                </a>                                
            <?php endif;?>

            <!-- Delete current user group -->
            <?php if(isset($usergroupbar['edit']) &&  (Yii::app()->session['loginID'] == $grow['owner_id'] || Permission::model()->hasGlobalPermission('usergroups','delete'))):?>
                <a class="btn btn-default" href='#' onclick="if (confirm('<?php eT("Are you sure you want to delete this entry?","js"); ?>')) { <?php echo convertGETtoPOST($this->createUrl('admin/usergroups/sa/delete/ugid/'.$ugid)); ?>}">
                    <img src="<?php echo Yii::app()->getBaseUrl(true);?>/images/lime-icons/328637/delete.png" alt='<?php eT("Delete current user group"); ?>'  />
                    <?php eT("Delete current user group"); ?>
                </a>                                
            <?php endif;?>
        </div>
        
        <div class="col-lg-6 col-sm-4 text-right">

            <?php if(isset($usergroupbar['savebutton']['form'])):?>
                <a class="btn btn-default" href="#" role="button" id="save-form-button" aria-data-form-id="<?php echo $usergroupbar['savebutton']['form']; ?>">
                    <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
                    <?php echo $usergroupbar['savebutton']['text'];?>
                </a>
            <?php endif;?>
            
Example #14
0
 /**
  * Generate tokens
  */
 public function tokenify($iSurveyId)
 {
     $iSurveyId = sanitize_int($iSurveyId);
     if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update')) {
         Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
         $this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
     }
     // CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
     $bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
     if (!$bTokenExists) {
         self::_newtokentable($iSurveyId);
     }
     $aData['thissurvey'] = getSurveyInfo($iSurveyId);
     $aData['surveyid'] = $iSurveyId;
     $surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
     $aData['sidemenu']['state'] = false;
     $aData["surveyinfo"] = $surveyinfo;
     $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyId . ")";
     $aData['sidemenu']["token_menu"] = TRUE;
     if (!Yii::app()->request->getParam('ok')) {
         $aData['sidemenu']['state'] = false;
         $this->_renderWrappedTemplate('token', array('message' => array('title' => gT("Create tokens"), 'message' => gT("Clicking 'Yes' will generate tokens for all those in this token list that have not been issued one. Continue?") . "<br /><br />\n" . "<input class='btn btn-default btn-lg' type='submit' value='" . gT("Yes") . "' onclick=\"" . convertGETtoPOST($this->getController()->createUrl("admin/tokens/sa/tokenify/surveyid/{$iSurveyId}", array('ok' => 'Y'))) . "\" />\n" . "<input class='btn btn-default  btn-lg' type='submit' value='" . gT("No") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/sa/index/surveyid/{$iSurveyId}") . "', '_top')\" />\n" . "<br />\n")), $aData);
     } else {
         //get token length from survey settings
         $newtoken = Token::model($iSurveyId)->generateTokens($iSurveyId);
         $newtokencount = $newtoken['0'];
         $neededtokencount = $newtoken['1'];
         if ($neededtokencount > $newtokencount) {
             $aData['success'] = false;
             $message = ngT('Only {n} token has been created.|Only {n} tokens have been created.', $newtokencount) . ngT('Need {n} token.|Need {n} tokens.', $neededtokencount);
             $message .= '<p><a href="' . App()->createUrl('admin/tokens/sa/index/surveyid/' . $iSurveyId) . '" title="" class="btn btn-default btn-lg">' . gT("Ok") . '</a></p>';
         } else {
             $aData['success'] = true;
             $message = ngT('{n} token has been created.|{n} tokens have been created.', $newtokencount);
             $message .= '<p><a href="' . App()->createUrl('admin/tokens/sa/index/surveyid/' . $iSurveyId) . '" title="" class="btn btn-default btn-lg">' . gT("Ok") . '</a></p>';
         }
         $this->_renderWrappedTemplate('token', array('message' => array('title' => gT("Create tokens"), 'message' => $message)), $aData);
     }
 }
    ?>
                        <input type='submit' value='<?php 
    $clang->eT("Expire survey");
    ?>
'/>
                    </form>
                </td>
                <td>
                    <?php 
    echo CHtml::form(array("admin/survey/sa/deactivate/surveyid/{$surveyid}/"), 'post');
    ?>
                        <input type='submit' value='<?php 
    $clang->eT("Deactivate survey");
    ?>
' onclick="<?php 
    echo convertGETtoPOST($this->createUrl("admin/survey/sa/deactivate/" . $surveyid) . "?action=deactivate&amp;ok=Y&amp;sid={$surveyid}");
    ?>
" />
                        <input type='hidden' value='Y' name='ok' />
                    </form>
                </td>
            </tr>
        </table>
    </div><br />
    <?php 
} else {
    ?>
    <br /><div class='messagebox ui-corner-all'>
        <div class='header ui-widget-header'><?php 
    $clang->eT("Deactivate Survey");
    echo "({$surveyid})";
                { ?>
                <a href='<?php echo $this->createUrl("admin/dataentry/editdata/subaction/edit/surveyid/{$surveyid}/id/{$id}/lang/$rlanguage"); ?>' title='<?php $clang->eT("Edit this entry"); ?>'>
                    <img src='<?php echo $sImageURL; ?>edit.png' alt='<?php $clang->gT("Edit this entry"); ?>' /></a>
                <?php }
                if (hasSurveyPermission($surveyid, 'responses', 'delete') && isset($rlanguage))
                { ?>
                <a href='#' title='<?php $clang->eT("Delete this entry"); ?>' onclick="if (confirm('<?php $clang->eT("Are you sure you want to delete this entry?", "js"); ?>')) { <?php echo convertGETtoPOST($this->createUrl("admin/dataentry/delete/id/$id/sid/$surveyid")); ?>}">
                    <img src='<?php echo $sImageURL; ?>delete.png' alt='<?php $clang->eT("Delete this entry"); ?>' /></a>
                <?php }
                else
                { ?>
                <img src='<?php echo $sImageURL; ?>delete_disabled.png' alt='<?php $clang->eT("You don't have permission to delete this entry."); ?>'/>
                <?php }
                if (hasFileUploadQuestion($surveyid))
                { ?>
                <a href='#' title='<?php $clang->eT("Download files for this entry"); ?>' onclick="<?php echo convertGETtoPOST('?action=browse&amp;subaction=all&amp;downloadfile=' . $id . '&amp;sid=' . $surveyid); ?>" >
                    <img src='<?php echo $sImageURL; ?>download.png' alt='<?php $clang->eT("Download files for this entry"); ?>' /></a>
                <?php } ?>

            <a href='<?php echo $this->createUrl("admin/export/exportresults/surveyid/$surveyid/id/$id"); ?>' title='<?php $clang->eT("Export this Response"); ?>' >
                <img src='<?php echo $sImageURL; ?>/export.png' alt='<?php $clang->eT("Export this Response"); ?>'/></a>
            <img src='<?php echo $sImageURL; ?>/separator.gif' class='separator' alt='' />
            <img src='<?php echo $sImageURL; ?>/blank.gif' width='20' height='20' alt='' />
            <a href='<?php echo $this->createUrl("admin/responses/view/surveyid/$surveyid/id/$last"); ?>' title='<?php $clang->eT("Show previous..."); ?>' >
                <img src='<?php echo $sImageURL; ?>databack.png' alt='<?php $clang->eT("Show previous..."); ?>' /></a>
            <a href='<?php echo $this->createUrl("admin/responses/view/surveyid/$surveyid/id/$next"); ?>' title='<?php $clang->eT("Show next..."); ?>'>
                <img src='<?php echo $sImageURL; ?>dataforward.png' alt='<?php $clang->eT("Show next..."); ?>' /></a>
        </div>
    </div>
</div>
Example #17
0
 /**
  * Function responsible to activate survey.
  *
  * @access public
  * @param int $iSurveyID
  * @return void
  */
 public function activate($iSurveyID)
 {
     if (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveyactivation', 'update')) {
         die;
     }
     $iSurveyID = (int) $iSurveyID;
     $aData = array();
     $aData['sidemenu']['state'] = false;
     $aData['aSurveysettings'] = getSurveyInfo($iSurveyID);
     $aData['surveyid'] = $iSurveyID;
     $surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
     $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
     // Die if this is not possible
     if (!isset($aData['aSurveysettings']['active']) || $aData['aSurveysettings']['active'] == 'Y') {
         $this->getController()->error('Survey not active');
     }
     $qtypes = getQuestionTypeList('', 'array');
     Yii::app()->loadHelper("admin/activate");
     if (empty($_POST['ok'])) {
         if (isset($_GET['fixnumbering']) && $_GET['fixnumbering']) {
             fixNumbering($_GET['fixnumbering'], $iSurveyID);
         }
         // Check consistency for groups and questions
         $failedgroupcheck = checkGroup($iSurveyID);
         $failedcheck = checkQuestions($iSurveyID, $iSurveyID, $qtypes);
         $aData['failedcheck'] = $failedcheck;
         $aData['failedgroupcheck'] = $failedgroupcheck;
         $aData['aSurveysettings'] = getSurveyInfo($iSurveyID);
         $this->_renderWrappedTemplate('survey', 'activateSurvey_view', $aData);
     } else {
         $survey = Survey::model()->findByAttributes(array('sid' => $iSurveyID));
         if (!is_null($survey)) {
             $survey->anonymized = Yii::app()->request->getPost('anonymized');
             $survey->datestamp = Yii::app()->request->getPost('datestamp');
             $survey->ipaddr = Yii::app()->request->getPost('ipaddr');
             $survey->refurl = Yii::app()->request->getPost('refurl');
             $survey->savetimings = Yii::app()->request->getPost('savetimings');
             $survey->save();
             Survey::model()->resetCache();
             // Make sure the saved values will be picked up
         }
         $aResult = activateSurvey($iSurveyID);
         if (isset($aResult['error'])) {
             $aViewUrls['output'] = "<br />\n<div class='messagebox ui-corner-all'>\n";
             if ($aResult['error'] == 'surveytablecreation') {
                 $aViewUrls['output'] .= "<div class='alert alert-warning' role='alert'>" . gT("Survey table could not be created.") . "</div>\n";
             } else {
                 $aViewUrls['output'] .= "<div class='alert alert-success' role='alert'>" . gT("Timings table could not be created.") . "</div>\n";
             }
             $aViewUrls['output'] .= "<strong class='text-warning'>" . gT("Database error!!") . "\n " . "\n" . "<pre>" . var_export($aResult['error'], true) . "</pre>\n\n                <a href='" . Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $iSurveyID) . "'>" . gT("Main Admin Screen") . "</a>\n</strong><br/>";
         } else {
             $warning = isset($aResult['warning']) ? true : false;
             $allowregister = $survey->allowregister == 'Y' ? true : false;
             $onclickAction = convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/sa/index/surveyid/" . $iSurveyID));
             $closedOnclickAction = convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/sa/index/surveyid/" . $iSurveyID));
             $noOnclickAction = convertGETtoPOST(Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $iSurveyID));
             $activationData = array('iSurveyID' => $iSurveyID, 'warning' => $warning, 'allowregister' => $allowregister, 'onclickAction' => $onclickAction, 'closedOnclickAction' => $closedOnclickAction, 'noOnclickAction' => $noOnclickAction);
             $aViewUrls['output'] = $this->getController()->renderPartial('/admin/survey/_activation_feedback', $activationData, true);
         }
         $this->_renderWrappedTemplate('survey', $aViewUrls, $aData);
     }
 }
Example #18
0
            { ?>

            <a href='<?php echo $this->createUrl("admin/questions/sa/editquestion/surveyid/".$surveyid."/gid/".$gid."/qid/".$qid); ?>'>
                <img src='<?php echo $sImageURL; ?>edit.png' alt='<?php eT("Edit Current Question"); ?>' /></a>
            <?php } ?>

        <?php if(Permission::model()->hasSurveyPermission($surveyid,'surveycontent','read'))
            { ?>
            <img src='<?php echo $sImageURL; ?>separator.gif' class='separator' alt=''  />
            <a target='_blank' href="<?php echo $this->createUrl("admin/expressions/sa/survey_logic_file/sid/{$surveyid}/gid/{$gid}/qid/{$qid}/"); ?>">
                <img src='<?php echo $sImageURL; ?>quality_assurance.png' alt='<?php eT("Check survey logic for current question"); ?>' /></a>
            <?php } ?>
        <?php if ($activated != "Y")
            {?>
            <a href='#'
                onclick="if (confirm('<?php eT("Deleting this question will also delete any answer options and subquestions it includes. Are you sure you want to continue?","js"); ?>')) { <?php echo convertGETtoPOST($this->createUrl("admin/questions/sa/delete/surveyid/$surveyid/gid/$gid/qid/$qid")); ?>}">
                <img style='<?php echo (Permission::model()->hasSurveyPermission($surveyid,'surveycontent','delete')?'':'visibility: hidden;');?>' src='<?php echo $sImageURL; ?>delete.png' alt='<?php eT("Delete current question"); ?>'/></a>
            <?php }
            else
            { ?>
            <a href='<?php echo $this->createUrl('admin/survey/sa/view/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid); ?>'
                onclick="alert('<?php eT("You can't delete this question because the survey is currently active.","js"); ?>')">
                <img src='<?php echo $sImageURL; ?>delete_disabled.png' alt='<?php eT("Disabled - Delete current question"); ?>' /></a>
            <?php }



            if(Permission::model()->hasSurveyPermission($surveyid,'surveycontent','export'))
            { ?>
            <a href='<?php echo $this->createUrl("admin/export/sa/question/surveyid/$surveyid/gid/$gid/qid/$qid");?>'>
                <img src='<?php echo $sImageURL; ?>dumpquestion.png' alt='<?php eT("Export this question"); ?>' /></a>
Example #19
0
 /**
  * Remove Token Database
  */
 function kill($iSurveyId)
 {
     // CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
     $bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
     if (!$bTokenExists) {
         self::_newtokentable($iSurveyId);
     }
     $iSurveyId = sanitize_int($iSurveyId);
     $clang = $this->getController()->lang;
     $aData['thissurvey'] = getSurveyInfo($iSurveyId);
     $aData['surveyid'] = $iSurveyId;
     if (!hasSurveyPermission($iSurveyId, 'surveyactivation', 'update')) {
         die;
     }
     $date = date('YmdHis');
     /* If there is not a $_POST value of 'ok', then ask if the user is sure they want to
        delete the tokens table */
     if (!Yii::app()->request->getPost('ok')) {
         $this->_renderWrappedTemplate('token', array('tokenbar', 'message' => array('title' => $clang->gT("Delete Tokens Table"), 'message' => $clang->gT("If you delete this table tokens will no longer be required to access this survey.") . "<br />" . $clang->gT("A backup of this table will be made if you proceed. Your system administrator will be able to access this table.") . "<br />\n" . "( \"old_tokens_{$iSurveyId}_{$date}\" )<br /><br />\n" . "<input type='submit' value='" . $clang->gT("Delete Tokens") . "' onclick=\"" . convertGETtoPOST($this->getController()->createUrl("admin/tokens/kill/surveyid/{$iSurveyId}") . "?ok=y") . "\" />\n" . "<input type='submit' value='" . $clang->gT("Cancel") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/index/surveyid/{$iSurveyId}") . "', '_top')\" />\n")), $aData);
     } else {
         $oldtable = "tokens_{$iSurveyId}";
         $newtable = "old_tokens_{$iSurveyId}_{$date}";
         Yii::app()->db->createCommand()->renameTable("{{{$oldtable}}}", "{{{$newtable}}}");
         Survey::model()->updateByPk($iSurveyId, array('attributedescriptions' => "a:0:{}"));
         //Remove any survey_links to the CPDB
         Survey_links::model()->deleteLinksBySurvey($iSurveyId);
         $this->_renderWrappedTemplate('token', array('tokenbar', 'message' => array('title' => $clang->gT("Delete Tokens Table"), 'message' => '<br />' . $clang->gT("The tokens table has now been removed and tokens are no longer required to access this survey.") . "<br /> " . $clang->gT("A backup of this table has been made and can be accessed by your system administrator.") . "<br />\n" . "(\"old_tokens_{$iSurveyId}_{$date}\")" . "<br /><br />\n" . "<input type='submit' value='" . $clang->gT("Main Admin Screen") . "' onclick=\"window.open('" . Yii::app()->getController()->createUrl("admin/survey/view/surveyid/" . $iSurveyId) . "', '_top')\" />")), $aData);
         LimeExpressionManager::SetDirtyFlag();
         // so that knows that token tables have changed
     }
 }
quality_assurance.png' alt='<?php 
    $clang->eT("Check survey logic for current question");
    ?>
' /></a>
            <?php 
}
?>
        <?php 
if ($activated != "Y") {
    ?>
            <a href='#'
                onclick="if (confirm('<?php 
    $clang->eT("Deleting this question will also delete any answer options and subquestions it includes. Are you sure you want to continue?", "js");
    ?>
')) { <?php 
    echo convertGETtoPOST($this->createUrl("admin/question/sa/delete/surveyid/{$surveyid}/gid/{$gid}/qid/{$qid}"));
    ?>
}">
                <img style='<?php 
    echo hasSurveyPermission($surveyid, 'surveycontent', 'delete') ? '' : 'visibility: hidden;';
    ?>
' src='<?php 
    echo $sImageURL;
    ?>
delete.png' alt='<?php 
    $clang->eT("Delete current question");
    ?>
'/></a>
            <?php 
} else {
    ?>
            <?php if($ugid && $grpresultcount > 0 &&
                Yii::app()->session['loginID'] == $grow['owner_id'])
                { ?>
                <a href="<?php echo $this->createUrl("admin/usergroups/edit/ugid/".$ugid); ?>">
                    <img src='<?php echo $imageurl; ?>/edit.png' alt='<?php $clang->eT("Edit current user group"); ?>' name='EditUserGroup' /></a>
                <?php }
                else
                { ?>
                <img src='<?php echo $imageurl; ?>/blank.gif' alt='' width='40' height='20' />
                <?php }

                if($ugid && $grpresultcount > 0 &&
                Yii::app()->session['loginID'] == $grow['owner_id'])
                { ?>

                <a href='#' onclick="if (confirm('<?php $clang->eT("Are you sure you want to delete this entry?","js"); ?>')) { <?php echo convertGETtoPOST($this->createUrl('admin/usergroups/delete')."?action=delusergroup&amp;ugid=$ugid"); ?>}">
                    <img src='<?php echo $imageurl; ?>/delete.png' alt='<?php $clang->eT("Delete current user group"); ?>' name='DeleteUserGroup'  /></a>
                <?php }
                else
                { ?>
                <img src='<?php echo $imageurl; ?>/blank.gif' alt='' width='40' height='20' />
                <?php } ?>
            <img src='<?php echo $imageurl; ?>/blank.gif' alt='' width='92' height='20' />
            <img src='<?php echo $imageurl; ?>/separator.gif' alt='' />
        </div>
        <div class='menubar-right'>
            <label for="ugid"><?php $clang->eT("User groups"); ?>:</label>  <select name='ugid' id='ugid' onchange="window.location=this.options[this.selectedIndex].value">
                <?php echo getUserGroupList($ugid,'optionlist'); ?>
            </select>
            <?php if (Yii::app()->session['USER_RIGHT_SUPERADMIN'] == 1)
                { ?>
Example #22
0
 /**
  * Function responsible to activate survey.
  *
  * @access public
  * @param int $iSurveyID
  * @return void
  */
 public function activate($iSurveyID)
 {
     if (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveyactivation', 'update')) {
         die;
     }
     $iSurveyID = (int) $iSurveyID;
     $aData = array();
     $aData['aSurveysettings'] = getSurveyInfo($iSurveyID);
     $aData['surveyid'] = $iSurveyID;
     // Die if this is not possible
     if (!isset($aData['aSurveysettings']['active']) || $aData['aSurveysettings']['active'] == 'Y') {
         $this->getController()->error('Survey not active');
     }
     $qtypes = getQuestionTypeList('', 'array');
     Yii::app()->loadHelper("admin/activate");
     if (empty($_POST['ok'])) {
         if (isset($_GET['fixnumbering']) && $_GET['fixnumbering']) {
             fixNumbering($_GET['fixnumbering'], $iSurveyID);
         }
         // Check consistency for groups and questions
         $failedgroupcheck = checkGroup($iSurveyID);
         $failedcheck = checkQuestions($iSurveyID, $iSurveyID, $qtypes);
         $aData['failedcheck'] = $failedcheck;
         $aData['failedgroupcheck'] = $failedgroupcheck;
         $aData['aSurveysettings'] = getSurveyInfo($iSurveyID);
         $this->_renderWrappedTemplate('survey', 'activateSurvey_view', $aData);
     } else {
         $survey = Survey::model()->findByAttributes(array('sid' => $iSurveyID));
         if (!is_null($survey)) {
             $survey->anonymized = Yii::app()->request->getPost('anonymized');
             $survey->datestamp = Yii::app()->request->getPost('datestamp');
             $survey->ipaddr = Yii::app()->request->getPost('ipaddr');
             $survey->refurl = Yii::app()->request->getPost('refurl');
             $survey->savetimings = Yii::app()->request->getPost('savetimings');
             $survey->save();
             Survey::model()->resetCache();
             // Make sure the saved values will be picked up
         }
         $aResult = activateSurvey($iSurveyID);
         if (isset($aResult['error'])) {
             $aViewUrls['output'] = "<br />\n<div class='messagebox ui-corner-all'>\n" . "<div class='header ui-widget-header'>" . gT("Activate Survey") . " ({$iSurveyID})</div>\n";
             if ($aResult['error'] == 'surveytablecreation') {
                 $aViewUrls['output'] .= "<div class='warningheader'>" . gT("Survey table could not be created.") . "</div>\n";
             } else {
                 $aViewUrls['output'] .= "<div class='warningheader'>" . gT("Timings table could not be created.") . "</div>\n";
             }
             $aViewUrls['output'] .= "<p>" . gT("Database error!!") . "\n <font color='red'>" . "</font>\n" . "<pre>" . var_export($aResult['error'], true) . "</pre>\n\n                <a href='" . Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $iSurveyID) . "'>" . gT("Main Admin Screen") . "</a>\n</div>";
         } else {
             $aViewUrls['output'] = "<br />\n<div class='messagebox ui-corner-all'>\n" . "<div class='header ui-widget-header'>" . gT("Activate Survey") . " ({$iSurveyID})</div>\n" . "<div class='successheader'>" . gT("Survey has been activated. Results table has been successfully created.") . "</div><br /><br />\n";
             if (isset($aResult['warning'])) {
                 $aViewUrls['output'] .= "<div class='warningheader'>" . gT("The required directory for saving the uploaded files couldn't be created. Please check file premissions on the /upload/surveys directory.") . "</div>";
             }
             if ($survey->allowregister == 'Y') {
                 $aViewUrls['output'] .= gT("This survey allows public registration. A token table must also be created.") . "<br /><br />\n" . "<input type='submit' value='" . gT("Initialise tokens") . "' onclick=\"" . convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/sa/index/surveyid/" . $iSurveyID)) . "\" />\n";
             } else {
                 $aViewUrls['output'] .= gT("This survey is now active, and responses can be recorded.") . "<br /><br />\n" . "<strong>" . gT("Open-access mode") . ":</strong> " . gT("No invitation code is needed to complete the survey.") . "<br />" . gT("You can switch to the closed-access mode by initialising a token table with the button below.") . "<br /><br />\n" . "<input type='submit' value='" . gT("Switch to closed-access mode") . "' onclick=\"" . convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/sa/index/surveyid/" . $iSurveyID)) . "\" />\n" . "<input type='submit' value='" . gT("No, thanks.") . "' onclick=\"" . convertGETtoPOST(Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $iSurveyID)) . "\" />\n";
             }
             $aViewUrls['output'] .= "</div><br />&nbsp;\n";
         }
         $this->_renderWrappedTemplate('survey', $aViewUrls, $aData);
     }
 }
Example #23
0
<a class="ui-icon ui-icon-pencil" onclick="if (confirm('<?php 
eT("Are you sure you want to delete the selected entries?", "js");
?>
')) { <?php 
echo convertGETtoPOST($this->createUrl("admin/tokens/sa/delete/{$surveyid}/") . "?action=tokens&amp;sid={$surveyid}&amp;subaction=delete&amp;tokenids={$id}&amp;limit={$limit}&amp;start={$start}&amp;order={$order}");
?>
}" title="<?php 
eT("Delete the selected entries");
?>
"></a>
<a class="ui-icon"></a>
 {
     if (isset($fnames[$i]['type']) && $fnames[$i]['type'] == "|")
     {
         $index = $fnames[$i]['index'];
         $metadata = $fnames[$i]['metadata'];
         $phparray = json_decode_ls($dtrow[$fnames[$i][0]], true);
         if (isset($phparray[$index]))
         {
             if ($metadata === "size")
             {
             ?>
             <td align='center'><?php echo rawurldecode(((int) ($phparray[$index][$metadata])) . " KB"); ?></td>
             <?php }
             else if ($metadata === "name")
                 { ?>
                 <td><a href='#' onclick=" <?php echo convertGETtoPOST('?action=browse&amp;subaction=all&amp;downloadindividualfile=' . $phparray[$index][$metadata] . '&amp;fieldname=' . $fnames[$i][0] . '&amp;id=' . $dtrow['id'] . '&amp;sid=' . $surveyid); ?>" ><?php echo rawurldecode($phparray[$index][$metadata]); ?></a></td>
                 <?php }
                 else
                 { ?>
                 <td><?php echo rawurldecode($phparray[$index][$metadata]); ?></td>
                 <?php
             }
         }
         else
         {
         ?>
         <td>&nbsp;</td>
         <?php
         }
     }
     else
Example #25
0
<a class="ui-icon ui-icon-pencil" onclick="if (confirm('<?php $clang->eT("Are you sure you want to delete the selected entries?","js");?>')) { <?php echo convertGETtoPOST($this->createUrl("admin/tokens/delete/$surveyid/")."?action=tokens&amp;sid={$surveyid}&amp;subaction=delete&amp;tokenids=$id&amp;limit={$limit}&amp;start={$start}&amp;order={$order}");?>}" title="<?php $clang->eT("Delete the selected entries");?>"></a>
<a class="ui-icon"></a>