Display unpublishing confirmation page
@param stdClass $publication
$publication->courseshortname
$publication->courseid
$publication->hubname
$publication->huburl
$publication->id
342176
public function confirmunpublishing($publication) {
        $optionsyes = array('sesskey' => sesskey(), 'id' => $publication->courseid,
            'hubcourseid' => $publication->hubcourseid,
            'cancel' => true, 'publicationid' => $publication->id, 'confirm' => true);
        $optionsno = array('sesskey' => sesskey(), 'id' => $publication->courseid);
        $publication->hubname = html_writer::tag('a', 'Moodle.net',
            array('href' => HUB_MOODLEORGHUBURL));
        $formcontinue = new single_button(new moodle_url("/course/publish/index.php",
            $optionsyes), get_string('unpublish', 'hub'), 'post');
        $formcancel = new single_button(new moodle_url("/course/publish/index.php",
            $optionsno), get_string('cancel'), 'get');
        return $this->output->confirm(get_string('unpublishconfirmation', 'hub', $publication),
            $formcontinue, $formcancel);
    }
1308753
def unpublish(self):
        
        assert self.state == self.DRAFT

        with xact():
            self._publish(published=False)

            # Delete all scheduled items
            klass = self.get_version_class()
            for obj in klass.normal.filter(object_id=self.object_id, state=self.SCHEDULED):
                obj.delete()
73857
def unpublish_object(content_type_pk, obj_pk):
    
    ct = ContentType.objects.get_for_id(content_type_pk)
    obj = ct.get_object_for_this_type(pk=obj_pk)
    try:
        # Unbuild the object
        logger.info("unpublish_object task has received %s" % obj)
        obj.unbuild()
        # Run the `publish` management command unless the
        # ALLOW_BAKERY_AUTO_PUBLISHING variable is explictly set to False.
        if not getattr(settings, 'ALLOW_BAKERY_AUTO_PUBLISHING', True):
            logger.info("Not running publish command because \
ALLOW_BAKERY_AUTO_PUBLISHING is False")
        else:
            management.call_command("publish")
    except Exception:
        # Log the error if this crashes
        logger.error("Task Error: unpublish_object", exc_info=True)
526819
public function unpublish($comment)
    {
        $qry = new InvokePostMethodQuery($this->getResourcePath(), "unpublish", array(
            "comment" => $comment
        ));
        $this->getContext()->addQuery($qry);
    }
1270285
public function unpublish(ResourceActionEvent $event)
    {
        $nodes = $this->manager->setPublishedStatus([$event->getResourceNode()], false);

        $event->setResponse(
            new JsonResponse($this->serializer->serialize($nodes[0]))
        );
    }
417353
private function validatePublishing($publishing)
    {
        if ($this->isRoot() && $publishing !== null) {
            throw new \LogicException("Root page can't be scheduled published.");
        }

        if (!($publishing instanceof \DateTime)) {
            $publishing = $this->convertTimestampToDateTime($publishing);
        }

        return $publishing;
    }
346503
public function unpublishResource(PersistentResource $resource)
    {
        try {
            $objectName = $this->keyPrefix . $this->getRelativePublicationPathAndFilename($resource);
            $this->s3Client->deleteObject(array(
                'Bucket' => $this->bucketName,
                'Key' => $objectName
            ));
            $this->systemLogger->log(sprintf('Successfully unpublished resource as object "%s" (MD5: %s) from bucket "%s"', $objectName, $resource->getMd5() ?: 'unknown', $this->bucketName), LOG_DEBUG);
        } catch (\Exception $e) {
        }
    }
627592
public function stripB3NonPublished($pages)
    {
        foreach ($pages['_items'] as $index => $page) {
            if ($page['isBuilderThreePage'] && !$page['isBuilderThreePublished']) {
                unset($pages['_items'][$index]);
            }
        }

        return $pages;
    }
446832
public function view(stdClass $submission) {
        global $CFG;
        $result = '';

        $onlinetextsubmission = $this->get_onlinetext_submission($submission->id);

        if ($onlinetextsubmission) {

            // Render for portfolio API.
            $result .= $this->assignment->render_editor_content(ASSIGNSUBMISSION_ONLINETEXT_FILEAREA,
                                                                $onlinetextsubmission->submission,
                                                                $this->get_type(),
                                                                'onlinetext',
                                                                'assignsubmission_onlinetext');

            $plagiarismlinks = '';

            if (!empty($CFG->enableplagiarism)) {
                require_once($CFG->libdir . '/plagiarismlib.php');

                $plagiarismlinks .= plagiarism_get_links(array('userid' => $submission->userid,
                    'content' => trim($onlinetextsubmission->onlinetext),
                    'cmid' => $this->assignment->get_course_module()->id,
                    'course' => $this->assignment->get_course()->id,
                    'assignment' => $submission->assignment));
            }
        }

        return $plagiarismlinks . $result;
    }
1242299
def clear_published_date(self):
        
        # Implemented from template for osid.assessment.AssessmentOfferedForm.clear_start_time_template
        if (self.get_published_date_metadata().is_read_only() or
                self.get_published_date_metadata().is_required()):
            raise errors.NoAccess()
        self._my_map['publishedDate'] = self._published_date_default
1059974
public function admin_remove_service_confirmation($service) {
        global $CFG;
        $optionsyes = array('id' => $service->id, 'action' => 'delete',
            'confirm' => 1, 'sesskey' => sesskey());
        $optionsno = array('section' => 'externalservices');
        $formcontinue = new single_button(new moodle_url('service.php', $optionsyes),
                        get_string('delete'), 'post');
        $formcancel = new single_button(
                        new moodle_url($CFG->wwwroot . "/" . $CFG->admin . "/settings.php", $optionsno),
                        get_string('cancel'), 'get');
        return $this->output->confirm(get_string('deleteserviceconfirm', 'webservice', $service->name),
                $formcontinue, $formcancel);
    }
1051608
public static function get_published_course($publication) {
        try {
            list($courses, $unused) = api::get_courses('', !$publication->enrollable,
                $publication->enrollable, ['ids' => [$publication->hubcourseid], 'allsitecourses' => 1]);
            return reset($courses);
        } catch (\Exception $e) {
            \core\notification::add(get_string('errorcourseinfo', 'hub', $e->getMessage()),
                \core\output\notification::NOTIFY_ERROR);
        }
        return null;
    }
957704
public function onAfterPublish()
    {
        // store IDs of fields we've published
        $seenIDs = [];
        foreach ($this->owner->Fields() as $field) {
            // store any IDs of fields we publish so we don't unpublish them
            $seenIDs[] = $field->ID;
            $field->doPublish(Versioned::DRAFT, Versioned::LIVE);
            $field->destroy();
        }

        // fetch any orphaned live records
        $live = Versioned::get_by_stage(EditableFormField::class, Versioned::LIVE)
            ->filter([
                'ParentID' => $this->owner->ID,
            ]);

        if (!empty($seenIDs)) {
            $live = $live->exclude([
                'ID' => $seenIDs,
            ]);
        }

        // delete orphaned records
        foreach ($live as $field) {
            $field->deleteFromStage(Versioned::LIVE);
            $field->destroy();
        }
    }
380411
function unpublishPage(uri, user) {
  const update = {
    published: false,
    publishTime: null,
    url: '',
    history: [{ action: 'unpublish', timestamp: new Date().toISOString(), users: [userOrRobot(user)] }]
  };

  return changeMetaState(uri, update);
}
1204063
protected function convert_submission_for_gradebook(stdClass $submission) {
        $gradebookgrade = array();

        $gradebookgrade['userid'] = $submission->userid;
        $gradebookgrade['usermodified'] = $submission->userid;
        $gradebookgrade['datesubmitted'] = $submission->timemodified;

        return $gradebookgrade;
    }
251935
public function dcDateIssued($entity)
    {
        if (!$entity->displayMetaDates) {
            return '';
        }
        $published = ($entity->published !== null) ? $entity->published->format('c') : null;
        return $this->_render(self::ATTR_PROP, 'DC.date.issued', $published);
    }
1270643
public function remove(stdClass $submission) {
        global $DB;

        $submissionid = $submission ? $submission->id : 0;
        if ($submissionid) {
            $DB->delete_records('assignsubmission_onlinetext', array('submission' => $submissionid));
        }
        return true;
    }