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


PHP QuestionGroup::deleteWithDependency方法代码示例

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


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

示例1: delete_group

 /**
  * RPC Routine to delete a group of a survey .
  * Returns the id of the deleted group.
  *
  * @access public
  * @param string $sSessionKey Auth credentials
  * @param int $iSurveyID Id of the survey that the group belongs
  * @param int $iGroupID Id of the group to delete
  * @return array|int The id of the deleted group or status
  */
 public function delete_group($sSessionKey, $iSurveyID, $iGroupID)
 {
     if ($this->_checkSessionKey($sSessionKey)) {
         $iSurveyID = sanitize_int($iSurveyID);
         $iGroupID = sanitize_int($iGroupID);
         $oSurvey = Survey::model()->findByPk($iSurveyID);
         if (!isset($oSurvey)) {
             return array('status' => 'Error: Invalid survey ID');
         }
         if (Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'delete')) {
             $oGroup = QuestionGroup::model()->findByAttributes(array('gid' => $iGroupID));
             if (!isset($oGroup)) {
                 return array('status' => 'Error: Invalid group ID');
             }
             if ($oSurvey['active'] == 'Y') {
                 return array('status' => 'Error:Survey is active and not editable');
             }
             $depented_on = getGroupDepsForConditions($oGroup->sid, "all", $iGroupID, "by-targgid");
             if (isset($depented_on)) {
                 return array('status' => 'Group with depencdencies - deletion not allowed');
             }
             $iGroupsDeleted = QuestionGroup::deleteWithDependency($iGroupID, $iSurveyID);
             if ($iGroupsDeleted === 1) {
                 fixSortOrderGroups($iSurveyID);
                 return (int) $iGroupID;
             } else {
                 return array('status' => 'Group deletion failed');
             }
         } else {
             return array('status' => 'No permission');
         }
     } else {
         return array('status' => 'Invalid Session Key');
     }
 }
开发者ID:kasutori,项目名称:LimeSurvey,代码行数:45,代码来源:remotecontrol_handle.php

示例2: delete

 /**
  * Action to delete a question group.
  *
  * @access public
  * @return void
  */
 public function delete($iSurveyId, $iGroupId)
 {
     $iSurveyId = sanitize_int($iSurveyId);
     if (Permission::model()->hasSurveyPermission($iSurveyId, 'surveycontent', 'delete')) {
         LimeExpressionManager::RevertUpgradeConditionsToRelevance($iSurveyId);
         $iGroupId = sanitize_int($iGroupId);
         $iGroupsDeleted = QuestionGroup::deleteWithDependency($iGroupId, $iSurveyId);
         if ($iGroupsDeleted > 0) {
             fixSortOrderGroups($iSurveyId);
             Yii::app()->setFlashMessage(gT('The question group was deleted.'));
         } else {
             Yii::app()->setFlashMessage(gT('Group could not be deleted'), 'error');
         }
         LimeExpressionManager::UpgradeConditionsToRelevance($iSurveyId);
         $this->getController()->redirect(array('admin/survey/sa/view/surveyid/' . $iSurveyId));
     }
 }
开发者ID:venurasasanka,项目名称:LimeSurvey,代码行数:23,代码来源:questiongroups.php


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