Skip to content

Commit

Permalink
Dev Removed function from global namespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMousa committed Jul 22, 2014
1 parent e07db88 commit 33b5157
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
16 changes: 0 additions & 16 deletions application/helpers/common_helper.php
Expand Up @@ -12,22 +12,6 @@
*/
Yii::import('application.helpers.sanitize_helper', true);

/**
* Simple function to sort the permissions by title
*
* @param mixed $aPermissionA Permission A to compare
* @param mixed $aPermissionB Permission B to compare
*/
function comparePermission($aPermissionA,$aPermissionB)
{
if($aPermissionA['title'] >$aPermissionB['title']) {
return 1;
}
else {
return -1;
}
}

/**
* Translation helper function.
* @param string $string
Expand Down
4 changes: 3 additions & 1 deletion application/models/Permission.php
Expand Up @@ -73,7 +73,9 @@ public static function getSurveyBasePermissions()
'tokens'=>array('create'=>true,'read'=>true,'update'=>true,'delete'=>true,'import'=>true,'export'=>true,'title'=>$clang->gT("Tokens"),'description'=>$clang->gT("Permission to create/update/delete/import/export token entries"),'img'=>'tokens'),
'translations'=>array('create'=>false,'read'=>true,'update'=>true,'delete'=>false,'import'=>false,'export'=>false,'title'=>$clang->gT("Quick translation"),'description'=>$clang->gT("Permission to view & update the translations using the quick-translation feature"),'img'=>'translate')
);
uasort($aPermissions,"comparePermission");
uasort($aPermissions, function ($a, $b) {
return strcmp($a['title'], $b['title']);
});
return $aPermissions;
}

Expand Down

2 comments on commit 33b5157

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another comparePermission at line 102 to be fixed.

    usort($aPermissions, array($this, "comparePermission")); 

To have only one function

(bug : unable to update permission for users)
Take it because doing another update on model/Permission

@SamMousa
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.