Esempio n. 1
0
    /**
     * Add a LEAP2A entry element that corresponds to a submission including attachments.
     *
     * @param portfolio_format_leap2a_writer $leapwriter Writer object to add entries to.
     * @param workshop_submission $workshopsubmission
     * @param string $html The exported HTML content of the submission
     * @return int id of new entry
     */
    protected function export_content_leap2a(portfolio_format_leap2a_writer $leapwriter,
            workshop_submission $workshopsubmission, $html) {

        $entry = new portfolio_format_leap2a_entry('workshopsubmission'.$workshopsubmission->id,  s($workshopsubmission->title),
            'resource', $html);
        $entry->published = $workshopsubmission->timecreated;
        $entry->updated = $workshopsubmission->timemodified;
        $entry->author = (object)[
            'id' => $workshopsubmission->authorid,
            'email' => $workshopsubmission->authoremail
        ];
        username_load_fields_from_object($entry->author, $workshopsubmission);

        $leapwriter->link_files($entry, $this->multifiles);
        $entry->add_category('web', 'resource_type');
        $leapwriter->add_entry($entry);

        return $entry->id;
    }
Esempio n. 2
0
 /**
  * helper function to add a leap2a entry element
  * that corresponds to a single forum post,
  * including any attachments
  *
  * the entry/ies are added directly to the leapwriter, which is passed by ref
  *
  * @param portfolio_format_leap2a_writer $leapwriter writer object to add entries to
  * @param object $post                               the stdclass object representing the database record
  * @param string $posthtml                           the content of the post (prepared by {@link prepare_post}
  *
  * @return int id of new entry
  */
 private function prepare_post_leap2a(portfolio_format_leap2a_writer $leapwriter, $post, $posthtml)
 {
     $entry = new portfolio_format_leap2a_entry('forumpost' . $post->id, $post->subject, 'resource', $posthtml);
     $entry->published = $post->created;
     $entry->updated = $post->modified;
     $entry->author = $post->author;
     if (is_array($this->keyedfiles) && array_key_exists($post->id, $this->keyedfiles) && is_array($this->keyedfiles[$post->id])) {
         $leapwriter->link_files($entry, $this->keyedfiles[$post->id], 'forumpost' . $post->id . 'attachment');
     }
     $entry->add_category('web', 'resource_type');
     $leapwriter->add_entry($entry);
     return $entry->id;
 }
Esempio n. 3
0
 /**
  * helper function to add a leap2a entry element
  * that corresponds to a single certificate,
  *
  * the entry/ies are added directly to the leapwriter, which is passed by ref
  *
  * @global object $certificate the stdclass object representing the database record
  * @param portfolio_format_leap2a_writer $leapwriter writer object to add entries to
  * @param string $content  the content of the certificate (prepared by {@link prepare_certificate}
  *
  * @return int id of new entry
  */
 private function prepare_certificat_leap2a(portfolio_format_leap2a_writer $leapwriter, $content)
 {
     global $USER;
     $order = array(" ", "\r\n", "\n", "\r");
     $replace = ' ';
     $content = str_replace($order, $replace, $content);
     $title = get_string('certificat', 'referentiel') . ' ' . $this->occurrence->code_referentiel;
     $entry = new portfolio_format_leap2a_entry('certificat' . $this->certificat->id, $title, 'leap2', $content);
     // proposer ability ?
     $entry->published = time();
     $entry->updated = time();
     $entry->author->id = $this->certificat->userid;
     $entry->summary = '<p><h3>' . get_string('certificat', 'referentiel') . ' ' . get_string('referentiel', 'referentiel') . $this->occurrence->code_referentiel . '</h3>' . "\n" . '<p>' . $this->occurrence->description_referentiel . '</p>';
     $entry->add_category('web', 'any_type', 'Referentiel');
     // DEBUG
     // echo "<br />266 :: ENTRY<br />\n";
     // print_object($entry);
     $leapwriter->add_entry($entry);
     // echo "<br />272 :: LEAPWRITER<br />\n";
     // print_object($leapwriter);
     return $entry->id;
 }