當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Groups::deleteWithDependency方法代碼示例

本文整理匯總了PHP中Groups::deleteWithDependency方法的典型用法代碼示例。如果您正苦於以下問題:PHP Groups::deleteWithDependency方法的具體用法?PHP Groups::deleteWithDependency怎麽用?PHP Groups::deleteWithDependency使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Groups的用法示例。


在下文中一共展示了Groups::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 (hasSurveyPermission($iSurveyID, 'surveycontent', 'delete')) {
             $oGroup = Groups::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 = Groups::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:rawaludin,項目名稱:LimeSurvey,代碼行數:45,代碼來源:remotecontrol.php

示例2: delete

 /**
  * Action to delete a question group.
  *
  * @access public
  * @return void
  */
 public function delete($iSurveyId, $iGroupId)
 {
     $iSurveyId = sanitize_int($iSurveyId);
     if (hasSurveyPermission($iSurveyId, 'surveycontent', 'delete')) {
         LimeExpressionManager::RevertUpgradeConditionsToRelevance($iSurveyId);
         $iGroupId = sanitize_int($iGroupId);
         $clang = $this->getController()->lang;
         $iGroupsDeleted = Groups::deleteWithDependency($iGroupId, $iSurveyId);
         if ($iGroupsDeleted !== 1) {
             fixSortOrderGroups($iSurveyId);
             Yii::app()->user->setFlash('flashmessage', $clang->gT('The question group was deleted.'));
         } else {
             Yii::app()->user->setFlash('flashmessage', $clang->gT('Group could not be deleted'));
         }
         $this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/' . $iSurveyId));
         LimeExpressionManager::UpgradeConditionsToRelevance($iSurveyId);
     }
 }
開發者ID:ryu1inaba,項目名稱:LimeSurvey,代碼行數:24,代碼來源:questiongroup.php


注:本文中的Groups::deleteWithDependency方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。