本文整理匯總了PHP中Survey::remove方法的典型用法代碼示例。如果您正苦於以下問題:PHP Survey::remove方法的具體用法?PHP Survey::remove怎麽用?PHP Survey::remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Survey
的用法示例。
在下文中一共展示了Survey::remove方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: remove
public function remove()
{
if (!$this->exists()) {
return false;
}
// Remove all of the user's surveys
foreach ($this->surveys as $surveyID) {
$survey = new Survey($surveyID);
$survey->remove();
}
// And the container which references them
Redis::del("User:{$this->id}:surveys");
// And the username-userid reference
Redis::set("User:username:{$this->username}");
parent::remove();
}
示例2: delete
public function delete($id)
{
$survey = new Survey($id);
if (!$survey->exists()) {
$this->message = "Survey not found";
$this->status = 404;
return;
}
if ($survey->ownerID != Session::$user['id']) {
$this->message = "Unauthorized";
$this->status = 403;
return;
}
$survey->remove();
$this->message = "Survey removed";
$this->status = 204;
}
示例3: showRemoveSurveyRes
function showRemoveSurveyRes()
{
/* update last page */
$_SESSION['LASTPAGE'] = 'sysadmin.surveys';
$displaySysAdmin = new DisplaySysAdmin();
$suid = getFromSessionParams('suid');
if ($suid != '') {
//remove
$survey = new Survey($suid);
/* remove sections */
$sections = $survey->getSections();
foreach ($sections as $section) {
$section->remove();
/* remove variables */
$variables = $survey->getVariableDescriptives($section->getSeid());
foreach ($variables as $variable) {
$variable->remove();
}
}
/* remove types */
$types = $survey->getTypes();
foreach ($types as $type) {
$type->remove();
}
/* remove types */
$groups = $survey->getGroups();
foreach ($groups as $group) {
$group->remove();
}
/* remove versions */
$versions = $survey->getVersions();
foreach ($versions as $version) {
$version->remove();
}
/* remove survey */
$survey->remove();
/* update users */
$users = new Users();
$users = $users->getUsers();
foreach ($users as $u) {
$u->removeSurvey($suid);
$u->saveChanges();
}
/* return result */
return $displaySysAdmin->showSurveys($displaySysAdmin->displaySuccess(Language::messageSurveyRemoved($survey->getName())));
} else {
return $displaySysAdmin->showSurveys();
}
}