Skip to content

Commit

Permalink
Dev: PHPDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Dec 20, 2016
1 parent 99ca6e1 commit 81cfe03
Showing 1 changed file with 80 additions and 58 deletions.
138 changes: 80 additions & 58 deletions application/controllers/admin/tokens.php
Expand Up @@ -293,13 +293,19 @@ public function deleteToken()

/**
* Browse Tokens
* @param int $iSurveyId
* @param int $limit
* @param int $start
* @param boolean $order
* @param boolean $searchstring
* @return void
*/
public function browse($iSurveyId, $limit = 50, $start = 0, $order = false, $searchstring = false)
{
$iSurveyId = sanitize_int($iSurveyId);

/* Check permissions */
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'read'))
{
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'read')) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
$this->getController()->redirect(array("/admin/tokens/sa/index/surveyid/{$iSurveyId}"));
}
Expand All @@ -309,8 +315,7 @@ public function browse($iSurveyId, $limit = 50, $start = 0, $order = false, $sea

// CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
$bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
if (!$bTokenExists) //If no tokens table exists
{
if (!$bTokenExists) { //If no tokens table exists
self::_newtokentable($iSurveyId);
}

Expand All @@ -335,20 +340,16 @@ public function browse($iSurveyId, $limit = 50, $start = 0, $order = false, $sea
$last = $start - $limit;
$end = $tkcount - $limit;

if ($end < 0)
{
if ($end < 0) {
$end = 0;
}
if ($last < 0)
{
if ($last < 0) {
$last = 0;
}
if ($next >= $tkcount)
{
if ($next >= $tkcount) {
$next = $tkcount - $limit;
}
if ($end < 0)
{
if ($end < 0) {
$end = 0;
}
$order = Yii::app()->request->getPost('order','tid');
Expand All @@ -371,8 +372,7 @@ public function browse($iSurveyId, $limit = 50, $start = 0, $order = false, $sea
$aLanguageCodes=Survey::model()->findByPk($iSurveyId)->getAllLanguages();
$aLanguages=array();

foreach ($aLanguageCodes as $aCode)
{
foreach ($aLanguageCodes as $aCode) {
$aLanguages[$aCode]=getLanguageNameFromCode($aCode,false);
}

Expand All @@ -386,30 +386,28 @@ public function browse($iSurveyId, $limit = 50, $start = 0, $order = false, $sea

/// FOR GRID View
$model = TokenDynamic::model($iSurveyId);
if(isset($_GET['TokenDynamic']))
{
if(isset($_GET['TokenDynamic'])) {
$model->setAttributes($_GET['TokenDynamic'],false);
}

$aData['model'] = $model;

// Set number of page
if (isset($_GET['pageSize']))
{
if (isset($_GET['pageSize'])) {
Yii::app()->user->setState('pageSize',(int)$_GET['pageSize']);
}



$aData['massiveAction'] = App()->getController()->renderPartial('/admin/token/massive_actions/_selector', array(), true, false);

$this->_renderWrappedTemplate('token', array('browse'), $aData);
}

/**
* Called by if a token is saved after editing
* @todo Check if method is still in use
* @param mixed $iSurveyId The Survey ID
*/
* Called by if a token is saved after editing
* @todo Check if method is still in use
* @param int $iSurveyId The Survey ID
* @return void
*/
public function editToken($iSurveyId)
{
$this->registerScriptFile( 'ADMIN_SCRIPT_PATH', 'tokens.js');
Expand Down Expand Up @@ -760,6 +758,7 @@ public function edit($iSurveyId, $iTokenId, $ajax = false)
/**
* Delete tokens
* @param int $iSurveyID
* @return void
*/
public function delete($iSurveyID)
{
Expand Down Expand Up @@ -797,8 +796,11 @@ public function delete($iSurveyID)
}

/**
* Add dummy tokens form
*/
* Add dummy tokens form
* @param int $iSurveyId
* @param string $subaction
* @return void
*/
public function addDummies($iSurveyId, $subaction = '')
{
$iSurveyId = sanitize_int($iSurveyId);
Expand Down Expand Up @@ -956,8 +958,10 @@ public function addDummies($iSurveyId, $subaction = '')
}

/**
* Handle managetokenattributes action
*/
* Handle managetokenattributes action
* @param int $iSurveyId
* @return void
*/
public function managetokenattributes($iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
Expand Down Expand Up @@ -1014,8 +1018,10 @@ public function managetokenattributes($iSurveyId)
}

/**
* Update token attributes
*/
* Update token attributes
* @param int $iSurveyId
* @return void
*/
public function updatetokenattributes($iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
Expand Down Expand Up @@ -1054,8 +1060,10 @@ public function updatetokenattributes($iSurveyId)
}

/**
* Delete token attributes
*/
* Delete token attributes
* @param int $iSurveyId
* @return void
*/
public function deletetokenattributes($iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
Expand Down Expand Up @@ -1120,8 +1128,10 @@ public function deletetokenattributes($iSurveyId)
}

/**
* updatetokenattributedescriptions action
*/
* updatetokenattributedescriptions action
* @param int $iSurveyId
* @return void
*/
public function updatetokenattributedescriptions($iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
Expand Down Expand Up @@ -1168,8 +1178,11 @@ public function updatetokenattributedescriptions($iSurveyId)
}

/**
* Handle email action
*/
* Handle email action
* @param int $iSurveyId
* @param string $tokenids Int list separated with |?
* @return void
*/
public function email($iSurveyId, $tokenids = null)
{
$iSurveyId = sanitize_int($iSurveyId);
Expand Down Expand Up @@ -1569,9 +1582,10 @@ public function email($iSurveyId, $tokenids = null)
}

/**
* Export Dialog
*
*/
* Export Dialog
* @param int $iSurveyId
* @return void
*/
public function exportdialog($iSurveyId)
{
$surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
Expand Down Expand Up @@ -1676,12 +1690,10 @@ public function exportdialog($iSurveyId)
}

/**
* Performs a ldap import
*
* @access public
* @param int $iSurveyId
* @return void
*/
* Performs a ldap import
* @param int $iSurveyId
* @return void
*/
public function importldap($iSurveyId)
{
$iSurveyId = (int) $iSurveyId;
Expand Down Expand Up @@ -1957,8 +1969,10 @@ public function importldap($iSurveyId)
}

/**
* import from csv
*/
* import from csv
* @param int $iSurveyId
* @return void
*/
public function import($iSurveyId)
{
$aData = array();
Expand Down Expand Up @@ -2301,8 +2315,10 @@ public function import($iSurveyId)
}

/**
* Generate tokens
*/
* Generate tokens
* @param int $iSurveyId
* @return void
*/
public function tokenify($iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
Expand Down Expand Up @@ -2368,8 +2384,10 @@ public function tokenify($iSurveyId)
}

/**
* Remove Token Database
*/
* Remove Token Database
* @param int $iSurveyId
* @return void
*/
public function kill($iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
Expand Down Expand Up @@ -2428,6 +2446,10 @@ public function kill($iSurveyId)
}
}

/**
* @param int $iSurveyId
* @return void
*/
public function bouncesettings($iSurveyId)
{
$iSurveyId = $iSurveyID = sanitize_int($iSurveyId);
Expand Down Expand Up @@ -2482,13 +2504,13 @@ public function bouncesettings($iSurveyId)
}

/**
* Handle token form for addnew/edit actions
* @param int $iSurveyId
* @param string $subaction
* @param int $iTokenId
* @param boolean $ajax
* @return void
*/
* Handle token form for addnew/edit actions
* @param int $iSurveyId
* @param string $subaction
* @param int $iTokenId
* @param boolean $ajax
* @return void
*/
public function _handletokenform($iSurveyId, $subaction, $iTokenId="", $ajax=false)
{
// CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
Expand Down

0 comments on commit 81cfe03

Please sign in to comment.