本文整理汇总了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();
}
}