sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function getTokenAnswerLinkForBridge(\MUtil_Model_Bridge_TableBridgeAbstract $bridge, $keepCaps = false) { if (! $this->currentUser->hasPrivilege($this->_getAnswerMenuItem()->getPrivilege())) { return null; } return \MUtil_Lazy::method($this, 'getTokenAnswerLink', ...
De a lazy answer link for bridges @param \MUtil_Model_Bridge_TableBridgeAbstract $bridge @param boolean $keepCaps Keep the capital letters in the label @return \MUtil_Lazy_Call
entailment
public function getTokenAskButton($tokenId, $tokenStatus, $staffToken, $keepCaps) { if ('O' == $tokenStatus || 'P' == $tokenStatus) { if ($staffToken) { $menuItem = $this->_getAskMenuItem(); $label = $menuItem->get('label'); if ('P' == $tokenSt...
Generate a menu link for answers pop-up @param string $tokenId @param string $tokenStatus @param boolean $staffToken Is token answerable by staff @param boolean $keepCaps Keep the capital letters in the label @return \MUtil_Html_AElement
entailment
public function getTokenAskButtonForBridge(\MUtil_Model_Bridge_TableBridgeAbstract $bridge, $forceButton = false, $keepCaps = false) { if (! $this->currentUser->hasPrivilege($this->_getAskMenuItem()->getPrivilege())) { return null; } if ($forceButton) { return \MUtil...
De a lazy answer link for bridges @param \MUtil_Model_Bridge_TableBridgeAbstract $bridge @param boolean $forceButton Always show a button @param boolean $keepCaps Keep the capital letters in the label @return \MUtil_Lazy_Call
entailment
public function getTokenAskLinkForBridge(\MUtil_Model_Bridge_TableBridgeAbstract $bridge, $forceButton = false, $keepCaps = false) { $method = $this->getTokenAskButtonForBridge($bridge, $forceButton, $keepCaps); if (! $method) { $method = \MUtil_Lazy::method($this, 'getTokenCopyLink', ...
De a lazy answer link for bridges @param \MUtil_Model_Bridge_TableBridgeAbstract $bridge @param boolean $forceButton Always show a button @param boolean $keepCaps Keep the capital letters in the label @return \MUtil_Lazy_Call
entailment
public function getTokenEmailLink($tokenId, $tokenStatus, $canMail) { if ($canMail && ('O' == $tokenStatus || 'P' == $tokenStatus)) { $menuItem = $this->_getEmailMenuItem(); $link = $menuItem->toActionLinkLower([ 'gto_id_token' => $tokenId, 'can_be_ta...
Generate a menu link for email screen @param string $tokenId @param string $tokenStatus @param boolean $canMail @return \MUtil_Html_AElement
entailment
public function getTokenEmailLinkForBridge(\MUtil_Model_Bridge_TableBridgeAbstract $bridge) { if (! $this->currentUser->hasPrivilege($this->_getEmailMenuItem()->getPrivilege())) { return null; } return \MUtil_Lazy::method($this, 'getTokenEmailLink', $bridge->getL...
De a lazy answer link for bridges @param \MUtil_Model_Bridge_TableBridgeAbstract $bridge @return \MUtil_Lazy_Call
entailment
public function getTokenShowLink($tokenId, $plusLabel) { $menuItem = $this->_getShowMenuItem(); if ($plusLabel) { $link = $menuItem->toActionLink( \MUtil_Html::create()->strong($this->_('+')), [ 'gto_id_token' => $tokenId, ...
Generate a menu link for answers pop-up @param string $tokenId @param boolean $plusLabel Show plus instead of label @return \MUtil_Html_AElement
entailment
public function getTokenShowLinkForBridge(\MUtil_Model_Bridge_TableBridgeAbstract $bridge, $plusLabel = true) { if (! $this->currentUser->hasPrivilege($this->_getShowMenuItem()->getPrivilege())) { return null; } return \MUtil_Lazy::method($this, 'getTokenShowLink', $bridge->getL...
De a lazy show link for bridges @param \MUtil_Model_Bridge_TableBridgeAbstract $bridge @param boolean $plusLabel Show plus instead of label @return \MUtil_Lazy_Call
entailment
public function getTokenStatusDescriptionForBridge(\MUtil_Model_Bridge_TableBridgeAbstract $bridge, $addDescription = false) { return \MUtil_Lazy::method($this, 'getStatusDescription', $bridge->getLazy('token_status')); }
De a lazy status description text for bridges @param \MUtil_Model_Bridge_TableBridgeAbstract $bridge @param boolean $addDescription Add the description after the icon @return \MUtil_Lazy_Call
entailment
public function getTokenStatusLink($tokenId, $tokenStatus, $patientNr, $roundDescr, $surveyName, $result) { $menuItem = $this->_getShowMenuItem(); if ($tokenId && $menuItem) { $href = $menuItem->toHRefAttribute([ 'gto_id_token' => $tokenId, \Gems_Model::I...
Generate a menu link for answers pop-up @param string $tokenId @param string $tokenStatus @param string $patientNr @param string $roundDescr @param string $surveyName @param string $result @return \MUtil_Html_AElement
entailment
public function getTokenStatusLinkForBridge(\MUtil_Model_Bridge_TableBridgeAbstract $bridge) { if (! $this->currentUser->hasPrivilege($this->_getShowMenuItem()->getPrivilege())) { return $this->getTokenStatusShowForBridge($bridge); } return \MUtil_Lazy::method($this, 'getTokenSt...
De a lazy status show link for bridges @param \MUtil_Model_Bridge_TableBridgeAbstract $bridge @return \MUtil_Lazy_Call
entailment
public function getTokenStatusLinkForTokenId($tokenId) { $token = $tokenId ? $this->loader->getTracker()->getToken($tokenId) : null; if (! ($tokenId && $token->exists)) { return $this->getStatusIcon('D'); } return $this->getTokenStatusLink( $tokenId, $to...
De a lazy status show link for bridges @param \MUtil_Model_Bridge_TableBridgeAbstract $bridge @return \MUtil_Lazy_Call
entailment
public function getBrowseColumns() { // Newline placeholder $br = \MUtil_Html::create('br'); $sp = \MUtil_Html::raw(' '); $columns[10] = array('glo_name', $br, 'glo_organizations'); $columns[20] = array('glo_url', $br, 'glo_url_route'); $columns[30] = array('glo_addr...
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
protected function createModel($detailed, $action) { $model = new \MUtil_Model_TableModel('gems__locations'); $yesNo = $this->util->getTranslated()->getYesNo(); \Gems_Model::setChangeFieldsByPrefix($model, 'glo'); $model->setDeleteValues('glo_active', 0); $model->set('glo_...
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 addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model) { // Add link to patient to overview $menuItems = $this->findMenuItems('respondent', 'show'); if ($menuItems) { $menuItem = reset($menuItems); if ($men...
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
public function andIf($master = null) { if ($this->logicalOperator == "or") { throw new Exception("ValidationLogicCriteria: Cannot declare a logical operator more than once. (Specified andIf() after calling orIf()). Use a nested ValidationLogicCriteriaSet to combine conjunctive and disjuctive lo...
Adds a new criterion, and makes this set use conjuctive logic @param string $master The master form field @return ValidationLogicCriteria
entailment
public function orIf($master = null) { if ($this->logicalOperator == "and") { throw new Exception("ValidationLogicCriteria: Cannot declare a logical operator more than once. (Specified orIf() after calling andIf()). Use a nested ValidationLogicCriteriaSet to combine conjunctive and disjuctive lo...
Adds a new criterion, and makes this set use disjunctive logic @param string $master The master form field @return ValidationLogicCriteria
entailment
public function getMasterList() { $list = array(); foreach ($this->getCriteria() as $c) { if ($c instanceof ValidationLogicCriteria) { $list += $c->getMasterList(); } else { $list[] = $c->getMaster(); } } return $lis...
Gets a list of all the master fields in this criteria set @return string
entailment
private function _ensureGroupData($reload = false) { if ($reload || (! isset($this->_gemsSurvey['ggp_id_group']))) { $sql = "SELECT * FROM gems__groups WHERE ggp_id_group = ?"; $code = $this->_gemsSurvey['gsu_id_primary_group']; if ($code) { $row = $this...
Makes sure the group data is part of the $this->_gemsSurvey @param boolean $reload Optional parameter to force reload.
entailment
private function _updateSurvey(array $values, $userId) { if ($this->tracker->filterChangesOnly($this->_gemsSurvey, $values)) { if (\Gems_Tracker::$verbose) { $echo = ''; foreach ($values as $key => $val) { $old = isset($this->_gemsSurvey[$key]...
Update the survey, both in the database and in memory. @param array $values The values that this token should be set to @param int $userId The current user @return int 1 if data changed, 0 otherwise
entailment
public function calculateHash() { $answerModel = $this->getAnswerModel('en'); foreach($answerModel->getItemsOrdered() as $item) { $result = $answerModel->get($item, ['label', 'type', 'multiOptions', 'parent_question', 'thClass', 'group', 'description']); if (array_key...
Calculate a hash for this survey, taking into account the questions and answers @return string
entailment
public function checkRegistryRequestsAnswers() { if ($this->db && (! $this->_gemsSurvey)) { $result = $this->db->fetchRow("SELECT * FROM gems__surveys WHERE gsu_id_survey = ?", $this->_surveyId); if ($result) { $this->_gemsSurvey = $result; $this->exis...
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
public function copyTokenToSource(\Gems_Tracker_Token $token, $language) { $source = $this->getSource(); return $source->copyTokenToSource($token, $language, $this->_surveyId, $this->_gemsSurvey['gsu_surveyor_id']); }
Inserts the token in the source (if needed) and sets those attributes the source wants to set. @param \Gems_Tracker_Token $token @param string $language @return int 1 of the token was inserted or changed, 0 otherwise @throws \Gems_Tracker_Source_SurveyNotFoundException
entailment
public function getAnswerDateTime($fieldName, \Gems_Tracker_Token $token) { $source = $this->getSource(); return $source->getAnswerDateTime($fieldName, $token, $this->_surveyId, $this->_gemsSurvey['gsu_surveyor_id']); }
Returns a field from the raw answers as a date object. @param string $fieldName Name of answer field @param \Gems_Tracker_Token $token Gems token object @return \MUtil_Date date time or null
entailment
public function getAnswerSnippetNames(\Gems_Tracker_Token $token) { if (isset($this->_gemsSurvey['gsu_display_event'])) { $event = $this->events->loadSurveyDisplayEvent($this->_gemsSurvey['gsu_display_event']); return $event->getAnswerDisplaySnippets($token); } }
Returns a snippet name that can be used to display the answers to the token or nothing. @param \Gems_Tracker_Token $token @return array Of snippet names
entailment
public function getAnswerModel($language) { $source = $this->getSource(); return $source->getSurveyAnswerModel($this, $language, $this->_gemsSurvey['gsu_surveyor_id']); }
Returns a model for displaying the answers to this survey in the requested language. @param string $language (ISO) language string @return \MUtil_Model_ModelAbstract
entailment
public function getCompletionTime(\Gems_Tracker_Token $token) { $source = $this->getSource(); return $source->getCompletionTime($token, $this->_surveyId, $this->_gemsSurvey['gsu_surveyor_id']); }
The time the survey was completed according to the source @param \Gems_Tracker_Token $token Gems token object @return \MUtil_Date date time or null
entailment
public function getDatesList($language) { $source = $this->getSource(); return $source->getDatesList($language, $this->_surveyId, $this->_gemsSurvey['gsu_surveyor_id']); }
Returns an array containing fieldname => label for each date field in the survey. Used in dropdown list etc.. @param string $language (ISO) language string @return array Returns an array of the strings datename => label
entailment
public function getInsertDateUntil(\MUtil_Date $from) { return Period::applyPeriod( $from, $this->_gemsSurvey['gsu_valid_for_unit'], $this->_gemsSurvey['gsu_valid_for_length'] ); }
Calculate the until date for single survey insertion @param \MUtil_Date $from @return \MUtil_Date
entailment
public function getQuestionInformation($language) { return $this->getSource()->getQuestionInformation($language, $this->_surveyId, $this->_gemsSurvey['gsu_surveyor_id']); }
Returns an array of array with the structure: question => string, class => question|question_sub group => is for grouping type => (optional) source specific type answers => string for single types, array for selection of, nothing for no answer @param string $language (ISO) language string @return array Ne...
entailment
public function getQuestionList($language) { return $this->getSource()->getQuestionList($language, $this->_surveyId, $this->_gemsSurvey['gsu_surveyor_id']); }
Returns a fieldlist with the field names as key and labels as array. @param string $language (ISO) language string @return array of fieldname => label type
entailment
public function getRawTokenAnswerRow($tokenId) { $source = $this->getSource(); return $source->getRawTokenAnswerRow($tokenId, $this->_surveyId, $this->_gemsSurvey['gsu_surveyor_id']); }
Returns the answers in simple raw array format, without value processing etc. Function may return more fields than just the answers. @param string $tokenId Gems Token Id @return array Field => Value array
entailment
public function getRawTokenAnswerRows($filter = array()) { $source = $this->getSource(); return $source->getRawTokenAnswerRows((array) $filter, $this->_surveyId, $this->_gemsSurvey['gsu_surveyor_id']); }
Returns the answers of multiple tokens in simple raw nested array format, without value processing etc. Function may return more fields than just the answers. @param array $filter XXX @return array Of nested Field => Value arrays indexed by tokenId
entailment
public function getRawTokenAnswerRowsCount($filter = array()) { $source = $this->getSource(); return $source->getRawTokenAnswerRowsCount((array) $filter, $this->_surveyId, $this->_gemsSurvey['gsu_surveyor_id']); }
Returns the number of answers of multiple tokens @param array $filter XXX @return array Of nested Field => Value arrays indexed by tokenId
entailment
public function getStartTime(\Gems_Tracker_Token $token) { $source = $this->getSource(); return $source->getStartTime($token, $this->_surveyId, $this->_gemsSurvey['gsu_surveyor_id']); }
The time the survey was started according to the source @param \Gems_Tracker_Token $token Gems token object @return \MUtil_Date date time or null
entailment
public function inSource(\Gems_Tracker_Token $token) { $source = $this->getSource(); return $source->inSource($token, $this->_surveyId, $this->_gemsSurvey['gsu_surveyor_id']); }
Checks whether the token is in the source. @param \Gems_Tracker_Token $token Gems token object @return boolean
entailment
public function isCompleted(\Gems_Tracker_Token $token) { $source = $this->getSource(); return $source->isCompleted($token, $this->_surveyId, $this->_gemsSurvey['gsu_surveyor_id']); }
Returns true if the survey was completed according to the source @param \Gems_Tracker_Token $token Gems token object @return boolean True if the token has completed
entailment
public function updateConsent(\Gems_Tracker_Token $token, $consentCode = null) { $source = $this->getSource(); return $source->updateConsent($token, $this->_surveyId, $this->_gemsSurvey['gsu_surveyor_id'], $consentCode); }
Updates the consent code of the the token in the source (if needed) @param \Gems_Tracker_Token $token @param string $consentCode Optional consent code, otherwise code from token is used. @return int 1 of the token was inserted or changed, 0 otherwise
entailment
public function checkRegistryRequestsAnswers() { if ($this->token instanceof \Gems_Tracker_Token) { $this->wasAnswered = $this->token->isCompleted(); return ($this->request instanceof \Zend_Controller_Request_Abstract) && ($this->view instanceof \Zend_View) && ...
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
public function formatCompletion(\MUtil_Date $dateTime) { $days = abs($dateTime->diffDays()); switch ($days) { case 0: return $this->_('We have received your answers today. Thank you!'); case 1: return $this->_('We have received your answers ...
Formats an completion date for this display @param \MUtil_Date $dateTime @return string
entailment
public function formatUntil(\MUtil_Date $dateTime = null) { if (false === $this->showUntil) { return; } if (null === $dateTime) { return $this->_('Survey has no time limit.'); } $days = $dateTime->diffDays(); switch ($days) { case 0: ...
Formats an until date for this display @param \MUtil_Date $dateTime @return string
entailment
protected function getTokenHref(\Gems_Tracker_Token $token) { /*************** * Get the url * ***************/ $params = array( $this->request->getActionKey() => 'to-survey', \MUtil_Model::REQUEST_ID => $token->getTokenId(), 'RouteReset' ...
Get the href for a token @param \Gems_Tracker_Token $token @return \MUtil_Html_HrefArrayAttribute
entailment
protected function _getOrgTo($monitorName) { switch ($monitorName) { case 'maintenancemode': $where = "1 = 0"; break; case 'cronmail': default: $where = 'gor_mail_watcher = 1'; break; } ...
Return an array of organization recipients for the given monitorName @param string $monitorName @return array
entailment
protected function _getMailTo($monitorName) { $projTo = explode(',',$this->project->getMonitorTo($monitorName)); $userTo = $this->_getUserTo($monitorName); $orgTo = $this->_getOrgTo($monitorName); $mailtos = array_merge($projTo, $userTo, $orgTo); return arra...
Get the mail addresses for a monitor @param string $monitorName ProjectSettings name @param string $where Optional, a gems__staff SQL WHERE statement @return array
entailment
protected function _getUserTo($monitorName) { switch ($monitorName) { case 'maintenancemode': $roles = $this->util->getDbLookup()->getRolesByPrivilege('pr.maintenance.maintenance-mode'); if ($roles) { $joins = "JOIN gems__groups ON gsf_id_prima...
Return an array of user recipients for the given monitorName @param string $monitorName @return array
entailment
public function getReverseMaintenanceMonitorTemplate($locale) { switch ($locale) { case 'nl': $initSubject = "{name} is aangezet"; $initBbText = "L.S., De [b]{name}[/b] is op {setTime} aangezet. Zolang dit aan blijft staan kan u regelmatig waarschuwingen krijgen...
Return the mail template to use for sending ReverseMaintenanceMonitor messages There are two messages, the message when the maintenance mode is first turned on and the one that is sent after the set amount of time when the maintenance mode is still turned on. @param string $locale The locale to use for the message @...
entailment
public function reverseMaintenanceMonitor() { $job = $this->getReverseMaintenanceMonitor(); $lock = $this->util->getMaintenanceLock(); if ($lock->isLocked()) { $job->stop(); $lock->unlock(); return false; } $lock->lock(); $to = $...
Start the cron mail monitor @return boolean True when the job was started
entailment
public function startCronMailMonitor() { $to = $this->_getMailTo('cronmail'); $job = $this->getCronMailMonitor(); if (! $to) { $job->stop(); return false; } $locale = $this->project->getLocaleDefault(); list($subject, $messageBbText) = $this...
Start the cron mail monitor @return boolean True when the job was started
entailment
public static function solve(array $sudoku, $checkInput = false) { if($checkInput && !self::checkInput($sudoku)) { throw new \InvalidArgumentException('The input is no valid Sudoku array.'); } return self::recursive_solve($sudoku, count($sudoku)); }
Solves the Sudoku. @param array $sudoku @param bool $checkInput If true, the input gets checked for a valid Sudoku array, i.e. if it's a two dimensional square array containing only int and null values @return array|false Returns the solution or false if the sudoku is not solvable. @throws \InvalidArgumentExcept...
entailment
public static function generate($size, $difficulty, $seed = null) { list($task,) = self::generateWithSolution($size, $difficulty, $seed); return $task; }
Wrapper that calls Sudoku::generateWithSolution, but returns only the task. @param $size @param $difficulty @param null $seed @return mixed
entailment
public static function checkSolution(array $solution, array $task = null) { if(!self::checkInput($solution)) { throw new \InvalidArgumentException('Input is no Sudoku array.'); } $dim = count($solution); if($task !== null) { if(count($task) !...
Checks if the input is a valid sudoku solution. @param array $solution The solution to be checked @param array $task The task that should be result in the solution. If provided, it is checked if the solution relates to the task @return bool @throws \InvalidArgumentException
entailment
private static function array_shuffle(array &$array) { for($i = count($array) - 1; $i > 0; $i--) { $j = mt_rand(0,$i); $temp = $array[$i]; $array[$i] = $array[$j]; $array[$j] = $temp; } }
Shuffles an array using the Fisher-Yates-Algorithm and mt_rand(). So it is affected by the seed set by mt_srand(). This means the result is reproducible. @param array $array
entailment
public static function checkInput(array &$inputSudoku) { $rowCount = count($inputSudoku); if(!in_array($rowCount,self::$dimensions,true)) { return false; } foreach($inputSudoku as &$row) { // check dimensions if(!is_array($row) || ...
Checks if the input is an actual sudoku. i.e. The input array has two dimensions, is quadratic and contains only integers between 1 and the number of rows/columns. This function also casts all non null values to int, such that a valid input containing stings works fine. @param array $inputSudoku @return bool
entailment
protected function getConditions() { $conditionLoader = $this->loader->getConditions(); $conditions = []; for ($number = 1; $number <= 4; $number++) { $element = 'gcon_condition_text' . $number; $conditionId = (int) $this->_data[$element]; if ($conditionId...
Load the conditions @return \Gems\Condition\RoundConditionInterface[]
entailment
public function isValid($conditionId, $context) { $conditions = $this->getConditions(); $valid = true; foreach($conditions as $condition) { $valid = $valid && $condition->isValid($conditionId, $context); } return $valid; }
Does this track have the fieldcode the condition depends on? @param type $conditionId @param type $context @return boolean
entailment
public function find() { foreach ($this->getSupportedMailers() as $mailer) { $class = Helper::getMailerClassName($mailer); if (class_exists($class)) { $this->register($mailer); } } ksort($this->mailers); return $this->all(); }
Automatically find and register all officially supported mailers @return array An array of mailer names
entailment
protected function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model) { // Signal the bridge that we need these values $bridge->gr2t_id_respondent_track; $bridge->gr2t_id_respondent_track; $bridge->gr2o_patient_nr; $bridge->can_e...
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() { $model = parent::createModel(); $model->addColumn('CONCAT(gr2t_completed, \'' . $this->_(' of ') . '\', gr2t_count)', 'progress'); $model->set('progress', 'label', $this->_('Progress'), 'tdClass', 'rightAlign', 'thClass', 'rightAlign'); return $mo...
Creates the model @return \MUtil_Model_ModelAbstract
entailment
public function send(Message $mail): void { // Set original To, Cc, Bcc $counter = 0; foreach ((array) $mail->getHeader('To') as $email => $name) { $mail->setHeader('X-Original-To-' . $counter++, sprintf('<%s> %s', $email, $name)); } $counter = 0; foreach ((array) $mail->getHeader('Cc') as $email => $n...
Sends email
entailment
public function getSearchDefaults() { if (! $this->defaultSearchData) { $this->defaultSearchData = $this->getDateSelector()->getDefaultSearchData(); } return $this->defaultSearchData; }
Function to allow the creation of search defaults in code @see getSearchFilter() @return array
entailment
public function getSearchFilter($useRequest = true) { $filter = parent::getSearchFilter($useRequest); $selector = $this->getDateSelector(); $output = $selector->getFilter($this->request, $filter); // \MUtil_Echo::track($filter, $output); return $output; }
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 translateRowValues($row, $key) { $row = parent::translateRowValues($row, $key); if (! $row) { return false; } // Get the real organization from the provider_id or code if it exists if (isset($row[$this->orgIdField], $this->orgTranslations[$row[$t...
Perform any translations necessary for the code to work @param mixed $row array or \Traversable row @param scalar $key @return mixed Row array or false when errors occurred
entailment
public function getContent(\WikiRenderer\Markup\Trac\Config $config, \WikiRenderer\Generator\DocumentGeneratorInterface $documentGenerator, $wikiContent) { preg_match('/^Image\(([^\)]+)\)$/', $wikiContent, $attributes); $image = $documentGenerator->get...
returns the generator corresponding to the macro. @param Config $config @param \WikiRenderer\Generator\DocumentGeneratorInterface $documentGenerator @param string $wikiContent @return \WikiRenderer\Generator\InlineGeneratorInterface
entailment
public function execute($respTrackData = null, $userId = null) { $batch = $this->getBatch(); $tracker = $this->loader->getTracker(); $respTrack = $tracker->getRespondentTrack($respTrackData); $engine = $respTrack->getTrackEngine(); $engine->checkRoundsFor($respTrack...
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 applyParameters(array $parameters, $includeNumericFilters = false) { if ($parameters) { // Allow use when passed only an ID value if (isset($parameters[\MUtil_Model::REQUEST_ID]) && (! isset($parameters[\MUtil_Model::REQUEST_ID1], $parameters[\MUtil_Model::REQUEST...
Stores the fields that can be used for sorting or filtering in the sort / filter objects attached to this model. @param array $parameters @param boolean $includeNumericFilters When true numeric filter keys (0, 1, 2...) are added to the filter as well @return array The $parameters minus the sort & textsearch keys
entailment
public function getKeyRef($forData, $href = array(), $organizationInKey = null) { $keys = $this->getKeys(); if (! $organizationInKey) { if ($forData instanceof \MUtil_Lazy_RepeatableInterface) { // Here I kind of assume that the data always contains the organizatio...
Return an identifier the item specified by $forData basically transforms the fieldnames ointo oan IDn => value array @param mixed $forData Array value to vilter on @param array $href Or \ArrayObject @return array That can by used as href
entailment
protected function getTranslateAdapter() { if ($this->translate instanceof \Zend_Translate) { return $this->translate->getAdapter(); } if (! $this->translate instanceof \Zend_Translate_Adapter) { $this->translate = new \MUtil_Translate_Adapter_Potemki...
Returns a translate adaptor @return \Zend_Translate_Adapter
entailment
public function processAfterLoad($data, $new = false, $isPostData = false) { // Repeat settings here, because the might be overloaded in the meantime $this->refreshGroupSettings(); return parent::processAfterLoad($data, $new, $isPostData); }
Helper function that procesess the raw data after a load. @see \MUtil_Model_SelectModelPaginator @param mxied $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 refreshGroupSettings() { $group = $this->currentUser->getGroup(); if ($group instanceof Group) { $group->applyGroupToModel($this, $this->hideWhollyMasked); } }
Function to re-apply all the masks and settings for the current group @return void
entailment
public function getHtmlOutput(\Zend_View_Abstract $view) { $tUtil = $this->util->getTokenData(); $repeater = new \MUtil_Lazy_RepeatableByKeyValue($tUtil->getEveryStatus()); $table = new \MUtil_Html_TableElement(); $table->class = 'compliance timeTable rightFloat table table...
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 execute($lineNr = null, $fieldId = null, $fieldSub = null, $fieldCalc = null) { $batch = $this->getBatch(); $import = $batch->getVariable('import'); if (! (isset($import['trackId']) && $import['trackId'] && $fieldId)) { // Do nothing return; ...
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($lineNr = null, $forRoundOrder = null, $usesRoundRound = null, $roundField = null) { $batch = $this->getBatch(); $import = $batch->getVariable('import'); if (! (isset($import['trackId']) && $import['trackId'])) { // Do nothing return; ...
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($tracksData = null) { $batch = $this->getBatch(); switch (count((array) $tracksData)) { case 0: $batch->addToCounter('import_errors'); $batch->addMessage($this->_('No "track" data found in import file.')); break; ...
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
public function getHtmlOutput(\Zend_View_Abstract $view) { $table = \MUtil_Html_TableElement::createArray($this->tableData, $this->tableTitle, $this->tableNested); $table->class = 'browser table'; $div = \MUtil_Html::create()->div(array('class' => 'table-container')); $div[] = $table...
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 applyParsley() { $this->parsleyEnabled = true; $useCurrent = self::config()->use_current; // Include your own version of jQuery (>= 1.8) and entwine // You can also simply call globalRequirements() Requirements::javascript('zenvalidator/javascript/parsley-2....
applyParsley @return $this
entailment
public function disableParsley() { $this->parsleyEnabled = false; if ($this->form) { $this->form->removeExtraClass('parsley'); $this->form->removeExtraClass('custom-parsley'); } return $this; }
disableParsley @return this
entailment
public function setConstraint($fieldName, $constraint) { $class = get_class($constraint); // remove existing constraint if it already exists if ($this->getConstraint($fieldName, $class)) { $this->removeConstraint($fieldName, $class); } $this->constraints[$fieldNa...
setConstraint - sets a ZenValidatorContraint on this validator @param string $field - name of the field to be validated @param ZenFieldValidator $constraint @return $this
entailment
public function setConstraints($constraints) { foreach ($constraints as $fieldName => $v) { if (is_array($v)) { foreach ($v as $constraintFromArray) { $this->setConstraint($fieldName, $constraintFromArray); } } else { ...
setConstraints - sets multiple constraints on this validator @param array $constraints - $fieldName => ZenValidatorConstraint @return $this
entailment
public function getConstraint($fieldName, $constraintName) { if (isset($this->constraints[$fieldName][$constraintName])) { return $this->constraints[$fieldName][$constraintName]; } }
get a constraint by fieldName, constraintName @param string $fieldName @param string $constraintName @return ZenValidatorConstraint
entailment
public function removeConstraint($fieldName, $constraintName) { if ($constraint = $this->getConstraint($fieldName, $constraintName)) { if ($this->form) { $constraint->removeParsley(); } $class = get_class($constraint); unset($this->constraints[...
remove a constraint from a field @param string $field - name of the field to have a constraint removed from @param string $constraintName - class name of constraint @return $this
entailment
public function removeConstraints($fieldName) { if ($constraints = $this->getConstraints($fieldName)) { foreach ($constraints as $k => $v) { $this->removeConstraint($fieldName, $k); } unset($this->constraints[$fieldName]); } return $this; ...
remove all constraints from a field @param string $field - name of the field to have constraints removed from @return $this
entailment
public function addRequiredFields($fields, ...$otherFields) { if(!is_array($fields)) { $fields = [$fields]; } if(!empty($otherFields)) { $fields = array_merge($fields, $otherFields); } if (ArrayLib::is_associative($fields)) { foreach ($fiel...
A quick way of adding required constraints to a number of fields @param array $fieldNames - can be either indexed array of fieldnames, or associative array of fieldname => message @param array $otherFields @return this
entailment
public function php($data) { $valid = true; // If we want to ignore validation if (get_class($this->form->getRequestHandler()->buttonClicked()) === 'FormActionNoValidation') { return $valid; } // validate against form field validators $fields = $this->fo...
Performs the php validation on all ZenValidatorConstraints attached to this validator @return boolean
entailment
public function removeAllValidation() { if ($this->form) { foreach ($this->constraints as $fieldName => $constraints) { foreach ($constraints as $constraint) { $constraint->removeParsley(); unset($constraint); } ...
Removes all constraints from this validator.
entailment
public function fieldIsRequired($fieldName) { $required = false; $constraints = $this->getConstraints($fieldName); if ($constraints) { foreach ($constraints as $constraint) { if ($constraint instanceof Constraint_required) { $required = true; ...
Returns whether the field in question is required. This will usually display '*' next to the field. @param string $fieldName @return bool
entailment
public function getFieldName($field, $modelName) { if (isset($this->_unionMapsTo[$modelName][$field])) { return $this->_unionMapsTo[$modelName][$field]; } return $field; }
Get the SQL table name of the union sub model that should be used for this row. @param array $row @return string
entailment
public function getTableName($modelName) { if (! isset($this->_unionModels[$modelName])) { return null; } $model = $this->_unionModels[$modelName]; if ($model instanceof \MUtil_Model_TableModel) { return $model->getTableName(); } }
Get the SQL table name of the union sub model that should be used for this row. @param string $modelName Name of the submodel @return string
entailment
protected function checkRequired($exportCode, array $roundsData) { // First find rounds using this export code $rounds = array(); foreach ($roundsData as $roundData) { if ($roundData['survey_export_code'] == $exportCode) { $rounds[$roundData['gro_id_order']] = $ro...
Returns tru if another round depends on a round using this export code @param string $exportCode @param array $roundsData @return boolean
entailment
protected function checkSourceRequired($source, $field, array $rounds) { if (($source == \Gems_Tracker_Engine_StepEngineAbstract::ANSWER_TABLE) || ($source == \Gems_Tracker_Engine_StepEngineAbstract::TOKEN_TABLE)) { return isset($rounds[$field]) && $rounds[$field]; } ...
Returns true when thw valid_for_source and valid_for combo uses any round. @param string $source @param string $field @param array $rounds @return boolean
entailment
public function execute($lineNr = null, $surveyData = null) { $batch = $this->getBatch(); $import = $batch->getVariable('import'); $trackData = $this->util->getTrackData(); if (isset($surveyData['gsu_export_code']) && $surveyData['gsu_export_code']) { $name = ...
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($detailed, $action) { $model = $this->loader->getAgenda()->newFilterModel(); if ($detailed) { if (('edit' == $action) || ('create' == $action)) { $model->applyEditSettings(('create' == $action)); } else { $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 getShowFilter() { $filter = $this->loader->getAgenda()->getFilter($this->_getIdParam()); if ($filter) { return $filter; } }
Get an agenda filter for the current shown item @return AppointmentFilterInterface or null
entailment
public function getTextSettings() { $description = $this->_( "Use the %%-sign to search for zero or more random characters and an _ for a single random character." ) . "\n" . $this->_("Leave empty to filter for missing content."); return array( ...
Get the settings for the gaf_filter_textN fields Fields not in this array are not shown in any way @return array gaf_filter_textN => array(modelFieldName => fieldValue)
entailment
protected function saveData() { if ($this->trackEngine) { // concatenate user input (gtf_field fields) // before the data is saved (the fields them $this->formData['gr2t_track_info'] = $this->trackEngine->calculateFieldsInfo($this->formData); } // Perform...
Hook containing the actual save code. Call's afterSave() for user interaction. @see afterSave()
entailment
protected function getRequestKey() { if (! $this->_requestKey) { $request = $this->getRequest(); $this->_requestKey[$request->getModuleKey()] = $request->getModuleName(); $this->_requestKey[$request->getControllerKey()] = $request->getControllerName(); $t...
The module / controller /action of the request in an array. @return array
entailment
public function setProgramParams(array $programParams) { // Store result $this->_programParams = $programParams; if (! $this->_readonly) { $this->session->requestCache[$this->getStorageKey()] = $programParams; } return $this; }
Set the keys stored fot this cache @param array $programParams @return \Gems_Util_RequestCache (continuation pattern)
entailment
public static function set($name, $value, $days = 30, $basepath = '/') { // Gems uses the empty string when the base path is '/' if (! $basepath) { $basepath = '/'; } if (\Zend_Session::$_unitTestEnabled) { return true; } // Set the cookie fo...
Store this cookie in a generic save method that works for both sub-directory installations and own url installations. @param string $name Name of the cookie @param mixed $value Value to set @param int $days Number of days to keep this cookie @param string $basepath The folder of the domain, if any. @return boolean Tru...
entailment
public static function setOrganization($organization, $basepath = '/') { if ($organization) { // Set the cookie for 30 days return self::set(self::ORGANIZATION_COOKIE, $organization, 30, $basepath); } }
Store the organization in a cookie. @param int $organization Organization to store @param string $basepath The folder of the domain, if any. @return boolean True if the cookie was stored.
entailment
protected function createModel($detailed, $action) { // Export all if ('export' === $action) { $detailed = true; } if ($detailed) { $year = $this->_('Year'); $month = $this->_('Month'); $fields[$year] = new \Zend_Db_Expr("YEAR(gr2o_c...
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 afterRegistry() { $this->_select = $this->db->select(); $this->_select->from('gems__appointments', $this->fields); }
Called after the check that all required registry values have been set correctly has run. @return void
entailment