attributes['subtype'] = 'dmcompetencymodel'; $this->attributes['access_id'] = ACCESS_PUBLIC; } /** * Get list of competencies. * * @param int $limit Limit * @param int $offset Offset * @param bool $count Count * * @return mixed */ public function getCompetencies($limit = 10, $offset = 0, $count = false) { $options = array( 'types' => 'object', 'subtypes' => 'dmcompetency', 'limit' => $limit, 'offset' => $offset, 'count' => $count, 'container_guid' => $this->getGUID(), 'order_by' => 'guid ASC' ); return elgg_get_entities($options); } /** * Retuns number of PerformanceLevel objects in the model * * @return int */ public function getPerformanceLevelCount() { $level_count = 0; $competencies = $this->getCompetencies(0); if (is_array($competencies) && count($competencies) > 0) { foreach ($competencies as $competency) { $level_count += $competency->getPerformanceLevelCount(); } } return $level_count; } }