attributes['subtype'] = 'dmsubcompetency'; $this->attributes['access_id'] = ACCESS_PUBLIC; } /** * Get list of performance levels * * @param int $limit Limit * @param int $offset Offset * @param bool $count Count */ public function getPerformanceLevels($limit = 10, $offset = 0, $count = false) { $options = array( 'types' => 'object', 'subtypes' => 'dmperformancelevel', 'limit' => $limit, 'offset' => $offset, 'count' => $count, 'container_guid' => $this->getGUID(), 'order_by_metadata' => array('name' => 'level', 'direction' => 'ASC', 'as' => 'integer') ); return elgg_get_entities_from_metadata($options); } /** * Returns next subcompetency from the same competency if possible * * @return mixed */ public function getNextSubCompetency() { $options = array( 'types' => 'object', 'subtypes' => 'dmsubcompetency', 'limit' => 1, 'container_guid' => $this->getContainerGUID(), 'metadata_name_value_pairs' => array('name' => 'level', 'value' => ((int)$this->level + 1)) ); $next = elgg_get_entities_from_metadata($options); if (is_array($next) && sizeof($next)) { return $next[0]; } return false; } }