当前位置: 首页>>代码示例>>PHP>>正文


PHP Survey::Model方法代码示例

本文整理汇总了PHP中Survey::Model方法的典型用法代码示例。如果您正苦于以下问题:PHP Survey::Model方法的具体用法?PHP Survey::Model怎么用?PHP Survey::Model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Survey的用法示例。


在下文中一共展示了Survey::Model方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: hasSurveyPermission

 /**
  * Checks if a user has a certain permission in the given survey
  *
  * @param $iSurveyID integer The survey ID
  * @param $sPermission string Name of the permission
  * @param $sCRUD string The permission detail you want to check on: 'create','read','update','delete','import' or 'export'
  * @param $iUserID integer User ID - if not given the one of the current user is used
  * @return bool True if user has the permission
  */
 public function hasSurveyPermission($iSurveyID, $sPermission, $sCRUD = 'read', $iUserID = null)
 {
     $oSurvey = Survey::Model()->findByPk($iSurveyID);
     if (!$oSurvey) {
         return false;
     }
     // Get global correspondance for surveys rigth
     $sGlobalCRUD = $sCRUD == 'create' || $sCRUD == 'delete' && $sPermission != 'survey' ? 'update' : $sCRUD;
     return $this->hasGlobalPermission('surveys', $sGlobalCRUD, $iUserID) || $this->hasPermission($iSurveyID, 'survey', $sPermission, $sCRUD, $iUserID);
 }
开发者ID:joaocc,项目名称:LimeSurvey--LimeSurvey,代码行数:19,代码来源:Permission.php

示例2: hasSurveyPermission

 /**
  * Checks if a user has a certain permission in the given survey
  *
  * @param $iSurveyID integer The survey ID
  * @param $sPermission string Name of the permission
  * @param $sCRUD string The permission detail you want to check on: 'create','read','update','delete','import' or 'export'
  * @param $iUserID integer User ID - if not given the one of the current user is used
  * @return bool True if user has the permission
  */
 function hasSurveyPermission($iSurveyID, $sPermission, $sCRUD = 'read', $iUserID = null)
 {
     $oSurvey = Survey::Model()->findByPk($iSurveyID);
     if (!$oSurvey) {
         return false;
     }
     $iUserID = self::getUserId($iUserID);
     // If you own a survey you have access to the whole survey
     if ($iUserID == $oSurvey->owner_id) {
         return true;
     }
     // Get global correspondance for surveys rigth
     $sGlobalCRUD = $sCRUD == 'create' || $sCRUD == 'delete' && $sPermission != 'survey' ? 'update' : $sCRUD;
     return $this->hasGlobalPermission('surveys', $sGlobalCRUD, $iUserID) || $this->hasPermission($iSurveyID, 'survey', $sPermission, $sCRUD, $iUserID);
 }
开发者ID:venurasasanka,项目名称:LimeSurvey,代码行数:24,代码来源:Permission.php

示例3: hasSurveyPermission

 /**
  * Checks if a user has a certain permission in the given survey
  *
  * @param $iSurveyID integer The survey ID
  * @param $sPermission string Name of the permission
  * @param $sCRUD string The permission detail you want to check on: 'create','read','update','delete','import' or 'export'
  * @param $iUserID integer User ID - if not given the one of the current user is used
  * @return bool True if user has the permission
  */
 public function hasSurveyPermission($iSurveyID, $sPermission, $sCRUD = 'read', $iUserID = null)
 {
     $oSurvey = Survey::Model()->findByPk($iSurveyID);
     if (!$oSurvey) {
         return false;
     }
     // If the user has the permission to update all other surveys he may import/export as well
     if ($this->hasGlobalPermission('surveys', 'update', $iUserID) && $sPermission == 'token' && ($sCRUD == 'import' || $sCRUD == 'export')) {
         $sCRUD = 'update';
     }
     // Get global correspondance for surveys rigth
     $sGlobalCRUD = $sCRUD == 'create' || $sCRUD == 'delete' && $sPermission != 'survey' ? 'update' : $sCRUD;
     return $this->hasGlobalPermission('surveys', $sGlobalCRUD, $iUserID) || $this->hasPermission($iSurveyID, 'survey', $sPermission, $sCRUD, $iUserID);
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:23,代码来源:Permission.php


注:本文中的Survey::Model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。