Reads data for an event.
@param [String => Mixed] $opts
@return [String => Mixed]
@override Event
19365
public function read(array $opts) {
        return array_merge(parent::read($opts), [
            'verb' => [
                'id' => 'http://adlnet.gov/expapi/verbs/registered',
                'display' => $this->readVerbDisplay($opts),
            ],
            'object' => $this->readApp($opts),
        ]);
    }
653172
public function read(array $opts) {
        $scoreMax = $opts['scorm_scoes_track']['scoremax'];
        $scoreRaw = $opts['cmi_data']['cmivalue'];
        $scoreMin = $opts['scorm_scoes_track']['scoremin'];
        $scoreScaled = NULL;

        $scoreScaled = $scoreRaw >= 0 ? ($scoreRaw / $scoreMax) : ($scoreRaw / $scoreMin);

        return [array_merge(parent::read($opts)[0], [
            'recipe' => 'scorm_scoreraw_submitted',
            'scorm_score_raw' => $scoreRaw,
            'scorm_score_min' => $scoreMin,
            'scorm_score_max' => $scoreMax,
            'scorm_score_scaled' => $scoreScaled,
        ])];
    }
975268
public static function all($params = null, $opts = null)
    {
        self::_validateParams($params);
        $url = static::classUrl();

        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
        if (!is_a($obj, 'Stripe\\Collection')) {
            $class = get_class($obj);
            $message = "Expected type \"Stripe\\Collection\", got \"$class\" instead";
            throw new \Stripe\Error\Api($message);
        }
        $obj->setLastResponse($response);
        $obj->setRequestParams($params);
        return $obj;
    }
404239
public function played($optParams = array()) {
      $params = array();
      $params = array_merge($params, $optParams);
      $data = $this->__call('played', array($params));
      return $data;
    }
865280
public function read(array $opts) {
        return [array_merge(parent::read($opts)[0], [
            'recipe' => 'course_completed',
            'user_id' => $opts['relateduser']->id,
            'user_url' => $opts['relateduser']->url,
            'user_name' => $opts['relateduser']->fullname,
        ])];
    }
366771
public function parseFeedback($opts){
        $parsedQuestions = [];
        $scoreMax = 0;
        $scoreRaw = 0;

        foreach ($opts['questions'] as $item => $question) {
            // Find the response to the current question
            $currentResponse = null;
            foreach ($opts['attempt']->responses as $responseId => $response) {
                if (!empty($response->item) && $response->item == $item) {
                    $currentResponse = $response;
                }
            }

            if (is_null($currentResponse)) {
                // Perhaps a label or the learner did not answer this question - don't add to the array.
                break;
            }

            // Parse the current question
            $parsedQuestion = (object)[
                'question' => $question,
                'options' => $this->parseQuestionPresentation($question->presentation, $question->typ),
                'score' => (object) [
                    'max' => 0,
                    'raw' => 0
                ],
                'response' => null
            ];

            $parsedQuestion->response = $currentResponse->id;

            // Add scores and response
            foreach ($parsedQuestion->options as $optionIndex => $option) {
                if (isset($option->value) && $option->value > $parsedQuestion->score->max) {
                    $parsedQuestion->score->max = $option->value;
                }

                // Find the option the learner selected
                if ($optionIndex == $currentResponse->id){
                    if (isset($option->value)) {
                        $parsedQuestion->score->raw = $option->value;
                    }
                }
            }

            $scoreMax += $parsedQuestion->score->max;
            $scoreRaw += $parsedQuestion->score->raw;

            if ($parsedQuestion->score->max == 0) {
                $parsedQuestion->score->max = null;
                $parsedQuestion->score->raw = null;
            }
            else {
                $parsedQuestion->score->min = 0;
                $parsedQuestion->score->scaled = $parsedQuestion->score->raw / $parsedQuestion->score->max;
            }

            array_push(
                $parsedQuestions, 
                $parsedQuestion
            );
        }

        $scoreMin = null;
        $scoreScaled = null;
        if ($scoreMax == 0){
            $scoreMax = null;
            $scoreRaw = null;
        }
        else {
            $scoreScaled = $scoreRaw / $scoreMax;
            $scoreMin = 0;
        }

        return (object)[
            'questions' => $parsedQuestions,
            'score' => (object) [
                'max' => $scoreMax,
                'raw' => $scoreRaw,
                'min' => $scoreMin,
                'scaled' => $scoreScaled
            ] 
        ];
    }
544643
public function read(array $opts) {
        return [array_merge(parent::read($opts)[0], [
            'recipe' => 'scorm_event',
            'scorm_url' => $opts['module']->url,
            'scorm_name' => $opts['module']->name,
            'scorm_scoes_id' => $opts['scorm_scoes']->id,
            'scorm_scoes_type' => 'http://adlnet.gov/expapi/activities/lesson',
            'scorm_scoes_url' => $opts['module']->url,
            'scorm_scoes_name' => $opts['scorm_scoes']->title,
            'scorm_scoes_description' => $opts['scorm_scoes']->title,
            'scorm_attempt' => $opts['cmi_data']['attemptid'],
            'scorm_status' => $opts['scorm_scoes_track']['status'],
        ])];
    }
978083
public function get($userid = null, $opts = array())
	{
		$this->debug->groupCollapsed(__METHOD__, $userid);
		$opts = array_merge(array(
			'localtime' => true,	// true: return formatted date/time string for user's timezone
		), $opts);
		$vals_datetime = array('createdon','lastactivity','previousactivity');
		if (is_null($userid) || $userid == $this->userid) {
			$this->debug->log('use current user');
			$user = $this->user;
		} else {
			$ignore = array( 'password' );
			$joins = array();
			foreach ($this->cfg['userForeignKeys'] as $fka) {
				if (!empty($fka['getJoin'])) {
					$joins[] = $fka['getJoin'];
				}
				if (!empty($fka['ignoreKey'])) {
					$ignore[] = $fka['userCol'];
				}
			}
			$joins = !empty($joins)
				? ' '.implode(' ', $joins)
				: '';
			$query = 'SELECT * FROM `user`'
				.' LEFT JOIN `user_auth` USING (`userid`)'
				.$joins
				.' WHERE `user`.`userid` = '.$this->db->quoteValue($userid);
			$users = $this->db->query($query)[0];
			$this->debug->table($users, 'users');
			$user = $users[0];
			foreach ($vals_datetime as $k) {
				if (isset($user[$k])) {
					$user[$k] = strtotime($user[$k]);
				}
			}
			$query = 'SELECT `right` FROM `user_rights` WHERE `userid` = '.$this->db->quoteValue($userid);
			$rights = $this->db->query($query)[0];
			foreach ($rights as $k => $a) {
				$rights[$k] = $a['right'];
			}
			$user['previousactivity'] = $user['lastactivity'];
			$user['rights'] = $rights;
			foreach ($ignore as $k) {
				unset($user[$k]);
			}
		}
		if ($opts['localtime']) {
			foreach ($vals_datetime as $k) {
				$user[$k] = $this->datetimeLocal($user[$k]);
			}
		}
		$this->debug->log('user', $user);
		$this->debug->groupEnd();
		return $user;
	}
675347
private function getFillOpts($opts)
	{
		$this->debug->group(__CLASS__.'->'.__FUNCTION__);
		$arrayUtil = new ArrayUtil();
		$opts = $arrayUtil->mergeDeep(array(
			'output_file'	=> 'temporary',	// if null is passed, raw pdf will be returned
			'fillcolor'		=> null,		// font-color
			'checkbox_opts'	=> array(
				'fontname'		=> 'ZapfDingbats',
				'textformat'	=> 'utf16be',
				'encoding'		=> 'unicode',
				'position'		=> 'center',
				'bordercolor'	=> '#C0C0C0',	// or null
				// 'fontsize'	=> 12,
			),
			'checkbox_value'	=> "\x27\x18",
			'radio_opts'	=> array(
				'fontname'		=> 'ZapfDingbats',
				'textformat'	=> 'utf16be',
				'encoding'		=> 'unicode',
				'position'		=> 'center',
				'bordercolor'	=> '#C0C0C0',	// or null
				// 'fontsize'	=> 12,
			),
			'radio_value'	=> "\x25\xCF",
			'text_opts'		=> array(
				'bordercolor'	=> 'none',
			),
			'name_trans_func'	=> array(),			// function and parameters to transform block name
			'info' => array(),
		), $opts);
		if ($opts['output_file'] == 'temporary') {
			$temp_dir = sys_get_temp_dir();
			$opts['output_file'] = tempnam($temp_dir, 'pdf');
		}
		$this->debug->groupEnd();
		return $opts;
	}
1098807
protected function mountVolumes($opts)
    {
        foreach ($opts['roots'] as $i => $o) {
            $class = 'elFinderVolume'.(isset($o['driver']) ? $o['driver'] : '');

            if (class_exists($class)) {
                $volume = new $class();

                try {
                    if ($this->maxArcFilesSize && (empty($o['maxArcFilesSize']) || $this->maxArcFilesSize < $o['maxArcFilesSize'])) {
                        $o['maxArcFilesSize'] = $this->maxArcFilesSize;
                    }
                    // pass session handler
                    $volume->setSession($this->session);
                    if ($volume->mount($o)) {
                        // unique volume id (ends on "_") - used as prefix to files hash
                        $id = $volume->id();

                        $this->volumes[$id] = $volume;
                        if ((!$this->default || $volume->root() !== $volume->defaultPath()) && $volume->isReadable()) {
                            $this->default = $this->volumes[$id];
                        }
                    } else {
                        $this->removeNetVolume($i, $volume);
                        $this->mountErrors[] = 'Driver "'.$class.'" : '.implode(' ', $volume->error());
                    }
                } catch (Exception $e) {
                    $this->removeNetVolume($i, $volume);
                    $this->mountErrors[] = 'Driver "'.$class.'" : '.$e->getMessage();
                }
            } else {
                $this->removeNetVolume($i, $volume);
                $this->mountErrors[] = 'Driver "'.$class.'" does not exist';
            }
        }
    }
930509
public function read(array $opts) {
        return [array_merge(parent::read($opts)[0], [
            'recipe' => 'course_viewed',
            'course_url' => $opts['course']->url,
            'course_name' => $opts['course']->fullname ?: 'A Moodle course',
            'course_description' => strip_tags($opts['course']->summary) ?: 'A Moodle course',
            'course_type' => static::$xapiType.$opts['course']->type,
            'course_ext' => $opts['course'],
            'course_ext_key' => 'http://lrs.learninglocker.net/define/extensions/moodle_course',
        ])];
    }
522935
private function parseYamlOptions(array $opts = [])
    {
        if (is_file($this->runner->pwd.'/.phillip.yml')) {
            $options = Yaml::parseFile($this->runner->pwd.'/.phillip.yml');

            return array_merge($opts, $options);
        }

        return $opts;
    }
479633
public function read(array $opts) {
        return array_merge_recursive(parent::read($opts), [
            'verb' => [
                'id' => 'http://adlnet.gov/expapi/verbs/completed',
                'display' => $this->readVerbDisplay($opts),
            ],
            'object' => $this->readModule($opts),
            'context' => [
                'contextActivities' => [
                    'grouping' => [
                        $this->readCourse($opts),
                    ],
                ],
            ],
        ]);
    }
295404
public function insertEvent($event, $optParams = []): Google_Service_Calendar_Event
    {
        if ($event instanceof Event) {
            $event = $event->googleEvent;
        }

        return $this->calendarService->events->insert($this->calendarId, $event, $optParams);
    }
694774
public function read(array $opts) {
        $statement = parent::read($opts);
        $statement['verb'] = [
            'id' => 'http://id.tincanapi.com/verb/unregistered',
            'display' => $this->readVerbDisplay($opts),
        ];
        return $statement;
    }
1322240
public static function parse($opts)
    {
        if ($opts instanceof self) {
            return $opts;
        }
        if (is_null($opts)) {
            return new Options(null, array());
        }
        if (is_array($opts)) {
            $key = null;
            if (array_key_exists('api_key', $opts)) {
                $key = $opts['api_key'];
                unset($opts['api_key']);
            }
            return new Options($key, $opts);
        } else {
            throw new Error\InvalidOption('Options have to be array.');
        }
    }
190979
public function getEvents($limit = null)
    {
        $select = $this->getConnection()->select()->from($this->getMainTable());

        if ($limit !== null) {
            $select->limit($limit);
        }

        $eventData = $this->getConnection()->fetchAll($select);

        foreach ($eventData as &$currentEvent) {
            $currentEvent = array_merge($currentEvent, $this->jsonSerializer->unserialize($currentEvent['data']));
            unset($currentEvent['data']);
        }

        return $eventData;
    }