本文整理汇总了PHP中Annotation::setLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Annotation::setLink方法的具体用法?PHP Annotation::setLink怎么用?PHP Annotation::setLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Annotation
的用法示例。
在下文中一共展示了Annotation::setLink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recordToAnnotation
function recordToAnnotation($r)
{
$annotation = new Annotation();
$annotation->setAnnotationId($r->id);
$annotation->setUserId($r->userid);
if ($r->access) {
$annotation->setAccess($r->access);
}
if ($r->url) {
$annotation->setUrl($r->url);
}
if ($r->note) {
$annotation->setNote($r->note);
}
if ($r->quote) {
$annotation->setQuote($r->quote);
}
if ($r->quote_title) {
$annotation->setQuoteTitle($r->quote_title);
}
if ($r->quote_author) {
$annotation->setQuoteAuthor($r->quote_author);
}
if ($r->link) {
$annotation->setLink($r->link);
}
if ($r->link_title) {
$annotation->setLinkTitle($r->link_title);
}
$annotation->setCreated($r->created);
if ($r->start_block !== null) {
$range = new SequenceRange();
$range->setStart(new SequencePoint($r->start_block, $r->start_word, $r->start_char));
$range->setEnd(new SequencePoint($r->end_block, $r->end_word, $r->end_char));
$annotation->setSequenceRange($range);
} else {
if (!empty($r->range)) {
$range = new SequenceRange();
$range->fromString($r->range);
$annotation->setSequenceRange($range);
}
}
if ($r->start_xpath !== null) {
$range = new XPathRange();
$range->setStart(new XPathPoint($r->start_xpath, $r->start_word, $r->start_char));
$range->setEnd(new XpathPoint($r->end_xpath, $r->end_word, $r->end_char));
$annotation->setXPathRange($range);
}
return $annotation;
}
示例2: Annotation
/**
* Remember: This the Annotation class does not store Moodle user IDs, so
* you must be sure to query for username and quote_author_username if you
* want userid and quoteAuthorId set.
*/
function record_to_annotation($r)
{
$annotation = new Annotation();
$annotation->setAnnotationId($r->id);
if (array_key_exists('userid', $r)) {
$annotation->setUserId($r->userid);
}
if (array_key_exists('firstname', $r)) {
$annotation->setUserName($this->fullname2($r->firstname, $r->lastname));
}
if (array_key_exists('sheet_type', $r)) {
$annotation->setSheet($this->sheet_str($r->sheet_type));
}
if (array_key_exists('url', $r)) {
$annotation->setUrl($r->url);
}
if (array_key_exists('note', $r)) {
$annotation->setNote($r->note);
}
if (array_key_exists('quote', $r)) {
$annotation->setQuote($r->quote);
}
if (array_key_exists('quote_title', $r)) {
$annotation->setQuoteTitle($r->quote_title);
}
if (array_key_exists('quote_author_id', $r)) {
$annotation->setQuoteAuthorId($r->quote_author_id);
} elseif (array_key_exists('quote_author', $r)) {
// to support old mdl_annotation table
$annotation->setQuoteAuthorId($r->quote_author);
}
if (array_key_exists('quote_author_firstname', $r)) {
$annotation->setQuoteAuthorName($this->fullname2($r->quote_author_firstname, $r->quote_author_lastname));
}
if (array_key_exists('link', $r)) {
$annotation->setLink($r->link);
}
if (array_key_exists('link_title', $r)) {
$annotation->setLinkTitle($r->link_title);
}
if (array_key_exists('created', $r)) {
$annotation->setCreated((int) $r->created);
}
if (array_key_exists('modified', $r)) {
$annotation->setModified((int) $r->modified);
}
if (array_key_exists('lastread', $r)) {
$annotation->setLastRead((int) $r->lastread);
}
$start_line = array_key_exists('start_line', $r) ? $r->start_line : 0;
$end_line = array_key_exists('end_line', $r) ? $r->end_line : 0;
// The second and subsequente lines of the test are to catch cases where everything is blank,
// which can happen if the range is really old and uses the range field
if (array_key_exists('start_block', $r) && $r->start_block !== null && (!array_key_exists('range', $r) || ($start_line || $end_line || $r->start_block || $r->end_block || $r->start_word || $r->end_word || $r->start_char || $r->end_char))) {
$range = new SequenceRange();
$range->setStart(new SequencePoint($r->start_block, $start_line, $r->start_word, $r->start_char));
$range->setEnd(new SequencePoint($r->end_block, $end_line, $r->end_word, $r->end_char));
$annotation->setSequenceRange($range);
} else {
if (array_key_exists('range', $r) && $r->range !== null) {
$range = new SequenceRange();
$range->fromString($r->range);
$annotation->setSequenceRange($range);
}
}
if (array_key_exists('start_xpath', $r) && $r->start_xpath !== null) {
$range = new XPathRange();
$range->setStart(new XPathPoint($r->start_xpath, $start_line, $r->start_word, $r->start_char));
$range->setEnd(new XpathPoint($r->end_xpath, $end_line, $r->end_word, $r->end_char));
$annotation->setXPathRange($range);
}
return $annotation;
}