sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function getLoginLinkElement() { $element = $this->getElement($this->_tokenFieldName); if (! $element) { // Login link if ($link = $this->getLoginLink()) { $element = new \MUtil_Form_Element_Html($this->_loginLinkFieldName); // $element...
Returns a link to the login page @return \MUtil_Form_Element_Html
entailment
public function getUserNameElement() { $element = $this->getElement($this->usernameFieldName); if (! $element) { $element = parent::getUserNameElement(); $element->addValidator(new \Gems_User_Validate_ResetRequestValidator($this, $this->translate)); } retur...
Returns/sets a login name element. @return \Zend_Form_Element_Text
entailment
public function loadDefaultElements() { $this->getOrganizationElement(); $this->getUserNameElement(); $this->getSubmitButton(); $this->getLoginLinkElement(); return $this; }
The function that determines the element load order @return \Gems_User_Form_LoginForm (continuation pattern)
entailment
public function autofilterAction($resetMvc = true) { if ($resetMvc && $this->enableScreens) { $group = $this->currentUser->getGroup(); if ($group) { $browse = $group->getRespondentBrowseScreen(); if ($browse) { // All are arrays, ...
The automatically filtered result @param $resetMvc When true only the filtered resulsts
entailment
public function changeOrganizationAction() { if ($this->changeOrganizationSnippets) { $params = $this->_processParameters( $this->changeOrganizationParameters + $this->editParameters + $this->createEditParameters + [...
Action to change a users
entailment
public function createAction() { if ($this->enableScreens) { $edit = false; $org = $this->getRespondent()->getOrganization(); if (! $org) { $org = $this->currentOrganization; } if ($org) { $edit = $org->getResponde...
Action for showing a create new item page
entailment
public function editAction() { if ($this->enableScreens) { $edit = false; $org = $this->getRespondent()->getOrganization(); if ($org) { $edit = $org->getRespondentEditScreen(); } if (! $edit) { $group = $this->cur...
Action for showing a edit item page with extra title
entailment
public function exportArchiveAction() { $params = $this->_processParameters($this->showParameters); $this->addSnippets($this->exportSnippets, $params); $this->html->h2($this->_('Export respondent archive')); //Now show the export form $export = $this->loader->getRespondent...
Action for dossier export
entailment
public function getEditLink() { $request = $this->getRequest(); $item = $this->menu->find(array( $request->getControllerKey() => $request->getControllerName(), $request->getActionKey() => 'edit', 'allowed' => true)); if ($item) { return $item...
Get the link to edit respondent @return \MUtil_Html_HrefArrayAttribute
entailment
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()); ...
Helper function to get the title for the edit action. @return $string
entailment
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 @return array
entailment
public function getRespondentId() { // The actions do not set an respondent id if (in_array($this->getRequest()->getActionName(), $this->summarizedActions)) { return null; } return parent::getRespondentId(); }
Retrieve the respondent id (So we don't need to repeat that for every snippet.) @return int
entailment
public function getSearchData($useRequest = true) { $data = parent::getSearchData($useRequest); if (isset($data[\MUtil_Model::REQUEST_ID2])) { $orgs = intval($data[\MUtil_Model::REQUEST_ID2]); } else { $orgs = $this->currentUser->getRespondentOrgFilter(); } ...
Get the data to use for searching: the values passed in the request + any defaults used in the search form (or any other search request mechanism). It does not return the actual filter used in the query. @see getSearchFilter() @param boolean $useRequest Use the request as source (when false, the session is used) @re...
entailment
public function getSearchDefaults() { if (! isset($this->defaultSearchData[\MUtil_Model::REQUEST_ID2])) { if ($this->currentUser->hasPrivilege('pr.respondent.multiorg') && (! $this->currentOrganization->canHaveRespondents())) { $this->defaultSearchData[\MUtil_...
Function to allow the creation of search defaults in code @see getSearchFilter() @return array
entailment
public function getSearchFilter($useRequest = true) { $filter = parent::getSearchFilter($useRequest); if (isset($filter['gr2t_id_track']) && $filter['gr2t_id_track']) { switch ($filter['gr2t_id_track']) { case 'show_without_track': $filter[] = "NOT EX...
Get the filter to use with the model for searching including model sorts, etc.. @param boolean $useRequest Use the request as source (when false, the session is used) @return array or false
entailment
public function indexAction() { $group = $this->currentUser->getGroup(); if ($group && $this->enableScreens) { $browse = $group->getRespondentBrowseScreen(); if ($browse) { if ($browse instanceof ProcessModelInterface) { $browse->processMo...
Overrule default index for the case that the current organization cannot have users.
entailment
public function overviewAction() { if ($this->overviewSnippets) { $params = $this->_processParameters($this->overviewParameters); $menuList = $this->menu->getMenuList(); $menuList->addParameterSources($this->request, $this->menu->getParameterSource()); $...
Action for showing overview for a patient
entailment
public function showAction() { if ($this->enableScreens) { $show = false; $org = $this->getRespondent()->getOrganization(); if ($org) { $show = $org->getRespondentShowScreen(); } if (! $show) { $group = $this->curr...
Action for showing an item page with title
entailment
public function simpleApiAction() { $this->disableLayout(); $data = $this->getRequest()->getParams(); $importLoader = $this->loader->getImportLoader(); $model = $this->getModel(); $translator = new \Gems_Model_Translator_RespondentTranslator($this->_('Direct...
Action for a simple - usually command line - import
entailment
public function undeleteAction() { if ($this->deleteSnippets) { $params = $this->_processParameters($this->deleteParameters); $this->addSnippets($this->deleteSnippets, $params); } }
Action for showing a delete item page
entailment
public function getSqlWhereBoth($toApps) { $appWheres = array(); $epiWheres = array(); foreach ($this->_subFilters as $filterObject) { if ($filterObject instanceof AppointmentFilterInterface) { $toApp = $filterObject->preferAppointmentSql(); ...
Generate a where statement to filter the appointment model @param boolean $toApps Whether to return appointment or episode SQL @return string
entailment
public function matchAppointment(\Gems_Agenda_Appointment $appointment) { foreach ($this->_subFilters as $filterObject) { if ($filterObject instanceof AppointmentFilterInterface) { if ($filterObject->matchAppointment($appointment)) { return true; ...
Check a filter for a match @param \Gems\Agenda\Gems_Agenda_Appointment $appointment @return boolean
entailment
public function matchEpisode(EpisodeOfCare $episode) { foreach ($this->_subFilters as $filterObject) { if ($filterObject instanceof AppointmentFilterInterface) { if ($filterObject->matchEpisode($episode)) { return true; } } ...
Check a filter for a match @param \Gems\Agenda\EpisodeOfCare $episode @return boolean
entailment
public function checkRegistryRequestsAnswers() { if (! $this->db instanceof \Zend_Db_Adapter_Abstract) { return false; } $select = $this->db->select(); $select->from(['nw'=> 'gems__tokens'], [ 'gtrp_id_token_new' => 'gto_id_token', 'gtrp_created' ...
Should be called after answering the request to allow the Target to check if all required registry values have been set correctly. @return boolean False if required values are missing.
entailment
public function execute() { $row = $this->_stmt->fetch(); $batch = $this->getBatch(); $count = $batch->getCounter('inserted_token_replacements'); if ($row['gtrp_id_token_new'] == $this->_lastTokenId) { if (! $count) { $batch->addMessage($this->_('No toke...
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 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 ...
The diagnosis data of the episode translated from Json @return array of Json data
entailment
public function getDisplayString() { $results[] = $this->getStartDate()->toString($this->agenda->episodeDisplayFormat); $results[] = $this->getSubject(); $results[] = $this->getDiagnosis(); return implode($this->_('; '), array_filter($results)); }
Get a general description of this appointment @see \Gems_Agenda->getAppointmentDisplay() @return string
entailment
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 ...
The extra data of the episode translated from Json @return array of Json data
entailment
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['ge...
Return the start date @return \MUtil_Date Start date as a date or null
entailment
public function processTokenInsertion(\Gems_Tracker_Token $token) { if ($token->hasSuccesCode() && (! $token->isCompleted())) { // Preparation for a more general object class $code = $token->getSurvey()->getCode(); $prev = $token; while ($prev = $prev->getPre...
Process the data and return the answers that should be filled in beforehand. Storing the changed values is handled by the calling function. @param \Gems_Tracker_Token $token Gems token object @return array Containing the changed values
entailment
protected function getAutoSearchElements(array $data) { $elements = $this->getSurveySelectElements($data); $elements[] = null; $organizations = $this->currentUser->getRespondentOrganizations(); if (count($organizations) > 1) { $elements[] = $this->_createMultiCheckBoxEl...
Returns a text element for autosearch. Can be overruled. The form / html elements to search on. Elements can be grouped by inserting null's between them. That creates a distinct group of elements @param array $data The $form field values (can be usefull, but no need to set them) @return array Of \Zend_Form_Element's ...
entailment
protected function createModel($detailed, $action) { $model = $this->loader->getModels()->createLogModel(); if ($detailed) { $model->applyDetailSettings(); } else { $model->applyBrowseSettings(); } return $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 getSearchDefaults() { if (! $this->defaultSearchData) { $from = new \MUtil_Date(); $from->subWeek(2); $until = new \MUtil_Date(); $until->addDay(1); $this->defaultSearchData = array( 'datefrom' => $from, ...
Function to allow the creation of search defaults in code @see getSearchFilter() @return array
entailment
protected function _ensureSettings() { $this->_settings = [ 'name' => [ 'label' => $this->_('Mask respondent name'), 'description' => $this->_('Hide name and e-mail address.'), 'class' => 'NameMasker', 'maskFields' => $...
Set $this->_settings to array of [groupname => [label, description, class, maskFields] @return void
entailment
public function afterRegistry() { parent::afterRegistry(); $this->initTranslateable(); $this->_ensureSettings(); // Load the masker classes foreach ($this->_settings as $name => $setting) { if (isset($setting['class'], $setting['maskFields'])) { ...
Called after the check that all required registry values have been set correctly has run. @return void
entailment
public function decodeSettings($value, $isNew = false, $name = null, array $context = array(), $isPost = false) { if (is_array($value)) { return $value; } if ($value) { return json_decode($value, true); } return $this->defaultData; }
A ModelAbstract->setOnLoad() function that takes care of decoding the json settings to an array value @see \MUtil_Model_ModelAbstract @param mixed $value The value being saved @param boolean $isNew True when a new item is being saved @param string $name The name of the current field @param array $context Optional, th...
entailment
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 @param string $key @return string The settings name or null when not a key name
entailment
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 @param string $key @return string The storage name or null when not a key name
entailment
public function loadSettings($value, $isNew = false, $name = null, array $context = array(), $isPost = false) { if ($value) { return $value; } $setting = $this->getSettingsField($name); $storage = $this->getStorageField($name); if (isset($context[$storage])) { ...
A ModelAbstract->setOnLoad() function that takes care of transforming settings to values @see \MUtil_Model_ModelAbstract @param mixed $value The value being saved @param boolean $isNew True when a new item is being saved @param string $name The name of the current field @param array $context Optional, the other value...
entailment
public function saveSettings($value, $isNew = false, $name = null, array $context = array()) { $output = []; foreach ($context as $key => $value) { $setting = $this->getSettingsField($key); if ($setting) { // \MUtil_Echo::track($setting, $value); ...
A ModelAbstract->setOnSave() function that returns fields as a single storage string @see \MUtil_Model_ModelAbstract @param mixed $value The value being saved @param boolean $isNew True when a new item is being saved @param string $name The name of the current field @param array $context Optional, the other values be...
entailment
protected function addCompletionBlock(\Gems_Model_Bridge_ThreeColumnTableBridge $bridge, \MUtil_Model_ModelAbstract $model, \Gems_Menu_MenuList $links) { // COMPLETION DATE $fields = array(); if ($this->token->getReceptionCode()->hasDescription()) { $bridge->addMarkerRow(); ...
Adds third block to fifth group group of rows showing completion data Overrule this function to add different columns to the browse table, without having to recode the core table building code. @param \Gems_Model_Bridge_ThreeColumnTableBridge $bridge @param \MUtil_Model_ModelAbstract $model @param \Gems_Menu_MenuList...
entailment
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('c...
Adds first group of rows showing token specific data Overrule this function to add different columns to the browse table, without having to recode the core table building code. @param \Gems_Model_Bridge_ThreeColumnTableBridge $bridge @param \MUtil_Model_ModelAbstract $model @param \Gems_Menu_MenuList $links @return b...
entailment
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) { ...
Adds last group of rows cleaning up whatever is left to do in adding links etc. Overrule this function to add different columns to the browse table, without having to recode the core table building code. @param \Gems_Model_Bridge_ThreeColumnTableBridge $bridge @param \MUtil_Model_ModelAbstract $model @param \Gems_Men...
entailment
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)...
Adds second group of rows showing patient specific data Overrule this function to add different columns to the browse table, without having to recode the core table building code. @param \Gems_Model_Bridge_ThreeColumnTableBridge $bridge @param \MUtil_Model_ModelAbstract $model @param \Gems_Menu_MenuList $links @retur...
entailment
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 Overrule this function to add different columns to the browse table, without having to recode the core table building code. @param \Gems_Model_Bridge_ThreeColumnTableBridge $bridge @param \MUtil_Model_ModelAbstract $model @param \Gems_Menu_MenuList $links @return b...
entailment
protected function addShowTableRows(\MUtil_Model_Bridge_VerticalTableBridge $bridge, \MUtil_Model_ModelAbstract $model) { // \MUtil_Model::$verbose = true; // Don't know why, but is needed now $bridge->getRow(); $links = $this->getMenuList(); $links->addParameterSources($th...
Adds rows 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_VerticalTableBridge $bridge @param \MUtil_Model_ModelAbstract $model @return void
entailment
protected function addValidFromBlock(\Gems_Model_Bridge_ThreeColumnTableBridge $bridge, \MUtil_Model_ModelAbstract $model, \Gems_Menu_MenuList $links) { // Editable part (INFO / VALID FROM / UNTIL / E-MAIL $button = $links->getActionLink($this->request->getControllerName(), 'edit', true); $b...
Adds first block to fifth group group of rows showing valid from data Overrule this function to add different columns to the browse table, without having to recode the core table building code. @param \MUtil_Model_Bridge_VerticalTableBridge $bridge @param \MUtil_Model_ModelAbstract $model @param \Gems_Menu_MenuList $...
entailment
protected function _addUsedPrivileges(array &$privileges, $label) { foreach ($this->_subItems as $item) { // Skip autofilter action, but include all others if ($item->get('action') == 'autofilter') { continue; } $_itemlabel = $label . ($item->g...
Adds privileges that are used in this menu item to the array @param array $privileges
entailment
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 @return \Zend_Controller_Request_Abstract
entailment
protected function _toNavigationArray(\Gems_Menu_ParameterCollector $source) { $this->sortByOrder(); $lastParams = null; $pageIdx = 0; $pages = array(); foreach ($this->_subItems as $item) { // Skip button_only items if ($item->get('button_only...
Returns a \Zend_Navigation creation array for this menu item, with sub menu items in 'pages' @param \Gems_Menu_ParameterCollector $source @return array
entailment
protected function add($argsArray) { // Process parameters. $args = \MUtil_Ra::args(func_get_args(), 0, array('visible' => true, // All menu items are initally visible unless stated otherwise 'allowed' => true, // Same as with visible, need this for t_oNavigationA...
Add a sub item to this item. The argumenets can be any of those used for \Zend_Navigation_Page as well as some Gems specials.<ul> <li>'action' The name of the action.</li> <li>'allowed' Is the user allowed to access this menu item. Is checked against ACL using 'privilige'.</li> <li>'button_only' Never in the menu, onl...
entailment
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'); ...
Add a agenda setup menu tree to the menu @param string $label @param array $other @return \Gems_Menu_SubMenuItem
entailment
public function addAgendaSetupPage($label, $privilege, $controller, array $other = array()) { $page = $this->addPage($label, $privilege, $controller, 'index', $other); $page->addAutofilterAction(); $page->addCreateAction(); $page->addExportAction(); $page->addImportAction(); ...
Add a browse / ceate / edit / show / / sleanup etc.. menu item @param string $label @param string $privilege @param string $controller @param array $other @return \Gems_Menu_SubMenuItem
entailment
public function addBrowsePage($label, $privilege, $controller, array $other = array()) { $page = $this->addPage($label, $privilege, $controller, 'index', $other); $page->addAutofilterAction(); $page->addCreateAction(); $page->addExportAction(); $page->addImportAction(); ...
Add a browse / ceate / edit / show / etc.. menu item @param string $label @param string $privilege @param string $controller @param array $other @return \Gems_Menu_SubMenuItem
entailment
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. @param string $label @param string $privilege @param string $controller @param string $action @param array $other @return \Gems_Menu_SubMenuItem
entailment
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 @param string $label @param array $other @return \Gems_Menu_SubMenuItem
entailment
public function addCommSetupMenu($label) { $setup = $this->addContainer($label); // AUTOMATIC COMMUNICATION CONTROLLER $page = $setup->addBrowsePage($this->_('Automatic mail'), 'pr.comm.job', 'comm-job'); $page->addButtonOnly($this->_('Turn Automatic Mail Jobs OFF'), 'pr.comm.job', ...
Add a Mail menu tree to the menu @param string $label @param array $other @return \Gems_Menu_SubMenuItem
entailment
public function addExportContainer($label) { $export = $this->addContainer($label); // EXPORT $surveyExport = $export->addPage($this->_('Single survey answers'), 'pr.export', 'export-survey', 'index'); $surveyExport->addAutofilterAction(); $surveyExport->addExportAction(); ...
Shortcut function to create the export container. @param string $label Label for the container @return \Gems_Menu_MenuAbstract The new contact page
entailment
public function addFilePage($label, $privilege, $controller, array $other = array()) { $page = $this->addPage($label, $privilege, $controller, 'index', $other); $page->addAutofilterAction(); // $page->addCreateAction(); // $page->addExcelAction(); $page = $page->addShowAction...
Add a file upload/download page to the menu @param string $label The label to display for the menu item, null for access without display @param string $privilege The privilege for the item, null is always, 'pr.islogin' must be logged in, 'pr.nologin' only when not logged in. @param string $controller Wh...
entailment
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')...
Shortcut function to create the import container. @param string $label Label for the container @return \Gems_Menu_MenuAbstract The new contact page
entailment
public function addLogControllers() { // LOG SETUP CONTROLLER $this->addBrowsePage($this->_('Log Setup'), 'pr.log.maintenance', 'log-maintenance'); // LOG CONTROLLER $page = $this->addPage($this->_('Log'), 'pr.log', 'log', 'index'); $page->addAutofilterAction(); $pag...
Add the log menu items
entailment
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 $...
Add a page to the menu @param string $label The label to display for the menu item, null for access without display @param string $privilege The privilege for the item, null is always, 'pr.islogin' must be logged in, 'pr.nologin' only when not logged in. @param string $controller What controller to use ...
entailment
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 Co...
Add a list of report pages @param string $label The label to display for the menu item, null for access without display @return \Gems_Menu_SubMenuItem
entailment
public function addProjectInfoPage($label) { $page = $this->addPage($label, 'pr.project-information', 'project-information'); $page->addAction($this->_('Errors'), null, 'errors'); $page->addAction($this->_('PHP'), null, 'php'); $page->addAction($this->_('PHP Errors'), null...
Add pages that show the user technical information about the installation in the project. @param string $label @param array $other @return \Gems_Menu_SubMenuItem
entailment
public function addProjectPage($label) { if ($this->escort instanceof \Gems_Project_Tracks_SingleTrackInterface) { if ($trackId = $this->escort->getTrackId()) { $infoPage = $this->addPage($label, 'pr.project', 'project-tracks', 'show') ->addHiddenParameter(\MU...
Add pages that show the user an overview of the tracks / surveys used in the project. @param string $label @param array $other @return \Gems_Menu_SubMenuItem
entailment
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()); ...
Add a staff browse edit page to the menu, @param string $label @param array $other @return \Gems_Menu_SubMenuItem
entailment
public function addTrackBuilderMenu($label, array $other = array()) { $setup = $this->addContainer($label); // SURVEY SOURCES CONTROLLER $page = $setup->addPage($this->_('Survey Sources'), 'pr.source', 'source'); $page->addAutofilterAction(); $page->addCreateAction(); ...
Add a Trackbuilder menu tree to the menu @param string $label @param array $other @return \Gems_Menu_SubMenuItem
entailment
protected function applyAcl(\MUtil_Acl $acl, $userRole) { foreach ($this->_subItems as $item) { $allowed = $item->get('allowed', true); if ($allowed && ($privilege = $item->get('privilege'))) { $allowed = $acl->isAllowed($userRole, null, $privilege); } ...
Set the visibility of the menu item and any sub items in accordance with the specified user role. @param \Zend_Acl $acl @param string $userRole @return \Gems_Menu_MenuAbstract (continuation pattern)
entailment
protected function setBranchVisible(array $activeBranch) { $current = array_pop($activeBranch); foreach ($this->_subItems as $item) { if ($item->isVisible()) { if ($item === $current) { $item->set('active', true); $item->setBranchV...
Make sure only the active branch is visible @param array $activeBranch Of \Gems_Menu_Menu Abstract items @return \Gems_Menu_MenuAbstract (continuation pattern)
entailment
public static function sortOrder($aItem, $bItem) { $a = $aItem->get('order'); $b = $bItem->get('order'); if ($a == $b) { return 0; } return $a > $b ? 1 : -1; }
uasort() function for sortByOrder() @see sortByOrder(); @param self $aItem @param self $bItem @return int
entailment
public function formatDateForever($dateValue) { if ($dateValue) { return $this->formatDateTime($dateValue); } else { return \MUtil_Html::create()->span($this->_('forever'), array('class' => 'disabled')); } }
Get a readable version of date / time object with nearby days translated in text or 'forever' when null @param \MUtil_Date $dateValue @return string|\MUtil_Html_HtmlElement
entailment
public function formatDateNa($dateValue) { if ($dateValue) { return $this->formatDateTime($dateValue); } else { return \MUtil_Html::create()->span($this->_('n/a'), array('class' => 'disabled')); } }
Get a readable version of date / time object with nearby days translated in text or 'n/a' when null @param \MUtil_Date $dateValue @return string|\MUtil_Html_HtmlElement
entailment
public function formatDateNever($dateValue) { if ($dateValue) { return $this->formatDateTime($dateValue); } else { return \MUtil_Html::create()->span($this->_('never'), array('class' => 'disabled')); } }
Get a readable version of date / time object with nearby days translated in text or 'never' when null @param \MUtil_Date $dateValue @return string|\MUtil_Html_HtmlElement
entailment
public function formatDateUnknown($dateValue) { if ($dateValue) { return $this->formatDateTime($dateValue); } else { return \MUtil_Html::create()->span($this->_('unknown'), array('class' => 'disabled')); } }
Get a readable version of date / time object with nearby days translated in text or 'unknown' when null @param \MUtil_Date $dateValue @return string|\MUtil_Html_HtmlElement
entailment
public function formatDateTime($dateTimeValue) { if (! $dateTimeValue) { return null; } //$dateTime = strtotime($dateTimeValue); // \MUtil_Echo::track($dateTimeValue, date('c', $dateTime), $dateTime / 86400, date('c', time()), time() / 86400); // TODO: Timezone s...
Get a readable version of date / time object with nearby days translated in text @param \MUtil_Date $dateTimeValue @return string
entailment
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($r...
Returns the time in seconds as a display string @param int $dateTimeValue @return string
entailment
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 @param int $dateTimeValue @return string
entailment
public function getGenders($locale = null) { return array('M' => $this->_('Male', $locale), 'F' => $this->_('Female', $locale), 'U' => $this->_('Unknown', $locale)); }
Returns the functional description of a gender for use in e.g. interface elements @param string $locale @return array gender => string
entailment
public function getGenderGreeting($locale = null) { return array('M' => $this->_('mr.', $locale), 'F' => $this->_('mrs.', $locale), 'U' => $this->_('mr./mrs.', $locale)); }
Returns the gender for use as part of a sentence, e.g. Dear Mr/Mrs In practice: starts lowercase @param string $locale @return array gender => string
entailment
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 In practice: starts uppercase @param string $locale @return array gender => string
entailment
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'), ...
Get an array of translated labels for the date period units @return array date_unit => label
entailment
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 @param string $subject @return mxied
entailment
public function setOption($varname, $varvalue=null) { $keys = array_keys($this->_options); if(gettype($varname) === 'array') { foreach($varname as $name=>$value) { $this->setOption($name, $value); } ...
Sets an option in the option array(); @access public @param mixed $varname Can take the form of an array of options to set a string of an option name. @param mixed $varvalue The value of the option you are setting.
entailment
public function parse($source=false, $parse_collections=false, $_internal_loop=false) { // increment the parse count so it has unique identifiers self::$_instance += 1; // capture the source from the buffer if($source === false) { $source = o...
Parses the source for any custom tags. @access public @param mixed|boolean|string $source If false then it will capture the output buffer, otherwise if a string it will use this value to search for custom tags. @param boolean $parse_collections If true then any collected tags will be parsed after the tags are parsed. @...
entailment
private function _parseTag($tag) { // return nothing if the tag is disabled if(isset($tag['attributes']->disabled) === true && $tag['attributes']->disabled === 'true') { return ''; } $tag_data = false; $caching_...
Processes a tag by loading @access private @param array $tag The tag to parse. @return string The content of the tag.
entailment
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_SI...
Produces an error. @access public @param string $tag The name of the tag producing an error. @param string $message The message of the error. @return mixed|error|string Either a string or thrown error is returned dependent on the 'missing_tags_error_mode' option.
entailment
private function _parseTags($tags) { if(count($tags) > 0) { // loop through the tags foreach($tags as $key=>$tag) { // if a tag is delayed, it is rendered after everything else and it's has to be re parsed. ...
Loops and parses the found custom tags. @access private @param array $tags An array of found custom tag data. @return mixed|string|boolean Returns false if there are no tags, string otherwise.
entailment
function _processCollectedTags($source) { $to_replace = array(); $ordered = array(); foreach(self::$tag_collections as $tag_name=>$tags) { // if this block has a collection order use it if(isset(self::$_tag_order[$tag_name]) === true) ...
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. @param string $source The source of the output. @return string
entailment
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); ...
Searches and parses a source for custom tags. @access public @param string $source The source to search for custom tags in. @param mixed|boolean|string $tag_name If false then the default option 'tag_name' is used when searching for custom tags, if not and $tag_name is a string then a custom tag beginning with that pre...
entailment
private function _buildTag($str, $tagname) { // $tagname = $this->_options['tag_name']; $tag = array( 'block' => $str, 'content' => '', 'name' => '', 'attributes' => array() ); ...
Parses a tag for the tag attributes and inner content. @access private @param string $str The tag string to be parsed. @param string $tagname The prefix of the custom tag being parsed. @return array The tag
entailment
public static function getTemplate($tag, $produce_error=true) { // get the template $template_name = isset($tag['attributes']['template']) === true ? $tag['attributes']['template'] : 'default'; if(is_array(CustomTags::$tag_directory_base) === false) { ...
Returns the content of a template. @access public @param array $tag The tag array. @param boolean $produce_error If there is an error with the template and this is set to true then an error is produced.
entailment
public static function parseTemplate($tag, $replacements) { // get template $template = self::getTemplate($tag); $search = $replace = array(); // compile search and replace values for replacement foreach ($replacements as $varname => $varvalue) {...
A simple templater, replaces %VARNAME% with the value. @access public @param array $tag The tag array. @param array $replacements The array of search and replace values.
entailment
public function isValid($value, $context = array()) { $this->_message = null; $user = $this->_userSource->getUser(); If (! ($user->isActive() && $user->canResetPassword() && $user->isAllowedOrganization($context['organization']))) { $this->_message = $this->translate->_('User n...
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($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_org...
Adds all jobs to the queue @param $respondentId Optional, execute for just one respondent @param $organizationId Optional, execute for just one organization
entailment
public function afterRegistry() { parent::afterRegistry(); if (! $this->tokenLibrary instanceof \Gems_Tracker_Token_TokenLibrary) { $this->tokenLibrary = $this->loader->getTracker()->getTokenLibrary(); } }
Called after the check that all required registry values have been set correctly has run. @return void
entailment
protected function findTokenFor(array $row) { if (isset($row['token']) && $row['token']) { return $this->tokenLibrary->filter($row['token']); } return null; }
Find the token id using the passed row data and the other translator parameters. @param array $row @return string|null
entailment
public function getFieldsTranslations() { if (! $this->_targetModel instanceof \MUtil_Model_ModelAbstract) { throw new \MUtil_Model_ModelTranslateException(sprintf('Called %s without a set target model.', __FUNCTION__)); } $this->_targetModel->set('gto_id_token', 'label', $this->...
Get information on the field translations @return array of fields sourceName => targetName @throws \MUtil_Model_ModelException
entailment
public function execute() { //Now load all patches, and save the resulting changed patches for later (not used yet) $changed = $this->patcher->uploadPatches($this->loader->getVersions()->getBuild()); if ($changed) { $this->getBatch()->addMessage(sprintf($this->_('%d new or cha...
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 getSearchDefaults() { if (! $this->defaultSearchData) { $from = new \MUtil_Date(); $from->subWeek(2); $until = new \MUtil_Date(); $until->addDay(1); $this->defaultSearchData = array( \Gems_Snippets_AutosearchFormSn...
Function to allow the creation of search defaults in code @see getSearchFilter() @return array
entailment
public function checkRegistryRequestsAnswers() { if (! $this->organizationId) { if ($this->respondent) { $this->organizationId = $this->respondent->getOrganizationId(); } if (! $this->organizationId) { $this->organizationId = $this->reques...
Should be called after answering the request to allow the Target to check if all required registry values have been set correctly. @return boolean False if required are missing.
entailment