Get alignment of the badge.

@return array information.
324781
public function get_alignments() {
        global $DB;
        $badgeid = $this->_data->id;
        $alignments = array();
        $items = $DB->get_records_select('badge_alignment', 'badgeid = ?', array($badgeid));
        foreach ($items as $item) {
            $alignment = array('targetName' => $item->targetname, 'targetUrl' => $item->targeturl);
            if ($item->targetdescription) {
                $alignment['targetDescription'] = $item->targetdescription;
            }
            if ($item->targetframework) {
                $alignment['targetFramework'] = $item->targetframework;
            }
            if ($item->targetcode) {
                $alignment['targetCode'] = $item->targetcode;
            }
            $alignments[] = $alignment;
        }
        return $alignments;
    }
395959
public function getRelativeOffset() {
		if($this->getParent()) {
			return $this->id - $this->getParent()->getID();
		}

		return $this->id;
	}
1004891
public function get_criteria() {
        global $DB;
        $criteria = array();

        if ($records = (array)$DB->get_records('badge_criteria', array('badgeid' => $this->id))) {
            foreach ($records as $record) {
                $criteria[$record->criteriatype] = award_criteria::build((array)$record);
            }
        }

        return $criteria;
    }
1305253
public function save_alignment($alignment, $alignmentid = 0) {
        global $DB;

        $record = $DB->record_exists('badge_alignment', array('id' => $alignmentid));
        if ($record) {
            $alignment->id = $alignmentid;
            return $DB->update_record('badge_alignment', $alignment);
        } else {
            return $DB->insert_record('badge_alignment', $alignment, true);
        }
    }
1058601
public function closeTag()
    {
        $result = '</label>';
        if ($this->element->hasAttribute('required') && $this->element->getAttribute('required')) {
            $result = sprintf('<span class="required-mark">*</span> %s', $result);
        }

        return $result;
    }
496726
private function classes(): string
    {
        $classes = '';

        if ($this->bg_color !== null) {
            $classes = ' badge-' . $this->bg_color;
        }

        if ($this->text_color !== null) {
            $classes .= ' text-' . $this->text_color;
        }

        if ($this->pill === true) {
            $classes .= ' badge-pill';
        }

        return $classes;
    }
280669
protected function attributes() {return
		($this->isNative() ? $this->attributesN() :
			['href' => $this->lHref(), 'title' => $this->s()->label()]
		)
		+ [
			'class' => df_cc_s(
				'df-sso-button', $this->cssClass(), $this->s()->type(), $this->cssClass2()
			)
			,'id' => df_uid(4, "{$this->cssClass()}-")
			,'rel' => 'nofollow'
		]
	;}
472691
public function getAssignmentAttribute()
    {
        if (! $this->exists) {
            return static::ALL_PAGES;
        }

        $count = $this->menuPivot()->count();
        if ($count === 0) {
            return static::NO_PAGES;
        } elseif ($count > 1) {
            return static::SELECTED_PAGES;
        } elseif ($count === 1) {
            $pivot = $this->menuPivot()->first();
            if ($pivot->menu_id > 0) {
                return static::SELECTED_PAGES;
            }
        }

        return static::ALL_PAGES;
    }
59037
public function layout(): array
    {
        return [

            MetricsExample::class,
            ChartLineExample::class,

            Layout::columns([
                ChartPieExample::class,
                ChartBarExample::class,
            ]),

            Layout::tabs([
                'Example Tab Table' => TableExample::class,
                'Example Tab Rows'  => RowExample::class,
            ]),

            Layout::modals([
                'exampleModal' => Layout::rows([
                    Input::make('user.password')
                        ->type('test')
                        ->title(__('Example'))
                        ->placeholder(__('Example')),
                ]),
            ]),

        ];
    }
1305973
public function getTypeBadge()
    {
        switch ($this->type) {
            case self::TYPE_INFO:
                return '<span class="badge badge-info">info</span>';
            case self::TYPE_WARNING:
                return '<span class="badge badge-warning">Warning</span>';
            case self::TYPE_ERROR:
                return '<span class="badge badge-danger">Error</span>';
            case self::TYPE_SUCCESS:
                return '<span class="badge badge-success">success</span>';
        }
    }
32521
public function getFlags()
    {
        $flags = array();
        foreach ($this->names as $name => $bit) {
            if (($this->bitmask & $bit) === $bit) {
                $flags[] = $name;
            }
        }

        return $flags;
    }
437731
public function getBadges()
  {
    $badges = array();

    foreach(explode(":", $this["client_badges"]) as $set)
    {
      if(substr($set, 0, 7) == "badges=")
      {
        $badges[] = array_map("trim", explode(",", substr($set, 7)));
      }
    }

    return $badges;
  }
197772
public function get_badge_assertion() {
        global $CFG;
        $assertion = array();
        if ($this->_data) {
            $hash = $this->_data->uniquehash;
            $email = empty($this->_data->backpackemail) ? $this->_data->email : $this->_data->backpackemail;
            $assertionurl = new moodle_url('/badges/assertion.php', array('b' => $hash));
            $classurl = new moodle_url('/badges/assertion.php', array('b' => $hash, 'action' => 1));

            // Required.
            $assertion['uid'] = $hash;
            $assertion['recipient'] = array();
            $assertion['recipient']['identity'] = 'sha256$' . hash('sha256', $email . $CFG->badges_badgesalt);
            $assertion['recipient']['type'] = 'email'; // Currently the only supported type.
            $assertion['recipient']['hashed'] = true; // We are always hashing recipient.
            $assertion['recipient']['salt'] = $CFG->badges_badgesalt;
            $assertion['badge'] = $classurl->out(false);
            $assertion['verify'] = array();
            $assertion['verify']['type'] = 'hosted'; // 'Signed' is not implemented yet.
            $assertion['verify']['url'] = $assertionurl->out(false);
            $assertion['issuedOn'] = $this->_data->dateissued;
            // Optional.
            $assertion['evidence'] = $this->_url->out(false); // Currently issued badge URL.
            if (!empty($this->_data->dateexpire)) {
                $assertion['expires'] = $this->_data->dateexpire;
            }
            $this->embed_data_badge_version2($assertion, OPEN_BADGES_V2_TYPE_ASSERTION);
        }
        return $assertion;
    }
369893
public function getOffsetPosting()
    {
        $this->getJournal()->assertIsSimpleJournal();

        foreach ($this->getJournal()->getPostings() as $posting) {
            if ($posting != $this) {
                return $posting;
            }
        }
    }
1061434
public function getAugmentedSoFar()
    {
        if (!$this->offsetExists(self::KEY_AUGMENTED)) {
            $this[self::KEY_AUGMENTED] = [];
        }
        return $this[self::KEY_AUGMENTED];
    }
1201691
public function render(Badge $badge)
    {
        $subjectWidth = $this->stringWidth($badge->getSubject());
        $statusWidth = $this->stringWidth($badge->getStatus());

        $params = [
            'vendorWidth'         => $subjectWidth,
            'valueWidth'          => $statusWidth,
            'totalWidth'          => ($subjectWidth + $statusWidth) + 7,
            'vendorColor'         => $this->color,
            'valueColor'          => $badge->getHexColor(),
            'vendor'              => $badge->getSubject(),
            'value'               => $badge->getStatus(),
            'vendorStartPosition' => round($subjectWidth / 2, 1) + 1,
            'valueStartPosition'  => $subjectWidth + $statusWidth / 2 + 6,
            'arrowStartPosition'  => $subjectWidth + 6,
            'arrowPathPosition'   => $subjectWidth + 6.5,
        ];

        return $this->renderSvg($params, $badge->getFormat());
    }
1222811
protected static function define_properties() {
        return [
            'id' => [
                'type' => PARAM_INT,
                'description' => 'Badge id',
                'optional' => true,
            ],
            'name' => [
                'type' => PARAM_TEXT,
                'description' => 'Badge name',
            ],
            'description' => [
                'type' => PARAM_NOTAGS,
                'description' => 'Badge description',
                'null' => NULL_ALLOWED,
            ],
            'timecreated' => [
                'type' => PARAM_INT,
                'description' => 'Time created',
                'optional' => true,
                'default' => 0,
            ],
            'timemodified' => [
                'type' => PARAM_INT,
                'description' => 'Time modified',
                'optional' => true,
                'default' => 0,
            ],
            'usercreated' => [
                'type' => PARAM_INT,
                'description' => 'User created',
                'optional' => true,
            ],
            'usermodified' => [
                'type' => PARAM_INT,
                'description' => 'User modified',
                'optional' => true,
            ],
            'issuername' => [
                'type' => PARAM_NOTAGS,
                'description' => 'Issuer name',
            ],
            'issuerurl' => [
                'type' => PARAM_URL,
                'description' => 'Issuer URL',
            ],
            'issuercontact' => [
                'type' => PARAM_RAW,
                'description' => 'Issuer contact',
                'null' => NULL_ALLOWED,
            ],
            'expiredate' => [
                'type' => PARAM_INT,
                'description' => 'Expire date',
                'optional' => true,
                'null' => NULL_ALLOWED,
            ],
            'expireperiod' => [
                'type' => PARAM_INT,
                'description' => 'Expire period',
                'optional' => true,
                'null' => NULL_ALLOWED,
            ],
            'type' => [
                'type' => PARAM_INT,
                'description' => 'Type',
                'optional' => true,
                'default' => 1,
            ],
            'courseid' => [
                'type' => PARAM_INT,
                'description' => 'Course id',
                'optional' => true,
                'null' => NULL_ALLOWED,
            ],
            'message' => [
                'type' => PARAM_RAW,
                'description' => 'Message',
                'optional' => true,
            ],
            'messagesubject' => [
                'type' => PARAM_TEXT,
                'description' => 'Message subject',
                'optional' => true,
            ],
            'attachment' => [
                'type' => PARAM_INT,
                'description' => 'Attachment',
                'optional' => true,
                'default' => 1,
            ],
            'notification' => [
                'type' => PARAM_INT,
                'description' => 'Whether to notify when badge is awarded',
                'optional' => true,
                'default' => 1,
            ],
            'nextcron' => [
                'type' => PARAM_INT,
                'description' => 'Next cron',
                'optional' => true,
                'null' => NULL_ALLOWED,
            ],
            'status' => [
                'type' => PARAM_INT,
                'description' => 'Status',
                'optional' => true,
                'default' => 0,
            ],
            'issuedid' => [
                'type' => PARAM_INT,
                'description' => 'Issued id',
                'optional' => true,
            ],
            'uniquehash' => [
                'type' => PARAM_ALPHANUM,
                'description' => 'Unique hash',
            ],
            'dateissued' => [
                'type' => PARAM_INT,
                'description' => 'Date issued',
                'default' => 0,
            ],
            'dateexpire' => [
                'type' => PARAM_INT,
                'description' => 'Date expire',
                'null' => NULL_ALLOWED,
            ],
            'visible' => [
                'type' => PARAM_INT,
                'description' => 'Visible',
                'optional' => true,
                'default' => 0,
            ],
            'email' => [
                'type' => PARAM_TEXT,
                'description' => 'User email',
                'optional' => true,
            ],
            'version' => [
                'type' => PARAM_TEXT,
                'description' => 'Version',
                'optional' => true,
                'null' => NULL_ALLOWED,
            ],
            'language' => [
                'type' => PARAM_NOTAGS,
                'description' => 'Language',
                'optional' => true,
                'null' => NULL_ALLOWED,
            ],
            'imageauthorname' => [
                'type' => PARAM_TEXT,
                'description' => 'Name of the image author',
                'optional' => true,
                'null' => NULL_ALLOWED,
            ],
            'imageauthoremail' => [
                'type' => PARAM_TEXT,
                'description' => 'Email of the image author',
                'optional' => true,
                'null' => NULL_ALLOWED,
            ],
            'imageauthorurl' => [
                'type' => PARAM_URL,
                'description' => 'URL of the image author',
                'optional' => true,
                'null' => NULL_ALLOWED,
            ],
            'imagecaption' => [
                'type' => PARAM_TEXT,
                'description' => 'Caption of the image',
                'optional' => true,
                'null' => NULL_ALLOWED,
            ],
        ];
    }