sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
public function hasHtmlOutput()
{
$sql = "SELECT COALESCE(gto_round_description, '') AS label,
SUM(
CASE
WHEN gto_completion_time IS NOT NULL
THEN 1
ELSE 0
... | The place to check if the data set in the snippet is valid
to generate the snippet.
When invalid data should result in an error, you can throw it
here but you can also perform the check in the
checkRegistryRequestsAnswers() function from the
{@see \MUtil_Registry_TargetInterface}.
@return boolean | entailment |
public function getSubmitButton()
{
$element = $this->getElement($this->_submitFieldName);
if (! $element) {
// Submit knop
$options = array('class' => 'button');
$element = $this->createElement('submit', $this->_submitFieldName, $options);
$element-... | Returns/sets a submit button.
@return \Zend_Form_Element_Submit | entailment |
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) {
... | Gets all enabled commands for the file and type of image
@param $filename
@param $type
@return array | entailment |
public function execute($row = null)
{
if ($row) {
if ((! isset($row['grs_id_user'])) &&
isset($row['grs_ssn']) &&
$this->targetModel instanceof \Gems_Model_RespondentModel &&
$this->targetModel->hashSsn !== \Gems_Model_RespondentModel:... | Should handle execution of the task, taking as much (optional) parameters as needed
The parameters should be optional and failing to provide them should be handled by
the task
@param array $row Row to save | entailment |
public function execute($patchLevel = null)
{
//Update the patchlevel only when we have executed at least one patch
$batch = $this->getBatch();
if ($batch->getCounter('executed')) {
$this->db->query(
'INSERT IGNORE INTO gems__patch_levels (gpl_level, gpl_creat... | Should handle execution of the task, taking as much (optional) parameters as needed
The parameters should be optional and failing to provide them should be handled by
the task
@param int $patchLevel Only execute patches for this patchlevel | entailment |
public function getPresetTargetData()
{
$targetData = parent::getPresetTargetData();
if ($this->token) {
$targetData['track'] = $this->token->getTrackName();
$targetData['round'] = $this->token->getRoundDescription();
$targetData['survey'] = $t... | Get specific data set in the mailer
@return Array | entailment |
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)... | Log the communication for the respondent. | entailment |
public function tokenMailFields()
{
if ($this->token) {
$locale = $this->respondent->getLanguage();
$survey = $this->token->getSurvey();
// Count todo
$tSelect = $this->loader->getTracker()->getTokenSelect(array(
'all' => 'COUNT(*)',
... | Returns an array of {field_names} => values for this token for
use in an e-mail tamplate.
@param array $tokenData
@return array | entailment |
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');
... | Update the token data when a Mail has been sent.
@param integer $tokenId TokenId to update. If none is supplied, use the current token | entailment |
public function barcodeAction()
{
$code = $this->getRequest()->getParam('code', 'empty');
\Zend_Layout::getMvcInstance()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$barcodeOptions = array('text' => $code);
$rendererOptions = array();
$barcode = \Z... | This can be used to generate barcodes, use the action
/openrosa/barcode/code/<tokenid>
example:
/openrosa/barocde/code/22pq-grkq
The image will be a png | entailment |
public function downloadAction()
{
$filename = $this->getRequest()->getParam('form');
$filename = basename($filename); //Strip paths
$file = $this->formDir . $filename;
if (!empty($filename) && file_exists($file)) {
$this->getHelper('layout')->disableLayout();
... | This action should serve the right form to the downloading application
it should also handle expiration / availability of forms | entailment |
public function formlistAction()
{
//first create the baseurl of the form http(s)://projecturl/openrosa/download/form/
$helper = new \Zend_View_Helper_ServerUrl();
$baseUrl = $helper->serverUrl() . \Zend_Controller_Front::getInstance()->getBaseUrl() . '/openrosa/download/form/';
//... | Accessible via formList as defined in the menu and standard for openRosa clients | entailment |
private function processReceivedForm($answerXmlFile)
{
//Log what we received
$log = \Gems_Log::getLogger();
//$log->log(print_r($xmlFile, true), \Zend_Log::ERR);
$xml = simplexml_load_file($answerXmlFile);
$formId = $xml->attributes()->id;
$formVersion = $... | 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.
@param type $xmlFile
@return string ResultID or false on failure | entailment |
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()) {
... | Implements HTTP Basic auth | entailment |
public function submissionAction()
{
$this->makeRosaResponse();
if ($this->getRequest()->isHead()) {
$this->getResponse()->setHttpResponseCode(204);
} elseif ($this->getRequest()->isPost()) {
//Post
// We get $_FILES variable holding the formresults as xm... | Accepts the form
Takes two roundtrips:
- first we get a HEAD request that should be answerd with
responsecode 204
- then we get a post that only submits $_FILES (so actual $_POST will be empty)
this will be an xml file for the actuel response and optionally images and/or video
proper responses are
201 received and sto... | entailment |
protected function afterLoad()
{
if ($this->_data &&
$this->db instanceof \Zend_Db_Adapter_Abstract) {
$this->_fieldList2 = $this->loadFieldList($this->_data['gaf_filter_text1'], $this->_data['gaf_filter_text2']);
$this->_fieldList4 = $this->loadFieldList($this... | Override this function when you need to perform any actions when the data is loaded.
Test for the availability of variables as these objects can be loaded data first after
deserialization or registry variables first after normal instantiation.
That is why this function called both at the end of afterRegistry() and af... | entailment |
public function getAppointmentFieldValue(\Gems_Agenda_Appointment $appointment, $field)
{
switch ($field) {
case 'gap_id_organization':
return $appointment->getOrganizationId();
case 'gap_source':
return $appointment->getSource();
... | Get the field value from an appointment object
@param \Gems_Agenda_Appointment $appointment
@param string $field
@return mixed | entailment |
public function getSqlAppointmentsWhere()
{
if ($this->_data['gaf_filter_text1'] && $this->_data['gaf_filter_text2']) {
$wheres[] = $this->getSqlWhereSingle($this->_data['gaf_filter_text1'], $this->_data['gaf_filter_text2'], $this->_fieldList2);
}
if ($this->_data['gaf_filte... | Generate a where statement to filter the appointment model
@return string | entailment |
public function matchAppointment(\Gems_Agenda_Appointment $appointment)
{
$result1 = $this->matchSingle(
$this->_data['gaf_filter_text1'],
$this->_data['gaf_filter_text2'],
$this->_fieldList2,
$appointment);
$result2 = $this->m... | Check a filter for a match
@param \Gems\Agenda\Gems_Agenda_Appointment $appointment
@return boolean | entailment |
protected function matchSingle($field, $searchTxt, $fieldList, $appointment)
{
$result = true;
if ($field && $searchTxt) {
$value = $this->getAppointmentFieldValue($appointment, $field);
if (isset($this->_lookupTables[$field])) {
if ($fieldList && $fie... | Check a filter for a match
@param $field
@param $searchTxt
@param $fieldList
@param \Gems\Agenda\Gems_Agenda_Appointment $appointment
@return boolean | entailment |
public function execute($formData = null)
{
$batch = $this->getBatch();
$import = $batch->getVariable('import');
$tracker = $this->loader->getTracker();
$model = $tracker->getTrackModel();
$model->applyFormatting(true, true);
$trackData = $import['trackData'];
... | Should handle execution of the task, taking as much (optional) parameters as needed
The parameters should be optional and failing to provide them should be handled by
the task
@param array $trackData Nested array of trackdata | entailment |
function DecodeVendorSpecificContent($vendor_specific_raw_value)
{
$result = array();
$offset_in_raw = 0;
$vendor_id = (ord(substr($vendor_specific_raw_value, 0, 1))*256*256*256)+(ord(substr($vendor_specific_raw_value, 1, 1))*256*256)+(ord(substr($vendor_specific_raw_value, 2, 1))*256)+o... | *******************************************************************
Array returned: array(array(Vendor-Id1, Vendor type1, Attribute-Specific1), ..., array(Vendor-IdN, Vendor typeN, Attribute-SpecificN)
******************************************************************* | entailment |
function AccessRequest($username = '', $password = '', $udp_timeout = 0, $state = NULL)
{
$this->ClearDataReceived();
$this->ClearLastError();
$this->SetPacketCodeToSend(1); // Access-Request
if (0 < strlen($username))
{
$this->SetUsername($username);
... | /*
Function : AccessRequest
Return TRUE if Access-Request is accepted, FALSE otherwise | entailment |
public function execute($lineNr = null, $conditionData = null)
{
$batch = $this->getBatch();
$import = $batch->getVariable('import');
$conditionId = $conditionData['gcon_id'];
if (! (isset($import['trackId']) && $import['trackId'])) {
// Do nothing
... | Should handle execution of the task, taking as much (optional) parameters as needed
The parameters should be optional and failing to provide them should be handled by
the task | entailment |
public function getHtmlOutput(\Zend_View_Abstract $view)
{
$html = $this->getHtmlSequence();
if ($this->trackName) {
$html->h3(sprintf($this->_('Surveys in %s track'), $this->trackName));
}
$trackRepeater = $this->getRepeater($this->trackId);
$table = $html->div(... | Create the snippets content
This is a stub function either override getHtmlOutput() or override render()
@param \Zend_View_Abstract $view Just in case it is needed here
@return \MUtil_Html_HtmlInterface Something that can be rendered | entailment |
public function hasHtmlOutput()
{
if (! $this->trackId) {
if (isset($this->trackData['gtr_id_track'])) {
$this->trackId = $this->trackData['gtr_id_track'];
} elseif ($this->trackEngine instanceof \Gems_Tracker_Engine_TrackEngineInterface) {
$this->trac... | The place to check if the data set in the snippet is valid
to generate the snippet.
When invalid data should result in an error, you can throw it
here but you can also perform the check in the
checkRegistryRequestsAnswers() function from the
{@see \MUtil_Registry_TargetInterface}.
@return boolean | entailment |
protected function createForm($options = null)
{
// Make sure the reset parameter is removed
$url = [
$this->basepath->getBasePathIfExists(),
'/',
$this->request->getControllerName(),
'/',
$this->request->getActionName(),
];
... | Creates an empty form. Allows overruling in sub-classes.
@param mixed $options
@return \Zend_Form | entailment |
protected function processForm()
{
// Check job monitors as long as the login form is being processed
$this->util->getMonitor()->checkMonitors();
// Start the real work
$this->loadForm();
$orgId = null;
if ($this->request->isPost()) {
$orgId = $this->log... | Step by step form processing
Returns false when $this->afterSaveRouteUrl is set during the
processing, which happens by default when the data is saved.
@return boolean True when the form should be displayed | entailment |
public function cleanupAction()
{
$params = $this->_processParameters($this->showParameters);
$params['contentTitle'] = $this->_('Clean up existing appointments?');
$params['filterOn'] = 'gap_id_procedure';
$params['filterWhen'] = 'gap_filter';
$snippets = array(
... | Cleanup appointments | entailment |
protected function createModel($detailed, $action)
{
$translated = $this->util->getTranslated();
$model = new \MUtil_Model_TableModel('gems__agenda_procedures');
\Gems_Model::setChangeFieldsByPrefix($model, 'gapr');
$model->setDeleteValues('gapr_active', 0);
$model->s... | Creates a model for getModel(). Called only for each new $action.
The parameters allow you to easily adapt the model to the current action. The $detailed
parameter was added, because the most common use of action is a split between detailed
and summarized actions.
@param boolean $detailed True when the current action... | entailment |
protected function applySurveyListValidAfter(\MUtil_Model_ModelAbstract $model, array &$itemData)
{
$this->_ensureRounds();
$previous = $this->getPreviousRoundId($itemData['gro_id_round'], $itemData['gro_id_order']);
if ($previous) {
$itemData['gro_valid_after_id'] = $previous;... | Set the surveys to be listed as valid after choices for this item and the way they are displayed (if at all)
@param \MUtil_Model_ModelAbstract $model The round model
@param array $itemData The current items data
@param boolean True if the update changed values (usually by changed selection lists). | entailment |
protected function applySurveyListValidFor(\MUtil_Model_ModelAbstract $model, array &$itemData)
{
if (! (isset($itemData['gro_id_round']) && $itemData['gro_id_round'])) {
$itemData['gro_id_round'] = '';
}
// Fixed value
$itemData['gro_valid_for_id'] = $itemData['gro_id_ro... | Set the surveys to be listed as valid for choices for this item and the way they are displayed (if at all)
@param \MUtil_Model_ModelAbstract $model The round model
@param array $itemData The current items data
@param boolean True if the update changed values (usually by changed selection lists). | entailment |
public function getConversionTargets(array $options)
{
$results = array();
foreach ($options as $className => $label) {
switch ($className) {
case 'AnyStepEngine':
case 'NextStepEngine':
$results[$className] = $label;
... | Returns a list of classnames this track engine can be converted into.
Should always contain at least the class itself.
@see convertTo()
@param array $options The track engine class options available in as a "track engine class names" => "descriptions" array
@return array Filter or adaptation of $options | entailment |
protected function getValidUntilDate($fieldSource, $fieldName, $prevRoundId, \Gems_Tracker_Token $token, \Gems_Tracker_RespondentTrack $respTrack, $validFrom)
{
$date = null;
switch ($fieldSource) {
case parent::NO_TABLE:
break;
case parent::TOKEN_TABLE:
... | Returns the date to use to calculate the ValidUntil if any
@param string $fieldSource Source for field from round
@param string $fieldName Name from round
@param int $prevRoundId Id from round
@param \Gems_Tracker_Token $token
@param \Gems_Tracker_RespondentTrack $respTrack
@param \MUtil_Date $validFrom The calculated... | entailment |
public function toPHP()
{
$value1 = '$fields->dataFieldByName(\'' . $this->master . '\')->dataValue()';
$value2 = $this->value;
if ($operator = $this->phpOperator()) {
return $value1 . " {$operator} \"$value2\"";
}
switch ($this->operator) {
case 'co... | Returns a string of php code to be evaluated
@return string | entailment |
protected function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
{
$br = \MUtil_Html::create('br');
if (! $this->columns) {
$this->columns = array(
10 => array('gsf_login', $br, 'gsf_id_primary_group'),
... | Adds columns from the model to the bridge that creates the browse table.
Overrule this function to add different columns to the browse table, without
having to recode the core table building code.
@param \MUtil_Model_Bridge_TableBridge $bridge
@param \MUtil_Model_ModelAbstract $model
@return void | entailment |
protected function createModel()
{
if ($this->model instanceof \Gems_Model_StaffModel) {
$model = $this->model;
} else {
$model = $this->loader->getModels()->getStaffModel();
$model->applyBrowseSettings();
}
return $model;
} | Creates the model
@return \MUtil_Model_ModelAbstract | entailment |
protected function getEditMenuItems()
{
$resets = $this->findMenuItems($this->menuActionController, 'reset');
foreach ($resets as $resetPw) {
if ($resetPw instanceof \Gems_Menu_SubMenuItem) {
$resetPw->set('label', $this->_('password'));
}
}
re... | Returns an edit menu item, if access is allowed by privileges
@return \Gems_Menu_SubMenuItem | entailment |
protected function createModel()
{
if (! $this->model instanceof \Gems_Tracker_Model_TrackModel) {
$this->model = $this->loader->getTracker()->getTrackModel();
}
return $this->model;
} | Creates the model
@return \MUtil_Model_ModelAbstract | entailment |
protected function setShowTableFooter(\MUtil_Model_Bridge_VerticalTableBridge $bridge, \MUtil_Model_ModelAbstract $model)
{
if ($model instanceof \Gems_Tracker_Model_TrackModel) {
$this->useCount = $model->getStartCount($this->trackId);
if ($this->useCount) {
$this->... | Set the footer of the browse table.
Overrule this function to set the header differently, without
having to recode the core table building code.
@param \MUtil_Model_Bridge_VerticalTableBridge $bridge
@param \MUtil_Model_ModelAbstract $model
@return void | entailment |
public function toggleCheckboxes($id, $value = null, array $params = array())
{
$js = sprintf('%1$s("#%2$s").click(function(){
var checkboxes = %1$s("%3$s");
checkboxes.prop("checked", !checkboxes.prop("checked"));
});',
\ZendX_JQuery_View_Helper_JQuery::getJQueryHan... | put your code here | entailment |
public function setView(\Zend_View_Interface $view = null)
{
$element = parent::setView($view);
if (null !== $view) {
if (false === $view->getPluginLoader('helper')->getPaths('Gems_JQuery_View_Helper')) {
$view->addHelperPath('Gems/JQuery/View/Helper', 'Gems_JQuery_View_H... | Set the view object
Ensures that the view object has the \Gems_jQuery view helper path set.
@param \Zend_View_Interface $view
@return \Gems_JQuery_Form_Element_ToggleCheckboxes | entailment |
protected function createModel($detailed, $action)
{
// Load organizationId and respondentId
$this->loadParams();
$model = $this->loader->getModels()->createAppointmentModel();
if ($detailed) {
if (('edit' === $action) || ('create' === $action)) {
$model... | Creates a model for getModel(). Called only for each new $action.
The parameters allow you to easily adapt the model to the current action. The $detailed
parameter was added, because the most common use of action is a split between detailed
and summarized actions.
@param boolean $detailed True when the current action... | entailment |
public function getContentTitle()
{
$patientId = $this->_getParam(\MUtil_Model::REQUEST_ID1);
if ($patientId) {
if ($this->currentUser->areAllFieldsMaskedWhole('grs_first_name', 'grs_surname_prefix', 'grs_last_name')) {
return sprintf($this->_('Appointments for respondent... | Helper function to get the informed title for the index action.
@return $string | entailment |
public function getRespondent()
{
if (! $this->_respondent) {
$id = $this->_getParam(\Gems_Model::APPOINTMENT_ID);
if ($id && ! ($this->_getParam(\MUtil_Model::REQUEST_ID1) || $this->_getParam(\MUtil_Model::REQUEST_ID2))) {
$appointment = $this->loader->getAgenda()->g... | Get the respondent object
@return \Gems_Tracker_Respondent | entailment |
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', ... | Loads and checks the request parameters
@throws \Gems_Exception | entailment |
public function applyBrowseSettings()
{
$this->loadFilterDependencies(false);
$yesNo = $this->util->getTranslated()->getYesNo();
$this->set('gaf_class', 'label', $this->_('Filter type'),
'description', $this->_('Determines what is filtered how.'),
'multiOpti... | Set those settings needed for the browse display
@return \Gems_Agenda_AppointmentFilterModelAbstract | entailment |
public function applyDetailSettings()
{
$this->loadFilterDependencies(true);
$yesNo = $this->util->getTranslated()->getYesNo();
$this->resetOrder();
$this->set('gaf_class', 'label', $this->_('Filter type'),
'description', $this->_('Determines what is filtered how.'... | Set those settings needed for the detailed display
@return \Gems_Agenda_AppointmentFilterModelAbstract | entailment |
public function applyEditSettings($create = false)
{
$this->applyDetailSettings();
reset($this->filterOptions);
$default = key($this->filterOptions);
$this->set('gaf_class', 'default', $default, 'onchange', 'this.form.submit();');
// gaf_id is not needed for some va... | Set those values needed for editing
@return \Gems_Agenda_AppointmentFilterModelAbstract | entailment |
protected function loadFilterDependencies($activateDependencies = true)
{
if (! $this->filterOptions) {
$maxLength = $this->get('gaf_calc_name', 'maxlength');
$this->filterOptions = array();
foreach ($this->filterDependencies as $dependencyClass) {
$depen... | Load filter dependencies into model and populate the filterOptions
@return array filterClassName => Label | entailment |
public function afterRegistry()
{
parent::afterRegistry();
$this->model = $this->loader->getModels()->getRespondentModel(true);
if ($this->addLoginCheck) {
$this->model->addLoginCheck();
}
// Load the data
$this->refresh();
} | Called after the check that all required registry values
have been set correctly has run.
@return void | entailment |
public function applyToMenuSource(\Gems_Menu_ParameterSource $source)
{
$source->setPatient($this->getPatientNumber(), $this->getOrganizationId());
$source->offsetSet('resp_deleted', ($this->getReceptionCode()->isSuccess() ? 0 : 1));
return $this;
} | Set menu parameters from this token
@param \Gems_Menu_ParameterSource $source
@return \Gems_Tracker_RespondentTrack (continuation pattern) | entailment |
public function getAge($date = null, $months = false)
{
$birthDate = $this->getBirthDay();
if (is_null($date)) {
$date = new \MUtil_Date();
}
if (!($birthDate instanceof \MUtil_Date) || !($date instanceof \MUtil_Date)) {
return null;
... | Returns current age or at a given date when supplied
@param \MUtil_Date|null $date
@return int | entailment |
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
@return string | entailment |
public function getGreeting()
{
$genderGreetings = $this->util->getTranslated()->getGenderGreeting($this->getLanguage());
$gender = $this->getGender();
if (isset($genderGreetings[$gender])) {
$greeting = $genderGreetings[$this->getGender()] . ' ';
} else {
$... | Get the propper greeting of respondent
@return string | entailment |
public function getGreetingNL()
{
$genderGreetings = $this->util->getTranslated()->getGenderGreeting($this->getLanguage());
$greeting = $genderGreetings[$this->_gemsData['grs_gender']];
return $greeting . ' ' . ucfirst($this->getLastName());
} | Get the propper greeting of respondent
@return string | entailment |
public function getLanguage() {
if (!isset($this->respondentLanguage)) {
$this->respondentLanguage = $this->_gemsData['grs_iso_lang'];
}
return $this->respondentLanguage;
} | Get the respondents prefered language
@return string | entailment |
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
@return string | entailment |
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.
@return string | entailment |
public function hasActiveTracks()
{
$select = $this->db->select()
->from('gems__respondent2track', ['gr2t_id_respondent_track'])
->joinInner('gems__reception_codes', 'gr2t_reception_code = grc_id_reception_code', [])
->where('grc_success = 1')
... | Has the respondent active tracks
@return boolean | entailment |
public function hasAnyTracks()
{
$select = $this->db->select()
->from('gems__respondent2track', ['gr2t_id_respondent_track'])
->where('gr2t_id_user = ?', $this->respondentId)
->where('gr2t_id_organization = ?', $this->organizationId)
->limit(1)... | Has the respondent active tracks
@return boolean | entailment |
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;
$... | Refresh the data | entailment |
public function restoreTracks(\Gems_Util_ReceptionCode $oldCode, \Gems_Util_ReceptionCode $newCode) {
$count = 0;
if (!$oldCode->isSuccess() && $newCode->isSuccess()) {
$respTracks = $this->loader->getTracker()->getRespondentTracks(
$this->getId(),
... | Restores tracks for a respondent, when the reception code matches the given $oldCode
Used when restoring a respondent, and the restore tracks box is checked. This will
also restore all tokens in the tracks that have the same codes.
@param \Gems_Util_ReceptionCode $oldCode The old reception code
@param \Gems_Util_Rece... | entailment |
public function setReceptionCode($newCode)
{
return $this->model->setReceptionCode(
$this->getPatientNumber(),
$this->getOrganizationId(),
$newCode,
$this->getId(),
$this->getReceptionCode()
);
} | Set the reception code for a respondent and cascade non-success codes to the
tracks / surveys.
@param string $newCode String or \Gems_Util_ReceptionCode
@return \Gems_Util_ReceptionCode The new code reception code object for further processing | entailment |
protected function createModel($detailed, $action)
{
$filter = $this->getSearchFilter();
if (isset($filter['gto_id_survey']) && is_numeric($filter['gto_id_survey'])) {
// Surveys have been selected
$exportModelSource = $this->getExportModelSource();
$model = $exp... | Creates a model for getModel(). Called only for each new $action.
The parameters allow you to easily adapt the model to the current action. The $detailed
parameter was added, because the most common use of action is a split between detailed
and summarized actions.
@param boolean $detailed True when the current action... | entailment |
protected function setAfterDeleteRoute()
{
parent::setAfterDeleteRoute();
if (is_array($this->afterSaveRouteUrl)) {
$this->afterSaveRouteUrl[\MUtil_Model::REQUEST_ID] = $this->trackId;
$this->afterSaveRouteUrl[\Gems_Model::ROUND_ID] = null;
$this->afterSaveRou... | Set what to do when the form is 'finished'.
@return \MUtil_Snippets_ModelYesNoDeleteSnippetAbstract | entailment |
protected function setShowTableFooter(\MUtil_Model_Bridge_VerticalTableBridge $bridge, \MUtil_Model_ModelAbstract $model)
{
if ($model instanceof RoundModel) {
$this->useCount = $model->getStartCount($this->roundId);
if ($this->useCount) {
$this->addMessage(sprintf($... | Set the footer of the browse table.
Overrule this function to set the header differently, without
having to recode the core table building code.
@param \MUtil_Model_Bridge_VerticalTableBridge $bridge
@param \MUtil_Model_ModelAbstract $model
@return void | entailment |
public function getContent($file)
{
$content = $file instanceof File ? $file->getString() : file_get_contents($file);
// Yes, yes, regex'ing HTML is evil.
// Since we don't care about well-formedness or markup here, it does the job.
$content = preg_replace(
[
... | Extracts content from regex, by using strip_tags()
combined with regular expressions to remove non-content tags like <style> or <script>,
as well as adding line breaks after block tags.
@param File $file
@return string | entailment |
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
@param array $options
@return ZFDebug_Controller_Plugin_Debug | entailment |
public function unregisterPlugin($plugin)
{
if (false !== strpos($plugin, '_')) {
foreach ($this->_plugins as $key => $_plugin) {
if ($plugin == get_class($_plugin)) {
unset($this->_plugins[$key]);
}
}
} else {
$... | Unregister a plugin in the Debug Bar
@param string $plugin
@return ZFDebug_Controller_Plugin_Debug | entailment |
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
@param string $identifier
@return ZFDebug_Controller_Plugin_Debug_Plugin_Interface | entailment |
public function dispatchLoopShutdown()
{
if ($this->getRequest()->isXmlHttpRequest()) {
return;
}
$contentType = $this->getRequest()->getHeader('Content-Type');
if ((false !== $contentType) && (false === strpos($contentType, 'html')) && ($contentType !== '')) {
return;
... | Defined by Zend_Controller_Plugin_Abstract | entailment |
protected function _loadPlugins()
{
foreach ($this->_options['plugins'] as $plugin => $options) {
if (is_numeric($plugin)) {
# Plugin passed as array value instead of key
$plugin = $options;
$options = array();
}
// Registe... | Load plugins set in config option
@return void; | entailment |
protected function _getVersionPanel()
{
$panel = "<h4>ZFDebug $this->_version – Zend Framework "
. Zend_Version::VERSION . " on PHP " . phpversion() . "</h4>\n"
. "<p>©2008-2013 <a href='http://jokke.dk'>Joakim Nygård</a>" . $this->getLinebreak()
. "with contribu... | Returns version panel
@return string | entailment |
protected function _icon($kind)
{
switch ($kind) {
case 'database':
if (null === $this->_options['image_path'])
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAA... | Returns path to the specific icon
@return string | entailment |
protected function _headerOutput()
{
$collapsed = isset($_COOKIE['ZFDebugCollapsed']) ? $_COOKIE['ZFDebugCollapsed'] : '';
if ($collapsed) {
$boxheight = isset($_COOKIE['ZFDebugHeight']) ? $_COOKIE['ZFDebugHeight'] : '240';
} else {
$boxheight = '32';
}
... | Returns html header for the Debug Bar
@return string | entailment |
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(preg_replace('/(<\/head>)/i', $this->_headerOutput() . '$1', $response->getBody()));
$response->setBody(s... | Appends Debug Bar html output to the original page
@param string $html
@return void | entailment |
public function answerImportAction()
{
$controller = 'answers';
$importLoader = $this->loader->getImportLoader();
$params['defaultImportTranslator'] = $importLoader->getDefaultTranslator($controller);
$params['formatBoxClass'] = 'browser table';
$params['importer'... | Import answers to a survey | entailment |
public function calculateDuration($value, $isNew = false, $name = null, array $context = array(), $isPost = false)
{
$surveyId = isset($context['gsu_id_survey']) ? $context['gsu_id_survey'] : false;
if (! $surveyId) {
return $this->_('incalculable');
}
$fields['cnt'] = '... | A ModelAbstract->setOnLoad() function that takes care of transforming a
dateformat read from the database to a \Zend_Date format
If empty or \Zend_Db_Expression (after save) it will return just the value
currently there are no checks for a valid date format.
@see \MUtil_Model_ModelAbstract
@param mixed $value The va... | entailment |
public function calculateTrackCount($value, $isNew = false, $name = null, array $context = array(), $isPost = false)
{
$surveyId = isset($context['gsu_id_survey']) ? $context['gsu_id_survey'] : false;
if (! $surveyId) {
return 0;
}
$select = new \Zend_Db_Select($this->db... | A ModelAbstract->setOnLoad() function that takes care of transforming a
dateformat read from the database to a \Zend_Date format
If empty or \Zend_Db_Expression (after save) it will return just the value
currently there are no checks for a valid date format.
@see \MUtil_Model_ModelAbstract
@param mixed $value The va... | entailment |
public function calculateTrackUsage($value, $isNew = false, $name = null, array $context = array(), $isPost = false)
{
$surveyId = isset($context['gsu_id_survey']) ? $context['gsu_id_survey'] : false;
if (! $surveyId) {
return 0;
}
$select = new \Zend_Db_Select($this->db... | A ModelAbstract->setOnLoad() function that takes care of transforming a
dateformat read from the database to a \Zend_Date format
If empty or \Zend_Db_Expression (after save) it will return just the value
currently there are no checks for a valid date format.
@see \MUtil_Model_ModelAbstract
@param mixed $value The va... | entailment |
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->_... | Check the tokens for a single survey | entailment |
protected function createModel($detailed, $action)
{
$dbLookup = $this->util->getDbLookup();
$survey = null;
$translated = $this->util->getTranslated();
$yesNo = $translated->getYesNo();
if ($detailed) {
$surveyId = $this->_getIdParam();
i... | Creates a model for getModel(). Called only for each new $action.
The parameters allow you to easily adapt the model to the current action. The $detailed
parameter was added, because the most common use of action is a split between detailed
and summarized actions.
@param boolean $detailed True when the current action... | entailment |
public function getBrowseColumns()
{
$br = \MUtil_Html::create('br');
$output[10] = array('gsu_survey_name', $br, 'gsu_survey_description');
$output[20] = array('gsu_surveyor_active', \MUtil_Html::raw($this->_(' [')), 'gso_source_name',
\MUtil_Html::raw($this->_(']')), $br, 'gsu... | Set column usage to use for the browser.
Must be an array of arrays containing the input for TableBridge->setMultisort()
@return array or false | entailment |
public function getSurveyId()
{
$id = $this->_getIdParam();
$survey = $this->loader->getTracker()->getSurvey($id);
$this->menu->getParameterSource()->offsetSet('gsu_active', $survey->isActive() ? 1 : 0);
return $id;
} | Return the survey id (and set a menu var)
@return int | entailment |
public function pdfAction()
{
// Make sure nothing else is output
$this->initRawOutput();
// Output the PDF
$this->loader->getPdf()->echoPdfBySurveyId($this->_getParam(\MUtil_Model::REQUEST_ID));
} | Open pdf linked to survey | entailment |
public function getHtmlOutput(\Zend_View_Abstract $view)
{
$snippets = array();
$data = $this->getModel()->load();
// Find the first token with answers
foreach($data as $tokenData) {
$token = $this->loader->getTracker()->getToken($tokenData)->refresh();
... | Copied from parent, but insert chart instead of table after commented out part
@param \Zend_View_Abstract $view
@return type | entailment |
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 = ?', $tr... | Get config options for this token
Order of reading is track/round, survey, survey code
@param \Gems_Tracker_Token $token | entailment |
public function getHtmlOutput(\Zend_View_Abstract $view)
{
$html = $this->getHtmlSequence();
$html->h2($this->_('Thank you for subscribing!'));
return $html;
} | Create the snippets content
This is a stub function either override getHtmlOutput() or override render()
@param \Zend_View_Abstract $view Just in case it is needed here
@return \MUtil_Html_HtmlInterface Something that can be rendered | entailment |
public function getHtmlOutput(\Zend_View_Abstract $view)
{
if ($this->roundId) {
$htmlDiv = \MUtil_Html::div();
if ($this->showTitle) {
$htmlDiv->h3(sprintf($this->_('%s round'), $this->trackEngine->getName()));
}
$table = parent::getHtmlOu... | Create the snippets content
This is a stub function either override getHtmlOutput() or override render()
@param \Zend_View_Abstract $view Just in case it is needed here
@return \MUtil_Html_HtmlInterface Something that can be rendered | entailment |
protected function getMenuList()
{
$links = $this->menu->getMenuList();
$links->addParameterSources($this->request, $this->menu->getParameterSource());
$source = new \Gems_Menu_ParameterSource(array(
'gro_id_track' => $this->trackId,
'gro_id_round' => $this->trackEng... | overrule to add your own buttons.
@return \Gems_Menu_MenuList | entailment |
protected function addModelSettings(array &$settings)
{
$empty = $this->util->getTranslated()->getEmptyDropdownArray();
$settings['elementClass'] = 'Select';
$settings['multiOptions'] = $empty + $this->getLookup();
} | Add the model settings like the elementClass for this field.
elementClass is overwritten when this field is read only, unless you override it again in getDataModelSettings()
@param array $settings The settings set so far | entailment |
public function calculateFieldInfo($currentValue, array $fieldData)
{
if (! $currentValue) {
return $currentValue;
}
$lookup = $this->getLookup();
if (isset($lookup[$currentValue])) {
return $lookup[$currentValue];
}
return null;
} | Calculation the field info display for this type
@param array $currentValue The current value
@param array $fieldData The other values loaded so far
@return mixed the new value | entailment |
public function calculateFieldValue($currentValue, array $fieldData, array $trackData)
{
$calcUsing = $this->getCalculationFields($fieldData);
if ($calcUsing) {
$agenda = $this->getAgenda();
// Get the used fields with values
foreach (array_filter($calcUsing) as... | Calculate the field value using the current values
@param array $currentValue The current value
@param array $fieldData The other known field values
@param array $trackData The currently available track data (track id may be empty)
@return mixed the new value | entailment |
protected function getAgenda()
{
if (!$this->agenda) {
$this->agenda = $this->loader->getAgenda();
}
return $this->agenda;
} | Retreive the agenda if not injected
@return \Gems_Agenda | entailment |
public function getDataModelDependyChanges(array $context, $new)
{
if ($this->isReadOnly()) {
return null;
}
$empty = $this->util->getTranslated()->getEmptyDropdownArray();
$output['multiOptions'] = $empty + $this->getLookup($context['gr2t_id_organization']);
r... | Returns the changes to the model for this field that must be made in an array consisting of
<code>
array(setting1 => $value1, setting2 => $value2, ...),
</code>
By using [] array notation in the setting array key you can append to existing
values.
Use the setting 'value' to change a value in the original data.
When... | entailment |
public function createModel($detailed, $action)
{
$model = new \MUtil_Model_FolderModel(
GEMS_ROOT_DIR . '/var/logs',
null,
$this->recursive
);
if ($this->recursive) {
$model->set('relpath', 'label', $this->_('File (local)... | Creates a model for getModel(). Called only for each new $action.
The parameters allow you to easily adapt the model to the current action. The $detailed
parameter was added, because the most common use of action is a split between detailed
and summarized actions.
@param boolean $detailed True when the current action... | entailment |
public function deleteAction()
{
$model = $this->getModel();
$model->applyRequest($this->getRequest());
$model->delete();
$this->_reroute(array($this->getRequest()->getActionKey() => 'index', MUTil_Model::REQUEST_ID => null));
} | Confirm has been moved to javascript | entailment |
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: inli... | Action for downloading the file | entailment |
public function changePasswordAction()
{
if ($this->changePasswordSnippets) {
$params = $this->_processParameters($this->changePasswordParameters);
$this->addSnippets($this->changePasswordSnippets, $params);
}
} | Allow a user to change his / her password. | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.