sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
public function addCurrentParent($label = null)
{
$parent = $this->menu->getCurrentParent();
if ($parent && (! $parent->isTopLevel())) {
$this->addMenuItem($parent, $label);
}
return $this;
} | Adds the parent of the current menu item
Does nothing when the parent is a top level item (has no
controllor or is the \Gems_menu itself).
@param string $label Optional alternative label
@return \Gems_Menu_MenuList (continuation pattern) | entailment |
public function addCurrentSiblings($anyParameters = false, $includeCurrent = false)
{
if ($current = $this->menu->getCurrent()) {
if ($parent = $current->getParent()) {
$parameters = $current->getParameters();
if ($includeCurrent) {
$current = ... | Adds the siblings (= other children of the parent) of the current menu item to this list
@param boolean $anyParameters When false, siblings must have the same parameter set as the current menu item
@return \Gems_Menu_MenuList (continuation pattern) | entailment |
public function addMenuItem(\Gems_Menu_SubMenuItem $menuItem, $label = null)
{
$key = $this->_getKey($menuItem->get('controller'), $menuItem->get('action'));
if ($label) {
$this->altLabels[$key] = $label;
}
$this->offsetSet($key, $menuItem);
return $this;
} | Add a menu item to this list
@param \Gems_Menu_SubMenuItem $menuItem
@param string $label Optional alternative label
@return \Gems_Menu_MenuList (continuation pattern) | entailment |
public function getActionLink($controller, $action = 'index', $remove = false)
{
$key = $this->_getKey($controller, $action);
if ($this->offsetExists($key)) {
$result = $this->toActionLink($key);
if ($remove) {
$this->offsetUnset($key);
}
... | Get the action link for a specific item.
@param string $controller Controller name
@param string $action Action name
@param boolean $remove Optional, set to true to remove the item from this list.
@return \MUtil_Html_HtmlElement | entailment |
public function getActionLinks($remove, $contr1, $action1 = null, $contr2 = null, $action2 = null)
{
$args = func_get_args();
$count = func_num_args();
$results = new \MUtil_Html_Sequence();
$results->setGlue($this->getGlue());
for ($i = 1; $i < $count; $i += 2) {
... | Get the action links for the specified items.
@param boolean $remove Optional, set to true to remove the item from this list.
@param string $contr1 Controller name
@param string $action1 Action name, continues in pairs
@return \MUtil_Html_Sequence | entailment |
public function getFirstAction($remove = true)
{
foreach ($this->getArrayCopy() as $key => $item) {
if ($result = $this->toActionLink($key)) {
if ($remove) {
$this->offsetUnset($key);
}
return $result;
}
}... | Get the action link for a specific item.
@param boolean $remove Optional, set to true to remove the item from this list.
@return \MUtil_Html_HtmlElement | entailment |
public function render(\Zend_View_Abstract $view)
{
$html = '';
$glue = $this->getGlue();
foreach ($this->getIterator() as $key => $item) {
$html .= $glue;
if ($item instanceof \Gems_Menu_SubMenuItem) {
$item = $this->toActionLink($key);
... | Renders the element into a html string
The $view is used to correctly encode and escape the output
@param \Zend_View_Abstract $view
@return string Correctly encoded and escaped html output | entailment |
public function setLabel($controller, $action, $label)
{
$key = $this->_getKey($controller, $action);
$this->altLabels[$key] = $label;
return $this;
} | Changes the label for a specific menu item
@param string $controller Controller name
@param string $action Action name
@param string $label Alternative label
@return \Gems_Menu_MenuList (continuation pattern) | entailment |
public function showDisabled($value = true)
{
$this->sources[self::KEY_DISABLED] = (boolean) $value;
return $this;
} | Switches showing disabled menu items on or off (= default)
@param boolean $value
@return \Gems_Menu_MenuList (continuation pattern) | entailment |
public function get($parameter)
{
return isset($this->credentials[$parameter]) ? $this->credentials[$parameter] : null;
} | Get a single credential parameter.
@param string $parameter
@return mixed|null | entailment |
public function execute($respTrackData = null)
{
$batch = $this->getBatch();
$tracker = $this->loader->getTracker();
$respTrack = $tracker->getRespondentTrack($respTrackData);
$fieldsChanged = false;
$tokensChanged = $respTrack->recalculateFields($fieldsChanged);
... | 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 execute($tokenId = null)
{
$batch = $this->getBatch();
$tracker = $this->loader->getTracker();
$token = $tracker->getToken($tokenId);
$checked = $batch->addToCounter('ta-checkedTokens');
if ($token->inSource()) {
$survey = $token->getSurvey();... | 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 |
protected function createModel()
{
if (! $this->model instanceof LogModel) {
$this->model = $this->loader->getModels()->createLogModel();
$this->model->applyDetailSettings();
}
return $this->model;
} | Creates the model
@return \MUtil_Model_ModelAbstract | entailment |
protected function processFilterAndSort(\MUtil_Model_ModelAbstract $model)
{
if ($this->request->getParam('log')) {
$model->setFilter(array('gla_id' => $this->request->getParam('log')));
parent::processSortOnly($model);
} else {
parent::processFilterAndSort($model... | Overrule to implement snippet specific filtering and sorting.
@param \MUtil_Model_ModelAbstract $model | entailment |
protected function setShowTableFooter(\MUtil_Model_Bridge_VerticalTableBridge $bridge, \MUtil_Model_ModelAbstract $model)
{
$row = $bridge->getRow();
parent::setShowTableFooter($bridge, $model);
if (isset($row['gla_respondent_id'], $row['gla_organization']) &&
($this->menuL... | 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 |
protected function executeAction($from = null, $to = null)
{
$context = $this->getRequest()->getParam('id', 'gems');
$from = $this->getRequest()->getParam('from', $from);
$to = $this->getRequest()->getParam('to', $to);
$batch = $this->loader->getTaskRunnerBatch('upgrade' . $... | Executes the upgrades for a certain context
optional: give from and to levels
usage: execute/context/<context>{/from/int/to/int} | entailment |
public function indexAction()
{
$this->html->h2($this->getTopicTitle());
$displayColumns = array('link' => '',
'context' => $this->_('Context'),
'maxLevel' => $this->_('Max level'),
'level' => $t... | Overview of available contexts, max upgrade level and achieved upgrade level | entailment |
public function showAction()
{
$this->html->h2($this->getTopicTitle());
$context = $this->_getParam('id', 'gems');
$this->_upgrades->setContext($context);
if ($info = $this->_upgrades->getUpgradesInfo($context)) {
$this->html->table(array('class'=>'browser'))->tr()
... | Show the upgrades and level for a certain context
Usage: show/context/<context> | entailment |
protected function createModel($detailed, $action)
{
// Make sure the user is loaded
$user = $this->getSelectedUser();
if ($user) {
if (! ($this->currentUser->hasPrivilege('pr.staff.see.all') ||
$this->currentUser->isAllowedOrganization($user->getBaseOrganiza... | 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 getSearchDefaults()
{
$data = parent::getSearchDefaults();
if (! isset($data[\MUtil_Model::REQUEST_ID])) {
$data[\MUtil_Model::REQUEST_ID] = intval($this->_getIdParam());
}
return $data;
} | Function to allow the creation of search defaults in code
@see getSearchFilter()
@return array | entailment |
public function getSelectedUser()
{
static $user = null;
if ($user !== null) {
return $user;
}
$staffId = $this->_getIdParam();
if ($staffId) {
$user = $this->loader->getUserLoader()->getUserByStaffId($staffId);
$source = $this->menu->g... | Load the user selected by the request - if any
@staticvar \Gems_User_User $user
@return \Gems_User_User or false when not available | entailment |
public function hasHtmlOutput()
{
if ($this->trackEngine && (! $this->trackId)) {
$this->trackId = $this->trackEngine->getTrackId();
}
if ($this->trackId) {
// Try to get $this->trackEngine filled
if (! $this->trackEngine) {
// Set the eng... | 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 loadFormData()
{
parent::loadFormData();
if ($this->createData && !$this->request->isPost()) {
$this->formData = $this->trackEngine->getRoundDefaults() + $this->formData;
}
// Check the survey name
$surveys = $this->util->getTrackData()->getAl... | Hook that loads the form data from $_POST or the model
Or from whatever other source you specify here. | entailment |
protected function saveData()
{
parent::saveData();
if ($this->createData && (! $this->roundId)) {
$this->roundId = $this->formData['gro_id_round'];
}
if ($this->formData['gro_valid_for_source'] == 'tok'
&& $this->formData['gro_valid_for_field'] == 'gto_valid... | Hook containing the actual save code.
Call's afterSave() for user interaction.
@see afterSave() | entailment |
public function getRespondent()
{
if (! $this->_respondent) {
$patientNumber = $this->_getParam(\MUtil_Model::REQUEST_ID1);
$organizationId = $this->_getParam(\MUtil_Model::REQUEST_ID2);
$this->_respondent = $this->loader->getRespondent($patientNumber, $organizationId);... | Get the respondent object
@return \Gems_Tracker_Respondent | entailment |
public function execute($userId = 0)
{
$batch = $this->getBatch();
if ($batch->getCounter('movestarted') === 0) {
$batch->addToCounter('movestarted');
$select = $this->loader->getTracker()->getTokenSelect(['total' => new \Zend_Db_Expr('count(*)')])->andReceptionCodes([])->onl... | 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 executeIteration($userId = 0)
{
$tracker = $this->loader->getTracker();
$select = $tracker->getTokenSelect()->andReceptionCodes([])->onlyCompleted()->onlySucces()->forSurveyId($this->sourceSurveyId)->getSelect()->limit(1);
$results = $this->db->fetchAll($select);
$b... | Execute a single iteration of the task.
@param array $params The parameters to the execute function | entailment |
public function isFinished()
{
$batch = $this->getBatch();
if ($this->_finished) {
$batch->resetCounter('movestarted');
$moved = $batch->getCounter('moved');
$notFound = $batch->getCounter('notfound');
$this->getBatch()->addMessage(
... | Return true when the task has finished.
@return boolean | entailment |
public function applyBrowseSettings()
{
$dbLookup = $this->util->getDbLookup();
$definitions = $this->loader->getUserLoader()->getAvailableStaffDefinitions();
$localized = $this->util->getLocalized();
$projectName = $this->project->getName();
$yesNo = $this->util->... | Set those settings needed for the browse display
@return \Gems_Model_OrganizationModel | entailment |
public function applyDetailSettings()
{
$commUtil = $this->util->getCommTemplateUtil();
$staffTemplates = $commUtil->getCommTemplatesForTarget('staffPassword', null, true);
$this->applyBrowseSettings();
$this->set('gor_welcome', 'label', $this->_('Greeting'),
... | Set those settings needed for the detailed display
@return \Gems_Model_OrganizationModel | entailment |
public function applyEditSettings()
{
$this->applyDetailSettings();
$this->resetOrder();
$yesNo = $this->util->getTranslated()->getYesNo();
// GENERAL TAB
$this->set('gor_name',
'size', 25,
'validator', $this->createUniqueValidator('gor_name'... | Set those values needed for editing
@return \Gems_Model_OrganizationModel | entailment |
public function processAfterLoad($data, $new = false, $isPostData = false)
{
$data = parent::processAfterLoad($data, $new, $isPostData);
if ($data instanceof \Traversable) {
$data = iterator_to_array($data);
}
foreach ($data as &$row) {
if (isset($row['gor_us... | Helper function that procesess the raw data after a load.
@see \MUtil_Model_SelectModelPaginator
@param mixed $data Nested array or \Traversable containing rows or iterator
@param boolean $new True when it is a new item
@param boolean $isPostData With post data, unselected multiOptions values are not set so should be... | entailment |
public function save(array $newValues, array $filter = null, array $saveTables = null)
{
//First perform a save
$savedValues = parent::save($newValues, $filter, $saveTables);
//Now check if we need to save config values
if (isset($newValues['gor_user_class']) && !empty($newValues['g... | Save a single model item.
Makes sure the password is saved too using the userclass
@param array $newValues The values to store for a single model item.
@param array $filter If the filter contains old key values these are used
to decide on update versus insert.
@param array $saveTables Optional array containing the ta... | entailment |
protected function getExportModel()
{
$model = parent::getExportModel();
$model->del('allowed', 'formatFunction');
$model->del('denied', 'formatFunction');
$model->set('menu', 'formatFunction', [$this, 'changeArrow']);
return $model;
} | Get the model for export and have the option to change it before using for export
@return | entailment |
protected function getPrivileges()
{
if (!$this->privileges) {
$privileges = [];
$allExisting = $this->getUsedPrivileges();
foreach ($this->acl->getPrivilegeRoles() as $privilege => $roles) {
$privileges[$privilege]['privilege'] = $privilege;
... | Get list of privileges, their menu options and which role is allowed or denied this specific privilege
@return array list of privileges | entailment |
protected function setNonExistent($nonexistent)
{
if ($nonexistent) {
$translatedNonexistent = [];
foreach($nonexistent as $right=>$values) {
foreach($values as $key=>$value) {
if ($key == 'menu') {
continue;
... | Set assigned but nonexistent privileges and a snippet at the bottom of the page
@param array $nonexistent list of assigned but nonexistent privileges | entailment |
public function getVersion()
{
$version = $this->getProjectVersion();
if (APPLICATION_ENV !== 'production' && APPLICATION_ENV !== 'acceptance' && APPLICATION_ENV !== 'demo') {
$version .= '.' . $this->getBuild() . ' [' . APPLICATION_ENV . ']';
}
return $version;
} | The long string versions
@return string | entailment |
public function resampleImage()
{
$extension = strtolower($this->owner->getExtension());
if($this->owner->getHeight() > $this->getMaxX() || $this->owner->getWidth() > $this->getMaxY()) {
$original = $this->owner->getFullPath();
$resampled = $original. '.tmp.'. $extension;
... | Resamples the image to the maximum Height and Width | entailment |
protected function addModelSettings(array &$settings)
{
$concatter = new \MUtil_Model_Type_ConcatenatedRow(parent::FIELD_SEP, ' ', false);
$multi = explode(parent::FIELD_SEP, $this->_fieldDefinition['gtf_field_values']);
$settings = $concatter->getSettings() + $settings;
$setti... | 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 onFieldDataSave($currentValue, array $fieldData)
{
if (is_array($currentValue)) {
return implode(parent::FIELD_SEP, $currentValue);
}
return $currentValue;
} | Converting the field value when saving to a respondent track
@param array $currentValue The current value
@param array $fieldData The other values loaded so far
@return mixed the new value | entailment |
public function filter($value)
{
$values = explode(' ', $value);
foreach ($values as &$val) {
if (substr($val, -1) === '/') {
$val = substr($val, 0, -1);
}
}
return implode(' ', $values);
} | Returns the result of filtering $value
@param mixed $value
@throws \Zend_Filter_Exception If filtering $value is impossible
@return mixed | entailment |
public function array_filter($inputArray, $model)
{
$outputArray = array();
foreach ($inputArray as $key => $value) {
// Null and empty string are skipped
if (is_null($value) || $value === '') {
continue;
}
// Maybe do a check on multiO... | Strip elements from the array that are considered empty
Empty is NULL or empty string, values of 0 are NOT empty unless they are a checkbox
@param type $inputArray
@param type $model
@return boolean | entailment |
public function filterAnswers(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model, array $currentNames)
{
$rows = $bridge->getRows();
if (! $rows) {
return $currentNames;
}
$keys = array();
foreach ($rows as $row) {
// Add the k... | This function is called in addBrowseTableColumns() to filter the names displayed
by AnswerModelSnippetGeneric.
@see \Gems_Tracker_Snippets_AnswerModelSnippetGeneric
@param \MUtil_Model_Bridge_TableBridge $bridge
@param \MUtil_Model_ModelAbstract $model
@param array $currentNames The current names in use (allows chain... | entailment |
protected function afterLoad()
{
if ($this->_data) {
$this->_value = $this->_data['gaf_filter_text4'];
$filter[] = $this->_data['gaf_filter_text1'];
$filter[] = $this->_data['gaf_filter_text2'];
$filter[] = $this->_data['gaf_filter_text3'];
$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 matchEpisode(EpisodeOfCare $episode)
{
$data = $episode->getDiagnosisData();
if (! $data) {
return true;
}
if (!is_string($data)) {
$data = json_encode($data);
}
$regex = $this->getRegex();
if ((boolean) preg_match($r... | Check a filter for a match
@param \Gems\Agenda\EpisodeOfCare $episode
@return boolean | entailment |
public function createModel($detailed, $action)
{
$model = $this->loader->getModels()->getCommLogModel($detailed);
if (! $detailed) {
$model->addFilter(array(
'gr2o_patient_nr' => $this->_getParam(\MUtil_Model::REQUEST_ID1),
'gr2o_id_organization' => $thi... | 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()
{
$respondent = $this->getRespondent();
if ($respondent) {
return sprintf(
$this->_('Communication activity log for respondent %s: %s'),
$respondent->getPatientNumber(),
$respondent->getName()
... | Helper function to get the informed title for the index action.
@return $string | entailment |
public function getRespondent()
{
if (! $this->_respondent instanceof \Gems_Tracker_Respondent) {
if ($this->_getParam(\MUtil_Model::REQUEST_ID1) && $this->_getParam(\MUtil_Model::REQUEST_ID2)) {
$this->_respondent = parent::getRespondent();
} else {
... | Get the respondent object
@return \Gems_Tracker_Respondent | entailment |
public function getSearchFilter($useRequest = true)
{
$filter = parent::getSearchFilter($useRequest);
$where = \Gems_Snippets_AutosearchFormSnippet::getPeriodFilter($filter, $this->db);
if ($where) {
$filter[] = $where;
}
return $filter;
} | Get the filter to use with the model for searching
@param boolean $useRequest Use the request as source (when false, the session is used)
@return array or false | entailment |
public function isValid($value, $context = array())
{
$result = $this->_user->authenticate($value);
return $this->setAuthResult($result);
} | Returns true if and only if $value meets the validation requirements
If $value fails validation, then this method returns false, and
getMessages() will return an array of messages that explain why the
validation failed.
@param mixed $value
@param mixed $content
@return boolean
@throws \Zend_Validate_Exception If va... | entailment |
public function execute($lineNr = null, $roundData = null)
{
$batch = $this->getBatch();
$import = $batch->getVariable('import');
if (! (isset($import['trackId']) && $import['trackId'])) {
// Do nothing
return;
}
// Only save when export code is kno... | 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 |
protected function _createTrack($filter, $tracker)
{
$trackData = array('gr2t_comment' => sprintf(
$this->_('Track created by %s filter'),
$filter->getName()
));
$fields = array($filter->getFieldId() => $this->getId());
... | Create a new track for this appointment and the given filter
@param \Gems\Agenda\AppointmentFilterInterface $filter
@param \Gems_Tracker $tracker | entailment |
protected function _ensureRespondentOrgData()
{
if (! isset($this->_gemsData['gr2o_id_user'], $this->_gemsData['gco_code'])) {
$sql = "SELECT *
FROM gems__respondents INNER JOIN
gems__respondent2org ON grs_id_user = gr2o_id_user INNER JOIN
... | Makes sure the respondent data is part of the $this->_gemsData | entailment |
protected function checkCreateTracks($filters, $existingTracks, $tracker)
{
$tokenChanges = 0;
// Check for tracks that should be created
foreach ($filters as $filter) {
if (!$filter->isCreator()) {
continue;
}
$createTrack = true;
... | Check if a track should be created for any of the filters
@param \Gems\Agenda\AppointmentFilterInterface[] $filters
@param array $existingTracks
@param \Gems_Tracker $tracker
@return int Number of tokenchanges | entailment |
public function createAfterWaitDays($filter, $respTrack)
{
$createTrack = true;
$curr = $this->getAdmissionTime();
$end = $respTrack->getEndDate();
$wait = $filter->getWaitDays();
if ( (! $end) || ($curr->diffDays($end) <= $wait)) {
$cre... | Has the track ended <wait days> ago?
@param \Gems\Agenda\AppointmentFilterInterface $filter
@param \Gems_Tracker_RespondentTrack $respTrack
@return boolean | entailment |
public function createAlways($filter, $respTrack)
{
$createTrack = $this->createAfterWaitDays($filter, $respTrack);
if ($createTrack) {
$createTrack = $this->createWhenNotInThisTrack($filter, $respTrack);
}
return $createTrack;
} | Always report the track should be created
@param \Gems\Agenda\AppointmentFilterInterface $filter
@param \Gems_Tracker_RespondentTrack $respTrack
@return boolean | entailment |
public function createFromStart($filter, $respTrack)
{
$createTrack = true;
$curr = $this->getAdmissionTime();
$start = $respTrack->getStartDate();
$wait = $filter->getWaitDays();
if ((! $start) || ($curr->diffDays($start) <= $wait)) {
$create... | Always report the track should be created
@param \Gems\Agenda\AppointmentFilterInterface $filter
@param \Gems_Tracker_RespondentTrack $respTrack
@return boolean | entailment |
public function createNoOpen($filter, $respTrack)
{
// If an open track of this type exists: do not create a new one
$createTrack = !$respTrack->isOpen();
if ($createTrack) {
$createTrack = $this->createWhenNotInThisTrack($filter, $respTrack);
}
return $createTr... | Only return true when no open track exists
@param \Gems\Agenda\AppointmentFilterInterface $filter
@param \Gems_Tracker_RespondentTrack $respTrack
@return boolean | entailment |
public function createWhenNotInThisTrack($filter, $respTrack)
{
$createTrack = true;
$data = $respTrack->getFieldData();
if (isset($data[$filter->getFieldId()]) &&
($this->getId() == $data[$filter->getFieldId()])) {
$createTrack = false;
}
return... | Create when current appointment is not assigned to this field already
@param \Gems\Agenda\AppointmentFilterInterface $filter
@param \Gems_Tracker_RespondentTrack $respTrack
@return boolean | entailment |
public function createWhenNoOpen($filter, $respTrack)
{
// If an open track of this type exists: do not create a new one
$createTrack = !$respTrack->isOpen();
if ($createTrack) {
$createTrack = $this->createAfterWaitDays($filter, $respTrack);
}
if ($createTrack)... | Only return true when no open track exists
@param \Gems\Agenda\AppointmentFilterInterface $filter
@param \Gems_Tracker_RespondentTrack $respTrack
@return boolean | entailment |
public function getAdmissionTime()
{
if (isset($this->_gemsData['gap_admission_time']) && $this->_gemsData['gap_admission_time']) {
if (! $this->_gemsData['gap_admission_time'] instanceof \MUtil_Date) {
$this->_gemsData['gap_admission_time'] =
new \MUtil_D... | Return the admission time
@return \MUtil_Date Admission time as a date or null | entailment |
public function getDisplayString()
{
$results[] = $this->getAdmissionTime()->toString($this->agenda->appointmentDisplayFormat);
$results[] = $this->getActivityDescription();
$results[] = $this->getProcedureDescription();
$results[] = $this->getLocationDescription();
$results[... | Get a general description of this appointment
@see \Gems_Agenda->getAppointmentDisplay()
@return string | entailment |
public function getProcedureDescription()
{
if (! (isset($this->_gemsData['gap_id_procedure']) && $this->_gemsData['gap_id_procedure'])) {
return null;
}
if (!array_key_exists('gapr_name', $this->_gemsData)) {
$sql = "SELECT gapr_name FROM gems__agenda_procedures WHER... | Return the description of the current procedure
@return string or null when not found | entailment |
public function getRespondent()
{
return $this->loader->getRespondent(
$this->getPatientNumber(),
$this->getOrganizationId(),
$this->getRespondentId())
;
} | Return the respondent object
@return \Gems_Tracker_Respondent | entailment |
public function isActive()
{
return $this->exists &&
isset($this->_gemsData['gap_status']) &&
$this->agenda->isStatusActive($this->_gemsData['gap_status']);
} | Return true when the status is active
@return type | entailment |
public function updateTracks()
{
$tokenChanges = 0;
$tracker = $this->loader->getTracker();
// Find all the fields that use this agenda item
$select = $this->db->select();
$select->from('gems__respondent2track2appointment', array('gr2t2a_id_respondent_track'))
... | Recalculate all tracks that use this appointment
@return int The number of tokens changed by this code | entailment |
private function _deleteCache()
{
if ($this->_cache instanceof \Zend_Cache_Core) {
$this->_cache->remove($this->_cacheid);
$this->_cache->remove($this->_cacheid . 'trans');
}
} | Empty this cache instance | entailment |
private function _expandRole(&$roleList, $roleName, $depth = 0)
{
$role = $roleList[$roleName];
if (isset($role['marked']) && $role['marked']) {
return;
}
// possible circular reference!
if ($depth > 5) {
throw new \Exception("Possible circular refer... | Recursively expands roles into \Zend_Acl_Role objects
@param array $roleList
@param string $roleName | entailment |
private function _initAcl()
{
$this->_acl = new \MUtil_Acl();
if (get_class(self::$_instanceOfSelf)!=='Gems_Roles') {
throw new \Gems_Exception_Coding("Don't use project specific roles file anymore, you can now do so by using the gems_roles tabel and setup->roles from the interface.");
... | Reset de ACL en bouw opnieuw op | entailment |
private function _save()
{
if ($this->_cache instanceof \Zend_Cache_Core) {
if (! (
$this->_cache->save($this->_acl, $this->_cacheid, array('roles'), null) &&
$this->_cache->save($this->_roleTranslations, $this->_cacheid . 'trans', array('roles'), null)
... | Save to cache
@throws \Gems_Exception | entailment |
public static function getInstance()
{
if (!isset(self::$_instanceOfSelf)) {
$c = __CLASS__;
self::$_instanceOfSelf = new $c;
}
return self::$_instanceOfSelf;
} | Static acces function
@return \Gems_Roles | entailment |
public function load()
{
if ($this->_cache instanceof \Zend_Cache_Core) {
$cache = $this->_cache;
if (! ($cache->test($this->_cacheid) && $cache->test($this->_cacheid . 'trans'))) {
// cache miss
$this->build();
} else {
// ... | Load the ACL values either from the cache or from build() | entailment |
public function loadDbAcl()
{
$db = \Zend_Registry::get('db');
$sql = "SELECT grl_id_role, grl_name, grl_privileges, grl_parents FROM gems__roles";
$roles = $db->fetchAll($sql);
if (empty($roles)) {
throw new \Exception("No roles stored in db");
}
// S... | Load access control list from db
@throws \Exception | entailment |
public function translateToRoleId($role)
{
$lookup = array_flip($this->_roleTranslations);
if (isset($lookup[$role])) {
return $lookup[$role];
}
return $role;
} | Translate string role id to numeric role id
@param string $role
@return array Of role id's | entailment |
public function translateToRoleIds($roles)
{
if (!is_array($roles)) {
if ($roles) {
$roles = explode(",", $roles);
} else {
$roles = array();
}
}
$lookup = array_flip($this->_roleTranslations);
foreach ($roles as $... | Translate all string role id's to numeric role ids
@param mixed $roles string or array
@return array Of role id's | entailment |
public function translateToRoleName($role)
{
if (isset($this->_roleTranslations[$role])) {
return $this->_roleTranslations[$role];
}
return $role;
} | Translate numeric role id to string name
@param int $role
@return string | entailment |
public function translateToRoleNames($roles)
{
if (!is_array($roles)) {
if ($roles) {
$roles = explode(",", $roles);
} else {
$roles = array();
}
}
foreach ($roles as $key => $role) {
if (isset($this->_roleTransl... | Translate all numeric role id's to string names
@param mixed $roles string or array
@return array | entailment |
public function getTab()
{
//pseudo constructor to catch more constants
$constants = get_defined_constants(true);
$this->_userConstants = $constants['user'];
ksort($this->_userConstants);
$count = count($this->_userConstants);
return "Constants ($count)";
} | Gets menu tab for the Debugbar
@return string | entailment |
public function getInstance($name, $model, $data)
{
$instance = $this->_loadClass($name, true, array($model, $data));
return $instance;
} | Returns an instance (row) of the the model, this allows for easy loading of instances
Best usage would be to load from within the model, so return type can be
fixed there and code completion would work like desired
@param string $name
@param \MUtil_Model_ModelAbstract $model
@param array $data
@return mixed | entailment |
public function getRespondent($patientId, $organizationId, $respondentId = null)
{
if ($patientId) {
if (isset($this->_respondents[$organizationId][$patientId])) {
return $this->_respondents[$organizationId][$patientId];
}
}
$newResp = $this->_loadClas... | Get a respondent object
@param string $patientId Patient number, you can use $respondentId instead
@param int $organizationId Organization id
@param int $respondentId Optional respondent id, used when patient id is empty
@return \Gems_Tracker_Respondent | entailment |
public function getFieldId()
{
if (isset($this->_data['gtap_id_app_field']) && $this->_data['gtap_id_app_field']) {
return FieldsDefinition::makeKey(
FieldMaintenanceModel::APPOINTMENTS_NAME,
$this->_data['gtap_id_app_field']
);
... | The field id as it is recognized be the track engine
@return string | entailment |
public function getWaitDays()
{
if (isset($this->_data['gtap_create_wait_days'], $this->_data['gtap_create_track']) &&
$this->_data['gtap_create_track']) {
return intval($this->_data['gtap_create_wait_days']);
}
} | The number of days to wait between track creation
@return int or null when no track creation or no wait days | entailment |
public function serialize() {
$data = array();
foreach (get_object_vars($this) as $name => $value) {
if (! $this->filterRequestNames($name)) {
$data[$name] = $value;
}
}
return serialize($data);
} | By default only object variables starting with '_' are serialized in order to
avoid serializing any resource types loaded by
\MUtil_Translate_TranslateableAbstract
@return string | entailment |
function GeSHi($source = '', $language = '', $path = '') {
if (!empty($source)) {
$this->set_source($source);
}
if (!empty($language)) {
$this->set_language($language);
}
$this->set_language_path($path);
} | Creates a new GeSHi object, with source and language
@param string The source code to highlight
@param string The language to highlight the source with
@param string The path to the language file directory. <b>This
is deprecated!</b> I've backported the auto path
detection from the 1.1.X dev branch, so now it
should b... | entailment |
function error() {
if ($this->error) {
//Put some template variables for debugging here ...
$debug_tpl_vars = array(
'{LANGUAGE}' => $this->language,
'{PATH}' => $this->language_path
);
$msg = str_replace(
array_keys... | Returns an error message associated with the last GeSHi operation,
or false if no error has occured
@return string|false An error message if there has been an error, else false
@since 1.0.0 | entailment |
function set_language($language, $force_reset = false) {
if ($force_reset) {
$this->loaded_language = false;
}
//Clean up the language name to prevent malicious code injection
$language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language);
$language = strtolower($lang... | Sets the language for this object
@note since 1.0.8 this function won't reset language-settings by default anymore!
if you need this set $force_reset = true
@param string The name of the language to use
@since 1.0.0 | entailment |
function set_language_path($path) {
if ($path) {
$this->language_path = ('/' == $path[strlen($path) - 1]) ? $path : $path . '/';
$this->set_language($this->language); // otherwise set_language_path has no effect
}
} | Sets the path to the directory containing the language files. Note
that this path is relative to the directory of the script that included
geshi.php, NOT geshi.php itself.
@param string The path to the language directory
@since 1.0.0
@deprecated The path to the language files should now be automatically
detected, so t... | entailment |
function set_keyword_group_style($key, $style, $preserve_defaults = false) {
//Set the style for this keyword group
if (!$preserve_defaults) {
$this->language_data['STYLES']['KEYWORDS'][$key] = $style;
} else {
$this->language_data['STYLES']['KEYWORDS'][$key] .= $style;
... | Sets the style for a keyword group. If $preserve_defaults is
true, then styles are merged with the default styles, with the
user defined styles having priority
@param int The key of the keyword group to change the styles of
@param string The style to make the keywords
@param boolean Whether to merge the new style... | entailment |
function set_keyword_group_highlighting($key, $flag = true) {
$this->lexic_permissions['KEYWORDS'][$key] = ($flag) ? true : false;
} | Turns highlighting on/off for a keyword group
@param int The key of the keyword group to turn on or off
@param boolean Whether to turn highlighting for that group on or off
@since 1.0.0 | entailment |
function set_symbols_style($style, $preserve_defaults = false, $group = 0) {
// Update the style of symbols
if (!$preserve_defaults) {
$this->language_data['STYLES']['SYMBOLS'][$group] = $style;
} else {
$this->language_data['STYLES']['SYMBOLS'][$group] .= $style;
... | Sets the styles for symbols. If $preserve_defaults is
true, then styles are merged with the default styles, with the
user defined styles having priority
@param string The style to make the symbols
@param boolean Whether to merge the new styles with the old or just
to overwrite them
@param int Tells the group of s... | entailment |
function set_symbols_highlighting($flag) {
// Update lexic permissions for this symbol group
$this->lexic_permissions['SYMBOLS'] = ($flag) ? true : false;
// For backward compatibility
$this->set_brackets_highlighting ($flag);
} | Turns highlighting on/off for symbols
@param boolean Whether to turn highlighting for symbols on or off
@since 1.0.0 | entailment |
function set_regexps_style($key, $style, $preserve_defaults = false) {
if (!$preserve_defaults) {
$this->language_data['STYLES']['REGEXPS'][$key] = $style;
} else {
$this->language_data['STYLES']['REGEXPS'][$key] .= $style;
}
} | Sets the styles for regexps. If $preserve_defaults is
true, then styles are merged with the default styles, with the
user defined styles having priority
@param string The style to make the regular expression matches
@param boolean Whether to merge the new styles with the old or just
to overwrite them
@since 1.0.0 | entailment |
function add_keyword_group($key, $styles, $case_sensitive = true, $words = array()) {
$words = (array) $words;
if (empty($words)) {
// empty word lists mess up highlighting
return false;
}
//Add the new keyword group internally
$this->language_data['KEYW... | Creates a new keyword group
@param int The key of the keyword group to create
@param string The styles for the keyword group
@param boolean Whether the keyword group is case sensitive ornot
@param array The words to use for the keyword group
@since 1.0.0 | entailment |
function optimize_keyword_group($key) {
$this->language_data['CACHED_KEYWORD_LISTS'][$key] =
$this->optimize_regexp_list($this->language_data['KEYWORDS'][$key]);
} | compile optimized regexp list for keyword group
@param int The key of the keyword group to compile & optimize
@since 1.0.8 | entailment |
function handle_multiline_regexps($matches) {
$before = $this->_hmr_before;
$after = $this->_hmr_after;
if ($this->_hmr_replace) {
$replace = $this->_hmr_replace;
$search = array();
foreach (array_keys($matches) as $k) {
$search[] = '\\' . $k;... | handles newlines in REGEXPS matches. Set the _hmr_* vars before calling this
@note this is a callback, don't use it directly
@param array the matches array
@return string
@since 1.0.8
@access private | entailment |
function header() {
// Get attributes needed
/**
* @todo Document behaviour change - class is outputted regardless of whether
* we're using classes or not. Same with style
*/
$attributes = ' class="' . $this->language;
if ($this->overall_class != '') ... | Creates the header for the code block (with correct attributes)
@return string The header for the code block
@since 1.0.0
@access private | entailment |
public function getHtmlOutput(\Zend_View_Abstract $view)
{
if ($this->contentTitle) {
return \MUtil_Html::create($this->tagName, $this->contentTitle, array('class' => 'title'));
}
} | 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 addCancelButton()
{
$cancelUrl = [
$this->request->getControllerKey() => $this->request->getControllerName(),
$this->request->getActionKey() => $this->request->getActionName(),
$this->resetParam => 1,
];
$element =... | Simple default function for making sure there is a $this->_saveButton.
As the save button is not part of the model - but of the interface - it
does deserve it's own function. | entailment |
protected function addFormElements(\Zend_Form $form)
{
if (! $this->user->hasTwoFactor()) {
return;
}
$this->saveLabel = $this->_('Check code');
$options = [
'label' => $this->_('Enter authenticator code'),
'description' => $this->_('From t... | Add the elements to the form
@param \Zend_Form $form | entailment |
public function afterRegistry()
{
parent::afterRegistry();
$this->routeController = $this->request->getControllerName();
$this->routeAction = $this->request->getActionName();
if ($this->loginStatusTracker->hasUser()) {
$this->user = $this->loginStatusTracker->getUse... | Called after the check that all required registry values
have been set correctly has run.
This function is no needed if the classes are setup correctly
@return void | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.