diff --git a/application/controllers/OptinController.php b/application/controllers/OptinController.php index a9f92ef5ddc..cb4d304c5f7 100644 --- a/application/controllers/OptinController.php +++ b/application/controllers/OptinController.php @@ -64,7 +64,7 @@ function actiontokens($surveyid, $token, $langcode = '') } else { - $row = Tokens_dynamic::model($iSurveyID)->getEmailStatus($sToken); + $row = TokenDynamic::model($iSurveyID)->getEmailStatus($sToken); if ($row == false) { @@ -75,7 +75,7 @@ function actiontokens($surveyid, $token, $langcode = '') $usresult = $row['emailstatus']; if ($usresult=='OptOut') { - $usresult = Tokens_dynamic::model($iSurveyID)->updateEmailStatus($sToken, 'OK'); + $usresult = TokenDynamic::model($iSurveyID)->updateEmailStatus($sToken, 'OK'); $html = $clang->gT('You have been successfully added back to this survey.'); } else if ($usresult=='OK') diff --git a/application/controllers/OptoutController.php b/application/controllers/OptoutController.php index 33ff12bd49d..fb0e7a10e39 100644 --- a/application/controllers/OptoutController.php +++ b/application/controllers/OptoutController.php @@ -70,7 +70,7 @@ function actiontokens() } else { - $row = Tokens_dynamic::model($iSurveyID)->getEmailStatus($sToken); + $row = TokenDynamic::model($iSurveyID)->getEmailStatus($sToken); if ($row == false) { @@ -81,7 +81,7 @@ function actiontokens() $usresult = $row['emailstatus']; if ($usresult == 'OK') { - $usresult = Tokens_dynamic::model($iSurveyID)->updateEmailStatus($sToken, 'OptOut'); + $usresult = TokenDynamic::model($iSurveyID)->updateEmailStatus($sToken, 'OptOut'); $html = $clang->gT('You have been successfully removed from this survey.'); } else @@ -153,8 +153,8 @@ function actionparticipants() } else { - $row = Tokens_dynamic::model($iSurveyID)->getEmailStatus($sToken); - $datas = Tokens_dynamic::model($iSurveyID)->find('token = :token', array(":token"=>$sToken)); + $row = TokenDynamic::model($iSurveyID)->getEmailStatus($sToken); + $datas = TokenDynamic::model($iSurveyID)->find('token = :token', array(":token"=>$sToken)); if ($row == false) { @@ -165,7 +165,7 @@ function actionparticipants() $usresult = $row['emailstatus']; if ($usresult == 'OK') { - $usresult = Tokens_dynamic::model($iSurveyID)->updateEmailStatus($sToken, 'OptOut'); + $usresult = TokenDynamic::model($iSurveyID)->updateEmailStatus($sToken, 'OptOut'); $html = $clang->gT('You have been successfully removed from this survey.'); } else diff --git a/application/controllers/RegisterController.php b/application/controllers/RegisterController.php index 681afdafc67..c7b96bbe87f 100644 --- a/application/controllers/RegisterController.php +++ b/application/controllers/RegisterController.php @@ -159,8 +159,8 @@ function actionIndex($surveyid = null) $postattribute2=sanitize_xss_string(strip_tags(returnGlobal('register_attribute2'))); */ // Insert new entry into tokens db - Tokens_dynamic::sid($thissurvey['sid']); - $token = new Tokens_dynamic; + TokenDynamic::sid($thissurvey['sid']); + $token = new TokenDynamic; $token->firstname = $postfirstname; $token->lastname = $postlastname; $token->email = Yii::app()->request->getPost('register_email'); diff --git a/application/controllers/admin/dataentry.php b/application/controllers/admin/dataentry.php index 67c1058bb6d..728c35b2cf2 100644 --- a/application/controllers/admin/dataentry.php +++ b/application/controllers/admin/dataentry.php @@ -1839,7 +1839,7 @@ public function insert() (".implode(',',$columns).") VALUES (".implode(',',$values).")"; - //$this->tokens_dynamic_model->insertToken($surveyid,$tokendata); + //$this->TokenDynamic_model->insertToken($surveyid,$tokendata); dbExecuteAssoc($SQL); //Yii::app()->db->AutoExecute(db_table_name("tokens_".$surveyid), $tokendata,'INSERT'); $aDataentrymsgs[] = CHtml::tag('font', array('class'=>'successtitle'), $clang->gT("A token entry for the saved survey has been created too.")); diff --git a/application/controllers/admin/remotecontrol.php b/application/controllers/admin/remotecontrol.php index 93925618fc5..1870c529283 100644 --- a/application/controllers/admin/remotecontrol.php +++ b/application/controllers/admin/remotecontrol.php @@ -720,7 +720,7 @@ public function get_summary($sSessionKey,$iSurveyID, $sStatName) if(in_array($sStatName, $aPermittedTokenStats)) { if (tableExists('{{tokens_' . $iSurveyID . '}}')) - $summary = Tokens_dynamic::model($iSurveyID)->summary(); + $summary = TokenDynamic::model($iSurveyID)->summary(); else return array('status' => 'No available data'); } @@ -1845,13 +1845,13 @@ public function add_participants($sSessionKey, $iSurveyID, $aParticipantData, $b foreach ($aParticipantData as &$aParticipant) { $aParticipant=array_intersect_key($aParticipant,$aDestinationFields); - Tokens_dynamic::sid($iSurveyID); - $token = new Tokens_dynamic; + TokenDynamic::sid($iSurveyID); + $token = new TokenDynamic; if ($new_token_id=$token->insertParticipant($aParticipant)) { if ($bCreateToken) - $token_string = Tokens_dynamic::model()->createToken($new_token_id); + $token_string = TokenDynamic::model()->createToken($new_token_id); else $token_string = ''; @@ -1899,13 +1899,13 @@ public function delete_participants($sSessionKey, $iSurveyID, $aTokenIDs) $aResult=array(); foreach($aTokenIDs as $iTokenID) { - $tokenidExists = Tokens_dynamic::model($iSurveyID)->findByPk($iTokenID); + $tokenidExists = TokenDynamic::model($iSurveyID)->findByPk($iTokenID); if (!isset($tokenidExists)) $aResult[$iTokenID]='Invalid token ID'; else { Survey_links::deleteTokenLink(array($iTokenID), $iSurveyID); - if(Tokens_dynamic::model($iSurveyID)->deleteRecords(array($iTokenID))) + if(TokenDynamic::model($iSurveyID)->deleteRecords(array($iTokenID))) $aResult[$iTokenID]='Deleted'; else $aResult[$iTokenID]='Deletion went wrong'; @@ -1944,12 +1944,12 @@ public function get_participant_properties($sSessionKey, $iSurveyID, $iTokenID, if(!tableExists("{{tokens_$iSurveyID}}")) return array('status' => 'Error: No token table'); - $oToken = Tokens_dynamic::model($iSurveyID)->findByPk($iTokenID); + $oToken = TokenDynamic::model($iSurveyID)->findByPk($iTokenID); if (!isset($oToken)) return array('status' => 'Error: Invalid tokenid'); $aResult=array(); - $aBasicDestinationFields=Tokens_dynamic::model()->tableSchema->columnNames; + $aBasicDestinationFields=TokenDynamic::model()->tableSchema->columnNames; $aTokenProperties=array_intersect($aTokenProperties,$aBasicDestinationFields); if (empty($aTokenProperties)) @@ -1992,7 +1992,7 @@ public function set_participant_properties($sSessionKey, $iSurveyID, $iTokenID, if(!tableExists("{{tokens_$iSurveyID}}")) return array('status' => 'Error: No token table'); - $oToken = Tokens_dynamic::model($iSurveyID)->findByPk($iTokenID); + $oToken = TokenDynamic::model($iSurveyID)->findByPk($iTokenID); if (!isset($oToken)) return array('status' => 'Error: Invalid tokenid'); @@ -2000,7 +2000,7 @@ public function set_participant_properties($sSessionKey, $iSurveyID, $iTokenID, // Remove fields that may not be modified unset($aTokenData['tid']); - $aBasicDestinationFields=array_flip(Tokens_dynamic::model()->tableSchema->columnNames); + $aBasicDestinationFields=array_flip(TokenDynamic::model()->tableSchema->columnNames); $aTokenData=array_intersect_key($aTokenData,$aBasicDestinationFields); $aTokenAttributes = $oToken->getAttributes(); @@ -2061,9 +2061,9 @@ public function list_participants($sSessionKey, $iSurveyID, $iStart=0, $iLimit=1 return array('status' => 'Error: No token table'); if($bUnused) - $oTokens = Tokens_dynamic::model($iSurveyID)->findAll(array('condition'=>"completed = 'N'", 'limit' => $iLimit, 'offset' => $iStart)); + $oTokens = TokenDynamic::model($iSurveyID)->findAll(array('condition'=>"completed = 'N'", 'limit' => $iLimit, 'offset' => $iStart)); else - $oTokens = Tokens_dynamic::model($iSurveyID)->findAll(array('limit' => $iLimit, 'offset' => $iStart)); + $oTokens = TokenDynamic::model($iSurveyID)->findAll(array('limit' => $iLimit, 'offset' => $iStart)); if(count($oTokens)==0) return array('status' => 'No Tokens found'); @@ -2158,7 +2158,7 @@ public function invite_participants($sSessionKey, $iSurveyID ) $iMaxEmails = (int)Yii::app()->getConfig("maxemails"); $SQLemailstatuscondition = "emailstatus = 'OK'"; - $oTokens = Tokens_dynamic::model($iSurveyID); + $oTokens = TokenDynamic::model($iSurveyID); $aResultTokens = $oTokens->findUninvited(false, $iMaxEmails, true, $SQLemailstatuscondition); $aAllTokens = $oTokens->findUninvited(false, 0, true, $SQLemailstatuscondition); if (empty($aResultTokens)) @@ -2222,7 +2222,7 @@ public function remind_participants($sSessionKey, $iSurveyID, $iMinDaysBetween=n if(!is_null($iMaxReminders)) $SQLremindercountcondition = "remindercount < " . $iMaxReminders; - $oTokens = Tokens_dynamic::model($iSurveyID); + $oTokens = TokenDynamic::model($iSurveyID); $aResultTokens = $oTokens->findUninvited(false, $iMaxEmails, false, $SQLemailstatuscondition, $SQLremindercountcondition, $SQLreminderdelaycondition); $aAllTokens = $oTokens->findUninvited(false, 0, false, $SQLemailstatuscondition, $SQLremindercountcondition, $SQLreminderdelaycondition); diff --git a/application/controllers/admin/responses.php b/application/controllers/admin/responses.php index 2aecb69758f..6429498e9b5 100644 --- a/application/controllers/admin/responses.php +++ b/application/controllers/admin/responses.php @@ -305,7 +305,7 @@ public function index($iSurveyID) if (tableExists('{{tokens_' . $iSurveyID . '}}') && Permission::model()->hasSurveyPermission($iSurveyID,'tokens','read')) { $aData['with_token']= Yii::app()->db->schema->getTable('{{tokens_' . $iSurveyID . '}}'); - $aData['tokeninfo'] = Tokens_dynamic::model($iSurveyID)->summary(); + $aData['tokeninfo'] = TokenDynamic::model($iSurveyID)->summary(); } $aViewUrls[] = 'browseindex_view'; diff --git a/application/controllers/admin/surveyadmin.php b/application/controllers/admin/surveyadmin.php index c5964382910..f0b452846b8 100644 --- a/application/controllers/admin/surveyadmin.php +++ b/application/controllers/admin/surveyadmin.php @@ -685,7 +685,7 @@ public function getSurveys_json() $aSurveyEntry['viewurl'] = $this->getController()->createUrl("/admin/survey/sa/view/surveyid/" . $rows['sid']); if (tableExists('tokens_' . $rows['sid'] )) { - $cntResult = Tokens_dynamic::countAllAndCompleted($rows['sid']); + $cntResult = TokenDynamic::countAllAndCompleted($rows['sid']); $tokens = $cntResult['cntall']; $tokenscompleted = $cntResult['cntcompleted']; diff --git a/application/controllers/admin/tokens.php b/application/controllers/admin/tokens.php index 12b4c98f316..734fa11b60d 100644 --- a/application/controllers/admin/tokens.php +++ b/application/controllers/admin/tokens.php @@ -52,10 +52,10 @@ function index($iSurveyId) else { //Check that the tokens table has the required fields - Tokens_dynamic::model($iSurveyId)->checkColumns(); + TokenDynamic::model($iSurveyId)->checkColumns(); $aData['thissurvey'] = $thissurvey; $aData['surveyid'] = $iSurveyId; - $aData['queries'] = Tokens_dynamic::model($iSurveyId)->summary(); + $aData['queries'] = TokenDynamic::model($iSurveyId)->summary(); $this->_renderWrappedTemplate('token', array('tokenbar', 'tokensummary'), $aData); } @@ -196,7 +196,7 @@ function bounceprocessing($iSurveyId) ); $condn = array('token' => $tokenBounce[1]); - $record = Tokens_dynamic::model($iSurveyId)->findByAttributes($condn); + $record = TokenDynamic::model($iSurveyId)->findByAttributes($condn); foreach ($aData as $k => $v) $record->$k = $v; $record->save(); @@ -281,7 +281,7 @@ function browse($iSurveyId, $limit = 50, $start = 0, $order = false, $searchstri $limit = (int) $limit; $start = (int) $start; - $tkcount = Tokens_dynamic::model($iSurveyId)->count(); + $tkcount = TokenDynamic::model($iSurveyId)->count(); $next = $start + $limit; $last = $start - $limit; $end = $tkcount - $limit; @@ -327,7 +327,7 @@ function browse($iSurveyId, $limit = 50, $start = 0, $order = false, $searchstri $iquery = '(' . implode(' OR ', $iquery) . ')'; } - $tokens = Tokens_dynamic::model($iSurveyId)->findAll(array('condition' => $iquery, 'limit' => $limit, 'offset' => $start, 'order' => $order)); + $tokens = TokenDynamic::model($iSurveyId)->findAll(array('condition' => $iquery, 'limit' => $limit, 'offset' => $start, 'order' => $order)); $aData['bresult'] = array(); foreach ($tokens as $token) { @@ -378,7 +378,7 @@ function getTokens_json($iSurveyId, $search = null) $aData->page = $page; if (!empty($search)) { - $condition = Tokens_dynamic::model($iSurveyId)->getSearchMultipleCondition($search); + $condition = TokenDynamic::model($iSurveyId)->getSearchMultipleCondition($search); } else { $condition = new CDbCriteria(); } @@ -386,11 +386,11 @@ function getTokens_json($iSurveyId, $search = null) $condition->order = $sidx. " ". $sord; $condition->offset = ($page - 1) * $limit; $condition->limit = $limit; - $tokens = Tokens_dynamic::model($iSurveyId)->findAll($condition); + $tokens = TokenDynamic::model($iSurveyId)->findAll($condition); $condition->offset=0; $condition->limit=0; - $aData->records = Tokens_dynamic::model($iSurveyId)->count($condition); + $aData->records = TokenDynamic::model($iSurveyId)->count($condition); if ($limit>$aData->records) { @@ -542,7 +542,7 @@ function editToken($iSurveyId) // Used ? 2013-01-29 // { // $sLang = Yii::app()->request->getPost('language'); // } - Tokens_dynamic::model($iSurveyId); + TokenDynamic::model($iSurveyId); echo $from . ',' . $until; @@ -568,7 +568,7 @@ function editToken($iSurveyId) // Used ? 2013-01-29 $this->getController()->error(sprintf($this->controller->lang->gT('%s cannot be left empty'), $desc['description'])); $aData[$attr_name] = Yii::app()->request->getPost($attr_name); } - $token = Tokens_dynamic::model()->find('tid=' . Yii::app()->getRequest()->getPost('id')); + $token = TokenDynamic::model()->find('tid=' . Yii::app()->getRequest()->getPost('id')); foreach ($aData as $k => $v) $token->$k = $v; @@ -600,7 +600,7 @@ function editToken($iSurveyId) // Used ? 2013-01-29 $aData[$attr_name] = Yii::app()->request->getPost($attr_name); } echo ls_json_encode(var_export($aData)); - $token = new Tokens_dynamic; + $token = new TokenDynamic; foreach ($aData as $k => $v) $token->$k = $v; echo $token->save(); @@ -714,11 +714,11 @@ function addnew($iSurveyId) $aData[$attr_name] = Yii::app()->getRequest()->getPost($attr_name); } - $udresult = Tokens_dynamic::model($iSurveyId)->findAll("token <> '' and token = '$sanitizedtoken'"); + $udresult = TokenDynamic::model($iSurveyId)->findAll("token <> '' and token = '$sanitizedtoken'"); if (count($udresult) == 0) { // AutoExecute - $token = new Tokens_dynamic; + $token = new TokenDynamic; foreach ($aData as $k => $v) $token->$k = $v; $inresult = $token->save(); @@ -804,7 +804,7 @@ function edit($iSurveyId, $iTokenId) $aTokenData['remindersent'] = Yii::app()->request->getPost('remindersent'); $aTokenData['remindercount'] = intval(Yii::app()->request->getPost('remindercount')); - $udresult = Tokens_dynamic::model($iSurveyId)->findAll("tid <> '$iTokenId' and token <> '' and token = '$santitizedtoken'"); + $udresult = TokenDynamic::model($iSurveyId)->findAll("tid <> '$iTokenId' and token <> '' and token = '$santitizedtoken'"); if (count($udresult) == 0) { @@ -819,7 +819,7 @@ function edit($iSurveyId, $iTokenId) $aTokenData[$attr_name] = Yii::app()->request->getPost($attr_name); } - $token = Tokens_dynamic::model($iSurveyId)->findByPk($iTokenId); + $token = TokenDynamic::model($iSurveyId)->findByPk($iTokenId); foreach ($aTokenData as $k => $v) $token->$k = $v; $token->save(); @@ -874,7 +874,7 @@ function delete($iSurveyID) Survey_links::model()->deleteTokenLink($aTokenIds, $iSurveyID); //Then delete the tokens - Tokens_dynamic::model($iSurveyID)->deleteRecords($aTokenIds); + TokenDynamic::model($iSurveyID)->deleteRecords($aTokenIds); } } @@ -952,9 +952,9 @@ function addDummies($iSurveyId, $subaction = '') $tokenlength = sanitize_int(Yii::app()->request->getPost('tokenlen')); // Fill an array with all existing tokens - $criteria = Tokens_dynamic::model($iSurveyId)->getDbCriteria(); + $criteria = TokenDynamic::model($iSurveyId)->getDbCriteria(); $criteria->select = 'token'; - $ntresult = Tokens_dynamic::model($iSurveyId)->findAllAsArray($criteria); //Use AsArray to skip active record creation + $ntresult = TokenDynamic::model($iSurveyId)->findAllAsArray($criteria); //Use AsArray to skip active record creation $existingtokens=array(); foreach ($ntresult as $tkrow) { @@ -987,7 +987,7 @@ function addDummies($iSurveyId, $subaction = '') if($isvalidtoken) { $aDataToInsert['token'] = $newtoken; - Tokens_dynamic::model()->insertToken($iSurveyId, $aDataToInsert); + TokenDynamic::model()->insertToken($iSurveyId, $aDataToInsert); $newDummyToken ++; } @@ -1018,7 +1018,7 @@ function addDummies($iSurveyId, $subaction = '') } else { - $tkcount = Tokens_dynamic::model($iSurveyId)->count(); + $tkcount = TokenDynamic::model($iSurveyId)->count(); $tokenlength = Yii::app()->db->createCommand()->select('tokenlength')->from('{{surveys}}')->where('sid=:sid')->bindParam(":sid", $iSurveyId, PDO::PARAM_INT)->query()->readColumn(0); if (empty($tokenlength)) @@ -1076,7 +1076,7 @@ function managetokenattributes($iSurveyId) $aData['languages'] = $languages; $aData['tokencaptions'] = $captions; $aData['nrofattributes'] = 0; - $aData['examplerow'] = Tokens_dynamic::model($iSurveyId)->find(); + $aData['examplerow'] = TokenDynamic::model($iSurveyId)->find(); $this->_renderWrappedTemplate('token', array('tokenbar', 'managetokenattributes'), $aData); } @@ -1272,7 +1272,7 @@ function email($iSurveyId, $tokenids = null) Yii::app()->loadHelper('/admin/htmleditor'); Yii::app()->loadHelper('replacements'); - $query = Tokens_dynamic::model($iSurveyId)->find(); + $query = TokenDynamic::model($iSurveyId)->find(); $aExampleRow = empty($query) ? array() : $query->attributes; $aSurveyLangs = Survey::model()->findByPk($iSurveyId)->additionalLanguages; $sBaseLanguage = Survey::model()->findByPk($iSurveyId)->language; @@ -1313,7 +1313,7 @@ function email($iSurveyId, $tokenids = null) { if (empty($aData['tokenids'])) { - $aTokens = Tokens_dynamic::model($iSurveyId)->findUninvited($aTokenIds, 0, $bEmail, $SQLemailstatuscondition); + $aTokens = TokenDynamic::model($iSurveyId)->findUninvited($aTokenIds, 0, $bEmail, $SQLemailstatuscondition); foreach($aTokens as $aToken) { $aData['tokenids'][] = $aToken['tid']; @@ -1349,10 +1349,10 @@ function email($iSurveyId, $tokenids = null) } } - $ctresult = Tokens_dynamic::model($iSurveyId)->findUninvited($aTokenIds, 0, $bEmail, $SQLemailstatuscondition, $SQLremindercountcondition, $SQLreminderdelaycondition); + $ctresult = TokenDynamic::model($iSurveyId)->findUninvited($aTokenIds, 0, $bEmail, $SQLemailstatuscondition, $SQLremindercountcondition, $SQLreminderdelaycondition); $ctcount = count($ctresult); - $emresult = Tokens_dynamic::model($iSurveyId)->findUninvited($aTokenIds, $iMaxEmails, $bEmail, $SQLemailstatuscondition, $SQLremindercountcondition, $SQLreminderdelaycondition); + $emresult = TokenDynamic::model($iSurveyId)->findUninvited($aTokenIds, $iMaxEmails, $bEmail, $SQLemailstatuscondition, $SQLremindercountcondition, $SQLreminderdelaycondition); $emcount = count($emresult); foreach ($aSurveyLangs as $language) @@ -1470,7 +1470,7 @@ function email($iSurveyId, $tokenids = null) if (SendEmailMessage($modmessage, $modsubject, $to, $from, Yii::app()->getConfig("sitename"), $bHtml, getBounceEmail($iSurveyId), $aRelevantAttachments, $customheaders)) { // Put date into sent - $udequery = Tokens_dynamic::model($iSurveyId)->findByPk($emrow['tid']); + $udequery = TokenDynamic::model($iSurveyId)->findByPk($emrow['tid']); if ($bEmail) { $tokenoutput .= $clang->gT("Invitation sent to:"); @@ -1564,7 +1564,7 @@ function exportdialog($iSurveyId) } else { - $aData['resultr'] = Tokens_dynamic::model($iSurveyId)->findAll(array('select' => 'language', 'group' => 'language')); + $aData['resultr'] = TokenDynamic::model($iSurveyId)->findAll(array('select' => 'language', 'group' => 'language')); $aData['thissurvey'] = getSurveyInfo($iSurveyId); $aData['surveyid'] = $iSurveyId; @@ -2197,7 +2197,7 @@ function tokenify($iSurveyId) else { //get token length from survey settings - $newtoken = Tokens_dynamic::model($iSurveyId)->createTokens($iSurveyId); + $newtoken = TokenDynamic::model($iSurveyId)->createTokens($iSurveyId); $newtokencount = $newtoken['0']; $neededtokencount = $newtoken['1']; if($neededtokencount>$newtokencount) @@ -2348,7 +2348,7 @@ function _handletokenform($iSurveyId, $subaction, $iTokenId="") if ($subaction == "edit") { $aData['tokenid'] = $iTokenId; - $aData['tokendata'] = Tokens_dynamic::model($iSurveyId)->findByPk($iTokenId); + $aData['tokendata'] = TokenDynamic::model($iSurveyId)->findByPk($iTokenId); } $thissurvey = getSurveyInfo($iSurveyId); @@ -2443,7 +2443,7 @@ function _newtokentable($iSurveyId) Yii::app()->db->createCommand()->renameTable(Yii::app()->request->getPost('oldtable'), Yii::app()->db->tablePrefix."tokens_".intval($iSurveyId)); //Check that the tokens table has the required fields - Tokens_dynamic::model($iSurveyId)->checkColumns(); + TokenDynamic::model($iSurveyId)->checkColumns(); //Add any survey_links from the renamed table Survey_links::model()->rebuildLinksFromTokenTable($iSurveyId); diff --git a/application/helpers/admin/import_helper.php b/application/helpers/admin/import_helper.php index 4fa6251bbf9..961fcf95636 100644 --- a/application/helpers/admin/import_helper.php +++ b/application/helpers/admin/import_helper.php @@ -4054,7 +4054,7 @@ function XMLImportTokens($sFullFilepath,$iSurveyID,$sCreateMissingAttributeField $insertdata[(string)$key]=(string)$value; } - $result = Tokens_dynamic::model($iSurveyID)->insertToken($iSurveyID,$insertdata) or safeDie($clang->gT("Error").": Failed to insert data[15]
"); + $result = TokenDynamic::model($iSurveyID)->insertToken($iSurveyID,$insertdata) or safeDie($clang->gT("Error").": Failed to insert data[15]
"); $results['tokens']++; } diff --git a/application/helpers/admin/token_helper.php b/application/helpers/admin/token_helper.php index 91cefcdab8a..63ba3b912a7 100644 --- a/application/helpers/admin/token_helper.php +++ b/application/helpers/admin/token_helper.php @@ -78,7 +78,7 @@ function emailTokens($iSurveyID,$aResultTokens,$sType) $attributes = array_keys(getTokenFieldsAndNames($iSurveyID)); $oSurveyLocale=Surveys_languagesettings::model()->findAllByAttributes(array('surveyls_survey_id' => $iSurveyID)); - $oTokens = Tokens_dynamic::model($iSurveyID); + $oTokens = TokenDynamic::model($iSurveyID); $aSurveyLangs = $oSurvey->additionalLanguages; array_unshift($aSurveyLangs, $oSurvey->language); diff --git a/application/helpers/common_helper.php b/application/helpers/common_helper.php index 1b8e10a02db..c5ea1022a45 100644 --- a/application/helpers/common_helper.php +++ b/application/helpers/common_helper.php @@ -5479,8 +5479,8 @@ function getAttributeValue($surveyid,$attrName,$token) } $surveyid=sanitize_int($surveyid); - Tokens_dynamic::sid($surveyid); - $query=Tokens_dynamic::model()->find(array("token"=>$token)); + TokenDynamic::sid($surveyid); + $query=TokenDynamic::model()->find(array("token"=>$token)); $count=$query->count(); // OK - AR count if ($count != 1) @@ -5677,7 +5677,7 @@ function getNumericalFormat($lang = 'en', $integer = false, $negative = true) { */ function getTokenData($surveyid, $token) { - $thistoken = Tokens_dynamic::model($surveyid)->find('token = :token',array(':token' => $token)); + $thistoken = TokenDynamic::model($surveyid)->find('token = :token',array(':token' => $token)); $thistokenarray=array(); // so has default value if($thistoken) { @@ -5814,7 +5814,7 @@ function getXMLWriter() { function usedTokens($token, $surveyid) { $utresult = true; - $query=Tokens_dynamic::model($surveyid)->findAllByAttributes(array("token"=>$token)); + $query=TokenDynamic::model($surveyid)->findAllByAttributes(array("token"=>$token)); if (count($query) > 0) { $row = $query[0]; if ($row->usesleft > 0) $utresult = false; diff --git a/application/helpers/export_helper.php b/application/helpers/export_helper.php index 4c40edec352..ee82064f063 100644 --- a/application/helpers/export_helper.php +++ b/application/helpers/export_helper.php @@ -1762,7 +1762,7 @@ function tokensExport($iSurveyID) if (Yii::app()->request->getPost('tokendeleteexported') && !empty($aExportedTokens)) { - Tokens_dynamic::model($iSurveyID)->deleteByPk($aExportedTokens); + TokenDynamic::model($iSurveyID)->deleteByPk($aExportedTokens); } } diff --git a/application/helpers/frontend_helper.php b/application/helpers/frontend_helper.php index 054091cba5e..219520464f9 100644 --- a/application/helpers/frontend_helper.php +++ b/application/helpers/frontend_helper.php @@ -934,7 +934,7 @@ function submittokens($quotaexit=false) $today = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig("timeadjust")); // check how many uses the token has left - $oTokenInformation = Tokens_dynamic::model($surveyid)->findByAttributes(array('token' => $clienttoken)); + $oTokenInformation = TokenDynamic::model($surveyid)->findByAttributes(array('token' => $clienttoken)); if ($oTokenInformation) { $usesleft = $oTokenInformation->usesleft; @@ -1482,9 +1482,9 @@ function buildsurveysession($surveyid,$preview=false) //check if token actually does exist // check also if it is allowed to change survey after completion if ($thissurvey['alloweditaftercompletion'] == 'Y' ) { - $oTokenEntry = Tokens_dynamic::model($surveyid)->find('token=:token', array(':token'=>trim(strip_tags($clienttoken)))); + $oTokenEntry = TokenDynamic::model($surveyid)->find('token=:token', array(':token'=>trim(strip_tags($clienttoken)))); } else { - $oTokenEntry = Tokens_dynamic::model($surveyid)->find("token=:token AND (completed = 'N' or completed='')", array(':token'=>trim(strip_tags($clienttoken)))); + $oTokenEntry = TokenDynamic::model($surveyid)->find("token=:token AND (completed = 'N' or completed='')", array(':token'=>trim(strip_tags($clienttoken)))); } if (is_null($oTokenEntry) || ($areTokensUsed && $thissurvey['alloweditaftercompletion'] != 'Y') ) @@ -1522,15 +1522,15 @@ function buildsurveysession($surveyid,$preview=false) //check if tokens actually haven't been already used $areTokensUsed = usedTokens(trim(strip_tags($clienttoken)),$surveyid); //check if token actually does exist - $oTokenEntry = Tokens_dynamic::model($surveyid)->find('token=:token', array(':token'=>trim(strip_tags($clienttoken)))); + $oTokenEntry = TokenDynamic::model($surveyid)->find('token=:token', array(':token'=>trim(strip_tags($clienttoken)))); if ($thissurvey['alloweditaftercompletion'] == 'Y' ) { - $oTokenEntry = Tokens_dynamic::model($surveyid)->find('token=:token', array(':token'=>trim(strip_tags($clienttoken)))); + $oTokenEntry = TokenDynamic::model($surveyid)->find('token=:token', array(':token'=>trim(strip_tags($clienttoken)))); } else { - $oTokenEntry = Tokens_dynamic::model($surveyid)->find("token=:token AND (completed = 'N' or completed='')", array(':token'=>trim(strip_tags($clienttoken)))); + $oTokenEntry = TokenDynamic::model($surveyid)->find("token=:token AND (completed = 'N' or completed='')", array(':token'=>trim(strip_tags($clienttoken)))); } if (is_null($oTokenEntry) || ($areTokensUsed && $thissurvey['alloweditaftercompletion'] != 'Y') ) { diff --git a/application/models/Tokens_dynamic.php b/application/models/TokenDynamic.php similarity index 98% rename from application/models/Tokens_dynamic.php rename to application/models/TokenDynamic.php index a05bab17086..1465a7dd2fb 100644 --- a/application/models/Tokens_dynamic.php +++ b/application/models/TokenDynamic.php @@ -13,7 +13,7 @@ * Files Purpose: lots of common functions */ -class Tokens_dynamic extends LSActiveRecord +class TokenDynamic extends LSActiveRecord { protected static $sid = 0; @@ -25,7 +25,7 @@ class Tokens_dynamic extends LSActiveRecord * @static * @access public * @param int $surveyid - * @return Tokens_dynamic + * @return TokenDynamic */ public static function model($sid = NULL) { @@ -183,7 +183,7 @@ public function findUninvited($aTokenIds = false, $iMaxEmails = 0, $bEmail = tru $command->order = 'tid'; - $oResult = Tokens_dynamic::model()->findAll($command); + $oResult = TokenDynamic::model()->findAll($command); return $oResult; } @@ -455,7 +455,7 @@ function getSearchMultipleCondition($condition) function deleteToken($tokenid) { - $dlquery = "DELETE FROM ".Tokens_dynamic::tableName()." WHERE tid=:tokenid"; + $dlquery = "DELETE FROM ".TokenDynamic::tableName()." WHERE tid=:tokenid"; return Yii::app()->db->createCommand($dlquery)->bindParam(":tokenid", $tokenid)->query(); } @@ -463,7 +463,7 @@ function deleteRecords($iTokenIds) { foreach($iTokenIds as &$currentrow) $currentrow = Yii::app()->db->quoteValue($currentrow); - $dlquery = "DELETE FROM ".Tokens_dynamic::tableName()." WHERE tid IN (".implode(", ", $iTokenIds).")"; + $dlquery = "DELETE FROM ".TokenDynamic::tableName()." WHERE tid IN (".implode(", ", $iTokenIds).")"; return Yii::app()->db->createCommand($dlquery)->query(); } diff --git a/application/tests/staticCalls.php b/application/tests/staticCalls.php index 3e8b39dab85..253bd99fed3 100644 --- a/application/tests/staticCalls.php +++ b/application/tests/staticCalls.php @@ -67,7 +67,7 @@ function checkStatic($line) 'Participant_attribute::', 'Tokens::', 'UserGroup::', -'Tokens_dynamic::', +'TokenDynamic::', 'Conditions::', 'Survey_Common_Action::', 'Quota::',