idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
58,300
public function getFilenameController ( $ filename ) { $ filename = strtolower ( basename ( $ filename ) ) ; if ( preg_match ( '/^respondent/' , $ filename ) ) { return 'respondent' ; } if ( preg_match ( '/^appointment/' , $ filename ) ) { return 'calendar' ; } return false ; }
Get the controller that should be linked to the filename
58,301
public function getLongtermFileName ( $ controller , $ dateValue = null ) { if ( $ dateValue instanceof \ Zend_Date ) { $ date = $ dateValue ; } else { $ date = new \ MUtil_Date ( $ dateValue ) ; } $ name [ ] = $ controller ; $ name [ ] = $ date -> toString ( 'YYYY-MM-ddTHH-mm-ss' ) ; $ name [ ] = preg_replace ( '/[^a-zA-Z0-9_]/' , '' , $ this -> currentUser -> getLoginName ( ) ) ; $ name [ ] = $ this -> getOrganizationCode ( ) ; return implode ( '.' , array_filter ( $ name ) ) ; }
The file name to use for final storage minus the extension
58,302
public function getTranslators ( $ controller , $ filename = null ) { $ translator = $ this -> getTranslateAdapter ( ) ; switch ( $ controller ) { case 'answers' : $ output [ 'default' ] = new \ Gems_Model_Translator_TokenAnswerTranslator ( $ translator -> _ ( 'Link by token id' ) ) ; $ output [ 'resp' ] = new \ Gems_Model_Translator_RespondentAnswerTranslator ( $ translator -> _ ( 'Link by patient id' ) ) ; $ output [ 'date' ] = new \ Gems_Model_Translator_DateAnswerTranslator ( $ translator -> _ ( 'Link by patient id and completion date' ) ) ; break ; case 'calendar' : $ output [ 'default' ] = new \ Gems_Model_Translator_AppointmentTranslator ( $ translator -> _ ( 'Direct import' ) ) ; break ; case 'respondent' : $ output [ 'default' ] = new \ Gems_Model_Translator_RespondentTranslator ( $ translator -> _ ( 'Direct import' ) ) ; break ; case 'staff' : $ output [ 'default' ] = new \ Gems_Model_Translator_StaffTranslator ( $ translator -> _ ( 'Direct import' ) ) ; break ; default : $ output [ 'default' ] = new \ Gems_Model_Translator_StraightTranslator ( $ translator -> _ ( 'Direct import' ) ) ; break ; } foreach ( $ output as $ trs ) { $ this -> applySource ( $ trs ) ; } return $ output ; }
Get the possible translators for the import snippet .
58,303
private static function _arrayFindName ( array $ tokenAnswers , $ fieldNames ) { $ results = array ( ) ; foreach ( $ tokenAnswers as $ fieldName => $ value ) { if ( strpos ( $ fieldName , $ fieldNames ) !== false ) { $ results [ ] = $ fieldName ; } } return $ results ; }
Finds those tokenAnswers array keys that contain fieldNames in their key .
58,304
public static function roundFixed ( $ value , $ decimals = 2 ) { $ value = round ( $ value , $ decimals ) ; $ pos = strpos ( $ value , '.' ) ; if ( $ pos === false ) { $ value .= '.' . str_repeat ( '0' , $ decimals ) ; } else { $ extra = $ decimals - strlen ( $ value ) + $ pos + 1 ; if ( $ extra > 0 ) { $ value .= str_repeat ( '0' , $ extra ) ; } } return $ value ; }
Rounds the value with a fixed number of decimals padding zeros when required .
58,305
public function getLoginLinkElement ( ) { $ element = $ this -> getElement ( $ this -> _tokenFieldName ) ; if ( ! $ element ) { if ( $ link = $ this -> getLoginLink ( ) ) { $ element = new \ MUtil_Form_Element_Html ( $ this -> _loginLinkFieldName ) ; $ element -> setValue ( $ link ) ; $ this -> addElement ( $ element ) ; } return $ element ; } }
Returns a link to the login page
58,306
public function changeOrganizationAction ( ) { if ( $ this -> changeOrganizationSnippets ) { $ params = $ this -> _processParameters ( $ this -> changeOrganizationParameters + $ this -> editParameters + $ this -> createEditParameters + [ 'createData' => false ] ) ; $ this -> addSnippets ( $ this -> changeOrganizationSnippets , $ params ) ; } }
Action to change a users
58,307
public function exportArchiveAction ( ) { $ params = $ this -> _processParameters ( $ this -> showParameters ) ; $ this -> addSnippets ( $ this -> exportSnippets , $ params ) ; $ this -> html -> h2 ( $ this -> _ ( 'Export respondent archive' ) ) ; $ export = $ this -> loader -> getRespondentExport ( ) ; $ form = $ export -> getForm ( ) ; $ div = $ this -> html -> div ( array ( 'id' => 'mainform' ) ) ; $ div [ ] = $ form ; $ request = $ this -> getRequest ( ) ; $ form -> populate ( $ request -> getParams ( ) ) ; if ( $ request -> isPost ( ) ) { $ respondent = $ this -> getRespondent ( ) ; $ patients = array ( array ( 'gr2o_id_organization' => $ respondent -> getOrganizationId ( ) , 'gr2o_patient_nr' => $ respondent -> getPatientNumber ( ) ) ) ; $ export -> render ( $ patients , $ request -> getParam ( 'group' ) , $ request -> getParam ( 'format' ) ) ; } }
Action for dossier export
58,308
public function getEditLink ( ) { $ request = $ this -> getRequest ( ) ; $ item = $ this -> menu -> find ( array ( $ request -> getControllerKey ( ) => $ request -> getControllerName ( ) , $ request -> getActionKey ( ) => 'edit' , 'allowed' => true ) ) ; if ( $ item ) { return $ item -> toHRefAttribute ( $ request ) ; } }
Get the link to edit respondent
58,309
public function getEditTitle ( ) { $ respondent = $ this -> getRespondent ( ) ; if ( $ respondent -> exists ) { if ( $ this -> currentUser -> areAllFieldsMaskedWhole ( 'grs_first_name' , 'grs_last_name' ) ) { return sprintf ( $ this -> _ ( 'Edit respondent nr %s' ) , $ respondent -> getPatientNumber ( ) ) ; } return sprintf ( $ this -> _ ( 'Edit respondent nr %s: %s' ) , $ respondent -> getPatientNumber ( ) , $ respondent -> getName ( ) ) ; } return parent :: getEditTitle ( ) ; }
Helper function to get the title for the edit action .
58,310
public function getItemUrlArray ( ) { return array ( \ MUtil_Model :: REQUEST_ID1 => $ this -> _getParam ( \ MUtil_Model :: REQUEST_ID1 ) , \ MUtil_Model :: REQUEST_ID2 => $ this -> _getParam ( \ MUtil_Model :: REQUEST_ID2 ) , ) ; }
Return the array with items that should be used to find this item
58,311
public function indexAction ( ) { $ group = $ this -> currentUser -> getGroup ( ) ; if ( $ group && $ this -> enableScreens ) { $ browse = $ group -> getRespondentBrowseScreen ( ) ; if ( $ browse ) { if ( $ browse instanceof ProcessModelInterface ) { $ browse -> processModel ( $ this -> getModel ( ) ) ; } $ this -> autofilterParameters = $ browse -> getAutofilterParameters ( ) + $ this -> autofilterParameters ; $ this -> indexParameters = $ browse -> getStartStopParameters ( ) + $ this -> indexParameters ; $ autoSnippets = $ browse -> getAutofilterSnippets ( ) ; if ( false !== $ autoSnippets ) { $ this -> autofilterSnippets = $ autoSnippets ; } $ startSnippets = $ browse -> getStartSnippets ( ) ; if ( false !== $ startSnippets ) { $ this -> indexStartSnippets = $ startSnippets ; } $ stopSnippets = $ browse -> getStopSnippets ( ) ; if ( false !== $ stopSnippets ) { $ this -> indexStopSnippets = $ stopSnippets ; } } } if ( $ this -> currentUser -> hasPrivilege ( 'pr.respondent.multiorg' ) || $ this -> currentOrganization -> canHaveRespondents ( ) ) { parent :: indexAction ( ) ; } else { $ this -> addSnippet ( 'Organization\\ChooseOrganizationSnippet' ) ; } }
Overrule default index for the case that the current organization cannot have users .
58,312
public function overviewAction ( ) { if ( $ this -> overviewSnippets ) { $ params = $ this -> _processParameters ( $ this -> overviewParameters ) ; $ menuList = $ this -> menu -> getMenuList ( ) ; $ menuList -> addParameterSources ( $ this -> request , $ this -> menu -> getParameterSource ( ) ) ; $ menuList -> addCurrentParent ( $ this -> _ ( 'Cancel' ) ) ; $ params [ 'buttons' ] = $ menuList ; $ this -> addSnippets ( $ this -> overviewSnippets , $ params ) ; } }
Action for showing overview for a patient
58,313
public function simpleApiAction ( ) { $ this -> disableLayout ( ) ; $ data = $ this -> getRequest ( ) -> getParams ( ) ; $ importLoader = $ this -> loader -> getImportLoader ( ) ; $ model = $ this -> getModel ( ) ; $ translator = new \ Gems_Model_Translator_RespondentTranslator ( $ this -> _ ( 'Direct import' ) ) ; $ this -> source -> applySource ( $ translator ) ; $ translator -> setTargetModel ( $ model ) -> startImport ( ) ; $ raw = $ translator -> translateRowValues ( $ data , 1 ) ; $ errors = array ( ) ; if ( array_key_exists ( 'oldpid' , $ raw ) ) { $ oldPid = $ raw [ 'oldpid' ] ; if ( array_key_exists ( 'gr2o_patient_nr' , $ raw ) && array_key_exists ( 'gr2o_id_organization' , $ raw ) ) { $ newPid = $ raw [ 'gr2o_patient_nr' ] ; $ orgId = ( int ) $ raw [ 'gr2o_id_organization' ] ; $ result = $ model -> merge ( $ newPid , $ oldPid , $ orgId ) ; switch ( $ result ) { case \ Gems \ Model \ MergeResult :: BOTH : echo sprintf ( "%s merged to %s\n" , $ oldPid , $ newPid ) ; break ; case \ Gems \ Model \ MergeResult :: FIRST : echo sprintf ( "%s not found, nothing to merge\n" , $ oldPid ) ; break ; case \ Gems \ Model \ MergeResult :: SECOND : echo sprintf ( "%s renamed to %s\n" , $ oldPid , $ newPid ) ; $ raw = $ translator -> translateRowValues ( $ data , 1 ) ; break ; default : break ; } } else { $ errors [ ] = 'To merge you need at least oldpid, gr2o_patient_nr and gr2o_id_organization.' ; } } $ row = $ translator -> validateRowValues ( $ raw , 1 ) ; $ errors = array_merge ( $ errors , $ translator -> getRowErrors ( 1 ) ) ; if ( $ errors ) { echo "ERRORS Occured:\n" . implode ( "\n" , $ errors ) ; exit ( count ( $ errors ) ) ; } else { $ output = $ model -> save ( $ row ) ; $ changed = $ model -> getChanged ( ) ; $ patientId = $ output [ 'gr2o_patient_nr' ] ; if ( $ changed ) { echo "Changes to patient $patientId saved." ; } else { echo "No changes to patient $patientId." ; } return ; } }
Action for a simple - usually command line - import
58,314
public function undeleteAction ( ) { if ( $ this -> deleteSnippets ) { $ params = $ this -> _processParameters ( $ this -> deleteParameters ) ; $ this -> addSnippets ( $ this -> deleteSnippets , $ params ) ; } }
Action for showing a delete item page
58,315
public function getDiagnosisData ( ) { if ( ! isset ( $ this -> _gemsData [ 'gec_diagnosis' ] ) ) { return [ ] ; } if ( is_string ( $ this -> _gemsData [ 'gec_diagnosis' ] ) ) { $ this -> _gemsData [ 'gec_diagnosis' ] = json_decode ( $ this -> _gemsData [ 'gec_diagnosis' ] , true ) ; } return $ this -> _gemsData [ 'gec_diagnosis' ] ; }
The diagnosis data of the episode translated from Json
58,316
public function getExtraData ( ) { if ( ! isset ( $ this -> _gemsData [ 'gec_extra_data' ] ) ) { return [ ] ; } if ( is_string ( $ this -> _gemsData [ 'gec_extra_data' ] ) ) { $ this -> _gemsData [ 'gec_extra_data' ] = json_decode ( $ this -> _gemsData [ 'gec_extra_data' ] , true ) ; } return $ this -> _gemsData [ 'gec_extra_data' ] ; }
The extra data of the episode translated from Json
58,317
public function getStartDate ( ) { if ( isset ( $ this -> _gemsData [ 'gec_startdate' ] ) && $ this -> _gemsData [ 'gec_startdate' ] ) { if ( ! $ this -> _gemsData [ 'gec_startdate' ] instanceof \ MUtil_Date ) { $ this -> _gemsData [ 'gec_startdate' ] = new \ MUtil_Date ( $ this -> _gemsData [ 'gec_startdate' ] , \ Gems_Tracker :: DB_DATE_FORMAT ) ; } return $ this -> _gemsData [ 'gec_startdate' ] ; } }
Return the start date
58,318
public function getSettingsField ( $ key ) { $ pos = strpos ( $ key , $ this -> keySeparator ) ; if ( $ pos ) { return substr ( $ key , $ pos + strlen ( $ this -> keySeparator ) ) ; } return null ; }
Get the settings field name from a combined field name
58,319
public function getStorageField ( $ key ) { $ pos = strpos ( $ key , $ this -> keySeparator ) ; if ( $ pos ) { return substr ( $ key , 0 , $ pos ) ; } return null ; }
Get the storage field name from a combined field name
58,320
protected function addCompletionBlock ( \ Gems_Model_Bridge_ThreeColumnTableBridge $ bridge , \ MUtil_Model_ModelAbstract $ model , \ Gems_Menu_MenuList $ links ) { $ fields = array ( ) ; if ( $ this -> token -> getReceptionCode ( ) -> hasDescription ( ) ) { $ bridge -> addMarkerRow ( ) ; $ fields [ ] = 'grc_description' ; } $ fields [ ] = 'gto_completion_time' ; if ( $ this -> token -> isCompleted ( ) ) { $ fields [ ] = 'gto_duration_in_sec' ; } if ( $ this -> token -> hasResult ( ) ) { $ fields [ ] = 'gto_result' ; } $ controller = $ this -> request -> getControllerName ( ) ; $ fields [ ] = $ links -> getActionLinks ( true , $ controller , 'correct' , $ controller , 'delete' ) ; $ bridge -> addWithThird ( $ fields ) ; return true ; }
Adds third block to fifth group group of rows showing completion data
58,321
protected function addHeaderGroup ( \ Gems_Model_Bridge_ThreeColumnTableBridge $ bridge , \ MUtil_Model_ModelAbstract $ model , \ Gems_Menu_MenuList $ links ) { $ controller = $ this -> request -> getControllerName ( ) ; $ tData = $ this -> util -> getTokenData ( ) ; $ bridge -> addItem ( 'gto_id_token' , null , array ( 'colspan' => 1.5 ) ) ; $ copiedFrom = $ this -> token -> getCopiedFrom ( ) ; if ( $ copiedFrom ) { $ bridge -> tr ( ) ; $ bridge -> tdh ( $ this -> _ ( 'Token copied from' ) ) ; $ bridge -> td ( array ( 'colspan' => 2 , 'skiprowclass' => true ) ) -> a ( [ \ MUtil_Model :: REQUEST_ID => $ copiedFrom ] , $ copiedFrom ) ; } $ copiedTo = $ this -> token -> getCopiedTo ( ) ; if ( $ copiedTo ) { $ bridge -> tr ( ) ; $ bridge -> tdh ( $ this -> _ ( 'Token copied to' ) ) ; $ td = $ bridge -> td ( array ( 'colspan' => 2 , 'skiprowclass' => true ) ) ; foreach ( $ copiedTo as $ copy ) { $ td -> a ( [ \ MUtil_Model :: REQUEST_ID => $ copy ] , $ copy ) ; $ td -> append ( ' ' ) ; } } $ bridge -> tr ( ) ; $ bridge -> tdh ( $ this -> _ ( 'Status' ) ) ; $ td = $ bridge -> td ( [ 'colspan' => 2 , 'skiprowclass' => true ] , $ tData -> getTokenStatusShowForBridge ( $ bridge ) , ' ' , $ tData -> getTokenStatusDescriptionForBridge ( $ bridge ) ) ; $ bridge -> gto_in_source ; $ buttons = $ links -> getActionLinks ( true , 'ask' , 'take' , 'pdf' , 'show' , $ controller , 'questions' , $ controller , 'answer' , $ controller , 'answer-export' ) ; if ( count ( $ buttons ) ) { if ( isset ( $ buttons [ 'ask.take' ] ) && ( $ buttons [ 'ask.take' ] instanceof \ MUtil_Html_HtmlElement ) ) { if ( 'a' == $ buttons [ 'ask.take' ] -> tagName ) { $ buttons [ 'ask.take' ] = $ tData -> getTokenAskButtonForBridge ( $ bridge , true , true ) ; } } if ( isset ( $ buttons [ 'track.answer' ] ) && ( $ buttons [ 'track.answer' ] instanceof \ MUtil_Html_HtmlElement ) ) { if ( 'a' == $ buttons [ 'track.answer' ] -> tagName ) { $ buttons [ 'track.answer' ] = $ tData -> getTokenAnswerLinkForBridge ( $ bridge , true ) ; } } $ bridge -> tr ( ) ; $ bridge -> tdh ( $ this -> _ ( 'Actions' ) ) ; $ bridge -> td ( $ buttons , array ( 'colspan' => 2 , 'skiprowclass' => true ) ) ; } return true ; }
Adds first group of rows showing token specific data
58,322
protected function addLastitems ( \ Gems_Model_Bridge_ThreeColumnTableBridge $ bridge , \ MUtil_Model_ModelAbstract $ model , \ Gems_Menu_MenuList $ links ) { if ( $ links -> count ( ) ) { $ bridge -> tfrow ( $ links , array ( 'class' => 'centerAlign' ) ) ; } foreach ( $ bridge -> tbody ( ) as $ row ) { if ( isset ( $ row [ 1 ] ) && ( $ row [ 1 ] instanceof \ MUtil_Html_HtmlElement ) ) { if ( isset ( $ row [ 1 ] -> skiprowclass ) ) { unset ( $ row [ 1 ] -> skiprowclass ) ; } else { $ row [ 1 ] -> appendAttrib ( 'class' , $ bridge -> row_class ) ; } } } return true ; }
Adds last group of rows cleaning up whatever is left to do in adding links etc .
58,323
protected function addRespondentGroup ( \ Gems_Model_Bridge_ThreeColumnTableBridge $ bridge , \ MUtil_Model_ModelAbstract $ model , \ Gems_Menu_MenuList $ links ) { $ item = $ this -> menu -> findAllowedController ( 'respondent' , 'show' ) ; if ( $ item ) { $ href = $ item -> toHRefAttribute ( $ bridge , $ this -> request ) ; $ model -> set ( 'gr2o_patient_nr' , 'itemDisplay' , \ MUtil_Html :: create ( 'a' , $ href ) ) ; } $ bridge -> add ( 'gr2o_patient_nr' ) ; if ( ! $ this -> currentUser -> isFieldMaskedWhole ( 'respondent_name' ) ) { $ bridge -> add ( 'respondent_name' ) ; } return true ; }
Adds second group of rows showing patient specific data
58,324
protected function addRoundGroup ( \ Gems_Model_Bridge_ThreeColumnTableBridge $ bridge , \ MUtil_Model_ModelAbstract $ model , \ Gems_Menu_MenuList $ links ) { $ bridge -> add ( 'gsu_survey_name' ) ; $ bridge -> add ( 'gto_round_description' ) ; $ bridge -> add ( 'ggp_name' ) ; return true ; }
Adds forth group of rows showing round specific data
58,325
protected function addValidFromBlock ( \ Gems_Model_Bridge_ThreeColumnTableBridge $ bridge , \ MUtil_Model_ModelAbstract $ model , \ Gems_Menu_MenuList $ links ) { $ button = $ links -> getActionLink ( $ this -> request -> getControllerName ( ) , 'edit' , true ) ; $ bridge -> addWithThird ( 'gto_valid_from_manual' , 'gto_valid_from' , 'gto_valid_until_manual' , 'gto_valid_until' , 'gto_comment' , $ button ) ; return true ; }
Adds first block to fifth group group of rows showing valid from data
58,326
protected function _addUsedPrivileges ( array & $ privileges , $ label ) { foreach ( $ this -> _subItems as $ item ) { if ( $ item -> get ( 'action' ) == 'autofilter' ) { continue ; } $ _itemlabel = $ label . ( $ item -> get ( 'label' ) ? : $ item -> get ( 'privilege' ) ) ; if ( $ _privilege = $ item -> get ( 'privilege' ) ) { if ( isset ( $ privileges [ $ _privilege ] ) ) { $ privileges [ $ _privilege ] .= "<br/>&nbsp; + " . $ _itemlabel ; } else { $ privileges [ $ _privilege ] = $ _itemlabel ; } } $ item -> _addUsedPrivileges ( $ privileges , $ _itemlabel . '-&gt;' ) ; } }
Adds privileges that are used in this menu item to the array
58,327
protected function _getOriginalRequest ( ) { $ request = $ this -> escort -> request ; $ handler = $ request -> getParam ( 'error_handler' ) ; if ( $ handler ) { return $ handler -> request ; } return $ request ; }
Get tge request to use for menu building
58,328
protected function add ( $ argsArray ) { $ args = \ MUtil_Ra :: args ( func_get_args ( ) , 0 , array ( 'visible' => true , 'allowed' => true , ) ) ; if ( ! isset ( $ args [ 'label' ] ) ) { $ args [ 'visible' ] = false ; } if ( ! isset ( $ args [ 'order' ] ) ) { $ args [ 'order' ] = 10 * ( count ( $ this -> _subItems ) + 1 ) ; } $ page = new \ Gems_Menu_SubMenuItem ( $ this -> escort , $ this , $ args ) ; $ this -> _subItems [ ] = $ page ; return $ page ; }
Add a sub item to this item .
58,329
public function addAgendaSetupMenu ( $ label ) { $ setup = $ this -> addContainer ( $ label ) ; $ setup -> addAgendaSetupPage ( $ this -> _ ( 'Activities' ) , 'pr.agenda-activity' , 'agenda-activity' ) ; $ setup -> addAgendaSetupPage ( $ this -> _ ( 'Procedures' ) , 'pr.agenda-procedure' , 'agenda-procedure' ) ; $ setup -> addAgendaSetupPage ( $ this -> _ ( 'Diagnoses' ) , 'pr.agenda-diagnosis' , 'agenda-diagnosis' ) ; $ setup -> addAgendaSetupPage ( $ this -> _ ( 'Locations' ) , 'pr.locations' , 'location' ) ; $ setup -> addAgendaSetupPage ( $ this -> _ ( 'Healthcare staff' ) , 'pr.agenda-staff' , 'agenda-staff' ) ; $ setup -> addBrowsePage ( $ this -> _ ( 'Track field filters' ) , 'pr.agenda-filters' , 'agenda-filter' ) ; return $ setup ; }
Add a agenda setup menu tree to the menu
58,330
public function addButtonOnly ( $ label , $ privilege , $ controller , $ action = 'index' , array $ other = array ( ) ) { $ other [ 'button_only' ] = true ; return $ this -> addPage ( $ label , $ privilege , $ controller , $ action , $ other ) ; }
Add a menu item that is never added to the navigation tree and only shows up as a button .
58,331
public function addCalendarPage ( $ label ) { $ page = $ this -> addPage ( $ label , 'pr.calendar' , 'calendar' ) ; $ page -> addAutofilterAction ( ) ; $ page -> addExportAction ( ) ; $ page -> addImportAction ( ) ; $ page -> addAction ( null , 'pr.calendar.simple-api' , 'simple-api' ) ; return $ page ; }
Add a calendar page to the menu
58,332
public function addCommSetupMenu ( $ label ) { $ setup = $ this -> addContainer ( $ label ) ; $ page = $ setup -> addBrowsePage ( $ this -> _ ( 'Automatic mail' ) , 'pr.comm.job' , 'comm-job' ) ; $ page -> addButtonOnly ( $ this -> _ ( 'Turn Automatic Mail Jobs OFF' ) , 'pr.comm.job' , 'cron' , 'cron-lock' ) ; $ page -> addButtonOnly ( $ this -> _ ( 'Monitor' ) , 'pr.comm.job' , 'comm-job' , 'monitor' ) ; $ page -> addPage ( $ this -> _ ( 'Run all' ) , 'pr.cron.job' , 'comm-job' , 'execute-all' ) ; $ show = $ page -> findItem ( array ( 'controller' => 'comm-job' , 'action' => 'show' ) ) ; $ show -> addPage ( $ this -> _ ( 'Preview' ) , 'pr.cron.job' , 'comm-job' , 'preview' ) -> setModelParameters ( 1 ) ; $ show -> addPage ( $ this -> _ ( 'Run' ) , 'pr.cron.job' , 'comm-job' , 'execute' ) -> setModelParameters ( 1 ) ; $ ajaxPage = $ this -> addPage ( $ this -> _ ( 'Round Selection' ) , 'pr.comm.job' , 'comm-job' , 'roundselect' , array ( 'visible' => false ) ) ; $ ajaxPage = $ this -> addPage ( $ this -> _ ( 'Sort jobs' ) , 'pr.comm.job.edit' , 'comm-job' , 'sort' , array ( 'visible' => false ) ) ; $ page = $ setup -> addBrowsePage ( $ this -> _ ( 'Servers' ) , 'pr.mail.server' , 'mail-server' ) ; $ setup -> addBrowsePage ( $ this -> _ ( 'Templates' ) , 'pr.comm.template' , 'comm-template' ) ; $ page = $ setup -> addPage ( $ this -> _ ( 'Communication log' ) , 'pr.mail.log' , 'mail-log' ) ; $ page -> addAutofilterAction ( ) ; $ page -> addExportAction ( ) ; $ page -> addShowAction ( ) ; return $ setup ; }
Add a Mail menu tree to the menu
58,333
public function addExportContainer ( $ label ) { $ export = $ this -> addContainer ( $ label ) ; $ surveyExport = $ export -> addPage ( $ this -> _ ( 'Single survey answers' ) , 'pr.export' , 'export-survey' , 'index' ) ; $ surveyExport -> addAutofilterAction ( ) ; $ surveyExport -> addExportAction ( ) ; $ batchExport = $ export -> addPage ( $ this -> _ ( 'Multiple surveys answers' ) , 'pr.export' , 'export-multi-surveys' , 'index' ) ; $ batchExport -> addAutofilterAction ( ) ; $ export -> addPage ( $ this -> _ ( 'Respondent archives' ) , 'pr.export-html' , 'respondent-export' , 'index' ) ; return $ export ; }
Shortcut function to create the export container .
58,334
public function addImportContainer ( $ label ) { $ import = $ this -> addContainer ( $ label ) ; $ page = $ import -> addPage ( $ this -> _ ( 'Answers' ) , 'pr.survey-maintenance.answer-import' , 'file-import' , 'answers-import' ) ; $ uplPage = $ import -> addFilePage ( $ this -> _ ( 'Importable' ) , 'pr.file-import' , 'file-import' ) ; $ uplPage -> addImportAction ( 'pr.file-import.import' , array ( 'label' => $ this -> _ ( 'Import file' ) ) ) -> setModelParameters ( 1 ) ; $ impPage = $ import -> addFilePage ( $ this -> _ ( 'Imported files' ) , 'pr.file-import' , 'imported-files' ) ; $ impPage -> addImportAction ( 'pr.file-import.import' , array ( 'label' => $ this -> _ ( 'Reimport file' ) ) ) -> setModelParameters ( 1 ) ; $ errPage = $ import -> addFilePage ( $ this -> _ ( 'Imported failures' ) , 'pr.file-import' , 'imported-failures' ) ; $ errPage -> addImportAction ( 'pr.file-import.import' , array ( 'label' => $ this -> _ ( 'Retry import' ) ) ) -> setModelParameters ( 1 ) ; return $ import ; }
Shortcut function to create the import container .
58,335
public function addLogControllers ( ) { $ this -> addBrowsePage ( $ this -> _ ( 'Log Setup' ) , 'pr.log.maintenance' , 'log-maintenance' ) ; $ page = $ this -> addPage ( $ this -> _ ( 'Log' ) , 'pr.log' , 'log' , 'index' ) ; $ page -> addAutofilterAction ( ) ; $ page -> addExportAction ( ) ; $ page -> addShowAction ( ) -> setNamedParameters ( \ Gems_Model :: LOG_ITEM_ID , 'gla_id' ) ; $ this -> addFilePage ( $ this -> _ ( 'Log files' ) , 'pr.log.files' , 'log-file' ) ; }
Add the log menu items
58,336
public function addPage ( $ label , $ privilege , $ controller , $ action = 'index' , array $ other = array ( ) ) { $ other [ 'label' ] = $ label ; $ other [ 'controller' ] = $ controller ; $ other [ 'action' ] = $ action ; if ( $ privilege ) { $ other [ 'privilege' ] = $ privilege ; } return $ this -> add ( $ other ) ; }
Add a page to the menu
58,337
public function addPlanPage ( $ label ) { $ infoPage = $ this -> addContainer ( $ label ) ; $ page = $ infoPage -> addPage ( $ this -> _ ( 'Track Summary' ) , 'pr.plan.summary' , 'summary' , 'index' ) ; $ page -> addAutofilterAction ( ) ; $ page -> addExportAction ( ) ; $ page = $ infoPage -> addPage ( $ this -> _ ( 'Track Compliance' ) , 'pr.plan.compliance' , 'compliance' , 'index' ) ; $ page -> addAutofilterAction ( ) ; $ page -> addExportAction ( ) ; $ page = $ infoPage -> addPage ( $ this -> _ ( 'Track Field Utilization' ) , 'pr.plan.fields' , 'field-report' , 'index' ) ; $ page -> addAutofilterAction ( ) ; $ page -> addExportAction ( ) ; $ page = $ infoPage -> addPage ( $ this -> _ ( 'Track Field Content' ) , 'pr.plan.fields' , 'field-overview' , 'index' ) ; $ page -> addAutofilterAction ( ) ; $ page -> addExportAction ( ) ; $ plans [ ] = $ infoPage -> addPage ( $ this -> _ ( 'By period' ) , 'pr.plan.overview' , 'overview-plan' , 'index' ) ; $ plans [ ] = $ infoPage -> addPage ( $ this -> _ ( 'By token' ) , 'pr.plan.token' , 'token-plan' , 'index' ) ; $ plans [ ] = $ infoPage -> addPage ( $ this -> _ ( 'By respondent' ) , 'pr.plan.respondent' , 'respondent-plan' , 'index' ) ; foreach ( $ plans as $ plan ) { $ plan -> addAutofilterAction ( ) ; $ plan -> addAction ( $ this -> _ ( 'Bulk mail' ) , 'pr.token.bulkmail' , 'email' , array ( 'routeReset' => false ) ) ; $ plan -> addExportAction ( ) ; } $ page = $ infoPage -> addPage ( $ this -> _ ( 'Respondent status' ) , 'pr.plan.consent' , 'consent-plan' , 'index' ) ; $ page -> addShowAction ( ) ; $ page -> addExportAction ( ) ; return $ infoPage ; }
Add a list of report pages
58,338
public function addStaffPage ( $ label , array $ other = array ( ) ) { if ( $ this -> user -> hasPrivilege ( 'pr.staff.edit.all' ) ) { $ filter = array_keys ( $ this -> escort -> getUtil ( ) -> getDbLookup ( ) -> getOrganizations ( ) ) ; } else { $ filter = array_keys ( $ this -> user -> getAllowedOrganizations ( ) ) ; } $ page = $ this -> addPage ( $ label , 'pr.staff' , 'staff' , 'index' , $ other ) ; $ page -> addAutofilterAction ( ) ; $ createPage = $ page -> addCreateAction ( ) ; $ showPage = $ page -> addShowAction ( ) ; $ pages [ ] = $ showPage -> addEditAction ( ) ; $ pages [ ] = $ showPage -> addAction ( $ this -> _ ( 'Reset password' ) , 'pr.staff.edit' , 'reset' ) -> setModelParameters ( 1 ) -> addParameterFilter ( 'gsf_active' , 1 ) ; $ pages [ ] = $ showPage -> addAction ( $ this -> _ ( 'Reset 2FA' ) , 'pr.staff.edit' , 'reset2fa' ) -> setModelParameters ( 1 ) -> addParameterFilter ( 'gsf_active' , 1 , 'has_2factor' , 2 ) ; $ showPage -> addAction ( $ this -> _ ( 'Send Mail' ) , 'pr.staff.edit' , 'mail' ) -> setModelParameters ( 1 ) -> addParameterFilter ( 'can_mail' , 1 , 'gsf_active' , 1 , 'gsf_id_organization' , $ filter ) ; $ pages = $ pages + $ showPage -> addDeReactivateAction ( 'gsf_active' , 1 , 0 ) ; $ logPage = $ showPage -> addPage ( $ this -> _ ( 'Activity overview' ) , 'pr.staff-log' , 'staff-log' , 'index' ) -> setModelParameters ( 1 ) -> addParameterFilter ( 'gsf_id_organization' , $ filter ) ; $ logPage -> addAutofilterAction ( ) ; $ logPage -> addShowAction ( ) -> setModelParameters ( 1 ) -> addNamedParameters ( 'log' , 'gla_id' ) ; $ page -> addExportAction ( ) ; $ page -> addImportAction ( ) ; if ( ! $ this -> user -> hasPrivilege ( 'pr.staff.edit.all' ) ) { foreach ( $ pages as $ subPage ) { $ subPage -> addParameterFilter ( 'gsf_id_organization' , $ filter , 'accessible_role' , 1 ) ; } } return $ page ; }
Add a staff browse edit page to the menu
58,339
public function formatTime ( $ dateTimeValue ) { if ( $ dateTimeValue instanceof \ Zend_Date ) { $ dateTimeValue = $ dateTimeValue -> getTimestamp ( ) ; } $ seconds = str_pad ( $ dateTimeValue % 60 , 2 , '0' , STR_PAD_LEFT ) ; $ rest = intval ( $ dateTimeValue / 60 ) ; $ minutes = str_pad ( $ rest % 60 , 2 , '0' , STR_PAD_LEFT ) ; $ hours = intval ( $ rest / 60 ) ; $ days = intval ( $ hours / 24 ) ; if ( $ hours > 48 ) { $ hours = $ hours % 24 ; return sprintf ( $ this -> _ ( '%d days %d:%s:%s' ) , $ days , $ hours , $ minutes , $ seconds ) ; } elseif ( $ hours ) { return sprintf ( $ this -> _ ( '%d:%s:%s' ) , $ hours , $ minutes , $ seconds ) ; } else { return sprintf ( $ this -> _ ( '%d:%s' ) , $ minutes , $ seconds ) ; } }
Returns the time in seconds as a display string
58,340
public function formatTimeUnknown ( $ dateTimeValue ) { if ( null === $ dateTimeValue ) { return \ MUtil_Html :: create ( ) -> span ( $ this -> _ ( 'unknown' ) , array ( 'class' => 'disabled' ) ) ; } else { return $ this -> formatTime ( $ dateTimeValue ) ; } }
Returns the time in seconds as a display string or unknown when null
58,341
public function getGenderHello ( $ locale = null ) { return array ( 'M' => $ this -> _ ( 'Mr.' , $ locale ) , 'F' => $ this -> _ ( 'Mrs.' , $ locale ) , 'U' => $ this -> _ ( 'Mr./Mrs.' , $ locale ) ) ; }
Returns the gender for use in stand - alone name display
58,342
public function getPeriodUnits ( ) { return array ( 'S' => $ this -> translate -> _ ( 'Seconds' ) , 'N' => $ this -> translate -> _ ( 'Minutes' ) , 'H' => $ this -> translate -> _ ( 'Hours' ) , 'D' => $ this -> translate -> _ ( 'Days' ) , 'W' => $ this -> translate -> _ ( 'Weeks' ) , 'M' => $ this -> translate -> _ ( 'Months' ) , 'Q' => $ this -> translate -> _ ( 'Quarters' ) , 'Y' => $ this -> translate -> _ ( 'Years' ) ) ; }
Get an array of translated labels for the date period units
58,343
public function markEmpty ( $ value ) { if ( empty ( $ value ) ) { $ em = \ MUtil_Html :: create ( 'em' ) ; $ em -> raw ( $ this -> _ ( '&laquo;empty&raquo;' ) ) ; return $ em ; } return $ value ; }
Mark empty data as empty
58,344
public function parse ( $ source = false , $ parse_collections = false , $ _internal_loop = false ) { self :: $ _instance += 1 ; if ( $ source === false ) { $ source = ob_get_clean ( ) ; $ this -> _buffer_in_use = true ; $ parse_collections = true ; } $ tags = $ this -> collectTags ( $ source ) ; if ( count ( $ tags ) > 0 ) { $ output = $ this -> _parseTags ( $ tags ) ; if ( $ output && $ parse_collections === true ) { $ output = $ this -> _processCollectedTags ( $ output ) ; } if ( $ this -> _options [ 'echo_output' ] === true ) { echo $ output ; } return $ output ; } return $ source ; }
Parses the source for any custom tags .
58,345
public static function throwError ( $ tag , $ message ) { if ( self :: $ error_mode === self :: ERROR_EXCEPTION && ! $ this -> _buffer_in_use ) { throw new CustomTagsException ( '<strong>' . $ tag . '</strong> ' . $ message . '.' ) ; } else if ( self :: $ error_mode !== self :: ERROR_SILENT ) { return '<strong>[' . self :: $ name . ' Error]</strong>: ' . ucfirst ( $ tag ) . ' Tag - ' . $ message . '<br />' ; } return '' ; }
Produces an error .
58,346
private function _parseTags ( $ tags ) { if ( count ( $ tags ) > 0 ) { foreach ( $ tags as $ key => $ tag ) { if ( isset ( $ tag [ 'attributes' ] ) === true && isset ( $ tag [ 'attributes' ] -> delayed ) === true && $ tag [ 'attributes' ] -> delayed === 'true' ) { continue ; } if ( ( $ has_buried = preg_match_all ( '!------@@%([0-9\-]+)%@@------!' , $ tag [ 'content' ] , $ info ) ) > 0 ) { $ containers = $ info [ 0 ] ; $ indexs = $ info [ 1 ] ; $ replacements = array ( ) ; foreach ( $ indexs as $ key2 => $ index ) { $ index_parts = explode ( '-' , $ index ) ; $ tag_index = array_pop ( $ index_parts ) ; if ( isset ( $ tags [ $ tag_index ] [ 'parsed' ] ) === true ) { $ replacements [ $ key2 ] = $ tags [ $ tag_index ] [ 'parsed' ] ; } else { if ( isset ( $ tags [ $ tag_index ] [ 'block' ] ) === true ) { $ block = preg_replace ( '/ delayed="true"/' , '' , $ tags [ $ tag_index ] [ 'block' ] , 1 ) ; if ( isset ( $ tag [ 'block' ] ) === true ) { $ tag [ 'block' ] = str_replace ( $ containers [ $ key2 ] , $ block , $ tag [ 'block' ] ) ; } $ tag [ 'content' ] = str_replace ( $ containers [ $ key2 ] , $ block , $ tag [ 'content' ] ) ; } } } $ tags [ $ key ] [ 'buried_source_markers' ] = $ tag [ 'buried_source_markers' ] = $ containers ; } if ( $ tag [ 'name' ] === 'nocache' ) { array_push ( self :: $ nocache_tags , $ tag ) ; $ tags [ $ key ] [ 'parsed' ] = $ tag [ 'source_marker' ] ; } else if ( $ tag [ 'name' ] === ' text' ) { $ tags [ $ key ] [ 'parsed' ] = $ tag [ 'content' ] ; } else { $ tags [ $ key ] [ 'parsed' ] = $ this -> _parseTag ( $ tag ) ; } $ tags [ $ key ] [ 'parsed' ] = $ has_buried > 0 ? str_replace ( $ containers , $ replacements , $ tags [ $ key ] [ 'parsed' ] ) : $ tags [ $ key ] [ 'parsed' ] ; } return $ tags [ $ key ] [ 'parsed' ] ; } return false ; }
Loops and parses the found custom tags .
58,347
function _processCollectedTags ( $ source ) { $ to_replace = array ( ) ; $ ordered = array ( ) ; foreach ( self :: $ tag_collections as $ tag_name => $ tags ) { if ( isset ( self :: $ _tag_order [ $ tag_name ] ) === true ) { $ pos = self :: $ _tag_order [ $ tag_name ] ; $ ordered [ $ pos ] = $ tags ; continue ; } $ tag_func_name = ucwords ( str_replace ( array ( '_' , '-' ) , ' ' , $ tag_name ) ) ; $ tag_func_name = strtolower ( substr ( $ tag_func_name , 0 , 1 ) ) . substr ( $ tag_func_name , 1 ) ; $ tag_func_name = str_replace ( ' ' , '' , $ this -> _options [ 'tag_callback_prefix' ] . $ tag_func_name ) ; if ( $ this -> _options [ 'tag_global_callback' ] !== false ) { $ tags = call_user_func ( $ this -> _options [ 'tag_global_callback' ] , 'collection' , $ tag_func_name , $ tags , $ source ) ; } else { $ tags = call_user_func ( $ tag_func_name , $ tags , $ source ) ; } if ( $ tags === - 1 ) { $ source = self :: throwError ( $ tag_name , 'tag collection parsed however callback "' . $ tag_func_name . '" returned -1.' ) ; } else if ( is_array ( $ tags ) === false ) { $ source = self :: throwError ( $ tag_name , 'tag collection parsed however callback "' . $ tag_func_name . '" did not return the array of process tags.' ) ; } else if ( count ( $ tags ) > 0 ) { foreach ( $ tags as $ key => $ tag ) { if ( strpos ( $ source , $ tag [ 'tag' ] ) !== false ) { $ source = str_replace ( $ tag [ 'tag' ] , $ tag [ 'parsed' ] , $ source ) ; } else { array_push ( $ to_replace , $ tag ) ; } } } } foreach ( $ ordered as $ key => $ tags ) { $ tag_func_name = ucwords ( str_replace ( array ( '_' , '-' ) , ' ' , $ tag_name ) ) ; $ tag_func_name = strtolower ( substr ( $ tag_func_name , 0 , 1 ) ) . substr ( $ tag_func_name , 1 ) ; $ tag_func_name = str_replace ( ' ' , '' , $ this -> _options [ 'tag_callback_prefix' ] . $ tag_func_name ) ; $ tags = call_user_func ( $ tag_func_name , $ tags ) ; if ( $ tags === - 1 ) { $ source = self :: throwError ( $ tag [ 'name' ] , 'tag collection parsed however callback "' . $ tag_func_name . '" returned -1.' ) ; } } return $ this -> _doBuriedReplacements ( $ to_replace , $ source ) ; }
Process collected blocks . These are different types of block that are required to be processed as a group . Usual reasons for doing this are to reduce resources and sql queries .
58,348
public function collectTags ( $ source , $ tag_name = false ) { $ tagname = $ tag_name === false ? $ this -> _options [ 'tag_name' ] : $ tag_name ; $ tags = $ tag_names = array ( ) ; $ tag_count = 0 ; $ inner_tag_open_pos = $ source_len = strlen ( $ source ) ; $ opener = self :: $ tag_open . $ tagname . ':' ; $ opener_len = strlen ( $ opener ) ; $ closer = self :: $ tag_open . '/' . $ tagname . ':' ; $ closer_len = strlen ( $ closer ) ; $ closer_end = self :: $ tag_close ; while ( $ inner_tag_open_pos !== false ) { $ open_tag_look_source = substr ( $ source , 0 , $ inner_tag_open_pos ) ; $ open_tag_look_len = strlen ( $ open_tag_look_source ) ; $ inner_tag_open_pos = strrpos ( $ open_tag_look_source , $ opener ) ; if ( $ inner_tag_open_pos === false ) { array_push ( $ tags , array ( 'content' => $ source , 'name' => ' text' ) ) ; break ; } else { $ tag_look_source = substr ( $ source , $ inner_tag_open_pos ) ; $ open_bracket_pos = strpos ( $ tag_look_source , self :: $ tag_open , 1 ) ; $ short_tag_close_pos = strpos ( $ tag_look_source , '/' . self :: $ tag_close ) ; if ( $ short_tag_close_pos !== false && $ short_tag_close_pos < $ open_bracket_pos ) { $ inner_tag_close_pos = $ short_tag_close_pos + 2 ; } else { $ inner_tag_close_pos_begin = strpos ( $ tag_look_source , $ closer ) ; $ inner_tag_close_pos = strpos ( $ tag_look_source , $ closer_end , $ inner_tag_close_pos_begin ) + 1 ; } $ tag_source = substr ( $ tag_look_source , 0 , $ inner_tag_close_pos ) ; $ tag = $ this -> _buildTag ( $ tag_source , $ tagname ) ; $ index = count ( $ tags ) ; $ tag [ 'source_marker' ] = '------@@%' . self :: $ _instance . '-' . $ index . '%@@------' ; array_push ( $ tags , $ tag ) ; $ source = substr ( $ source , 0 , $ inner_tag_open_pos ) . $ tag [ 'source_marker' ] . substr ( $ source , $ inner_tag_open_pos + $ inner_tag_close_pos ) ; } } return $ tags ; }
Searches and parses a source for custom tags .
58,349
public static function getTemplate ( $ tag , $ produce_error = true ) { $ template_name = isset ( $ tag [ 'attributes' ] [ 'template' ] ) === true ? $ tag [ 'attributes' ] [ 'template' ] : 'default' ; if ( is_array ( CustomTags :: $ tag_directory_base ) === false ) { CustomTags :: $ tag_directory_base = array ( CustomTags :: $ tag_directory_base ) ; } foreach ( CustomTags :: $ tag_directory_base as $ directory ) { $ template = rtrim ( $ directory , DIRECTORY_SEPARATOR ) . $ tag [ 'name' ] . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $ template_name . '.html' ; if ( is_file ( $ template ) === true ) { return file_get_contents ( $ template ) ; } } if ( $ produce_error === true ) { CustomTags :: throwError ( $ tag [ 'name' ] , 'tag template resource not found.' ) ; } return false ; }
Returns the content of a template .
58,350
public static function parseTemplate ( $ tag , $ replacements ) { $ template = self :: getTemplate ( $ tag ) ; $ search = $ replace = array ( ) ; foreach ( $ replacements as $ varname => $ varvalue ) { array_push ( $ search , '%' . strtolower ( $ varname ) . '%' ) ; array_push ( $ replace , $ varvalue ) ; } return str_replace ( $ search , $ replace , $ template ) ; }
A simple templater replaces %VARNAME% with the value .
58,351
public function execute ( $ respondentId = null , $ organizationId = null ) { $ sql = "SELECT gcj_id_job FROM gems__comm_jobs WHERE gcj_active = 1" ; if ( $ organizationId ) { $ sql .= $ this -> db -> quoteInto ( " AND (gcj_id_organization IS NULL OR gcj_id_organization = ?)" , $ organizationId ) ; } $ sql .= " ORDER BY gcj_id_order, CASE WHEN gcj_id_survey IS NULL THEN 1 ELSE 0 END, CASE WHEN gcj_round_description IS NULL THEN 1 ELSE 0 END, CASE WHEN gcj_id_track IS NULL THEN 1 ELSE 0 END, CASE WHEN gcj_id_organization IS NULL THEN 1 ELSE 0 END" ; $ jobs = $ this -> db -> fetchAll ( $ sql ) ; $ batch = $ this -> getBatch ( ) ; if ( $ jobs ) { foreach ( $ jobs as $ job ) { $ batch -> addTask ( 'Mail\\ExecuteMailJobTask' , $ job [ 'gcj_id_job' ] , $ respondentId , $ organizationId ) ; } } else { $ this -> getBatch ( ) -> addMessage ( $ this -> _ ( 'Nothing to do, please create a mail job first.' ) ) ; } if ( $ batch -> getId ( ) == 'cron' ) { $ batch -> addTask ( 'Mail\\CronMailMonitorTask' ) ; } }
Adds all jobs to the queue
58,352
protected function getCommands ( $ filename , $ type ) { $ commands = $ this -> config -> get ( 'availableCommands' ) ; if ( ! $ type || ! isset ( $ commands [ $ type ] ) ) { return array ( ) ; } $ command = array ( ) ; foreach ( ( array ) $ this -> config -> get ( 'enabledCommands' ) as $ commandType ) { if ( isset ( $ commands [ $ type ] [ $ commandType ] ) ) { $ command [ ] = sprintf ( $ commands [ $ type ] [ $ commandType ] , rtrim ( $ this -> config -> get ( 'binDirectory' ) , '/' ) , escapeshellarg ( $ filename ) , $ this -> config -> get ( 'optimisingQuality' ) ) ; } } return $ command ; }
Gets all enabled commands for the file and type of image
58,353
protected function logRespondentCommunication ( ) { $ currentUserId = $ this -> loader -> getCurrentUser ( ) -> getUserId ( ) ; $ changeDate = new \ MUtil_Db_Expr_CurrentTimestamp ( ) ; $ logData [ 'grco_id_to' ] = $ this -> respondent -> getId ( ) ; if ( ! is_int ( $ this -> by ) ) { $ this -> by = $ currentUserId ; } $ logData [ 'grco_id_by' ] = $ this -> by ; $ logData [ 'grco_organization' ] = $ this -> organizationId ; $ logData [ 'grco_id_token' ] = $ this -> token -> getTokenId ( ) ; $ logData [ 'grco_method' ] = 'email' ; $ logData [ 'grco_topic' ] = substr ( $ this -> applyFields ( $ this -> subject ) , 0 , 120 ) ; $ to = array ( ) ; foreach ( $ this -> to as $ name => $ address ) { $ to [ ] = $ name . '<' . $ address . '>' ; } $ logData [ 'grco_address' ] = substr ( join ( ',' , $ to ) , 0 , 120 ) ; $ logData [ 'grco_sender' ] = substr ( $ this -> from , 0 , 120 ) ; $ logData [ 'grco_id_message' ] = $ this -> templateId ? $ this -> templateId : null ; $ logData [ 'grco_changed' ] = $ changeDate ; $ logData [ 'grco_changed_by' ] = $ this -> by ; $ logData [ 'grco_created' ] = $ changeDate ; $ logData [ 'grco_created_by' ] = $ this -> by ; $ this -> db -> insert ( 'gems__log_respondent_communications' , $ logData ) ; }
Log the communication for the respondent .
58,354
public function updateToken ( $ tokenId = false ) { if ( ! $ tokenId ) { $ tokenId = $ this -> token -> getTokenId ( ) ; } $ tokenData [ 'gto_mail_sent_num' ] = new \ Zend_Db_Expr ( 'gto_mail_sent_num + 1' ) ; $ tokenData [ 'gto_mail_sent_date' ] = \ MUtil_Date :: format ( new \ Zend_Date ( ) , 'yyyy-MM-dd' ) ; $ this -> db -> update ( 'gems__tokens' , $ tokenData , $ this -> db -> quoteInto ( 'gto_id_token = ?' , $ tokenId ) ) ; }
Update the token data when a Mail has been sent .
58,355
public function barcodeAction ( ) { $ code = $ this -> getRequest ( ) -> getParam ( 'code' , 'empty' ) ; \ Zend_Layout :: getMvcInstance ( ) -> disableLayout ( ) ; $ this -> _helper -> viewRenderer -> setNoRender ( ) ; $ barcodeOptions = array ( 'text' => $ code ) ; $ rendererOptions = array ( ) ; $ barcode = \ Zend_Barcode :: render ( 'code128' , 'image' , $ barcodeOptions , $ rendererOptions ) ; $ barcode -> render ( ) ; }
This can be used to generate barcodes use the action
58,356
public function formlistAction ( ) { $ helper = new \ Zend_View_Helper_ServerUrl ( ) ; $ baseUrl = $ helper -> serverUrl ( ) . \ Zend_Controller_Front :: getInstance ( ) -> getBaseUrl ( ) . '/openrosa/download/form/' ; $ model = $ this -> getModel ( ) ; $ rawForms = $ model -> load ( array ( 'gof_form_active' => 1 ) ) ; foreach ( $ rawForms as $ form ) { $ forms [ ] = array ( 'formID' => $ form [ 'gof_form_id' ] , 'name' => $ form [ 'gof_form_title' ] , 'version' => $ form [ 'gof_form_version' ] , 'hash' => md5 ( $ form [ 'gof_form_id' ] . $ form [ 'gof_form_version' ] ) , 'downloadUrl' => $ baseUrl . $ form [ 'gof_form_xml' ] ) ; } $ this -> makeRosaResponse ( ) ; $ xml = $ this -> getXml ( 'xforms xmlns="http://openrosa.org/xforms/xformsList"' ) ; foreach ( $ forms as $ form ) { $ xform = $ xml -> addChild ( 'xform' ) ; foreach ( $ form as $ key => $ value ) { $ xform -> addChild ( $ key , $ value ) ; } } echo $ xml -> asXML ( ) ; }
Accessible via formList as defined in the menu and standard for openRosa clients
58,357
private function processReceivedForm ( $ answerXmlFile ) { $ log = \ Gems_Log :: getLogger ( ) ; $ xml = simplexml_load_file ( $ answerXmlFile ) ; $ formId = $ xml -> attributes ( ) -> id ; $ formVersion = $ xml -> attributes ( ) -> version ; $ model = $ this -> getModel ( ) ; $ filter = array ( 'gof_form_id' => $ formId , 'gof_form_version' => $ formVersion , ) ; if ( $ formData = $ model -> loadFirst ( $ filter ) ) { $ this -> openrosaFormID = $ formData [ 'gof_id' ] ; try { $ form = new OpenRosa_Tracker_Source_OpenRosa_Form ( $ this -> formDir . $ formData [ 'gof_form_xml' ] ) ; $ answers = $ form -> saveAnswer ( $ answerXmlFile ) ; return $ answers [ 'orf_id' ] ; } catch ( \ Exception $ exc ) { return false ; } } else { return false ; } }
Handles receiving and storing the data from a form files are stored on actual upload process this only handles storing form data and can be used for resubmission too .
58,358
public function preDispatch ( ) { parent :: preDispatch ( ) ; $ action = strtolower ( $ this -> getRequest ( ) -> getActionName ( ) ) ; if ( in_array ( $ action , $ this -> authActions ) ) { $ auth = \ Zend_Auth :: getInstance ( ) ; $ this -> auth = $ auth ; if ( ! $ auth -> hasIdentity ( ) ) { $ config = array ( 'accept_schemes' => 'basic' , 'realm' => GEMS_PROJECT_NAME , 'nonce_timeout' => 3600 , ) ; $ adapter = new \ Zend_Auth_Adapter_Http ( $ config ) ; $ basicResolver = new \ Zend_Auth_Adapter_Http_Resolver_File ( ) ; $ basicResolver -> setFile ( GEMS_ROOT_DIR . '/var/settings/pwd.txt' ) ; $ adapter -> setBasicResolver ( $ basicResolver ) ; $ request = $ this -> getRequest ( ) ; $ response = $ this -> getResponse ( ) ; assert ( $ request instanceof \ Zend_Controller_Request_Http ) ; assert ( $ response instanceof \ Zend_Controller_Response_Http ) ; $ adapter -> setRequest ( $ request ) ; $ adapter -> setResponse ( $ response ) ; $ result = $ auth -> authenticate ( $ adapter ) ; if ( ! $ result -> isValid ( ) ) { $ adapter -> getResponse ( ) -> sendResponse ( ) ; print 'Unauthorized' ; exit ; } } } }
Implements HTTP Basic auth
58,359
public function submissionAction ( ) { $ this -> makeRosaResponse ( ) ; if ( $ this -> getRequest ( ) -> isHead ( ) ) { $ this -> getResponse ( ) -> setHttpResponseCode ( 204 ) ; } elseif ( $ this -> getRequest ( ) -> isPost ( ) ) { $ upload = new \ Zend_File_Transfer_Adapter_Http ( ) ; $ files = $ upload -> getFileInfo ( ) ; foreach ( $ files as $ file => $ info ) { if ( ! $ upload -> isUploaded ( $ file ) ) { print "Why haven't you uploaded the file ?" ; continue ; } if ( ! $ upload -> isValid ( $ file ) ) { print "Sorry but $file is not what we wanted" ; continue ; } } $ upload -> setDestination ( $ this -> responseDir ) ; if ( $ upload -> receive ( 'xml_submission_file' ) ) { $ xmlFile = $ upload -> getFileInfo ( 'xml_submission_file' ) ; $ answerXmlFile = $ xmlFile [ 'xml_submission_file' ] [ 'tmp_name' ] ; $ resultId = $ this -> processReceivedForm ( $ answerXmlFile ) ; if ( $ resultId === false ) { foreach ( $ xml -> children ( ) as $ child ) { $ log -> log ( $ child -> getName ( ) . ' -> ' . $ child , \ Zend_Log :: ERR ) ; } } else { \ MUtil_File :: ensureDir ( $ this -> responseDir . 'forms/' . ( int ) $ this -> openrosaFormID . '/' ) ; $ upload -> setDestination ( $ this -> responseDir . 'forms/' . ( int ) $ this -> openrosaFormID . '/' ) ; foreach ( $ upload -> getFileInfo ( ) as $ file => $ info ) { if ( $ info [ 'received' ] != 1 ) { $ upload -> addFilter ( 'Rename' , $ resultId . '_' . $ info [ 'name' ] , $ file ) ; } } if ( ! $ upload -> receive ( ) ) { $ messages = $ upload -> getMessages ( ) ; echo implode ( "\n" , $ messages ) ; } $ this -> getResponse ( ) -> setHttpResponseCode ( 201 ) ; } } } }
Accepts the form
58,360
public function getAppointmentFieldValue ( \ Gems_Agenda_Appointment $ appointment , $ field ) { switch ( $ field ) { case 'gap_id_organization' : return $ appointment -> getOrganizationId ( ) ; case 'gap_source' : return $ appointment -> getSource ( ) ; case 'gap_id_attended_by' : return $ appointment -> getAttendedById ( ) ; case 'gap_id_referred_by' : return $ appointment -> getReferredById ( ) ; case 'gap_id_activity' : return $ appointment -> getActivityId ( ) ; case 'gap_id_procedure' : return $ appointment -> getProcedureId ( ) ; case 'gap_id_location' : return $ appointment -> getLocationId ( ) ; case 'gap_subject' : return $ appointment -> getSubject ( ) ; } }
Get the field value from an appointment object
58,361
protected function processForm ( ) { $ this -> util -> getMonitor ( ) -> checkMonitors ( ) ; $ this -> loadForm ( ) ; $ orgId = null ; if ( $ this -> request -> isPost ( ) ) { $ orgId = $ this -> loginForm -> getActiveOrganizationId ( ) ; if ( $ orgId && ( $ this -> currentUser -> getCurrentOrganizationId ( ) != $ orgId ) ) { $ this -> currentUser -> setCurrentOrganization ( $ orgId ) ; } } if ( $ this -> loginForm -> wasSubmitted ( ) ) { $ user = $ this -> loginForm -> getUser ( ) ; if ( $ this -> loginForm -> isValid ( $ this -> request -> getPost ( ) , false ) ) { $ user -> switchLocale ( ) ; $ this -> loginStatusTracker -> setPasswordText ( $ this -> loginForm -> getPasswordText ( ) ) -> setUser ( $ user ) ; return false ; } $ errors = \ MUtil_Ra :: flatten ( $ this -> loginForm -> getMessages ( ) ) ; $ logErrors = join ( ' - ' , $ errors ) ; $ msg = sprintf ( 'Failed login for : %s (%s) - %s' , $ user -> getLoginName ( ) , $ user -> getCurrentOrganizationId ( ) , $ logErrors ) ; $ this -> accesslog -> logChange ( $ this -> request , $ msg ) ; } return true ; }
Step by step form processing
58,362
public function toPHP ( ) { $ value1 = '$fields->dataFieldByName(\'' . $ this -> master . '\')->dataValue()' ; $ value2 = $ this -> value ; if ( $ operator = $ this -> phpOperator ( ) ) { return $ value1 . " {$operator} \"$value2\"" ; } switch ( $ this -> operator ) { case 'contains' : return 'strpos(' . $ value1 . '' . ", \"$value2\") !== false" ; case 'Checked' : return "$value1 == \"1\"" ; case 'Empty' : return $ value1 . '==""' ; case 'hasCheckedOption' : return 'strpos(' . $ value1 . '' . ", \"$value2\") !== false" ; case 'hasCheckedAtLeast' : return 'substr_count(' . $ value1 . ',",") >= ' . $ value2 ; case 'hasCheckedLessThan' : return 'substr_count(' . $ value1 . ',",") <= ' . $ value2 ; default : throw new Exception ( "ValidationLogicCriteria: php operator \"$this->operator\" not configured." ) ; } }
Returns a string of php code to be evaluated
58,363
protected function getEditMenuItems ( ) { $ resets = $ this -> findMenuItems ( $ this -> menuActionController , 'reset' ) ; foreach ( $ resets as $ resetPw ) { if ( $ resetPw instanceof \ Gems_Menu_SubMenuItem ) { $ resetPw -> set ( 'label' , $ this -> _ ( 'password' ) ) ; } } return array_merge ( parent :: getEditMenuItems ( ) , $ resets , $ this -> findMenuItems ( $ this -> menuActionController , 'mail' ) ) ; }
Returns an edit menu item if access is allowed by privileges
58,364
protected function loadParams ( ) { $ patientNr = $ this -> _getParam ( \ MUtil_Model :: REQUEST_ID1 ) ; $ this -> appointmentId = $ this -> _getParam ( \ Gems_Model :: APPOINTMENT_ID ) ; if ( $ this -> appointmentId ) { $ select = $ this -> db -> select ( ) ; $ select -> from ( 'gems__appointments' , array ( 'gap_id_user' , 'gap_id_organization' ) ) -> joinInner ( 'gems__respondent2org' , 'gap_id_user = gr2o_id_user AND gap_id_organization = gr2o_id_organization' , array ( 'gr2o_patient_nr' ) ) -> where ( 'gap_id_appointment = ?' , $ this -> appointmentId ) ; $ data = $ this -> db -> fetchRow ( $ select ) ; if ( $ data ) { $ this -> organizationId = $ data [ 'gap_id_organization' ] ; $ this -> respondentId = $ data [ 'gap_id_user' ] ; $ patientNr = $ data [ 'gr2o_patient_nr' ] ; } } else { $ this -> organizationId = $ this -> _getParam ( \ MUtil_Model :: REQUEST_ID2 ) ; if ( $ patientNr && $ this -> organizationId ) { $ this -> respondentId = $ this -> util -> getDbLookup ( ) -> getRespondentId ( $ patientNr , $ this -> organizationId ) ; } } if ( ! $ this -> respondentId ) { throw new \ Gems_Exception ( $ this -> _ ( 'Requested agenda data not available!' ) ) ; } else { $ orgs = $ this -> currentUser -> getAllowedOrganizations ( ) ; if ( ! isset ( $ orgs [ $ this -> organizationId ] ) ) { $ org = $ this -> loader -> getOrganization ( $ this -> organizationId ) ; if ( $ org -> exists ( ) ) { throw new \ Gems_Exception ( sprintf ( $ this -> _ ( 'You have no access to %s appointments!' ) , $ org -> getName ( ) ) ) ; } else { throw new \ Gems_Exception ( $ this -> _ ( 'Organization does not exist.' ) ) ; } } } $ source = $ this -> menu -> getParameterSource ( ) ; if ( $ this -> appointmentId ) { $ source -> setAppointmentId ( $ this -> appointmentId ) ; } if ( $ patientNr && $ this -> organizationId ) { $ source -> setPatient ( $ patientNr , $ this -> organizationId ) ; } }
Loads and checks the request parameters
58,365
protected function loadFilterDependencies ( $ activateDependencies = true ) { if ( ! $ this -> filterOptions ) { $ maxLength = $ this -> get ( 'gaf_calc_name' , 'maxlength' ) ; $ this -> filterOptions = array ( ) ; foreach ( $ this -> filterDependencies as $ dependencyClass ) { $ dependency = $ this -> agenda -> newFilterObject ( $ dependencyClass ) ; if ( $ dependency instanceof FilterModelDependencyAbstract ) { $ this -> filterOptions [ $ dependency -> getFilterClass ( ) ] = $ dependency -> getFilterName ( ) ; if ( $ activateDependencies ) { $ dependency -> setMaximumCalcLength ( $ maxLength ) ; $ this -> addDependency ( $ dependency ) ; } } } asort ( $ this -> filterOptions ) ; } return $ this -> filterOptions ; }
Load filter dependencies into model and populate the filterOptions
58,366
public function getFullName ( ) { $ genderGreetings = $ this -> util -> getTranslated ( ) -> getGenderHello ( $ this -> getLanguage ( ) ) ; $ greeting = isset ( $ genderGreetings [ $ this -> getGender ( ) ] ) ? $ genderGreetings [ $ this -> getGender ( ) ] : '' ; return $ greeting . ' ' . $ this -> getName ( ) ; }
Get the formal name of respondent
58,367
public function getLanguage ( ) { if ( ! isset ( $ this -> respondentLanguage ) ) { $ this -> respondentLanguage = $ this -> _gemsData [ 'grs_iso_lang' ] ; } return $ this -> respondentLanguage ; }
Get the respondents prefered language
58,368
public function getLastName ( ) { $ lastname = '' ; if ( ! empty ( $ this -> _gemsData [ 'grs_surname_prefix' ] ) ) { $ lastname .= $ this -> _gemsData [ 'grs_surname_prefix' ] . ' ' ; } $ lastname .= $ this -> _gemsData [ 'grs_last_name' ] ; return $ lastname ; }
Get Last name of respondent
58,369
public function getPhonenumber ( ) { for ( $ i = 1 ; $ i <= $ this -> maxPhoneNumber ; $ i ++ ) { if ( isset ( $ this -> _gemsData [ 'grs_phone_' . $ i ] ) && ! empty ( $ this -> _gemsData [ 'grs_phone_' . $ i ] ) ) { return $ this -> _gemsData [ 'grs_phone_' . $ i ] ; } } return null ; }
Get the first entered phonenumber of the respondent .
58,370
public function refresh ( ) { $ default = true ; $ filter = array ( ) ; if ( $ this -> patientId ) { $ filter [ 'gr2o_patient_nr' ] = $ this -> patientId ; $ default = false ; } elseif ( $ this -> respondentId ) { $ filter [ 'gr2o_id_user' ] = $ this -> respondentId ; $ default = false ; } if ( ! $ filter ) { $ filter [ ] = '1=0' ; } if ( $ this -> organizationId ) { $ filter [ 'gr2o_id_organization' ] = $ this -> organizationId ; } $ this -> _gemsData = $ this -> model -> loadFirst ( $ filter ) ; if ( $ this -> _gemsData ) { $ this -> exists = true ; $ this -> patientId = $ this -> _gemsData [ 'gr2o_patient_nr' ] ; $ this -> organizationId = $ this -> _gemsData [ 'gr2o_id_organization' ] ; $ this -> respondentId = $ this -> _gemsData [ 'gr2o_id_user' ] ; } else { $ this -> _gemsData = $ this -> model -> loadNew ( ) ; $ this -> exists = false ; } if ( $ this -> currentUser instanceof \ Gems_User_User ) { $ this -> _gemsData = $ this -> currentUser -> applyGroupMask ( $ this -> _gemsData ) ; } }
Refresh the data
58,371
public function setOptions ( array $ options = array ( ) ) { if ( isset ( $ options [ 'image_path' ] ) ) { $ this -> _options [ 'image_path' ] = $ options [ 'image_path' ] ; } if ( isset ( $ options [ 'plugins' ] ) ) { $ this -> _options [ 'plugins' ] = $ options [ 'plugins' ] ; } return $ this ; }
Sets options of the Debug Bar
58,372
public function unregisterPlugin ( $ plugin ) { if ( false !== strpos ( $ plugin , '_' ) ) { foreach ( $ this -> _plugins as $ key => $ _plugin ) { if ( $ plugin == get_class ( $ _plugin ) ) { unset ( $ this -> _plugins [ $ key ] ) ; } } } else { $ plugin = strtolower ( $ plugin ) ; if ( isset ( $ this -> _plugins [ $ plugin ] ) ) { unset ( $ this -> _plugins [ $ plugin ] ) ; } } return $ this ; }
Unregister a plugin in the Debug Bar
58,373
public function getPlugin ( $ identifier ) { $ identifier = strtolower ( $ identifier ) ; if ( isset ( $ this -> _plugins [ $ identifier ] ) ) { return $ this -> _plugins [ $ identifier ] ; } return false ; }
Get a registered plugin in the Debug Bar
58,374
protected function _loadPlugins ( ) { foreach ( $ this -> _options [ 'plugins' ] as $ plugin => $ options ) { if ( is_numeric ( $ plugin ) ) { $ plugin = $ options ; $ options = array ( ) ; } if ( is_object ( $ plugin ) && in_array ( 'ZFDebug_Controller_Plugin_Debug_Plugin_Interface' , class_implements ( $ plugin ) ) ) { $ this -> registerPlugin ( $ plugin ) ; continue ; } if ( ! is_string ( $ plugin ) ) { throw new Exception ( "Invalid plugin name" , 1 ) ; } $ plugin = ucfirst ( $ plugin ) ; if ( in_array ( $ plugin , ZFDebug_Controller_Plugin_Debug :: $ standardPlugins ) ) { $ pluginClass = 'ZFDebug_Controller_Plugin_Debug_Plugin_' . $ plugin ; } else { if ( ! preg_match ( '~^[\w]+$~D' , $ plugin ) ) { throw new Zend_Exception ( "ZFDebug: Invalid plugin name [$plugin]" ) ; } $ pluginClass = $ plugin ; } require_once str_replace ( '_' , DIRECTORY_SEPARATOR , $ pluginClass ) . '.php' ; $ object = new $ pluginClass ( $ options ) ; $ this -> registerPlugin ( $ object ) ; } }
Load plugins set in config option
58,375
protected function _icon ( $ kind ) { switch ( $ kind ) { case 'database' : if ( null === $ this -> _options [ 'image_path' ] ) return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAEYSURBVBgZBcHPio5hGAfg6/2+R980k6wmJgsJ5U/ZOAqbSc2GnXOwUg7BESgLUeIQ1GSjLFnMwsKGGg1qxJRmPM97/1zXFAAAAEADdlfZzr26miup2svnelq7d2aYgt3rebl585wN6+K3I1/9fJe7O/uIePP2SypJkiRJ0vMhr55FLCA3zgIAOK9uQ4MS361ZOSX+OrTvkgINSjS/HIvhjxNNFGgQsbSmabohKDNoUGLohsls6BaiQIMSs2FYmnXdUsygQYmumy3Nhi6igwalDEOJEjPKP7CA2aFNK8Bkyy3fdNCg7r9/fW3jgpVJbDmy5+PB2IYp4MXFelQ7izPrhkPHB+P5/PjhD5gCgCenx+VR/dODEwD+A3T7nqbxwf1HAAAAAElFTkSuQmCC' ; return $ this -> _options [ 'image_path' ] . '/database.png' ; break ; case 'exception' : if ( null === $ this -> _options [ 'image_path' ] ) return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJPSURBVDjLpZPLS5RhFMYfv9QJlelTQZwRb2OKlKuINuHGLlBEBEOLxAu46oL0F0QQFdWizUCrWnjBaDHgThCMoiKkhUONTqmjmDp2GZ0UnWbmfc/ztrC+GbM2dXbv4ZzfeQ7vefKMMfifyP89IbevNNCYdkN2kawkCZKfSPZTOGTf6Y/m1uflKlC3LvsNTWArr9BT2LAf+W73dn5jHclIBFZyfYWU3or7T4K7AJmbl/yG7EtX1BQXNTVCYgtgbAEAYHlqYHlrsTEVQWr63RZFuqsfDAcdQPrGRR/JF5nKGm9xUxMyr0YBAEXXHgIANq/3ADQobD2J9fAkNiMTMSFb9z8ambMAQER3JC1XttkYGGZXoyZEGyTHRuBuPgBTUu7VSnUAgAUAWutOV2MjZGkehgYUA6O5A0AlkAyRnotiX3MLlFKduYCqAtuGXpyH0XQmOj+TIURt51OzURTYZdBKV2UBSsOIcRp/TVTT4ewK6idECAihtUKOArWcjq/B8tQ6UkUR31+OYXP4sTOdisivrkMyHodWejlXwcC38Fvs8dY5xaIId89VlJy7ACpCNCFCuOp8+BJ6A631gANQSg1mVmOxxGQYRW2nHMha4B5WA3chsv22T5/B13AIicWZmNZ6cMchTXUe81Okzz54pLi0uQWp+TmkZqMwxsBV74Or3od4OISPr0e3SHa3PX0f3HXKofNH/UIG9pZ5PeUth+CyS2EMkEqs4fPEOBJLsyske48/+xD8oxcAYPzs4QaS7RR2kbLTTOTQieczfzfTv8QPldGvTGoF6/8AAAAASUVORK5CYII=' ; return $ this -> _options [ 'image_path' ] . '/exception.png' ; break ; case 'error' : if ( null === $ this -> _options [ 'image_path' ] ) return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAIsSURBVDjLpVNLSJQBEP7+h6uu62vLVAJDW1KQTMrINQ1vPQzq1GOpa9EppGOHLh0kCEKL7JBEhVCHihAsESyJiE4FWShGRmauu7KYiv6Pma+DGoFrBQ7MzGFmPr5vmDFIYj1mr1WYfrHPovA9VVOqbC7e/1rS9ZlrAVDYHig5WB0oPtBI0TNrUiC5yhP9jeF4X8NPcWfopoY48XT39PjjXeF0vWkZqOjd7LJYrmGasHPCCJbHwhS9/F8M4s8baid764Xi0Ilfp5voorpJfn2wwx/r3l77TwZUvR+qajXVn8PnvocYfXYH6k2ioOaCpaIdf11ivDcayyiMVudsOYqFb60gARJYHG9DbqQFmSVNjaO3K2NpAeK90ZCqtgcrjkP9aUCXp0moetDFEeRXnYCKXhm+uTW0CkBFu4JlxzZkFlbASz4CQGQVBFeEwZm8geyiMuRVntzsL3oXV+YMkvjRsydC1U+lhwZsWXgHb+oWVAEzIwvzyVlk5igsi7DymmHlHsFQR50rjl+981Jy1Fw6Gu0ObTtnU+cgs28AKgDiy+Awpj5OACBAhZ/qh2HOo6i+NeA73jUAML4/qWux8mt6NjW1w599CS9xb0mSEqQBEDAtwqALUmBaG5FV3oYPnTHMjAwetlWksyByaukxQg2wQ9FlccaK/OXA3/uAEUDp3rNIDQ1ctSk6kHh1/jRFoaL4M4snEMeD73gQx4M4PsT1IZ5AfYH68tZY7zv/ApRMY9mnuVMvAAAAAElFTkSuQmCC' ; return $ this -> _options [ 'image_path' ] . '/error.png' ; break ; case 'close' : return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAABHElEQVQoFZ2SMUsDQRCFN6eRIIIS0MZW0gUs72orayvh/C3HNfkXV/kftEhz3V0pigghrc0VQdsYiO/b3MAaYgh58HZ2387czt6+jvuLvpaX4oV41m59KTbipzhrNdexieKVOBBPAy2cfmsxEaeIBwwCRdfiMYt/0JNOJ3NxFmmgPU7qii7P8yExRKCRQy41jsR7qITRUqiq6sk05mjsmaY45I43Ii14KPEhjuPbuq6fEWyeJMnjKsOPDYV34lEgOitG4wNrRchz7rgXDlXFO21tVR24tVOp2e/n8I4L8VzslWXZRFE0SdN0rLVHURSvaFmWvbUSRvgw55gB/Fu2CZvCj8QXcWrOwYM44kTEIZvASe+it5ydaIk7m/wXTbV0eSnRtrUAAAAASUVORK5CYII=' ; break ; default : if ( null === $ this -> _options [ 'image_path' ] ) return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHhSURBVDjLpZI9SJVxFMZ/r2YFflw/kcQsiJt5b1ije0tDtbQ3GtFQYwVNFbQ1ujRFa1MUJKQ4VhYqd7K4gopK3UIly+57nnMaXjHjqotnOfDnnOd/nt85SURwkDi02+ODqbsldxUlD0mvHw09ubSXQF1t8512nGJ/Uz/5lnxi0tB+E9QI3D//+EfVqhtppGxUNzCzmf0Ekojg4fS9cBeSoyzHQNuZxNyYXp5ZM5Mk1ZkZT688b6thIBenG/N4OB5B4InciYBCVyGnEBHO+/LH3SFKQuF4OEs/51ndXMXC8Ajqknrcg1O5PGa2h4CJUqVES0OO7sYevv2qoFBmJ/4gF4boaOrg6rPLYWaYiVfDo0my8w5uj12PQleB0vcp5I6HsHAUoqUhR29zH+5B4IxNTvDmxljy3x2YCYUwZVlbzXJh9UKeQY6t2m0Lt94Oh5loPdqK3EkjzZi4MM/Y9Db3MTv/mYWVxaqkw9IOATNR7B5ABHPrZQrtg9sb8XDKa1+QOwsri4zeHD9SAzE1wxBTXz9xtvMc5ZU5lirLSKIz18nJnhOZjb22YKkhd4odg5icpcoyL669TAAujlyIvmPHSWXY1ti1AmZ8mJ3ElP1ips1/YM3H300g+W+51nc95YPEX8fEbdA2ReVYAAAAAElFTkSuQmCC' ; return $ this -> _options [ 'image_path' ] . '/unknown.png' ; break ; } }
Returns path to the specific icon
58,376
protected function _headerOutput ( ) { $ collapsed = isset ( $ _COOKIE [ 'ZFDebugCollapsed' ] ) ? $ _COOKIE [ 'ZFDebugCollapsed' ] : '' ; if ( $ collapsed ) { $ boxheight = isset ( $ _COOKIE [ 'ZFDebugHeight' ] ) ? $ _COOKIE [ 'ZFDebugHeight' ] : '240' ; } else { $ boxheight = '32' ; } return ( ' <style type="text/css" media="screen"> html,body {height:100%} #ZFDebug, #ZFDebug div, #ZFDebug span, #ZFDebug h1, #ZFDebug h2, #ZFDebug h3, #ZFDebug h4, #ZFDebug h5, #ZFDebug h6, #ZFDebug p, #ZFDebug blockquote, #ZFDebug pre, #ZFDebug a, #ZFDebug code, #ZFDebug em, #ZFDebug img, #ZFDebug strong, #ZFDebug dl, #ZFDebug dt, #ZFDebug dd, #ZFDebug ol, #ZFDebug ul, #ZFDebug li, #ZFDebug table, #ZFDebug tbody, #ZFDebug tfoot, #ZFDebug thead, #ZFDebug tr, #ZFDebug th, #ZFDebug td { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; } #ZFDebug_offset {height:' . $ boxheight . 'px} #ZFDebug {height:' . $ boxheight . 'px; width:100%; background:#262626; font: 12px/1.4em Lucida Grande, Lucida Sans Unicode, sans-serif; position:fixed; bottom:0px; left:0px; color:#FFF; background:#000000; z-index:2718281828459045;} #ZFDebug p {margin:1em 0} #ZFDebug a {color:#FFFFFF} #ZFDebug tr {color:#FFFFFF;} #ZFDebug td {vertical-align:top; padding-bottom:1em} #ZFDebug ol {margin:1em 0 0 0; padding:0; list-style-position: inside;} #ZFDebug li {margin:0;} #ZFDebug .clickable {cursor:pointer} #ZFDebug #ZFDebug_info {display:block; height:32px; background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAyCAMAAABSxbpPAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACFQTFRFFhYWIyMjGhoaHBwcJSUlExMTFBQUHx8fISEhGBgYJiYmWIZXxwAAAC5JREFUeNrsxskNACAMwLBAucr+A/OLWAEJv0wXQ1xSVBFiiiWKaGLr96EeAQYA2KMRY8RL/qEAAAAASUVORK5CYII=) } #ZFDebug #ZFDebugResize {cursor:row-resize; height:1px; border-top:1px solid #1a1a1a;border-bottom:1px solid #333333; } #ZFDebug .ZFDebug_span {padding:0 15px; line-height:32px; display:block; float:left} #ZFDebug .ZFDebug_panel {padding:0px 15px 15px 15px; font: 11px/1.4em Menlo, Monaco, Lucida Console, monospace; text-align:left; height:' . ( $ boxheight - 50 ) . 'px; overflow:auto; display:none; } #ZFDebug h4 {font:bold 12px/1.4em Menlo, Monaco, Lucida Console, monospace; margin:1em 0; color: yellow;} #ZFDebug .ZFDebug_active {background:#1a1a1a;} #ZFDebug .ZFDebug_panel .pre {margin:0 0 0 22px} #ZFDebug_exception { border:1px solid #CD0A0A;display: block; } </style> <script type="text/javascript"> var ZFDebugLoad = window.onload; window.onload = function(){ if (ZFDebugLoad) { ZFDebugLoad(); } if ("' . $ collapsed . '" != "") { ZFDebugPanel("' . $ collapsed . '"); } window.zfdebugHeight = "' . ( isset ( $ _COOKIE [ 'ZFDebugHeight' ] ) ? $ _COOKIE [ 'ZFDebugHeight' ] : '240' ) . '"; document.onmousemove = function(e) { var event = e || window.event; window.zfdebugMouse = Math.max(40, Math.min(window.innerHeight, -1*(event.clientY-window.innerHeight-32))); } var ZFDebugResizeTimer = null; document.getElementById("ZFDebugResize").onmousedown=function(e){ ZFDebugResize(); ZFDebugResizeTimer = setInterval("ZFDebugResize()",50); return false; } document.onmouseup=function(e){ clearTimeout(ZFDebugResizeTimer); } }; function ZFDebugResize() { window.zfdebugHeight = window.zfdebugMouse; document.cookie = "ZFDebugHeight="+window.zfdebugHeight+";expires=;path=/"; document.getElementById("ZFDebug").style.height = window.zfdebugHeight+"px"; document.getElementById("ZFDebug_offset").style.height = window.zfdebugHeight+"px"; var panels = document.getElementById("ZFDebug").children; for (var i=0; i < document.getElementById("ZFDebug").childElementCount; i++) { if (panels[i].className.indexOf("ZFDebug_panel") == -1) continue; panels[i].style.height = window.zfdebugHeight-50+"px"; } } var ZFDebugCurrent = null; function ZFDebugPanel(name) { if (ZFDebugCurrent == name) { document.getElementById("ZFDebug").style.height = "32px"; document.getElementById("ZFDebug_offset").style.height = "32px"; ZFDebugCurrent = null; document.cookie = "ZFDebugCollapsed=;expires=;path=/"; } else { document.getElementById("ZFDebug").style.height = window.zfdebugHeight+"px"; document.getElementById("ZFDebug_offset").style.height = window.zfdebugHeight+"px"; ZFDebugCurrent = name; document.cookie = "ZFDebugCollapsed="+name+";expires=;path=/"; } var panels = document.getElementById("ZFDebug").children; for (var i=0; i < document.getElementById("ZFDebug").childElementCount; i++) { if (panels[i].className.indexOf("ZFDebug_panel") == -1) continue; if (ZFDebugCurrent && panels[i].id == name) { document.getElementById("ZFDebugInfo_"+name.substring(8)).className += " ZFDebug_active"; panels[i].style.display = "block"; panels[i].style.height = (window.zfdebugHeight-50)+"px"; } else { var element = document.getElementById("ZFDebugInfo_"+panels[i].id.substring(8)); element.className = element.className.replace("ZFDebug_active", ""); panels[i].style.display = "none"; } } } </script> ' ) ; }
Returns html header for the Debug Bar
58,377
protected function _output ( $ html ) { $ html = "<div id='ZFDebug_offset'></div>\n<div id='ZFDebug'>\n$html\n</div>\n</body>" ; $ response = $ this -> getResponse ( ) ; $ response -> setBody ( str_ireplace ( '</body>' , $ this -> _headerOutput ( ) . $ html , $ response -> getBody ( ) ) ) ; }
Appends Debug Bar html output to the original page
58,378
public function answerImportAction ( ) { $ controller = 'answers' ; $ importLoader = $ this -> loader -> getImportLoader ( ) ; $ params [ 'defaultImportTranslator' ] = $ importLoader -> getDefaultTranslator ( $ controller ) ; $ params [ 'formatBoxClass' ] = 'browser table' ; $ params [ 'importer' ] = $ importLoader -> getImporter ( $ controller ) ; $ params [ 'importLoader' ] = $ importLoader ; $ params [ 'tempDirectory' ] = $ importLoader -> getTempDirectory ( ) ; $ params [ 'importTranslators' ] = $ importLoader -> getTranslators ( $ controller ) ; $ this -> addSnippets ( 'Survey_AnswerImportSnippet' , $ params ) ; }
Import answers to a survey
58,379
public function checkAction ( ) { $ surveyId = $ this -> getSurveyId ( ) ; $ where = $ this -> db -> quoteInto ( 'gto_id_survey = ?' , $ surveyId ) ; $ batch = $ this -> loader -> getTracker ( ) -> recalculateTokens ( 'surveyCheck' . $ surveyId , $ this -> currentUser -> getUserId ( ) , $ where ) ; $ title = sprintf ( $ this -> _ ( 'Checking for the %s survey for answers .' ) , $ this -> db -> fetchOne ( "SELECT gsu_survey_name FROM gems__surveys WHERE gsu_id_survey = ?" , $ surveyId ) ) ; $ this -> _helper -> BatchRunner ( $ batch , $ title , $ this -> accesslog ) ; $ this -> addSnippet ( 'Survey\\CheckAnswersInformation' , 'itemDescription' , $ this -> _ ( 'This task checks all tokens using this survey for answers.' ) ) ; }
Check the tokens for a single survey
58,380
public function pdfAction ( ) { $ this -> initRawOutput ( ) ; $ this -> loader -> getPdf ( ) -> echoPdfBySurveyId ( $ this -> _getParam ( \ MUtil_Model :: REQUEST_ID ) ) ; }
Open pdf linked to survey
58,381
public function getConfig ( $ token ) { try { $ trackId = $ token -> getTrackId ( ) ; $ roundId = $ token -> getRoundId ( ) ; $ db = \ Zend_Db_Table :: getDefaultAdapter ( ) ; $ select = $ db -> select ( ) -> from ( 'gems__chart_config' ) -> where ( 'gcc_tid = ?' , $ trackId ) -> where ( 'gcc_rid = ?' , $ roundId ) ; if ( $ result = $ select -> query ( ) -> fetch ( ) ) { $ config = \ Zend_Json :: decode ( $ result [ 'gcc_config' ] ) ; return $ config ; } $ surveyId = $ token -> getSurveyId ( ) ; $ select = $ db -> select ( ) -> from ( 'gems__chart_config' ) -> where ( 'gcc_sid = ?' , $ surveyId ) ; if ( $ result = $ select -> query ( ) -> fetch ( ) ) { $ config = \ Zend_Json :: decode ( $ result [ 'gcc_config' ] ) ; return $ config ; } $ surveyCode = $ token -> getSurvey ( ) -> getCode ( ) ; $ select = $ db -> select ( ) -> from ( 'gems__chart_config' ) -> where ( 'gcc_code = ?' , $ surveyCode ) ; $ config = $ select -> query ( ) -> fetch ( ) ; if ( $ config !== false ) { $ config = \ Zend_Json :: decode ( $ config [ 'gcc_config' ] ) ; } return $ config ; } catch ( \ Exception $ exc ) { } return false ; }
Get config options for this token
58,382
protected function getAgenda ( ) { if ( ! $ this -> agenda ) { $ this -> agenda = $ this -> loader -> getAgenda ( ) ; } return $ this -> agenda ; }
Retreive the agenda if not injected
58,383
public function downloadAction ( ) { $ model = $ this -> getModel ( ) ; $ model -> applyRequest ( $ this -> getRequest ( ) ) ; $ fileData = $ model -> loadFirst ( ) ; header ( 'Content-Type: application/x-download' ) ; header ( 'Content-Length: ' . $ fileData [ 'size' ] ) ; header ( 'Content-Disposition: inline; filename="' . $ fileData [ 'filename' ] . '"' ) ; header ( 'Pragma: public' ) ; echo $ fileData [ 'content' ] ; exit ( ) ; }
Action for downloading the file
58,384
public function overviewAction ( ) { if ( $ this -> overviewSnippets ) { $ params = $ this -> _processParameters ( $ this -> overviewParameters ) ; $ this -> addSnippets ( $ this -> overviewSnippets , $ params ) ; } }
Show log overview for the current user
58,385
public function showLogAction ( ) { if ( $ this -> showLogSnippets ) { $ params = $ this -> _processParameters ( $ this -> showLogParameters ) ; $ this -> addSnippets ( $ this -> showLogSnippets , $ params ) ; } }
Show a log item
58,386
public function twoFactorAction ( ) { if ( $ this -> twoFactorSnippets ) { $ params = $ this -> _processParameters ( $ this -> twoFactorParameters ) ; $ this -> addSnippets ( $ this -> twoFactorSnippets , $ params ) ; } }
Set two factor authentication
58,387
protected function exportFieldData ( array $ data ) { $ replacements = array ( "\n" => '\\n' , "\r" => '\\r' , "\t" => '\\t' ) ; foreach ( $ data as & $ item ) { $ item = strtr ( ( string ) $ item , $ replacements ) ; } fwrite ( $ this -> _file , implode ( "\t" , $ data ) . "\r\n" ) ; }
Write the array to the output to file
58,388
protected function exportTypeHeader ( $ header , $ prependNewline = true ) { if ( $ prependNewline ) { fwrite ( $ this -> _file , "\r\n" ) ; } fwrite ( $ this -> _file , "$header\r\n" ) ; }
Write the export type to the output
58,389
public function setBatch ( \ MUtil_Task_TaskBatch $ batch ) { parent :: setBatch ( $ batch ) ; $ this -> _file = $ batch -> getVariable ( 'file' ) ; return $ this ; }
Sets the batch this task belongs to
58,390
protected function translateFieldCode ( FieldsDefinition $ fields , $ fieldId ) { $ field = $ fields -> getField ( $ fieldId ) ; if ( $ field instanceof FieldInterface ) { return '{f' . $ field -> getOrder ( ) . '}' ; } return $ fieldId ; }
Translate a field code to the field order number
58,391
protected function _cleanData ( $ values ) { $ linebreak = $ this -> getLinebreak ( ) ; if ( is_array ( $ values ) ) { ksort ( $ values ) ; } $ retVal = '<div class="pre">' ; foreach ( $ values as $ key => $ value ) { $ key = htmlspecialchars ( $ key ) ; if ( is_numeric ( $ value ) ) { $ retVal .= $ key . ' => ' . $ value . $ linebreak ; } else if ( is_string ( $ value ) ) { $ retVal .= $ key . ' => \'' . htmlspecialchars ( $ value ) . '\'' . $ linebreak ; } else if ( is_array ( $ value ) ) { $ retVal .= $ key . ' => ' . self :: _cleanData ( $ value ) ; } else if ( is_object ( $ value ) ) { $ retVal .= $ key . ' => ' . get_class ( $ value ) . ' Object()' . $ linebreak ; } else if ( is_null ( $ value ) ) { $ retVal .= $ key . ' => NULL' . $ linebreak ; } } return $ retVal . '</div>' ; }
Transforms data into readable format
58,392
protected function getFixedParams ( ) { $ neededParams = parent :: getFixedParams ( ) ; $ neededParams [ ] = \ MUtil_Model :: REQUEST_ID1 ; $ neededParams [ ] = \ MUtil_Model :: REQUEST_ID2 ; return $ neededParams ; }
Return the fixed parameters
58,393
protected function addPaginator ( \ MUtil_Html_TableElement $ table , \ Zend_Paginator $ paginator ) { $ table -> tfrow ( ) -> pagePanel ( $ paginator , $ this -> request , $ this -> translate , array ( 'baseUrl' => $ this -> baseUrl ) ) ; }
Add the paginator panel to the table .
58,394
protected function getFileIcons ( \ MUtil_Model_Bridge_TableBridge $ bridge ) { $ onDelete = new \ MUtil_Html_OnClickArrayAttribute ( ) ; $ onDelete -> addConfirm ( \ MUtil_Lazy :: call ( 'sprintf' , $ this -> _ ( "Are you sure you want to delete '%s'?" ) , $ bridge -> relpath ) ) ; return array ( 'process.png' => $ this -> findMenuItem ( $ this -> request -> getControllerName ( ) , 'import' ) , 'download.png' => $ this -> findMenuItem ( $ this -> request -> getControllerName ( ) , 'download' ) , 'eye.png' => $ this -> findMenuItem ( $ this -> request -> getControllerName ( ) , 'show' ) , 'edit.png' => $ this -> findMenuItem ( $ this -> request -> getControllerName ( ) , 'edit' ) , 'delete.png' => array ( $ this -> findMenuItem ( $ this -> request -> getControllerName ( ) , 'delete' ) , $ onDelete , ) , ) ; }
Get the file icons
58,395
protected function addOrgSelect ( array & $ elements , $ data , $ elementId = 'gto_id_organzation' ) { $ orgs = $ this -> currentUser -> getRespondentOrganizations ( ) ; if ( count ( $ orgs ) > 1 ) { if ( $ this -> orgIsMultiCheckbox ) { $ elements [ $ elementId ] = $ this -> _createMultiCheckBoxElements ( $ elementId , $ orgs , ' ' ) ; } else { $ elements [ $ elementId ] = $ this -> _createSelectElement ( $ elementId , $ orgs , $ this -> _ ( '(all organizations)' ) ) ; } } }
Add organization select to the elements array
58,396
protected function addPeriodSelect ( array & $ elements , $ data ) { $ dates = array ( 'gr2t_start_date' => $ this -> _ ( 'Track start' ) , 'gr2t_end_date' => $ this -> _ ( 'Track end' ) , 'gto_valid_from' => $ this -> _ ( 'Valid from' ) , 'gto_valid_until' => $ this -> _ ( 'Valid until' ) , ) ; $ this -> _addPeriodSelectors ( $ elements , $ dates , 'gto_valid_from' ) ; }
Add period select to the elements array
58,397
protected function addTrackSelect ( array & $ elements , $ data , $ elementId = 'gto_id_track' ) { $ this -> trackFieldId = $ elementId ; $ orgs = $ this -> currentUser -> getRespondentOrganizations ( ) ; $ tracks = $ this -> util -> getTrackData ( ) -> getTracksForOrgs ( $ orgs ) ; if ( count ( $ tracks ) > 1 ) { $ elements [ $ elementId ] = $ this -> _createSelectElement ( $ elementId , $ tracks , $ this -> _ ( '(select a track)' ) ) ; $ elements [ $ elementId ] -> setAttrib ( 'onchange' , 'this.form.submit();' ) ; } }
Add track select to the elements array
58,398
protected function createTokenId ( ) { $ max = strlen ( $ this -> tokenChars ) - 1 ; $ len = strlen ( $ this -> tokenFormat ) ; do { $ out = '' ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { if ( '\\' == $ this -> tokenFormat [ $ i ] ) { $ i ++ ; $ out .= $ this -> tokenFormat [ $ i ] ; } else { $ out .= $ this -> tokenChars [ mt_rand ( 0 , $ max ) ] ; } } } while ( $ this -> db -> fetchOne ( 'SELECT gto_id_token FROM gems__tokens WHERE gto_id_token = ?' , $ out ) ) ; return $ out ; }
Generates a random token and checks for uniqueness
58,399
public function filter ( $ token ) { if ( $ this -> tokenFrom ) { $ token = strtr ( $ token , $ this -> tokenFrom , $ this -> tokenTo ) ; } if ( ! $ this -> tokenCaseSensitive ) { $ token = strtolower ( $ token ) ; } $ tokenLength = strlen ( $ token ) ; $ filteredToken = '' ; for ( $ tokenPos = 0 ; ( $ tokenPos < $ tokenLength ) ; $ tokenPos ++ ) { if ( strpos ( $ this -> tokenChars , $ token [ $ tokenPos ] ) !== false ) { $ filteredToken .= $ token [ $ tokenPos ] ; } } $ formatLength = strlen ( $ this -> tokenFormat ) ; $ tokenLength = strlen ( $ filteredToken ) ; $ tokenPos = 0 ; $ resultToken = '' ; for ( $ formatPos = 0 ; ( $ formatPos < $ formatLength ) && ( $ tokenPos < $ tokenLength ) ; $ formatPos ++ ) { if ( '\\' == $ this -> tokenFormat [ $ formatPos ] ) { $ formatPos ++ ; $ resultToken .= $ this -> tokenFormat [ $ formatPos ] ; } else { $ resultToken .= $ filteredToken [ $ tokenPos ] ; $ tokenPos ++ ; } } if ( $ tokenPos < $ tokenLength ) { $ resultToken .= ' ?' . substr ( $ filteredToken , $ tokenPos ) ; } return $ resultToken ; }
Removes all unacceptable characters from the input token and inserts any fixed characters left out