public function runWithParams($params)
 {
     if (!hasGlobalPermission('USER_RIGHT_PARTICIPANT_PANEL')) {
         die('No permission');
     }
     parent::runWithParams($params);
 }
Пример #2
0
 /**
  * RPC routine to to initialise the survey's collection of tokens where new participant tokens may be later added.
  *
  * @access public
  * @param string $sSessionKey Auth credentials
  * @param integer $iSurveyID ID of the survey where a token table will be created for
  * @param array $aAttributeFields  An array of integer describing any additional attribute fields
  * @return array Status=>OK when successfull, otherwise the error description
  */
 public function activate_tokens($sSessionKey, $iSurveyID, $aAttributeFields = array())
 {
     if (!$this->_checkSessionKey($sSessionKey)) {
         return array('status' => 'Invalid session key');
     }
     if (hasGlobalPermission('USER_RIGHT_CREATE_SURVEY')) {
         $oSurvey = Survey::model()->findByPk($iSurveyID);
         if (is_null($oSurvey)) {
             return array('status' => 'Error: Invalid survey ID');
         }
         if (is_array($aAttributeFields) && count($aAttributeFields) > 0) {
             foreach ($aAttributeFields as &$sField) {
                 $sField = intval($sField);
                 $sField = 'attribute_' . $sField;
             }
             $aAttributeFields = array_unique($aAttributeFields);
         }
         Yii::app()->loadHelper('admin/token');
         if (createTokenTable($iSurveyID, $aAttributeFields)) {
             return array('status' => 'OK');
         } else {
             return array('status' => 'Token table could not be created');
         }
     } else {
         return array('status' => 'No permission');
     }
 }
    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'] || 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");
    ?>
Пример #4
0
/**
* getSurveyList() Queries the database (survey table) for a list of existing surveys
*
* @param boolean $returnarray if set to true an array instead of an HTML option list is given back
* @return string This string is returned containing <option></option> formatted list of existing surveys
*
*/
function getSurveyList($returnarray = false, $returnwithouturl = false, $surveyid = false)
{
    $cached = null;
    $timeadjust = getGlobalSetting('timeadjust');
    $clang = new Limesurvey_lang(Yii::app()->session['adminlang']);
    if (is_null($cached)) {
        if (!hasGlobalPermission('USER_RIGHT_SUPERADMIN')) {
            $surveyidresult = Survey::model()->permission(Yii::app()->user->getId())->with(array('languagesettings' => array('condition' => 'surveyls_language=language')))->findAll();
        } else {
            $surveyidresult = Survey::model()->with(array('languagesettings' => array('condition' => 'surveyls_language=language')))->findAll();
        }
        $surveynames = array();
        foreach ($surveyidresult as $result) {
            $surveynames[] = array_merge($result->attributes, $result->languagesettings[0]->attributes);
        }
        $cached = $surveynames;
    } else {
        $surveynames = $cached;
    }
    $surveyselecter = "";
    if ($returnarray === true) {
        return $surveynames;
    }
    $activesurveys = '';
    $inactivesurveys = '';
    $expiredsurveys = '';
    if ($surveynames) {
        foreach ($surveynames as $sv) {
            $surveylstitle = flattenText($sv['surveyls_title']);
            if (strlen($surveylstitle) > 45) {
                $surveylstitle = htmlspecialchars(mb_strcut(html_entity_decode($surveylstitle, ENT_QUOTES, 'UTF-8'), 0, 45, 'UTF-8')) . "...";
            }
            if ($sv['active'] != 'Y') {
                $inactivesurveys .= "<option ";
                if (Yii::app()->user->getId() == $sv['owner_id']) {
                    $inactivesurveys .= " style=\"font-weight: bold;\"";
                }
                if ($sv['sid'] == $surveyid) {
                    $inactivesurveys .= " selected='selected'";
                    $svexist = 1;
                }
                if ($returnwithouturl === false) {
                    $inactivesurveys .= " value='" . Yii::app()->getController()->createUrl("/admin/survey/view/surveyid/" . $sv['sid']) . "'>{$surveylstitle}</option>\n";
                } else {
                    $inactivesurveys .= " value='{$sv['sid']}'>{$surveylstitle}</option>\n";
                }
            } elseif ($sv['expires'] != '' && $sv['expires'] < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $timeadjust)) {
                $expiredsurveys .= "<option ";
                if (Yii::app()->user->getId() == $sv['owner_id']) {
                    $expiredsurveys .= " style=\"font-weight: bold;\"";
                }
                if ($sv['sid'] == $surveyid) {
                    $expiredsurveys .= " selected='selected'";
                    $svexist = 1;
                }
                if ($returnwithouturl === false) {
                    $expiredsurveys .= " value='" . Yii::app()->getController()->createUrl("/admin/survey/view/surveyid/" . $sv['sid']) . "'>{$surveylstitle}</option>\n";
                } else {
                    $expiredsurveys .= " value='{$sv['sid']}'>{$surveylstitle}</option>\n";
                }
            } else {
                $activesurveys .= "<option ";
                if (Yii::app()->user->getId() == $sv['owner_id']) {
                    $activesurveys .= " style=\"font-weight: bold;\"";
                }
                if ($sv['sid'] == $surveyid) {
                    $activesurveys .= " selected='selected'";
                    $svexist = 1;
                }
                if ($returnwithouturl === false) {
                    $activesurveys .= " value='" . Yii::app()->getController()->createUrl("/admin/survey/view/surveyid/" . $sv['sid']) . "'>{$surveylstitle}</option>\n";
                } else {
                    $activesurveys .= " value='{$sv['sid']}'>{$surveylstitle}</option>\n";
                }
            }
        }
        // End Foreach
    }
    //Only show each activesurvey group if there are some
    if ($activesurveys != '') {
        $surveyselecter .= "<optgroup label='" . $clang->gT("Active") . "' class='activesurveyselect'>\n";
        $surveyselecter .= $activesurveys . "</optgroup>";
    }
    if ($expiredsurveys != '') {
        $surveyselecter .= "<optgroup label='" . $clang->gT("Expired") . "' class='expiredsurveyselect'>\n";
        $surveyselecter .= $expiredsurveys . "</optgroup>";
    }
    if ($inactivesurveys != '') {
        $surveyselecter .= "<optgroup label='" . $clang->gT("Inactive") . "' class='inactivesurveyselect'>\n";
        $surveyselecter .= $inactivesurveys . "</optgroup>";
    }
    if (!isset($svexist)) {
        $surveyselecter = "<option selected='selected' value=''>" . $clang->gT("Please choose...") . "</option>\n" . $surveyselecter;
    } else {
        if ($returnwithouturl === false) {
            $surveyselecter = "<option value='" . Yii::app()->getController()->createUrl("/admin") . "'>" . $clang->gT("None") . "</option>\n" . $surveyselecter;
        } else {
            $surveyselecter = "<option value=''>" . $clang->gT("None") . "</option>\n" . $surveyselecter;
        }
    }
    return $surveyselecter;
}
Пример #5
0
 /**
  * Load menu bar of user group controller.
  * @param int $ugid
  * @return void
  */
 function _userGroupBar($ugid = 0)
 {
     $data['clang'] = Yii::app()->lang;
     Yii::app()->loadHelper('database');
     if (!empty($ugid)) {
         $sQuery = "SELECT gp.* FROM {{user_groups}} AS gp, {{user_in_groups}} AS gu WHERE gp.ugid=gu.ugid AND gp.ugid = {$ugid}";
         if (!hasGlobalPermission('USER_RIGHT_SUPERADMIN')) {
             $sQuery .= " AND gu.uid = " . Yii::app()->session['loginID'];
         }
         $grpresult = Yii::app()->db->createCommand($sQuery)->queryRow();
         //Checked
         if ($grpresult) {
             $grpresultcount = 1;
             $grow = array_map('htmlspecialchars', $grpresult);
         } else {
             $grpresultcount = 0;
             $grow = false;
         }
         $data['grow'] = $grow;
         $data['grpresultcount'] = $grpresultcount;
     }
     $data['ugid'] = $ugid;
     $data['imageurl'] = Yii::app()->getConfig("adminimageurl");
     // Don't came from rendertemplate ?
     $this->getController()->render('/admin/usergroup/usergroupbar_view', $data);
 }
Пример #6
0
?>
 alt='<?php 
$clang->eT("Add another search criteria");
?>
' id="addbutton" style="margin-bottom:4px"></td>
        </tr>
    </table>
    <br/>


</div>
<br/>
<table id="displaytokens"></table> <div id="pager"></div>

<?php 
if (hasGlobalPermission('USER_RIGHT_PARTICIPANT_PANEL')) {
    ?>
    <div id="addcpdb" title="addsurvey" style="display:none">
        <p><?php 
    $clang->eT("Please select the attributes that are to be added to the central database");
    ?>
</p>
        <p>
            <select id="attributeid" name="attributeid" multiple="multiple">
                <?php 
    if (!empty($attrfieldnames)) {
        foreach ($attrfieldnames as $key => $value) {
            echo "<option value='" . $key . "'>" . $value . "</option>";
        }
    }
    ?>
 /**
  * This function change the owner of a survey.
  *
  * @access public
  * @param int $newowner
  * @param int $iSurveyID
  * @return void
  */
 public function ajaxowneredit($newowner, $iSurveyID)
 {
     header('Content-type: application/json');
     $intNewOwner = sanitize_int($newowner);
     $intSurveyId = sanitize_int($iSurveyID);
     $owner_id = Yii::app()->session['loginID'];
     $query_condition = 'sid=:sid';
     $params[':sid'] = $intSurveyId;
     if (!hasGlobalPermission("USER_RIGHT_SUPERADMIN")) {
         $query_condition .= ' AND owner_id=:uid';
         $params[':uid'] = $owner_id;
     }
     $result = Survey::model()->updateAll(array('owner_id' => $intNewOwner), $query_condition, $params);
     $result = Survey::model()->with('owner')->findAllByAttributes(array('sid' => $intSurveyId, 'owner_id' => $intNewOwner));
     $intRecordCount = count($result);
     $aUsers = array('record_count' => $intRecordCount);
     foreach ($result as $row) {
         $aUsers['newowner'] = $row->owner->users_name;
     }
     $ajaxoutput = ls_json_encode($aUsers) . "\n";
     echo $ajaxoutput;
 }
Пример #8
0
 /**
  * This function sends the shared participant info to the share panel using JSON encoding
  * This function is called after the share panel grid is loaded
  * This function returns the json depending on the user logged in by checking it from the session
  * @param it takes the session user data loginID
  * @return JSON encoded string containg sharing information
  */
 function getTokens_json($iSurveyId, $search = null)
 {
     // CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
     $bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
     if (!$bTokenExists) {
         $clang->eT("No token table.");
         // return json ? error not treated in js.
         return;
     }
     $clang = $this->getController()->lang;
     if (!hasSurveyPermission($iSurveyId, 'tokens', 'read')) {
         $clang->eT("We are sorry but you don't have permissions to do this.");
         // return json ? error not treated in js.
         return;
     }
     $page = Yii::app()->request->getPost('page', 1);
     $sidx = Yii::app()->request->getPost('sidx', 'lastname');
     $sord = Yii::app()->request->getPost('sord', 'asc');
     $limit = Yii::app()->request->getPost('rows', 25);
     $aData = new stdClass();
     $aData->page = $page;
     if (!empty($search)) {
         $condition = Tokens_dynamic::model($iSurveyId)->getSearchMultipleCondition($search);
     } else {
         $condition = new CDbCriteria();
     }
     $condition->order = $sidx . " " . $sord;
     $condition->offset = ($page - 1) * $limit;
     $condition->limit = $limit;
     $tokens = Tokens_dynamic::model($iSurveyId)->findAll($condition);
     $condition->offset = 0;
     $condition->limit = 0;
     $aData->records = Tokens_dynamic::model($iSurveyId)->count($condition);
     if ($limit > $aData->records) {
         $limit = $aData->records;
     }
     if ($limit != 0) {
         $aData->total = ceil($aData->records / $limit);
     } else {
         $aData->total = 0;
     }
     Yii::app()->loadHelper("surveytranslator");
     $format = getDateFormatData(Yii::app()->session['dateformat']);
     $aSurveyInfo = Survey::model()->findByPk($iSurveyId)->getAttributes();
     //Get survey settings
     $attributes = getAttributeFieldNames($iSurveyId);
     // Now find all responses for the visible tokens
     $visibleTokens = array();
     $answeredTokens = array();
     if ($aSurveyInfo['anonymized'] == "N" && $aSurveyInfo['active'] == "Y") {
         foreach ($tokens as $token) {
             if (isset($token['token']) && $token['token']) {
                 $visibleTokens[] = $token['token'];
             }
         }
         $answers = Survey_dynamic::model($iSurveyId)->findAllByAttributes(array('token' => $visibleTokens));
         foreach ($answers as $answer) {
             $answeredTokens[$answer['token']] = $answer['token'];
         }
     }
     foreach ($tokens as $token) {
         $aRowToAdd = array();
         if ((int) $token['validfrom']) {
             $token['validfrom'] = date($format['phpdate'] . ' H:i', strtotime(trim($token['validfrom'])));
         } else {
             $token['validfrom'] = '';
         }
         if ((int) $token['validuntil']) {
             $token['validuntil'] = date($format['phpdate'] . ' H:i', strtotime(trim($token['validuntil'])));
         } else {
             $token['validuntil'] = '';
         }
         $aRowToAdd['id'] = $token['tid'];
         $action = "";
         $action .= "<div class='inputbuttons'>";
         // so we can hide this when edit is clicked
         // Check is we have an answer
         if (in_array($token['token'], $answeredTokens) && hasSurveyPermission($iSurveyId, 'responses', 'read')) {
             // @@TODO change link
             $url = $this->getController()->createUrl("admin/responses/sa/browse/surveyid/{$iSurveyId}", array('token' => $token['token']));
             $title = $clang->gT("View response details");
             $action .= CHtml::link(CHtml::image(Yii::app()->getConfig('adminimageurl') . 'token_viewanswer.png', $title, array('title' => $title)), $url, array('class' => 'imagelink'));
         } else {
             $action .= '<div style="width: 20px; height: 16px; float: left;"></div>';
         }
         // Check if the token can be taken
         if ($token['token'] != "" && ($token['completed'] == "N" || $token['completed'] == "") && hasSurveyPermission($iSurveyId, 'responses', 'create')) {
             $action .= viewHelper::getImageLink('do_16.png', "survey/index/sid/{$iSurveyId}/token/{$token['token']}/newtest/Y", $clang->gT("Do survey"), '_blank');
         } else {
             $action .= '<div style="width: 20px; height: 16px; float: left;"></div>';
         }
         if (hasSurveyPermission($iSurveyId, 'tokens', 'delete')) {
             $attribs = array('onclick' => 'if (confirm("' . $clang->gT("Are you sure you want to delete this entry?") . ' (' . $token['tid'] . ')")) {$("#displaytokens").delRowData(' . $token['tid'] . ');$.post(delUrl,{tid:' . $token['tid'] . '});}');
             $action .= viewHelper::getImageLink('token_delete.png', null, $clang->gT("Delete token entry"), null, 'imagelink btnDelete', $attribs);
         }
         if (strtolower($token['emailstatus']) == 'ok' && hasSurveyPermission($iSurveyId, 'tokens', 'update')) {
             if ($token['completed'] == 'N' && $token['usesleft'] > 0) {
                 if ($token['sent'] == 'N') {
                     $action .= viewHelper::getImageLink('token_invite.png', "admin/tokens/sa/email/surveyid/{$iSurveyId}/tokenids/" . $token['tid'], $clang->gT("Send invitation email to this person (if they have not yet been sent an invitation email)"), "_blank");
                 } else {
                     $action .= viewHelper::getImageLink('token_remind.png', "admin/tokens/sa/email/action/remind/surveyid/{$iSurveyId}/tokenids/" . $token['tid'], $clang->gT("Send reminder email to this person (if they have already received the invitation email)"), "_blank");
                 }
             } else {
                 $action .= '<div style="width: 20px; height: 16px; float: left;"></div>';
             }
         } else {
             $action .= '<div style="width: 20px; height: 16px; float: left;"></div>';
         }
         if (hasSurveyPermission($iSurveyId, 'tokens', 'update')) {
             $action .= viewHelper::getImageLink('edit_16.png', null, $clang->gT("Edit token entry"), null, 'imagelink token_edit');
         }
         if (!empty($token['participant_id']) && $token['participant_id'] != "" && hasGlobalPermission('USER_RIGHT_PARTICIPANT_PANEL')) {
             $action .= viewHelper::getImageLink('cpdb_16.png', "admin/participants/sa/displayParticipants/searchurl/participant_id||equal||" . $token['participant_id'], $clang->gT("View this person in the central participants database"), '_top');
         } else {
             $action .= '<div style="width: 20px; height: 16px; float: left;"></div>';
         }
         $action .= '</div>';
         $aRowToAdd['cell'] = array($token['tid'], $action, $token['firstname'], $token['lastname'], $token['email'], $token['emailstatus'], $token['token'], $token['language'], $token['sent'], $token['remindersent'], $token['remindercount'], $token['completed'], $token['usesleft'], $token['validfrom'], $token['validuntil']);
         foreach ($attributes as $attribute) {
             $aRowToAdd['cell'][] = $token[$attribute];
         }
         $aData->rows[] = $aRowToAdd;
     }
     echo ls_json_encode($aData);
 }
Пример #9
0
function getUserGroupList($ugid = NULL, $outputformat = 'optionlist')
{
    $clang = Yii::app()->lang;
    //$squery = "SELECT ugid, name FROM ".db_table_name('user_groups') ." WHERE owner_id = {Yii::app()->session['loginID']} ORDER BY name";
    $sQuery = "SELECT a.ugid, a.name, a.owner_id, b.uid FROM {{user_groups}} AS a LEFT JOIN {{user_in_groups}} AS b ON a.ugid = b.ugid WHERE 1=1 ";
    if (!hasGlobalPermission('USER_RIGHT_SUPERADMIN')) {
        $sQuery .= "AND uid = " . Yii::app()->session['loginID'];
    }
    $sQuery .= " ORDER BY name";
    $sresult = Yii::app()->db->createCommand($sQuery)->query();
    //Checked
    if (!$sresult) {
        return "Database Error";
    }
    $selecter = "";
    foreach ($sresult->readAll() as $row) {
        $groupnames[] = $row;
    }
    //$groupnames = $sresult->GetRows();
    $simplegidarray = array();
    if (isset($groupnames)) {
        foreach ($groupnames as $gn) {
            $selecter .= "<option ";
            if (Yii::app()->session['loginID'] == $gn['owner_id']) {
                $selecter .= " style=\"font-weight: bold;\"";
            }
            //if (isset($_GET['ugid']) && $gn['ugid'] == $_GET['ugid']) {$selecter .= " selected='selected'"; $svexist = 1;}
            if ($gn['ugid'] == $ugid) {
                $selecter .= " selected='selected'";
                $svexist = 1;
            }
            $link = Yii::app()->getController()->createUrl("/admin/usergroups/view/ugid/" . $gn['ugid']);
            $selecter .= " value='{$link}'>{$gn['name']}</option>\n";
            $simplegidarray[] = $gn['ugid'];
        }
    }
    if (!isset($svexist)) {
        $selecter = "<option value='-1' selected='selected'>" . $clang->gT("Please choose...") . "</option>\n" . $selecter;
    }
    //else {$selecter = "<option value='-1'>".$clang->gT("None")."</option>\n".$selecter;}
    if ($outputformat == 'simplegidarray') {
        return $simplegidarray;
    } else {
        return $selecter;
    }
}
Пример #10
0
 /**
  * This function sends the shared participant info to the share panel using JSON encoding
  * This function is called after the share panel grid is loaded
  * This function returns the json depending on the user logged in by checking it from the session
  * @param it takes the session user data loginID
  * @return JSON encoded string containg sharing information
  */
 function getTokens_json($iSurveyId, $search = null)
 {
     // CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
     $bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
     if (!$bTokenExists) {
         self::_newtokentable($iSurveyId);
     }
     $clang = $this->getController()->lang;
     $page = Yii::app()->request->getPost('page');
     $sidx = Yii::app()->request->getPost('sidx');
     $sidx = !empty($sidx) ? $sidx : "lastname";
     $sord = Yii::app()->request->getPost('sord');
     $sord = !empty($sord) ? $sord : "asc";
     $limit = Yii::app()->request->getPost('rows');
     $limit = isset($limit) ? $limit : 25;
     //Stop division by zero errors
     $page = isset($page) ? $page : 1;
     //Stop division by zero errors
     $aData = new stdClass();
     $aData->page = $page;
     if (!empty($search)) {
         $condition = Tokens_dynamic::model($iSurveyId)->getSearchMultipleCondition($search);
     } else {
         $condition = new CDbCriteria();
     }
     $condition->order = $sidx . " " . $sord;
     $condition->offset = ($page - 1) * $limit;
     $condition->limit = $limit;
     $tokens = Tokens_dynamic::model($iSurveyId)->findAll($condition);
     $condition->offset = 0;
     $condition->limit = 0;
     $aData->records = Tokens_dynamic::model($iSurveyId)->count($condition);
     if ($limit > $aData->records) {
         $limit = $aData->records;
     }
     if ($limit != 0) {
         $aData->total = ceil($aData->records / $limit);
     } else {
         $aData->total = 0;
     }
     Yii::app()->loadHelper("surveytranslator");
     $format = getDateFormatData(Yii::app()->session['dateformat']);
     $aSurveyInfo = Survey::model()->findByPk($iSurveyId)->getAttributes();
     //Get survey settings
     $attributes = getAttributeFieldNames($iSurveyId);
     foreach ($tokens as $token) {
         $aRowToAdd = array();
         if ((int) $token['validfrom']) {
             $token['validfrom'] = date($format['phpdate'] . ' H:i', strtotime(trim($token['validfrom'])));
         } else {
             $token['validfrom'] = '';
         }
         if ((int) $token['validuntil']) {
             $token['validuntil'] = date($format['phpdate'] . ' H:i', strtotime(trim($token['validuntil'])));
         } else {
             $token['validuntil'] = '';
         }
         $aRowToAdd['id'] = $token['tid'];
         $action = "";
         if ($token['token'] != "" && ($token['completed'] == "N" || $token['completed'] == "")) {
             $action .= '<input type="image" style="float: left" src="' . Yii::app()->getConfig('adminimageurl') . 'do_16.png" title="' . $clang->gT("Do survey") . '" alt="' . $clang->gT("Do survey") . '" onclick=\'window.open("' . Yii::app()->getController()->createUrl("survey/index/sid/{$iSurveyId}/token/{$token['token']}/newtest/Y") . '", "_blank")\'>';
         } elseif ($token['completed'] != "N" && $token['completed'] != "" && $aSurveyInfo['anonymized'] == "N" && $aSurveyInfo['active'] == 'Y') {
             // Get the survey response id of the matching entry, can be optimised into 1 call leaving for now
             $id = Survey_dynamic::model($iSurveyId)->findAllByAttributes(array('token' => $token['token']));
             if (count($id) > 0) {
                 $action .= '<input type="image" style="float: left" src="' . Yii::app()->getConfig('adminimageurl') . 'token_viewanswer.png" title="' . $clang->gT("View response details") . '" alt="' . $clang->gT("View response details") . '" onClick=\'window.open("' . Yii::app()->getController()->createUrl("admin/responses/sa/view/surveyid/{$iSurveyId}/id/{$id[0]['id']}") . '", "_top")\'>';
             } else {
                 $action .= '<div style="width: 20px; height: 16px; float: left;"></div>';
             }
         } else {
             $action .= '<div style="width: 20px; height: 16px; float: left;"></div>';
         }
         $action .= '<input type="image" style="float: left" src="' . Yii::app()->getConfig('adminimageurl') . 'token_delete.png" title="' . $clang->gT("Delete token entry") . '" alt="' . $clang->gT("Delete token entry") . '" onclick=\'if (confirm("' . $clang->gT("Are you sure you want to delete this entry?") . ' (' . $token['tid'] . ')")) {$("#displaytokens").delRowData(' . $token['tid'] . ');$.post(delUrl,{tid:' . $token['tid'] . '});}\'>';
         if (strtolower($token['emailstatus']) == 'ok') {
             if ($token['completed'] == 'N' && $token['usesleft'] > 0) {
                 if ($token['sent'] == 'N') {
                     $action .= '<input type="image" style="float: left" src="' . Yii::app()->getConfig('adminimageurl') . 'token_invite.png" name="sendinvitations" id="sendinvitations" title="' . $clang->gT("Send invitation email to this person (if they have not yet been sent an invitation email)") . '" onclick=\'window.open("' . Yii::app()->getController()->createUrl("admin/tokens/sa/email/surveyid/{$iSurveyId}/tokenids/" . $token['tid']) . '")\' />';
                 } else {
                     $action .= '<input type="image" style="float: left" src="' . Yii::app()->getConfig('adminimageurl') . 'token_remind.png" name="sendreminders" id="sendreminders" title="' . $clang->gT("Send reminder email to this person (if they have already received the invitation email)") . '" onclick=\'window.open("' . Yii::app()->getController()->createUrl("admin/tokens/sa/email/action/remind/surveyid/{$iSurveyId}/tokenids/" . $token['tid']) . '")\' />';
                 }
             } else {
                 $action .= '<div style="width: 20px; height: 16px; float: left;"></div>';
             }
         } else {
             $action .= '<div style="width: 20px; height: 16px; float: left;"></div>';
         }
         $action .= '<input style="float: left; height: 16; width: 16px; font-size: 8; font-family: verdana" type="image" src="' . Yii::app()->getConfig('adminimageurl') . 'edit_16.png" class="token_edit" title="' . $clang->gT("Edit token entry") . '" alt="' . $clang->gT("Edit token entry") . '">';
         if (!empty($token['participant_id']) && $token['participant_id'] != "" && hasGlobalPermission('USER_RIGHT_PARTICIPANT_PANEL')) {
             $action .= '<input type="image" style="float: left" src="' . Yii::app()->getConfig('adminimageurl') . 'cpdb_16.png" name="viewparticipant" id="viewparticipant" title="' . $clang->gT("View this person in the central participants database") . '" alt="' . $clang->gT("View this person in the central participants database") . '" onClick=\'window.open("' . Yii::app()->getController()->createUrl("admin/participants/sa/displayParticipants/searchurl/participant_id||equal||" . $token['participant_id']) . '", "_top")\'>';
         } else {
             $action .= '<div style="width: 20px; height: 16px; float: left;"></div>';
         }
         $aRowToAdd['cell'] = array($token['tid'], $action, $token['firstname'], $token['lastname'], $token['email'], $token['emailstatus'], $token['token'], $token['language'], $token['sent'], $token['remindersent'], $token['remindercount'], $token['completed'], $token['usesleft'], $token['validfrom'], $token['validuntil']);
         foreach ($attributes as $attribute) {
             $aRowToAdd['cell'][] = $token[$attribute];
         }
         $aData->rows[] = $aRowToAdd;
     }
     echo ls_json_encode($aData);
 }