idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
58,200
public function getRounds ( ) { $ this -> _ensureRounds ( ) ; foreach ( $ this -> _rounds as $ roundId => $ roundData ) { if ( ! isset ( $ this -> _roundObjects [ $ roundId ] ) ) { $ this -> _roundObjects [ $ roundId ] = $ this -> tracker -> createTrackClass ( 'Round' , $ roundData ) ; } } return $ this -> _roundObjects ; }
Get all the round objects
58,201
protected function removeInactiveRounds ( \ Gems_Tracker_RespondentTrack $ respTrack , $ userId ) { $ qTrackId = $ this -> db -> quote ( $ this -> _trackId ) ; $ qRespTrackId = $ this -> db -> quote ( $ respTrack -> getRespondentTrackId ( ) ) ; $ orgId = $ this -> db -> quote ( $ respTrack -> getOrganizationId ( ) ) ; $ where = "gto_start_time IS NULL AND gto_id_respondent_track = $qRespTrackId AND gto_id_round != 0 AND gto_id_round IN (SELECT gro_id_round FROM gems__rounds WHERE (gro_active = 0 OR gro_organizations NOT LIKE CONCAT('%|',$orgId,'|%')) AND gro_id_track = $qTrackId)" ; return $ this -> db -> delete ( 'gems__tokens' , $ where ) ; }
Remove the unanswered tokens for inactive rounds .
58,202
public function getNextLevel ( $ context = null , $ level = null ) { if ( is_null ( $ context ) ) { $ context = $ this -> getContext ( ) ; } if ( is_null ( $ level ) ) { $ level = $ this -> getLevel ( $ context ) ; } $ currentContext = $ this -> _upgradeStack [ $ context ] ; ksort ( $ currentContext ) ; $ levels = array_keys ( $ currentContext ) ; $ current = array_search ( $ level , $ levels ) ; if ( $ current !== false ) { $ current ++ ; if ( isset ( $ levels [ $ current ] ) ) return $ levels [ $ current ] ; } return ++ $ level ; }
Get the next level for a given level and context
58,203
public function getUpgrades ( $ context = null ) { if ( ! $ context ) { $ context = $ this -> getContext ( ) ; } if ( isset ( $ this -> _upgradeStack [ $ context ] ) ) { return $ this -> _upgradeStack [ $ context ] ; } return array ( ) ; }
Retrieve the upgrades for a certain context will return an empty array when nothing present .
58,204
protected function initUpgradeFile ( ) { touch ( $ this -> upgradeFile ) ; $ this -> _info = new \ Zend_Config_Ini ( $ this -> upgradeFile , null , array ( 'allowModifications' => true ) ) ; foreach ( array_keys ( $ this -> _upgradeStack ) as $ context ) { $ maxLevel = $ this -> getMaxLevel ( $ context ) ; $ this -> setLevel ( $ context , $ maxLevel , true ) ; } }
When upgrade file does not exist create it and default to the max level since no upgrades should be needed after a clean install
58,205
protected function addAnswersToModel ( ) { $ transformer = new AddAnswersTransformer ( $ this -> survey , $ this -> source ) ; $ this -> addTransformer ( $ transformer ) ; }
Does the real work
58,206
public function andReceptionCodes ( $ fields = '*' ) { $ this -> sql_select -> join ( 'gems__reception_codes' , 'gems__tokens.gto_reception_code = grc_id_reception_code' , $ fields ) ; $ expr = str_replace ( 'gto_' , 'gems__tokens.gto_' , ( string ) $ this -> util -> getTokenData ( ) -> getStatusExpression ( ) ) ; $ this -> sql_select -> columns ( [ 'token_status' => new \ Zend_Db_Expr ( $ expr ) ] , 'gems__tokens' ) ; return $ this ; }
Add reception codes and token status calculation
58,207
public function andRespondentTracks ( $ fields = '*' , $ groupBy = false ) { $ this -> sql_select -> join ( 'gems__respondent2track' , 'gto_id_respondent_track = gr2t_id_respondent_track' , $ fields ) ; if ( $ groupBy && is_array ( $ fields ) ) { $ this -> sql_select -> group ( $ fields ) ; } return $ this ; }
Add Respondent Track info to the select statement
58,208
public function forRespondent ( $ respondentId , $ organizationId = null ) { if ( null !== $ respondentId ) { $ this -> sql_select -> where ( 'gto_id_respondent = ?' , $ respondentId ) ; } if ( null !== $ organizationId ) { $ this -> sql_select -> where ( 'gto_id_organization = ?' , $ organizationId ) ; } return $ this ; }
Select only a specific respondent
58,209
public function forWhere ( $ cond , $ bind = null ) { $ this -> sql_select -> where ( $ cond , $ bind ) ; return $ this ; }
For adding generic where statements
58,210
public function onlyActive ( $ recentCheck = false ) { $ this -> sql_select -> where ( 'gto_in_source = ?' , 1 ) -> where ( 'gto_completion_time IS NULL' ) ; if ( $ recentCheck ) { $ this -> sql_select -> where ( 'gto_start_time > DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 7 DAY)' ) ; } return $ this ; }
Select only active tokens
58,211
public function render ( $ content ) { $ element = $ this -> getElement ( ) ; $ view = $ element -> getView ( ) ; if ( null === $ view ) { return $ content ; } $ jQueryParams = $ this -> getJQueryParams ( ) ; $ attribs = array_merge ( $ this -> getAttribs ( ) , $ this -> getOptions ( ) ) ; $ helper = $ this -> getHelper ( ) ; $ id = $ element -> getId ( ) . '-container' ; return $ view -> $ helper ( $ id , $ jQueryParams , $ attribs ) ; }
Render an jQuery UI Widget element using its associated view helper
58,212
protected function _getTokenFromSqlWhere ( $ from , $ fieldName ) { $ lsDb = $ this -> getSourceDatabase ( ) ; $ tokField = $ lsDb -> quoteIdentifier ( $ fieldName ) ; foreach ( str_split ( $ from ) as $ check ) { $ checks [ ] = 'LOCATE(' . $ lsDb -> quote ( $ check ) . ', ' . $ tokField . ')' ; } return '(' . implode ( ' OR ' , $ checks ) . ')' ; }
Creates a where filter statement for tokens that do not have a correct name and are in a tokens table
58,213
protected function _getTokenFromToSql ( $ from , $ to , $ fieldName ) { $ lsDb = $ this -> getSourceDatabase ( ) ; if ( $ from ) { return 'REPLACE(' . $ this -> _getTokenFromToSql ( substr ( $ from , 1 ) , substr ( $ to , 1 ) , $ fieldName ) . ', ' . $ lsDb -> quote ( $ from [ 0 ] ) . ', ' . $ lsDb -> quote ( $ to [ 0 ] ) . ')' ; } else { return $ lsDb -> quoteIdentifier ( $ fieldName ) ; } }
Creates a SQL update statement for tokens that do not have a correct name and are in a tokens table .
58,214
protected function _updateGemsSurveyExists ( array $ surveyorSids , $ userId ) { $ sqlWhere = 'gsu_id_source = ' . $ this -> _gemsDb -> quote ( $ this -> getId ( ) ) . ' AND (gsu_status IS NULL OR gsu_active = 1 OR gsu_surveyor_active = 1) AND gsu_surveyor_id NOT IN (' . implode ( ', ' , $ surveyorSids ) . ')' ; $ data [ 'gsu_active' ] = 0 ; $ data [ 'gsu_surveyor_active' ] = 0 ; $ data [ 'gsu_status' ] = 'Survey was removed from source.' ; $ data [ 'gsu_changed' ] = new \ MUtil_Db_Expr_CurrentTimestamp ( ) ; $ data [ 'gsu_changed_by' ] = $ userId ; $ this -> _gemsDb -> update ( 'gems__surveys' , $ data , $ sqlWhere ) ; return $ this -> _gemsDb -> fetchPairs ( 'SELECT gsu_id_survey, gsu_survey_name FROM gems__surveys WHERE ' . $ sqlWhere ) ; }
This helper function updates the surveys in the gems_surveys table that no longer exist in in the source and returns a list of their names .
58,215
protected function _updateSource ( array $ values , $ userId ) { if ( $ this -> tracker -> filterChangesOnly ( $ this -> _sourceData , $ values ) ) { if ( \ Gems_Tracker :: $ verbose ) { $ echo = '' ; foreach ( $ values as $ key => $ val ) { $ echo .= $ key . ': ' . $ this -> _sourceData [ $ key ] . ' => ' . $ val . "\n" ; } \ MUtil_Echo :: r ( $ echo , 'Updated values for ' . $ this -> getId ( ) ) ; } if ( ! isset ( $ values [ 'gso_changed' ] ) ) { $ values [ 'gso_changed' ] = new \ MUtil_Db_Expr_CurrentTimestamp ( ) ; } if ( ! isset ( $ values [ 'gso_changed_by' ] ) ) { $ values [ 'gso_changed_by' ] = $ userId ; } $ this -> _sourceData = $ values + $ this -> _sourceData ; return $ this -> _gemsDb -> update ( 'gems__sources' , $ values , array ( 'gso_id_source = ?' => $ this -> getId ( ) ) ) ; } else { return 0 ; } }
Updates this source both in the database and in memory .
58,216
protected function filterLimitOffset ( & $ filter , $ select ) { $ limit = null ; $ offset = null ; if ( array_key_exists ( 'limit' , $ filter ) ) { $ limit = ( int ) $ filter [ 'limit' ] ; unset ( $ filter [ 'limit' ] ) ; } if ( array_key_exists ( 'offset' , $ filter ) ) { $ offset = ( int ) $ filter [ 'offset' ] ; unset ( $ filter [ 'offset' ] ) ; } $ select -> limit ( $ limit , $ offset ) ; }
Extract limit and offset from the filter and add it to a select
58,217
public function getSourceDatabase ( ) { if ( ! $ this -> _sourceDb ) { if ( $ dbConfig [ 'dbname' ] = $ this -> _sourceData [ 'gso_ls_database' ] ) { $ gemsConfig = $ this -> _gemsDb -> getConfig ( ) ; $ gemsName = $ gemsConfig [ 'dbname' ] ; if ( ( $ dbConfig [ 'dbname' ] != $ gemsName ) && ( $ adapter = $ this -> _sourceData [ 'gso_ls_adapter' ] ) ) { if ( array_key_exists ( 'gso_ls_charset' , $ this -> _sourceData ) ) { $ dbConfig [ 'charset' ] = $ this -> _sourceData [ 'gso_ls_charset' ] ? $ this -> _sourceData [ 'gso_ls_charset' ] : $ gemsConfig [ 'charset' ] ; } $ dbConfig [ 'host' ] = $ this -> _sourceData [ 'gso_ls_dbhost' ] ? $ this -> _sourceData [ 'gso_ls_dbhost' ] : $ gemsConfig [ 'host' ] ; if ( isset ( $ this -> _sourceData [ 'gso_ls_dbport' ] ) ) { $ dbConfig [ 'port' ] = $ this -> _sourceData [ 'gso_ls_dbport' ] ; } elseif ( isset ( $ gemsConfig [ 'port' ] ) ) { $ dbConfig [ 'port' ] = $ gemsConfig [ 'port' ] ; } $ dbConfig [ 'username' ] = $ this -> _sourceData [ 'gso_ls_username' ] ? $ this -> _sourceData [ 'gso_ls_username' ] : $ gemsConfig [ 'username' ] ; $ dbConfig [ 'password' ] = $ this -> _sourceData [ 'gso_ls_password' ] ? $ this -> project -> decrypt ( $ this -> _sourceData [ 'gso_ls_password' ] ) : $ gemsConfig [ 'password' ] ; $ this -> _sourceDb = \ Zend_Db :: factory ( $ adapter , $ dbConfig ) ; } } if ( ! $ this -> _sourceDb ) { $ this -> _sourceDb = $ this -> _gemsDb ; } } return $ this -> _sourceDb ; }
Get the db adapter for this source
58,218
protected function getSurveyData ( $ surveyId , $ field = null ) { static $ cache = array ( ) ; if ( ! isset ( $ cache [ $ surveyId ] ) ) { $ cache [ $ surveyId ] = $ this -> _gemsDb -> fetchRow ( 'SELECT * FROM gems__surveys WHERE gsu_id_survey = ? LIMIT 1' , $ surveyId , \ Zend_Db :: FETCH_ASSOC ) ; } if ( null === $ field ) { return $ cache [ $ surveyId ] ; } else { if ( isset ( $ cache [ $ surveyId ] [ $ field ] ) ) { return $ cache [ $ surveyId ] [ $ field ] ; } } }
Returns all info from the Gems surveys table for a givens Gems Survey Id
58,219
public function synchronizeSurveyBatch ( \ Gems_Task_TaskRunnerBatch $ batch , $ userId ) { $ select = $ this -> _gemsDb -> select ( ) ; $ select -> from ( 'gems__surveys' , array ( 'gsu_id_survey' , 'gsu_surveyor_id' ) ) -> where ( 'gsu_id_source = ?' , $ this -> getId ( ) ) -> order ( 'gsu_surveyor_id' ) ; $ gemsSurveys = $ this -> _gemsDb -> fetchPairs ( $ select ) ; if ( ! $ gemsSurveys ) { $ gemsSurveys = array ( ) ; } $ sourceSurveys = $ this -> _getSourceSurveysForSynchronisation ( ) ; if ( $ sourceSurveys ) { $ sourceSurveys = array_combine ( $ sourceSurveys , $ sourceSurveys ) ; } else { $ sourceSurveys = array ( ) ; } foreach ( $ gemsSurveys as $ surveyId => $ sourceSurveyId ) { if ( isset ( $ sourceSurveys [ $ sourceSurveyId ] ) ) { $ batch -> addTask ( 'Tracker_CheckSurvey' , $ this -> getId ( ) , $ sourceSurveyId , $ surveyId , $ userId ) ; $ batch -> addTask ( 'Tracker_AddRefreshQuestions' , $ this -> getId ( ) , $ sourceSurveyId , $ surveyId ) ; } else { $ batch -> addTask ( 'Tracker_CheckSurvey' , $ this -> getId ( ) , null , $ surveyId , $ userId ) ; } } foreach ( array_diff ( $ sourceSurveys , $ gemsSurveys ) as $ sourceSurveyId ) { $ batch -> addTask ( 'Tracker_CheckSurvey' , $ this -> getId ( ) , $ sourceSurveyId , null , $ userId ) ; $ batch -> addTask ( 'Tracker_AddRefreshQuestions' , $ this -> getId ( ) , $ sourceSurveyId , null ) ; } }
Updates the gems database with the latest information about the surveys in this source adapter
58,220
public function afterSaveRoute ( $ data ) { $ this -> accesslog -> logChange ( $ this -> request , null , $ data ) ; $ url = $ this -> getAfterSaveRoute ( $ data ) ; if ( $ url !== null && $ url !== false ) { $ this -> _helper -> redirector -> gotoRoute ( $ url , null , true ) ; return true ; } return false ; }
Get the afterSaveRoute and execute it
58,221
protected function aliasAction ( $ alias ) { $ request = $ this -> getRequest ( ) ; $ request -> setActionName ( $ alias ) ; $ request -> setParam ( $ request -> getActionKey ( ) , $ alias ) ; }
Set the action key in request
58,222
public function createAction ( ) { if ( $ form = $ this -> processForm ( ) ) { $ this -> setPageTitle ( sprintf ( $ this -> _ ( 'New %s...' ) , $ this -> getTopic ( ) ) ) ; $ this -> html [ ] = $ form ; } }
Creates a form for a new record
58,223
public function createForm ( $ options = null ) { if ( $ this -> useTabbedForms ) { $ form = new \ Gems_TabForm ( $ options ) ; } else { $ form = parent :: createForm ( $ options ) ; } return $ form ; }
Retrieve a form object and add extra decorators
58,224
public function deleteAction ( ) { if ( $ this -> isConfirmedItem ( $ this -> _ ( 'Delete %s' ) ) ) { $ model = $ this -> getModel ( ) ; $ deleted = $ model -> delete ( ) ; $ this -> addMessage ( sprintf ( $ this -> _ ( '%2$u %1$s deleted' ) , $ this -> getTopic ( $ deleted ) , $ deleted ) , 'success' ) ; $ this -> _reroute ( array ( 'action' => 'index' ) , true ) ; } }
Creates a form to delete a record
58,225
public function editAction ( ) { if ( $ form = $ this -> processForm ( ) ) { if ( $ this -> useTabbedForms && method_exists ( $ this , 'getSubject' ) ) { $ data = $ this -> getModel ( ) -> loadFirst ( ) ; $ subject = $ this -> getSubject ( $ data ) ; $ this -> setPageTitle ( sprintf ( $ this -> _ ( 'Edit %s %s' ) , $ this -> getTopic ( 1 ) , $ subject ) ) ; } else { $ this -> setPageTitle ( sprintf ( $ this -> _ ( 'Edit %s' ) , $ this -> getTopic ( 1 ) ) ) ; } $ this -> html [ ] = $ form ; } }
Creates a form to edit
58,226
public function getBrowseTable ( array $ baseUrl = array ( ) , $ sort = null , $ model = null ) { $ table = parent :: getBrowseTable ( $ baseUrl , $ sort , $ model ) ; $ table -> class = 'browser table' ; $ table -> setOnEmpty ( sprintf ( $ this -> _ ( 'No %s found' ) , $ this -> getTopic ( 0 ) ) ) ; $ table -> getOnEmpty ( ) -> class = 'centerAlign' ; return $ table ; }
Creates from the model a \ MUtil_Html_TableElement that can display multiple items .
58,227
public function importAction ( ) { $ controller = $ this -> getRequest ( ) -> getControllerName ( ) ; $ importLoader = $ this -> loader -> getImportLoader ( ) ; $ model = $ this -> getModel ( ) ; $ params = array ( ) ; $ params [ 'defaultImportTranslator' ] = $ importLoader -> getDefaultTranslator ( $ controller ) ; $ params [ 'formatBoxClass' ] = 'browser table' ; $ params [ 'importer' ] = $ importLoader -> getImporter ( $ controller , $ model ) ; $ params [ 'model' ] = $ model ; $ params [ 'tempDirectory' ] = $ importLoader -> getTempDirectory ( ) ; $ params [ 'importTranslators' ] = $ importLoader -> getTranslators ( $ controller ) ; $ this -> addSnippets ( $ this -> importSnippets , $ params ) ; }
Generic model based import action
58,228
public function onFakeSubmit ( & $ form , & $ data ) { if ( $ this -> useMultiRowForm ) { if ( $ this -> hasNew ( ) && isset ( $ data [ 'insert_button' ] ) && $ data [ 'insert_button' ] ) { $ model = $ this -> getModel ( ) ; $ mname = $ model -> getName ( ) ; $ data [ $ mname ] [ ] = $ model -> loadNew ( ) ; } } }
Performs actions when the form is submitted but the submit button was not checked
58,229
protected function setPageTitle ( $ title ) { $ this -> pageTitle = $ title ; $ args = array ( 'class' => 'title' ) ; $ titleTag = \ MUtil_Html :: create ( 'h3' , $ title , $ args ) ; $ this -> html -> append ( $ titleTag ) ; }
Set the page title on top of a page also store it in a public var
58,230
public function showAction ( ) { $ this -> setPageTitle ( sprintf ( $ this -> _ ( 'Show %s' ) , $ this -> getTopic ( ) ) ) ; $ model = $ this -> getModel ( ) ; $ repeater = $ model -> loadRepeatable ( ) ; $ table = $ this -> getShowTable ( ) ; $ table -> setOnEmpty ( sprintf ( $ this -> _ ( 'Unknown %s.' ) , $ this -> getTopic ( 1 ) ) ) ; $ table -> setRepeater ( $ repeater ) ; $ table -> tfrow ( $ this -> createMenuLinks ( $ this -> menuShowIncludeLevel ) , array ( 'class' => 'centerAlign' ) ) ; if ( $ menuItem = $ this -> findAllowedMenuItem ( 'edit' ) ) { $ table -> tbody ( ) -> onclick = array ( 'location.href=\'' , $ menuItem -> toHRefAttribute ( $ this -> getRequest ( ) ) , '\';' ) ; } $ tableContainer = \ MUtil_Html :: create ( 'div' , array ( 'class' => 'table-container' ) , $ table ) ; $ this -> html [ ] = $ tableContainer ; }
Shows a table displaying a single record from the model
58,231
protected function _checkFilterUsed ( $ filter ) { $ filter = parent :: _checkFilterUsed ( $ filter ) ; if ( isset ( $ filter [ 'gr2o_id_organization' ] ) ) { if ( true === $ filter [ 'gr2o_id_organization' ] ) { unset ( $ filter [ 'gr2o_id_organization' ] ) ; } } else { if ( $ this -> isMultiOrganization ( ) && ! isset ( $ filter [ 'gr2o_patient_nr' ] ) ) { $ allowed = $ this -> currentUser -> getAllowedOrganizations ( ) ; $ filter [ 'gr2o_id_organization' ] = array_keys ( $ allowed ) ; } else { $ filter [ 'gr2o_id_organization' ] = $ this -> getCurrentOrganization ( ) ; } } if ( self :: SSN_HASH === $ this -> hashSsn ) { array_walk_recursive ( $ filter , array ( $ this , 'applyHash' ) ) ; } return $ filter ; }
Add an organization filter if it wasn t specified in the filter .
58,232
public function addLoginCheck ( ) { if ( ! $ this -> hasAlias ( 'gems__user_logins' ) ) { $ this -> addLeftTable ( 'gems__user_logins' , array ( 'gr2o_patient_nr' => 'gul_login' , 'gr2o_id_organization' => 'gul_id_organization' ) , 'gul' , \ MUtil_Model_DatabaseModelAbstract :: SAVE_MODE_UPDATE | \ MUtil_Model_DatabaseModelAbstract :: SAVE_MODE_DELETE ) ; } $ this -> addColumn ( "CASE WHEN gul_id_user IS NULL OR gul_user_class = 'NoLogin' OR gul_can_login = 0 THEN 0 ELSE 1 END" , 'has_login' ) ; return $ this ; }
Add the table and field to check for respondent login checks
58,233
public static function addNameToModel ( \ Gems_Model_JoinModel $ model , $ label ) { $ nameExpr [ ] = "COALESCE(grs_last_name, '-')" ; $ fieldList [ ] = 'grs_last_name' ; if ( $ model -> has ( 'grs_partner_last_name' ) ) { if ( $ model -> has ( 'grs_partner_surname_prefix' ) ) { $ nameExpr [ ] = "COALESCE(CONCAT(' ', grs_partner_surname_prefix), '')" ; $ fieldList [ ] = 'grs_partner_surname_prefix' ; } $ nameExpr [ ] = "COALESCE(CONCAT(' ', grs_partner_last_name), '')" ; $ fieldList [ ] = 'grs_partner_last_name' ; } $ nameExpr [ ] = "', '" ; if ( $ model -> has ( 'grs_first_name' ) ) { if ( $ model -> has ( 'grs_initials_name' ) ) { $ nameExpr [ ] = "COALESCE(grs_first_name, grs_initials_name, '')" ; $ fieldList [ ] = 'grs_first_name' ; $ fieldList [ ] = 'grs_initials_name' ; } else { $ nameExpr [ ] = "COALESCE(grs_first_name, '')" ; $ fieldList [ ] = 'grs_first_name' ; } } elseif ( $ model -> has ( 'grs_initials_name' ) ) { $ nameExpr [ ] = "COALESCE(grs_initials_name, '')" ; $ fieldList [ ] = 'grs_initials_name' ; } if ( $ model -> has ( 'grs_surname_prefix' ) ) { $ nameExpr [ ] = "COALESCE(CONCAT(' ', grs_surname_prefix), '')" ; $ fieldList [ ] = 'grs_surname_prefix' ; } $ model -> set ( 'name' , 'label' , $ label , 'column_expression' , new \ Zend_Db_Expr ( "CONCAT(" . implode ( ', ' , $ nameExpr ) . ")" ) , 'fieldlist' , $ fieldList ) ; }
Add the respondent name as a caclulated field to the model
58,234
public function copyToOrg ( $ fromOrgId , $ fromPid , $ toOrgId , $ toPid , $ keepConsent = false ) { $ this -> currentUser -> disableMask ( ) ; $ fromPatient = $ this -> loadFirst ( [ 'gr2o_id_organization' => $ fromOrgId , 'gr2o_patient_nr' => $ fromPid ] ) ; if ( empty ( $ fromPatient ) ) { throw new \ Gems_Exception ( $ this -> _ ( 'Respondent not found in sending organization.' ) ) ; } $ toPatientByPid = $ this -> loadFirst ( [ 'gr2o_id_organization' => $ toOrgId , 'gr2o_patient_nr' => $ toPid ] ) ; $ toPatientByRespondent = $ this -> loadFirst ( [ 'gr2o_id_organization' => $ toOrgId , 'gr2o_id_user' => $ fromPatient [ 'gr2o_id_user' ] ] ) ; if ( ! empty ( $ toPatientByPid ) && $ toPatientByPid [ 'gr2o_id_user' ] = $ fromPatient [ 'gr2o_id_user' ] ) { throw new \ Gems_Exception ( $ this -> _ ( 'Respondent already exists in destination organization.' ) ) ; } if ( ! empty ( $ toPatientByPid ) && empty ( $ toPatientByRespondent ) ) { throw new \ Gems_Exception ( $ this -> _ ( 'Respondent with requested respondent number already exists in receiving organization.' ) ) ; } if ( ! empty ( $ toPatientByRespondent ) ) { throw new \ Gems_Exception ( $ this -> _ ( 'Respondent already exists in destination organization, but with different respondent number.' ) ) ; } $ toPatient = $ fromPatient ; if ( ! $ keepConsent ) { unset ( $ toPatient [ 'gr2o_consent' ] ) ; } $ toPatient [ 'gr2o_patient_nr' ] = $ toPid ; $ toPatient [ 'gr2o_id_organization' ] = $ toOrgId ; $ toPatient [ 'gr2o_reception_code' ] = \ GemsEscort :: RECEPTION_OK ; $ loginToSaveTable = false ; if ( isset ( $ this -> _saveTables [ 'gems__user_logins' ] ) ) { $ loginToSaveTable = $ this -> _saveTables [ 'gems__user_logins' ] ; unset ( $ this -> _saveTables [ 'gems__user_logins' ] ) ; } $ result = $ this -> save ( $ toPatient ) ; if ( $ loginToSaveTable ) { $ this -> _saveTables [ 'gems__user_logins' ] = $ loginToSaveTable ; } $ this -> currentUser -> enableMask ( ) ; return $ result ; }
Copy a respondent to a new organization
58,235
public function countTracks ( $ patientId , $ organizationId , $ respondentId = null , $ active = false ) { $ db = $ this -> getAdapter ( ) ; $ select = $ db -> select ( ) ; $ select -> from ( 'gems__respondent2track' , array ( 'COALESCE(COUNT(*), 0)' ) ) ; if ( null === $ respondentId ) { $ respondentId = $ this -> util -> getDbLookup ( ) -> getRespondentId ( $ patientId , $ organizationId ) ; } $ select -> where ( 'gr2t_id_user = ?' , $ respondentId ) ; if ( null !== $ organizationId ) { $ select -> where ( 'gr2t_id_organization = ?' , $ organizationId ) ; } if ( $ active ) { $ select -> joinInner ( 'gems__reception_codes' , 'gr2t_reception_code = grc_id_reception_code' ) -> where ( 'grc_success = 1' ) ; } return $ db -> fetchOne ( $ select ) ; }
Count the number of tracks the respondent has for this organization
58,236
public function getReceptionCode ( $ patientId , $ organizationId , $ respondentId = null ) { $ db = $ this -> getAdapter ( ) ; $ select = $ db -> select ( ) ; $ select -> from ( 'gems__respondent2org' , array ( 'gr2o_reception_code' ) ) ; if ( $ patientId ) { $ select -> where ( 'gr2o_patient_nr = ?' , $ patientId ) ; } else { $ select -> where ( 'gr2o_id_user = ?' , $ respondentId ) ; } $ select -> where ( 'gr2o_id_organization = ?' , $ organizationId ) ; return $ db -> fetchOne ( $ select ) ; }
Get the current reception code for a respondent
58,237
public function hasTracks ( $ patientId , $ organizationId , $ respondentId = null , $ active = false ) { return ( boolean ) $ this -> countTracks ( $ patientId , $ organizationId , $ respondentId , $ active ) ; }
Has the respondent tracks
58,238
public function formatDate ( $ value ) { return \ MUtil_Html :: create ( 'span' , \ MUtil_Date :: format ( $ value , \ Zend_Date :: DAY_SHORT . ' ' . \ Zend_Date :: MONTH_NAME_SHORT . ' ' . \ Zend_Date :: YEAR , 'yyyy-MM-dd' ) ) ; }
Display the date field
58,239
public function formatTime ( $ value ) { return \ MUtil_Html :: create ( 'span' , ' ' , \ MUtil_Date :: format ( $ value , 'HH:mm ' . \ Zend_Date :: WEEKDAY_SHORT , $ this -> _dateStorageFormat ) ) ; }
Display the time field
58,240
protected function fixSql ( $ where ) { if ( $ where == parent :: NO_MATCH_SQL ) { return parent :: MATCH_ALL_SQL ; } elseif ( $ where == parent :: MATCH_ALL_SQL ) { return parent :: NO_MATCH_SQL ; } else { return "NOT ($where)" ; } }
Standard where processing
58,241
public function authenticate ( ) { $ result = call_user_func_array ( $ this -> _callback , $ this -> _params ) ; if ( ! ( $ result instanceof Result ) ) { if ( $ result === true ) { $ result = new Result ( Result :: SUCCESS , $ this -> _identity ) ; } else { $ result = new Result ( Result :: FAILURE_CREDENTIAL_INVALID , $ this -> _identity ) ; } } return $ result ; }
Perform the authenticate attempt
58,242
public function ensureDefaultUserValues ( array $ values , \ Gems_User_UserDefinitionInterface $ definition , $ defName = null ) { if ( ! isset ( $ values [ 'user_active' ] ) ) { $ values [ 'user_active' ] = true ; } if ( ! isset ( $ values [ 'user_staff' ] ) ) { $ values [ 'user_staff' ] = $ definition -> isStaff ( ) ; } if ( ! isset ( $ values [ 'user_resetkey_valid' ] ) ) { $ values [ 'user_resetkey_valid' ] = false ; } if ( ! isset ( $ values [ 'user_two_factor_key' ] ) ) { $ values [ 'user_two_factor_key' ] = null ; } if ( ! isset ( $ values [ 'user_enable_2factor' ] ) ) { $ values [ 'user_enable_2factor' ] = null ; } if ( $ defName ) { $ values [ '__user_definition' ] = $ defName ; } return $ values ; }
Makes sure default values are set for a user
58,243
public function getChangePasswordForm ( $ user , $ args_array = null ) { $ args = \ MUtil_Ra :: args ( func_get_args ( ) , array ( 'user' => 'Gems_User_User' ) ) ; $ form = $ this -> _loadClass ( 'Form_ChangePasswordForm' , true , array ( $ args ) ) ; return $ form ; }
Returns a change password form for this user
58,244
public final function getCurrentUser ( ) { if ( ! self :: $ currentUser ) { if ( $ this -> session -> __isset ( '__user_definition' ) ) { $ defName = $ this -> session -> __get ( '__user_definition' ) ; if ( substr ( $ defName , - 10 , 10 ) != 'Definition' ) { $ defName .= 'Definition' ; } self :: $ currentUser = $ this -> _loadClass ( 'User' , true , array ( $ this -> session , $ this -> _getClass ( $ defName ) ) ) ; } else { if ( \ MUtil_Console :: isConsole ( ) ) { if ( ! $ this -> project -> isConsoleAllowed ( ) ) { echo "Accessing " . GEMS_PROJECT_NAME . " from the command line is not allowed.\n" ; exit ; } $ request = \ Zend_Controller_Front :: getInstance ( ) -> getRequest ( ) ; if ( ( $ request instanceof \ MUtil_Controller_Request_Cli ) && $ request -> hasUserLogin ( ) ) { $ user = $ this -> getUser ( $ request -> getUserName ( ) , $ request -> getUserOrganization ( ) ) ; $ authResult = $ user -> authenticate ( $ request -> getUserPassword ( ) ) ; if ( ! $ authResult -> isValid ( ) ) { echo "Invalid user login data.\n" ; echo implode ( "\n" , $ authResult -> getMessages ( ) ) ; exit ; } self :: $ currentUser = $ user ; } elseif ( $ this -> project -> getConsoleRole ( ) ) { self :: $ currentUser = $ this -> loadUser ( self :: USER_CONSOLE , 0 , '(system)' ) ; } } if ( ! self :: $ currentUser ) { self :: $ currentUser = $ this -> getUser ( null , self :: SYSTEM_NO_ORG ) ; } self :: $ currentUser -> setAsCurrentUser ( ) ; } } return self :: $ currentUser ; }
Get the currently loggin in user
58,245
public function getResetRequestForm ( $ args_array = null ) { $ args = \ MUtil_Ra :: args ( func_get_args ( ) ) ; return $ this -> _loadClass ( 'Form_ResetRequestForm' , true , array ( $ args ) ) ; }
Returns a reset form for handling both the incoming request and the outgoing reset request
58,246
public function getTwoFactorAuthenticator ( $ className ) { $ object = $ this -> _loadClass ( 'TwoFactor_' . $ className , true ) ; if ( ! $ object instanceof TwoFactorAuthenticatorInterface ) { throw new \ Gems_Exception_Coding ( sprintf ( 'The authenticator class %s should be an instance of TwoFactorAuthenticatorInterface.' , $ className ) ) ; } return $ object ; }
Get TwoFactorAuthenticatorInterface class
58,247
public function getUserByResetKey ( $ resetKey ) { if ( ( null == $ resetKey ) || ( 0 == strlen ( trim ( $ resetKey ) ) ) ) { return $ this -> loadUser ( self :: USER_NOLOGIN , null , null ) ; } $ select = $ this -> db -> select ( ) ; $ select -> from ( 'gems__user_passwords' , array ( ) ) -> joinLeft ( 'gems__user_logins' , 'gup_id_user = gul_id_user' , array ( "gul_user_class" , 'gul_id_organization' , 'gul_login' ) ) -> where ( 'gup_reset_key = ?' , $ resetKey ) ; if ( $ row = $ this -> db -> fetchRow ( $ select , null , \ Zend_Db :: FETCH_NUM ) ) { return $ this -> loadUser ( $ row [ 0 ] , $ row [ 1 ] , $ row [ 2 ] ) ; } return $ this -> loadUser ( self :: USER_NOLOGIN , null , null ) ; }
Get the user having the reset key specified
58,248
protected function getUserClass ( $ login_name , $ organization ) { if ( ( null !== $ login_name ) && $ this -> isProjectUser ( $ login_name ) ) { return $ this -> loadUser ( self :: USER_PROJECT , $ organization , $ login_name ) ; } if ( null == $ login_name ) { return $ this -> loadUser ( self :: USER_NOLOGIN , $ organization , $ login_name ) ; } if ( ! $ this -> allowLoginOnWithoutOrganization ) { if ( ( null == $ organization ) || ( ! intval ( $ organization ) ) ) { return $ this -> loadUser ( self :: USER_NOLOGIN , $ organization , $ login_name ) ; } } try { $ select = $ this -> getUserClassSelect ( $ login_name , $ organization ) ; if ( $ row = $ this -> db -> fetchRow ( $ select , null , \ Zend_Db :: FETCH_NUM ) ) { if ( $ row [ 3 ] == 1 || $ this -> allowLoginOnOtherOrganization === true ) { return $ this -> loadUser ( $ row [ 0 ] , $ row [ 1 ] , $ row [ 2 ] ) ; } } } catch ( \ Zend_Db_Exception $ e ) { } return $ this -> loadUser ( self :: USER_NOLOGIN , $ organization , $ login_name ) ; }
Returns the name of the user definition class of this user .
58,249
protected function getUserClassSelect ( $ login_name , $ organization ) { $ select = $ this -> db -> select ( ) ; $ select -> from ( 'gems__user_logins' , array ( "gul_user_class" , 'gul_id_organization' , 'gul_login' ) ) -> where ( 'gul_can_login = 1' ) ; if ( $ this -> allowLoginOnWithoutOrganization && ! $ organization ) { $ select -> columns ( new \ Zend_Db_Expr ( '1 AS tolerance' ) ) ; } else { $ select -> from ( 'gems__organizations' , array ( ) ) -> columns ( new \ Zend_Db_Expr ( "CASE WHEN gor_id_organization = gul_id_organization THEN 1 WHEN gor_accessible_by LIKE CONCAT('%:', gul_id_organization, ':%') THEN 2 ELSE 3 END AS tolerance" ) ) -> where ( 'gor_active = 1' ) -> where ( 'gor_id_organization = ?' , $ organization ) -> order ( 'tolerance' ) ; } $ wheres [ ] = $ this -> db -> quoteInto ( 'gul_login = ?' , $ login_name ) ; $ isEmail = \ MUtil_String :: contains ( $ login_name , '@' ) ; if ( $ isEmail && $ this -> allowStaffEmailLogin ) { $ rows = $ this -> db -> fetchAll ( "SELECT gsf_login, gsf_id_organization FROM gems__staff WHERE gsf_email = ?" , $ login_name ) ; if ( $ rows ) { foreach ( $ rows as $ row ) { $ wheres [ ] = $ this -> db -> quoteInto ( 'gul_login = ? AND ' , $ row [ 'gsf_login' ] ) . $ this -> db -> quoteInto ( 'gul_id_organization = ?' , $ row [ 'gsf_id_organization' ] ) ; } } } if ( $ isEmail && $ this -> allowRespondentEmailLogin ) { $ rows = $ this -> db -> fetchAll ( "SELECT gr2o_patient_nr, gr2o_id_organization FROM gems__respondent2org " . "INNER JOIN gems__respondents WHERE gr2o_id_user = grs_id_user AND gr2o_email = ?" , $ login_name ) ; if ( $ rows ) { foreach ( $ rows as $ row ) { $ wheres [ ] = $ this -> db -> quoteInto ( 'gul_login = ? AND ' , $ row [ 'gr2o_patient_nr' ] ) . $ this -> db -> quoteInto ( 'gul_id_organization = ?' , $ row [ 'gr2o_id_organization' ] ) ; } } } $ select -> where ( new \ Zend_Db_Expr ( '(' . implode ( ') OR (' , $ wheres ) . ')' ) ) ; return $ select ; }
Returns a select statement to find a corresponding user .
58,250
protected function loadUser ( $ defName , $ userOrganization , $ userName ) { $ definition = $ this -> getUserDefinition ( $ defName ) ; $ values = $ definition -> getUserData ( $ userName , $ userOrganization ) ; $ values = $ this -> ensureDefaultUserValues ( $ values , $ definition , $ defName ) ; return $ this -> _loadClass ( 'User' , true , array ( $ values , $ definition ) ) ; }
Returns a loaded user object
58,251
public function setCurrentUser ( \ Gems_User_User $ user ) { if ( $ user !== self :: $ currentUser ) { $ this -> unsetCurrentUser ( ) ; self :: $ currentUser = $ user ; if ( $ escort = GemsEscort :: getInstance ( ) ) { $ escort -> currentUser = $ user ; } if ( ! $ user -> isCurrentUser ( ) ) { $ user -> setAsCurrentUser ( true ) ; } } return $ this ; }
Sets a new user as the current user .
58,252
public function unsetCurrentUser ( ) { if ( ( self :: $ currentUser instanceof \ Gems_User_User ) && self :: $ currentUser -> isCurrentUser ( ) ) { self :: $ currentUser -> unsetAsCurrentUser ( false ) ; } self :: $ currentUser = null ; return $ this ; }
Removes the current user
58,253
protected function addTokenToDocument ( \ Zend_Pdf $ pdf , $ tokenId , $ surveyId ) { $ token = strtoupper ( $ tokenId ) ; foreach ( array ( 'Title' , 'Subject' , 'Keywords' ) as $ name ) { if ( isset ( $ pdf -> properties [ $ name ] ) ) { $ orgValue = $ pdf -> properties [ $ name ] ; if ( mb_detect_encoding ( $ orgValue ) === false ) { mb_convert_encoding ( $ orgValue , mb_internal_encoding ( ) , 'UTF-16' ) ; } $ value = rtrim ( $ orgValue ) . ' ' . $ token ; } else { $ value = $ token ; } $ pdf -> properties [ $ name ] = $ value ; } $ pdf -> properties [ 'ModDate' ] = 'D:' . str_replace ( ':' , "'" , date ( 'YmdHisP' ) ) . "'" ; $ pdf -> properties [ 'Producer' ] = $ this -> project -> getName ( ) ; $ pdf -> properties [ 'Creator' ] = $ this -> project -> getName ( ) ; $ pdf -> properties [ 'Author' ] = $ this -> project -> getName ( ) ; }
Add the token to every page of a pdf
58,254
protected function addTokenToPage ( \ Zend_Pdf_Page $ page , $ tokenId ) { if ( $ this -> pageFont ) { $ font = \ Zend_Pdf_Font :: fontWithName ( $ this -> pageFont ) ; if ( $ this -> pageXfromLeft ) { $ x = $ this -> pageX ; } else { $ x = $ page -> getWidth ( ) - $ this -> pageX ; } if ( $ this -> pageYfromTop ) { $ y = $ page -> getHeight ( ) - $ this -> pageY ; } else { $ y = $ this -> pageY ; } $ page -> setFont ( $ font , $ this -> pageFontSize ) ; $ page -> drawText ( strtoupper ( $ tokenId ) , $ x , $ y , 'UTF-8' ) ; } }
Add the token to a pdf page
58,255
protected function echoPdf ( \ Zend_Pdf $ pdf , $ filename , $ download = false , $ exit = true ) { $ content = $ pdf -> render ( ) ; $ this -> echoPdfContent ( $ content , $ filename , $ download ) ; if ( $ exit ) { exit ; } }
Echos the pdf as output with the specified filename .
58,256
public function echoPdfContent ( $ content , $ filename , $ download = false ) { if ( $ download ) { header ( 'Content-Type: application/x-download' ) ; } else { header ( 'Content-Type: application/pdf' ) ; } header ( 'Content-Length: ' . strlen ( $ content ) ) ; header ( 'Content-Disposition: inline; filename="' . $ filename . '"' ) ; header ( 'Cache-Control: private, max-age=0, must-revalidate' ) ; header ( 'Pragma: public' ) ; echo $ content ; }
Output the pdf with the right headers .
58,257
public function echoPdfBySurveyId ( $ surveyId ) { $ pdf = $ this -> getSurveyPdf ( $ surveyId ) ; $ this -> echoPdf ( $ pdf , $ surveyId . '.pdf' ) ; }
Reads the survey pdf and outputs the result ( without token id s etc ..
58,258
public function echoPdfByTokenId ( $ tokenId ) { $ surveyId = $ this -> db -> fetchOne ( 'SELECT gto_id_survey FROM gems__tokens WHERE gto_id_token = ?' , $ tokenId ) ; $ pdf = $ this -> getSurveyPdf ( $ surveyId ) ; $ this -> addTokenToDocument ( $ pdf , $ tokenId , $ surveyId ) ; foreach ( $ pdf -> pages as $ page ) { $ this -> addTokenToPage ( $ page , $ tokenId ) ; } $ this -> echoPdf ( $ pdf , $ tokenId . '.pdf' ) ; }
Reads the survey pdf belonging to this token puts the token id on de pages and outputs the result .
58,259
public function getUploadDir ( $ subdir = null ) { $ dir = GEMS_ROOT_DIR . '/var/uploads' ; if ( $ subdir ) { if ( ( $ subdir [ 0 ] == '/' ) || ( $ subdir [ 0 ] == '\\' ) || ( substr ( $ subdir , 1 , 2 ) == ':\\' ) ) { $ dir = rtrim ( $ subdir , '\//' ) ; } else { $ dir .= DIRECTORY_SEPARATOR . rtrim ( $ subdir , '\//' ) ; } } if ( ! is_dir ( $ dir ) ) { $ oldmask = umask ( 0777 ) ; if ( ! @ mkdir ( $ dir , 0777 , true ) ) { $ this -> throwLastError ( sprintf ( $ this -> translate -> _ ( "Could not create '%s' directory." ) , $ dir ) ) ; } umask ( $ oldmask ) ; } return $ dir ; }
Return upload directory optionally with specified sub directory .
58,260
protected function throwLastError ( $ msg ) { if ( $ last = \ MUtil_Error :: getLastPhpErrorMessage ( ) ) { $ msg .= sprintf ( $ this -> translate -> _ ( ' The error message is: %s' ) , $ last ) ; } throw new \ Gems_Exception_Coding ( $ msg ) ; }
Helper function for error handling
58,261
private function _applyParameterSources ( \ Gems_Menu_ParameterCollector $ source , array & $ parameters , $ raiseConditions ) { $ condition = true ; if ( $ this -> _applyParameterFilter ( $ source , $ raiseConditions , $ condition ) ) { return false ; } $ this -> _applyParameterSource ( $ source , $ parameters ) ; foreach ( $ this -> _requiredParameters as $ param => $ name ) { if ( ! isset ( $ parameters [ $ param ] ) ) { if ( \ Gems_Menu :: $ verbose ) { \ MUtil_Echo :: r ( '<b>Not found:</b> ' . $ param . '/' . $ name , $ this -> get ( 'label' ) . ' (' . $ this -> get ( 'controller' ) . '/' . $ this -> get ( 'action' ) . ')' ) ; } return false ; } } if ( $ this -> _hiddenOrgId && $ raiseConditions ) { if ( isset ( $ parameters [ \ MUtil_Model :: REQUEST_ID1 ] , $ parameters [ \ MUtil_Model :: REQUEST_ID2 ] ) && ( $ parameters [ \ MUtil_Model :: REQUEST_ID2 ] == $ this -> _hiddenOrgId ) ) { $ parameters [ \ MUtil_Model :: REQUEST_ID ] = $ parameters [ \ MUtil_Model :: REQUEST_ID1 ] ; unset ( $ parameters [ \ MUtil_Model :: REQUEST_ID1 ] , $ parameters [ \ MUtil_Model :: REQUEST_ID2 ] ) ; } } return $ condition ; }
A function that determines the parameters that this menu item should have using these paramter sources .
58,262
private function _toHRef ( \ Gems_Menu_ParameterCollector $ source , & $ condition ) { if ( $ this -> get ( 'allowed' ) ) { $ parameters = array ( ) ; if ( $ condition = $ this -> _applyParameterSources ( $ source , $ parameters , ! $ condition ) ) { if ( $ this -> _hiddenOrgId ) { $ url = new \ Gems_Menu_HiddenOrganizationHrefAttribute ( $ parameters ) ; $ url -> setHiddenOrgId ( $ this -> _hiddenOrgId ) ; } else { $ url = new \ MUtil_Html_HrefArrayAttribute ( $ parameters ) ; } $ url -> setRouteReset ( $ this -> get ( 'reset_param' , true ) ) ; foreach ( array ( 'module' , 'controller' , 'action' , 'route' ) as $ name ) { if ( $ this -> has ( $ name ) ) { $ url -> add ( $ name , $ this -> get ( $ name ) ) ; } } return $ url ; } } }
Generate a hrf attribute using these sources
58,263
public function addAction ( $ label , $ privilege = null , $ action = 'index' , array $ other = array ( ) ) { $ other [ 'label' ] = $ label ; $ other [ 'controller' ] = $ this -> get ( 'controller' ) ; $ other [ 'action' ] = $ action ; if ( null === $ privilege ) { $ privilege = $ this -> get ( 'privilege' ) ; } if ( null !== $ privilege ) { $ other [ 'privilege' ] = $ privilege ; } return $ this -> add ( $ other ) ; }
Add an action to the current subMenuItem
58,264
public function addActionButton ( $ label , $ privilege = null , $ action = 'index' , array $ other = array ( ) ) { $ other [ 'button_only' ] = true ; return $ this -> addAction ( $ label , $ privilege , $ action , $ other ) ; }
Add a button only action to the current subMenuItem
58,265
public function addCreateAction ( $ privilege = null , array $ other = array ( ) ) { if ( isset ( $ other [ 'label' ] ) ) { $ label = $ other [ 'label' ] ; unset ( $ other [ 'label' ] ) ; } else { $ label = $ this -> _ ( 'New' ) ; } if ( null === $ privilege ) { $ privilege = $ this -> get ( 'privilege' ) . '.create' ; } return $ this -> addAction ( $ label , $ privilege , 'create' , $ other ) ; }
Add an Create new action to the current subMenuItem
58,266
public function addDeReactivateAction ( $ checkField , $ deactivateOn = 1 , $ reactivateOn = 1 , array $ otherDeact = array ( ) , array $ otherReact = array ( ) ) { $ pages = array ( ) ; if ( null !== $ deactivateOn ) { if ( isset ( $ otherDeact [ 'privilege' ] ) ) { $ privilege = $ otherDeact [ 'privilege' ] ; } else { $ privilege = $ this -> get ( 'privilege' ) . '.deactivate' ; } $ deactivate = $ this -> addAction ( $ this -> _ ( 'Deactivate' ) , $ privilege , 'deactivate' , $ otherDeact ) ; $ deactivate -> setModelParameters ( 1 ) -> addParameterFilter ( $ checkField , $ deactivateOn ) ; $ pages [ 'deactivate' ] = $ deactivate ; } if ( null !== $ reactivateOn ) { if ( isset ( $ otherReact [ 'privilege' ] ) ) { $ privilege = $ otherReact [ 'privilege' ] ; } else { $ privilege = $ this -> get ( 'privilege' ) . '.reactivate' ; } $ reactivate = $ this -> addAction ( $ this -> _ ( 'Reactivate' ) , $ privilege , 'reactivate' , $ otherReact ) ; $ reactivate -> setModelParameters ( 1 ) -> addParameterFilter ( $ checkField , $ reactivateOn ) ; $ pages [ 'reactivate' ] = $ reactivate ; } return $ pages ; }
Add a standard deactivate action and optional reactivate action to the current menu item
58,267
public function addHiddenParameter ( $ name , $ value = null ) { if ( null === $ value ) { unset ( $ this -> _hiddenParameters [ $ name ] ) ; } else { $ this -> _hiddenParameters [ $ name ] = $ value ; } return $ this ; }
Add parameter values that should not show in the url but that must be added to the request when this menu item is current .
58,268
public function addImportAction ( $ privilege = null , array $ other = array ( ) ) { if ( isset ( $ other [ 'label' ] ) ) { $ label = $ other [ 'label' ] ; unset ( $ other [ 'label' ] ) ; } else { $ label = $ this -> _ ( 'Import' ) ; } if ( null === $ privilege ) { $ privilege = $ this -> get ( 'privilege' ) . '.import' ; } $ menu = $ this -> addAction ( $ label , $ privilege , 'import' , $ other ) ; return $ menu ; }
Add a standard import action to the current menu item
58,269
public function addNamedParameters ( $ arrayOrKey1 = null , $ altName1 = null ) { $ params = \ MUtil_Ra :: pairs ( func_get_args ( ) ) ; foreach ( $ params as $ param => $ name ) { if ( is_int ( $ param ) ) { $ param = $ name ; } $ this -> _requiredParameters [ $ param ] = $ name ; $ this -> _parameters [ $ param ] = $ name ; } return $ this ; }
Add required parameters - shown in the url - for this menu item .
58,270
public function addShowAction ( $ privilege = null , array $ other = array ( ) ) { if ( isset ( $ other [ 'label' ] ) ) { $ label = $ other [ 'label' ] ; unset ( $ other [ 'label' ] ) ; } else { $ label = $ this -> _ ( 'Show' ) ; } $ menu = $ this -> addAction ( $ label , $ privilege , 'show' , $ other ) ; $ menu -> setModelParameters ( 1 ) ; return $ menu ; }
Add a standard show action to the current menu item
58,271
public function checkParameterFilter ( $ arrayOrKey1 , $ value1 = null ) { $ checks = \ MUtil_Ra :: pairs ( func_get_args ( ) ) ; foreach ( $ checks as $ name => $ value ) { if ( null === $ value ) { if ( isset ( $ this -> _parameterFilter [ $ name ] ) ) { return false ; } } else { if ( isset ( $ this -> _parameterFilter [ $ name ] ) ) { if ( $ this -> _parameterFilter [ $ name ] != $ value ) { return false ; } } else { return false ; } } } return true ; }
Check if a menu item contains these parameter settings
58,272
public function setNamedParameters ( $ arrayOrKey1 = null , $ key2 = null ) { $ params = \ MUtil_Ra :: pairs ( func_get_args ( ) ) ; $ this -> removeParameters ( ) ; $ this -> addNamedParameters ( $ params ) ; return $ this ; }
Set the required parameters - shown in the url - for this menu item .
58,273
public function getFieldLabels ( ) { $ output = array ( 'gap_id_organization' => $ this -> _ ( 'Organization' ) , 'gap_source' => $ this -> _ ( 'Source of appointment' ) , 'gap_id_attended_by' => $ this -> _ ( 'With' ) , 'gap_id_referred_by' => $ this -> _ ( 'Referrer' ) , 'gap_id_activity' => $ this -> _ ( 'Activity' ) , 'gap_id_procedure' => $ this -> _ ( 'Procedure' ) , 'gap_id_location' => $ this -> _ ( 'Location' ) , 'gap_subject' => $ this -> _ ( 'Subject' ) , ) ; asort ( $ output ) ; return $ output ; }
Get the field names in appontments with their labels as the value
58,274
public function getSnippet ( $ filename , array $ extraSourceParameters = null ) { try { $ this -> addRegistryContainer ( $ extraSourceParameters , 'tmpContainer' ) ; $ snippet = $ this -> _loadClass ( $ filename , true ) ; $ this -> removeRegistryContainer ( 'tmpContainer' ) ; if ( self :: $ verbose ) { \ MUtil_Echo :: r ( 'Loading snippet ' . $ filename . '<br/>' . 'Using snippet: ' . get_class ( $ snippet ) ) ; } } catch ( \ Exception $ exc ) { if ( self :: $ verbose ) { \ MUtil_Echo :: r ( $ exc -> getMessage ( ) , __CLASS__ . '->' . __FUNCTION__ . '(' . $ filename . ')' ) ; } throw $ exc ; } return $ snippet ; }
Searches and loads a . php snippet file .
58,275
private function _enableAutoSubmitElement ( $ element ) { if ( $ element instanceof \ Zend_Form || $ element instanceof \ Zend_Form_DisplayGroup ) { foreach ( $ element -> getElements ( ) as $ sub ) { $ this -> _enableAutoSubmitElement ( $ sub ) ; } } elseif ( $ element instanceof \ Gems_Form_AutosubmitElementInterface ) { $ element -> enableAutoSubmit ( $ this -> _autosubmit ) ; } }
Change all elements into an autosubmit element
58,276
public function activateJQuery ( ) { if ( $ this -> _no_jquery ) { parent :: activateJQuery ( ) ; $ this -> addPrefixPath ( 'Gems_JQuery_Form_Decorator' , 'Gems/JQuery/Form/Decorator/' , \ Zend_Form :: DECORATOR ) ; $ this -> addPrefixPath ( 'Gems_JQuery_Form_Element' , 'Gems/JQuery/Form/Element/' , \ Zend_Form :: ELEMENT ) ; } return $ this ; }
Activate JQuery for this form
58,277
public function addElement ( $ element , $ name = null , $ options = null ) { parent :: addElement ( $ element , $ name , $ options ) ; if ( $ this -> isAutoSubmit ( ) ) { if ( null !== $ name ) { $ element = $ this -> getElement ( $ name ) ; } $ this -> _enableAutoSubmitElement ( $ element ) ; } return $ this ; }
Add a new element
58,278
public function setAutoSubmit ( $ submitUrl , $ targetId , $ selective = false ) { $ args = \ MUtil_Ra :: args ( func_get_args ( ) , array ( 'submitUrl' => array ( 'MUtil_Html_UrlArrayAttribute' , 'is_array' , 'is_string' ) , 'targetId' => array ( 'MUtil_Html_ElementInterface' , 'is_string' ) , ) , null , \ MUtil_Ra :: STRICT ) ; if ( isset ( $ args [ 'targetId' ] ) ) { if ( $ args [ 'targetId' ] instanceof \ MUtil_Html_ElementInterface ) { if ( isset ( $ args [ 'targetId' ] -> id ) ) { $ args [ 'targetId' ] = '#' . $ args [ 'targetId' ] -> id ; } elseif ( isset ( $ args [ 'targetId' ] -> class ) ) { $ args [ 'targetId' ] = '.' . $ args [ 'targetId' ] -> class ; } else { $ args [ 'targetId' ] = $ args [ 'targetId' ] -> getTagName ( ) ; } } else { $ args [ 'targetId' ] = '#' . $ args [ 'targetId' ] ; } } if ( $ selective ) { $ args [ 'selective' ] = true ; } $ this -> _autosubmit = $ args ; $ this -> _enableAutoSubmitElement ( $ this ) ; $ this -> activateJQuery ( ) ; }
Change the form into an autosubmit form
58,279
protected function _filterData ( $ data , array $ filters ) { $ limit = false ; if ( isset ( $ filters [ 'limit' ] ) ) { $ limit = $ filters [ 'limit' ] ; unset ( $ filters [ 'limit' ] ) ; } $ filteredData = parent :: _filterData ( $ data , $ filters ) ; if ( $ limit ) { if ( is_array ( $ limit ) ) { $ filteredData = array_slice ( $ filteredData , $ limit [ 1 ] , $ limit [ 0 ] ) ; } elseif ( is_numeric ( $ limit ) ) { $ filteredData = array_slice ( $ filteredData , 0 , $ limit ) ; } } return $ filteredData ; }
Filters the data array using a model filter
58,280
public function getItemCount ( $ filter = true , $ sort = true ) { $ data = $ this -> _loadAllTraversable ( ) ; if ( $ filter ) { $ data = $ this -> _filterData ( $ data , $ filter ) ; } return count ( $ data ) ; }
Calculates the total number of items in a model result with certain filters
58,281
protected function _addExtraDataToExportModel ( \ MUtil_Model_ModelAbstract $ model , array $ data , array & $ prefixes ) { $ this -> _addExtraTrackFields ( $ model , $ data , $ prefixes ) ; $ this -> _addExtraRespondentNumber ( $ model , $ data , $ prefixes ) ; $ this -> _addExtraGenderAge ( $ model , $ data , $ prefixes ) ; $ this -> _addExtraTokenReceptionCode ( $ model , $ data , $ prefixes ) ; $ this -> _addExtraTrackReceptionCode ( $ model , $ data , $ prefixes ) ; $ this -> _addExtraTrackFieldsByCode ( $ model , $ data , $ prefixes ) ; }
Extensible function for added project specific data extensions
58,282
protected function _addNestedFieldsToExportModel ( \ MUtil_Model_ModelAbstract $ model , array $ data , array & $ prefixes ) { if ( $ model -> getMeta ( 'nested' , false ) ) { $ nestedNames = $ model -> getMeta ( 'nestedNames' ) ; foreach ( $ nestedNames as $ nestedName ) { $ nestedModel = $ model -> get ( $ nestedName , 'model' ) ; $ nestedLabels = $ nestedModel -> getcolNames ( 'label' ) ; foreach ( $ nestedLabels as $ colName ) { $ label = $ nestedModel -> get ( $ colName , 'label' ) ; $ model -> set ( $ colName , 'label' , $ label ) ; } $ model -> remove ( $ nestedName , 'label' ) ; } } }
Add nested model fields to the export model
58,283
protected function _addSurveyAnswersToExportModel ( \ MUtil_Model_ModelAbstract $ model , \ Gems_Tracker_Survey $ survey , array $ data , array & $ prefixes ) { $ prefixes [ 'A' ] = [ ] ; $ language = $ this -> locale -> getLanguage ( ) ; $ questions = $ survey -> getQuestionList ( $ language ) ; $ questionInformation = $ survey -> getQuestionInformation ( $ language ) ; foreach ( $ questions as $ questionName => $ label ) { if ( $ parent = $ model -> get ( $ questionName , 'parent_question' ) ) { if ( $ model -> get ( $ parent , 'type' ) === \ MUtil_Model :: TYPE_NOVALUE ) { if ( isset ( $ data [ 'subquestions' ] ) && $ data [ 'subquestions' ] == 'prefix_child' ) { $ cleanLabel = strip_tags ( $ label ) ; $ model -> set ( $ questionName , 'label' , $ cleanLabel ) ; } if ( isset ( $ data [ 'subquestions' ] ) && $ data [ 'subquestions' ] == 'show_parent' ) { if ( ! in_array ( $ parent , $ prefixes [ 'A' ] ) ) { $ prefixes [ 'A' ] [ ] = $ parent ; if ( isset ( $ questionInformation [ $ parent ] , $ questionInformation [ $ parent ] [ 'question' ] ) ) { $ cleanLabel = strip_tags ( $ questionInformation [ $ parent ] [ 'question' ] ) ; $ model -> set ( $ parent , 'label' , $ cleanLabel ) ; } } } else { $ model -> remove ( $ parent , 'label' ) ; } } } if ( $ question = $ model -> get ( $ questionName , 'survey_question' ) && $ model -> get ( $ questionName , 'label' ) == null ) { $ model -> set ( $ questionName , 'label' , $ questionName ) ; if ( isset ( $ questionInformation [ $ questionName ] , $ questionInformation [ $ questionName ] [ 'question' ] ) ) { $ cleanLabel = strip_tags ( $ questionInformation [ $ questionName ] [ 'question' ] ) ; $ model -> set ( $ questionName , 'label' , $ cleanLabel ) ; } } $ prefixes [ 'A' ] [ ] = $ questionName ; } }
Add all survey answers to the export model
58,284
protected function _addSurveySourceAttributesToExportModel ( \ MUtil_Model_ModelAbstract $ model , \ Gems_Tracker_Survey $ survey , array $ data , array & $ prefixes ) { $ source = $ survey -> getSource ( ) ; $ attributes = $ source -> getAttributes ( ) ; $ preExistingFields = $ model -> getColNames ( 'label' ) ; $ attributes = array_diff ( $ attributes , $ preExistingFields ) ; foreach ( $ attributes as $ attribute ) { $ model -> set ( $ attribute , 'label' , $ attribute ) ; } }
Add the survey source attributes to the export model that have not yet been set .
58,285
public function getExtraDataFormElements ( \ Gems_Form $ form , $ data ) { $ this -> form = $ form ; $ elements = [ ] ; if ( isset ( $ data [ 'gto_id_track' ] ) && $ data [ 'gto_id_track' ] ) { $ elements [ 'add_track_fields' ] = $ this -> _createCheckboxElement ( 'add_track_fields' , $ this -> _ ( 'Track fields' ) , $ this -> _ ( 'Add track fields to export' ) ) ; } if ( $ this -> currentUser -> hasPrivilege ( 'pr.export.add-resp-nr' ) ) { $ elements [ 'export_resp_nr' ] = $ this -> _createCheckboxElement ( 'export_resp_nr' , $ this -> getRespondentModel ( ) -> get ( 'gr2o_patient_nr' , 'label' ) , $ this -> _ ( 'Add respondent nr to export' ) ) ; } if ( $ this -> currentUser -> hasPrivilege ( 'pr.export.gender-age' ) ) { $ elements [ 'export_resp_gender' ] = $ this -> _createCheckboxElement ( 'export_resp_gender' , $ this -> _ ( 'Respondent gender' ) , $ this -> _ ( 'Add respondent gender to export' ) ) ; $ elements [ 'export_birth_year' ] = $ this -> _createCheckboxElement ( 'export_birth_year' , $ this -> _ ( 'Respondent birth year' ) , $ this -> _ ( 'Add respondent birth year to export' ) ) ; $ elements [ 'export_birth_month' ] = $ this -> _createCheckboxElement ( 'export_birth_month' , $ this -> _ ( 'Respondent birth month' ) , $ this -> _ ( 'Add respondent birth month to export' ) ) ; } $ elements [ 'export_track_reception_code' ] = $ this -> _createCheckboxElement ( 'export_track_reception_code' , $ this -> _ ( 'Track reception code' ) , $ this -> _ ( 'Add reception code of track' ) ) ; $ elements [ 'export_token_reception_code' ] = $ this -> _createCheckboxElement ( 'export_token_reception_code' , $ this -> _ ( 'Token reception code' ) , $ this -> _ ( 'Add reception code of token' ) ) ; return $ elements ; }
Get form elements for the specific Export
58,286
public function unsubscribeAction ( ) { $ orgId = urldecode ( $ this -> getRequest ( ) -> getParam ( 'org' ) ) ; if ( $ orgId && ( $ orgId != $ this -> currentUser -> getCurrentOrganizationId ( ) ) ) { $ allowedOrganizations = $ this -> currentUser -> getAllowedOrganizations ( ) ; if ( ( ! $ this -> currentUser -> isActive ( ) ) || isset ( $ allowedOrganizations [ $ orgId ] ) ) { $ this -> currentUser -> setCurrentOrganization ( $ orgId ) ; } } $ this -> html -> h1 ( $ this -> _ ( 'Unsubscribe' ) ) ; $ screen = $ this -> currentUser -> getCurrentOrganization ( ) -> getUnsubscribeScreen ( ) ; if ( $ screen instanceof UnsubscribeScreenInterface ) { $ params = $ screen -> getUnsubscribeParameters ( ) ; $ snippets = $ screen -> getUnsubscribeSnippets ( ) ; } else { $ list = $ this -> _getScreenOrgs ( 'gor_respondent_unsubscribe' ) ; if ( $ list ) { $ params = [ 'action' => 'unsubscribe' , 'info' => $ this -> _ ( 'Select an organization to unsubscribe from:' ) , 'orgs' => $ list , ] ; $ snippets = [ 'Organization\\ChooseListedOrganizationSnippet' ] ; } else { $ params = [ ] ; $ snippets = [ 'Unsubscribe\\NoUnsubscriptionsSnippet' ] ; } } $ this -> addSnippets ( $ snippets , $ params ) ; }
Ask the user which organization to unsubscribe from
58,287
public function removesessionAction ( ) { $ success = false ; $ request = $ this -> getEvent ( ) -> getRequest ( ) ; if ( $ request instanceof Request && $ request -> isPost ( ) ) { $ containerName = $ request -> getPost ( 'containerName' , 'Default' ) ; $ keysession = $ request -> getPost ( 'keysession' , '' ) ; $ success = $ this -> sessionManager -> sessionSetting ( $ containerName , $ keysession ) ; } return new JsonModel ( [ 'success' => $ success , ] ) ; }
Remove Session by Container and its key .
58,288
public function reloadsessionAction ( ) { $ sessionData = $ this -> sessionManager -> getSessionData ( false ) ; $ renderedContent = $ this -> viewRenderer -> render ( 'zend-developer-tools/toolbar/session-data-list' , [ 'sessionData' => $ sessionData ] ) ; return new JsonModel ( [ 'san_sessiontoolbar_data_renderedContent' => $ renderedContent , ] ) ; }
Reload Session data .
58,289
public function clearsessionAction ( ) { $ request = $ this -> getEvent ( ) -> getRequest ( ) ; if ( $ request instanceof Request && $ request -> isPost ( ) ) { $ this -> sessionManager -> clearSession ( $ request -> getPost ( 'byContainer' ) ) ; } $ sessionData = $ this -> sessionManager -> getSessionData ( ) ; $ renderedContent = $ this -> viewRenderer -> render ( 'zend-developer-tools/toolbar/session-data-list' , [ 'sessionData' => $ sessionData ] ) ; return new JsonModel ( [ 'san_sessiontoolbar_data_renderedContent' => $ renderedContent , ] ) ; }
Clear Session data .
58,290
public function savesessionAction ( ) { $ processSetOrAddSessionData = [ 'success' => false , 'errorMessage' => '' ] ; $ request = $ this -> getEvent ( ) -> getRequest ( ) ; if ( $ request instanceof Request && $ request -> isPost ( ) ) { $ processSetOrAddSessionData = $ this -> setOrAddSession ( $ request ) ; } $ sessionData = $ this -> sessionManager -> getSessionData ( ) ; $ renderedContent = $ this -> viewRenderer -> render ( 'zend-developer-tools/toolbar/session-data-list' , [ 'sessionData' => $ sessionData ] ) ; return new JsonModel ( [ 'success' => $ processSetOrAddSessionData [ 'success' ] , 'errorMessage' => $ processSetOrAddSessionData [ 'errorMessage' ] , 'san_sessiontoolbar_data_renderedContent' => $ renderedContent , ] ) ; }
Save Session by Container and its key .
58,291
private function setOrAddSession ( Request $ request ) { $ containerName = $ request -> getPost ( 'containerName' , 'Default' ) ; $ keysession = $ request -> getPost ( 'keysession' , '' ) ; $ sessionValue = $ request -> getPost ( 'sessionvalue' , '' ) ; $ new = ( bool ) $ request -> getPost ( 'new' , false ) ; $ notEmptyValidator = new NotEmpty ( ) ; if ( $ notEmptyValidator -> isValid ( $ keysession ) && $ notEmptyValidator -> isValid ( $ sessionValue ) ) { $ success = $ this -> sessionManager -> sessionSetting ( $ containerName , $ keysession , $ sessionValue , [ 'set' => true , 'new' => $ new ] ) ; return [ 'success' => $ success , 'errorMessage' => '' ] ; } return [ 'success' => false , 'errorMessage' => 'Value is required and can\'t be empty' ] ; }
Set or Add Session Data Process .
58,292
public function getCalculationFields ( array $ fieldData ) { $ output = array ( ) ; if ( isset ( $ this -> _fieldDefinition [ 'gtf_calculate_using' ] ) ) { $ sources = explode ( self :: FIELD_SEP , $ this -> _fieldDefinition [ 'gtf_calculate_using' ] ) ; foreach ( $ sources as $ source ) { if ( isset ( $ fieldData [ $ source ] ) && $ fieldData [ $ source ] ) { $ output [ $ source ] = $ fieldData [ $ source ] ; } else { $ output [ $ source ] = null ; } } } return array_reverse ( $ output , true ) ; }
Get the fields that should be used for calculation first field to use first .
58,293
protected function _getSelectForm ( ) { $ form = new \ Gems_Form ( array ( 'name' => 'autosubmit' , 'class' => 'form-inline' , 'role' => 'form' ) ) ; $ form -> setHtml ( 'div' ) ; $ div = $ form -> getHtml ( ) ; $ div -> class = 'search' ; $ span = $ div -> div ( array ( 'class' => 'panel panel-default' ) ) -> div ( array ( 'class' => 'inputgroup panel-body' ) ) ; $ element = $ form -> createElement ( 'select' , 'gpa_level' , array ( 'multiOptions' => $ this -> patchLevels , 'onchange' => 'this.form.submit();' , 'onkeyup' => 'this.form.submit();' , ) ) ; $ element -> setValue ( $ this -> getPatchLevel ( ) ) ; $ span -> input ( $ element ) ; $ form -> addElement ( $ element ) ; $ submit = $ form -> createElement ( 'submit' , 'search' , array ( 'label' => $ this -> _ ( 'Search' ) , 'class' => 'button small' , ) ) ; $ span -> input ( $ submit ) ; $ form -> addElement ( $ submit ) ; return $ form ; }
The form for selecting the patch level
58,294
public function getStructuralPatches ( $ patchLevel ) { $ patches = $ this -> db -> fetchAll ( "SELECT * FROM gems__patches WHERE gpa_level = ? ORDER BY gpa_location, gpa_name, gpa_order" , $ patchLevel ) ; foreach ( $ patches as $ patchId => $ patch ) { if ( \ MUtil_String :: startsWith ( trim ( $ patch [ 'gpa_sql' ] ) , 'INSERT' , true ) || \ MUtil_String :: startsWith ( trim ( $ patch [ 'gpa_sql' ] ) , 'UPDATE' , true ) || \ MUtil_String :: startsWith ( trim ( $ patch [ 'gpa_sql' ] ) , 'DELETE' , true ) ) { unset ( $ patches [ $ patchId ] ) ; } } return $ patches ; }
Get the structural patches for the given patch level
58,295
public function getTextOutput ( ) { $ patchLevel = $ this -> getPatchLevel ( ) ; $ commands = array ( sprintf ( '-- Patch level %d structural changes' , $ patchLevel ) ) ; $ lastLocation = '' ; $ lastName = '' ; $ noOutput = true ; foreach ( $ this -> getStructuralPatches ( $ patchLevel ) as $ patch ) { if ( $ patch [ 'gpa_location' ] != $ lastLocation ) { $ commands [ ] = sprintf ( "\n-- DATABASE LOCATION: %s" , $ patch [ 'gpa_location' ] ) ; $ lastLocation = $ patch [ 'gpa_location' ] ; } if ( $ patch [ 'gpa_name' ] != $ lastName ) { $ commands [ ] = sprintf ( "\n-- PATCH: %s" , $ patch [ 'gpa_name' ] ) ; $ lastName = $ patch [ 'gpa_name' ] ; } $ commands [ ] = $ patch [ 'gpa_sql' ] . ';' ; $ noOutput = false ; } if ( $ noOutput ) { $ commands [ ] = sprintf ( "\n-- No structural changes in patchlevel %d" , $ patchLevel ) ; } $ commands [ ] = '' ; return implode ( "\n" , $ commands ) ; }
Get the content as text
58,296
protected function getPatchLevel ( ) { if ( isset ( $ this -> searchData [ 'gpa_level' ] ) && $ this -> searchData [ 'gpa_level' ] ) { return $ this -> searchData [ 'gpa_level' ] ; } return reset ( $ this -> patchLevels ) ; }
Current patch level
58,297
protected function getHeaders ( \ MUtil_Model_ModelAbstract $ model , array $ currentNames ) { $ lastParent = null ; $ results = array ( ) ; foreach ( $ currentNames as $ name ) { if ( $ model -> is ( $ name , 'type' , \ MUtil_Model :: TYPE_NOVALUE ) ) { $ results [ $ name ] = $ name ; } elseif ( $ parent = $ model -> get ( $ name , 'parent_question' ) ) { $ results [ $ parent ] = $ parent ; } } return $ results ; }
Returns only the headers
58,298
protected function restoreHeaderPositions ( \ MUtil_Model_ModelAbstract $ model , array $ currentNames ) { $ lastParent = null ; $ results = array ( ) ; foreach ( $ currentNames as $ name ) { if ( $ model -> is ( $ name , 'type' , \ MUtil_Model :: TYPE_NOVALUE ) ) { continue ; } if ( $ parent = $ model -> get ( $ name , 'parent_question' ) ) { if ( $ lastParent !== $ parent ) { if ( isset ( $ results [ $ parent ] ) ) { $ results [ ] = $ parent ; } else { $ results [ $ parent ] = $ parent ; } $ lastParent = $ parent ; } } else { $ lastParent = $ name ; } $ results [ $ name ] = $ name ; } return $ results ; }
Restores the header position of question before their corresponding question_sub
58,299
protected function getControllerTargetModel ( $ controller ) { switch ( $ controller ) { case 'respondent' : $ model = $ this -> loader -> getModels ( ) -> getRespondentModel ( true ) ; $ model -> applyEditSettings ( ) ; return $ model ; case 'calendar' : $ model = $ this -> loader -> getModels ( ) -> createAppointmentModel ( ) ; $ this -> applySource ( $ model ) ; $ model -> applyEditSettings ( ) ; return $ model ; default : return null ; } }
The model to use with a controller