/** * Get QualificationGroup data for one or more QualificationGroupes. * @param array $data filter data * @return array */ function getQualificationGroup($data = NULL, $disable_paging = FALSE, $mode = 'flat') { if (!$this->getPermissionObject()->Check('qualification', 'enabled') or !($this->getPermissionObject()->Check('qualification', 'view') or $this->getPermissionObject()->Check('qualification', 'view_own') or $this->getPermissionObject()->Check('qualification', 'view_child'))) { //return $this->getPermissionObject()->PermissionDenied(); $data['filter_columns'] = $this->handlePermissionFilterColumns(isset($data['filter_columns']) ? $data['filter_columns'] : NULL, Misc::trimSortPrefix($this->getOptions('list_columns'))); } $data = $this->initializeFilterAndPager($data, $disable_paging); $data['filter_data']['permission_children_ids'] = $this->getPermissionObject()->getPermissionChildren('qualification', 'view'); $qglf = TTnew('QualificationGroupListFactory'); if ($mode == 'flat') { $qglf->getAPISearchByCompanyIdAndArrayCriteria($this->getCurrentCompanyObject()->getId(), $data['filter_data'], $data['filter_items_per_page'], $data['filter_page'], NULL, $data['filter_sort']); Debug::Text('Record Count: ' . $qglf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10); if ($qglf->getRecordCount() > 0) { $this->getProgressBarObject()->start($this->getAMFMessageID(), $qglf->getRecordCount()); $this->setPagerObject($qglf); foreach ($qglf as $ug_obj) { $retarr[] = $ug_obj->getObjectAsArray($data['filter_columns'], $data['filter_data']['permission_children_ids']); $this->getProgressBarObject()->set($this->getAMFMessageID(), $qglf->getCurrentRow()); } $this->getProgressBarObject()->stop($this->getAMFMessageID()); return $this->returnHandler($retarr); } } else { $nodes = $qglf->getByCompanyIdArray($this->getCurrentCompanyObject()->getId()); //Debug::Arr($nodes, ' Nodes: ', __FILE__, __LINE__, __METHOD__, 10); Debug::Text('Record Count: ' . count($nodes), __FILE__, __LINE__, __METHOD__, 10); if (isset($nodes)) { //$retarr = $uglf->getArrayByNodes( FastTree::FormatArray( $nodes, 'PLAIN_TEXT', TRUE) ); $retarr = FastTree::FormatFlexArray($nodes); Debug::Arr($retarr, ' Data: ', __FILE__, __LINE__, __METHOD__, 10); //There seems to be a bug with Flex here that if getQualification() and getQualificationGroup() are called at the same time //if this function returns an array with the keys out of order (1, 5, 10, rather then 0,1,3,4,5) Flex just sees //some empty object. //Not sure why this is happening with just this function, but the workaround for now is to call getQualificationGroup() //in a separate call to the server. //This could have something to do with the array having 0 => ... as the first entry, which we ran into a issue //in ExceptionPolicyFactory with getOptions('email_notification') return $this->returnHandler($retarr); } } return $this->returnHandler(TRUE); //No records returned. }