IMP_Indices_Copy_Notepad::_create PHP Méthode

_create() protected méthode

protected _create ( $mbox, $subject, $body )
    protected function _create($mbox, $subject, $body)
    {
        global $notification, $registry;
        $list = str_replace(self::NOTEPAD_EDIT, '', $mbox);
        /* Create a new iCalendar. */
        $vCal = new Horde_Icalendar();
        $vCal->setAttribute('PRODID', '-//The Horde Project//IMP ' . $registry->getVersion() . '//EN');
        $vCal->setAttribute('METHOD', 'PUBLISH');
        /* Create a new vNote object using this message's contents. */
        $vNote = Horde_Icalendar::newComponent('vnote', $vCal);
        $vNote->setAttribute('BODY', $subject . "\n" . $body);
        /* Get the list of editable notepads. */
        $lists = $this->getNotepads(true);
        /* Attempt to add the new vNote item to the requested notepad. */
        try {
            $res = $registry->call('notes/import', array($vNote, 'text/x-vnote', $list));
        } catch (Horde_Exception $e) {
            $notification->push($e);
            return;
        }
        if (!$res) {
            $notification->push(_("An unknown error occured while creating the new note."), 'horde.error');
        } elseif (!empty($lists)) {
            $name = '"' . htmlspecialchars($subject) . '"';
            /* Attempt to convert the object name into a hyperlink. */
            if ($registry->hasLink('notes/show')) {
                $name = sprintf('<a href="%s">%s</a>', Horde::url($registry->link('notes/show', array('uid' => $res))), $name);
            }
            $notification->push(sprintf(_("%s was successfully added to \"%s\"."), $name, htmlspecialchars($lists[$list]->get('name'))), 'horde.success', array('content.raw'));
        }
    }
IMP_Indices_Copy_Notepad