sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
public function getDateUnitsList()
{
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 units used by this engine
@return array date_unit => label
@deprecated since 1.7.1 use Translated->getDatePeriodUnits() | entailment |
public function getInsertableSurveys($organizationId = null)
{
$cacheId = __CLASS__ . '_' . __FUNCTION__ . '_' . $organizationId;
if ($results = $this->cache->load($cacheId)) {
return $results;
}
if (null === $organizationId) {
$orgWhere = '';
} else... | Retrieve an array of key/value pairs for gsu_id_survey and gsu_survey_name
that are active and are insertable
@param int $organizationId Optional organization id
@return array | entailment |
public function getSurveysByCode($code)
{
$cacheId = __CLASS__ . '_' . __FUNCTION__ . '_' . $code;
if ($results = $this->cache->load($cacheId)) {
return $results;
}
$select = $this->db->select();
$select->from('gems__surveys', array('gsu_id_survey', 'gsu_survey_... | Get all the surveys for a certain code
@param string $code
@return array survey id => survey name | entailment |
public function getSurveysFor($organizationId)
{
if ($organizationId !== null) {
$where = "AND EXISTS (SELECT 1 FROM gems__rounds
INNER JOIN gems__tracks ON gro_id_track = gtr_id_track
WHERE gro_id_survey = gsu_id_survey AND
gtr_organizations LIKE ... | Get all the surveys for a certain organization id
@param int $organizationId
@return array survey id => survey name | entailment |
public function getTrackDateFields($trackId)
{
$dateFields = $this->db->fetchPairs("SELECT gtf_id_field, gtf_field_name FROM gems__track_fields WHERE gtf_id_track = ? AND gtf_field_type = 'date' ORDER BY gtf_id_order", $trackId);
if (! $dateFields) {
$dateFields = array();
}
... | Returns array (id => name) of the track date fields for this track, sorted by order
@param int $trackId
@return array | entailment |
public function getTracksBySurvey($surveyId)
{
$cacheId = __CLASS__ . '_' . __FUNCTION__ . '_' . $surveyId;
if ($results = $this->cache->load($cacheId)) {
return $results;
}
$select = $this->db->select();
$select->from('gems__tracks', array('gtr_id_track', 'gtr_... | Get all the tracks for a certain survey
@param int $surveyId
@return array survey id => survey name | entailment |
public function getTracksForOrgs(array $orgs)
{
$orgWhere = "(INSTR(gtr_organizations, '|" .
implode("|') > 0 OR INSTR(gtr_organizations, '|", array_keys($orgs)) .
"|') > 0)";
$select = "SELECT gtr_id_track, gtr_track_name
FROM gems__tracks
... | Returns array (id => name) of all tracks accessible by this organization, sorted alphabetically
@param array $orgs orgId => org name
@return array | entailment |
public function getTrackTitle($trackId)
{
$tracks = $this->getAllTracks();
if ($tracks && isset($tracks[$trackId])) {
return $tracks[$trackId];
}
} | Returns title of the track.
@param int $trackId
@return string | entailment |
public function hasHtmlOutput()
{
if (! $this->multiTracks) {
return false;
}
$this->tracker = $this->loader->getTracker();
if (! $this->respondentTrackId) {
$this->respondentTrackId = $this->request->getParam(\Gems_Model::RESPONDENT_TRACK);
}
... | 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 processFilterAndSort(\MUtil_Model_ModelAbstract $model)
{
$model->setFilter(array(
'gr2t_id_track' => $this->trackId,
'gr2t_id_user' => $this->respondentId,
'gr2t_id_organization' => $this->organizationId,
));
if ($thi... | Overrule to implement snippet specific filtering and sorting.
@param \MUtil_Model_ModelAbstract $model | entailment |
public function logError(\Exception $exception, \Zend_Controller_Request_Abstract $request = null)
{
$info = array();
$info[] = 'Class: ' . get_class($exception);
$info[] = 'Message: ' . $this->stripHtml($exception->getMessage());
if (($exception instanceof \Gems_Exception) &... | Helper method to log exception and (optional) request information
@param \Exception $exception
@param \Zend_Controller_Request_Abstract $request | entailment |
protected function createModel()
{
$model = $this->token->getModel();
$model->applyFormatting();
if ($this->useFakeForm && $this->token->hasSuccesCode() && (! $this->token->isCompleted())) {
$model->set('gto_id_token', 'formatFunction', array(__CLASS__, 'makeFakeForm'));
... | Creates the model
@return \MUtil_Model_ModelAbstract | entailment |
public function getHtmlOutput(\Zend_View_Abstract $view)
{
if ($this->tokenId) {
if ($this->token->exists) {
$htmlDiv = \MUtil_Html::div();
$htmlDiv->h3($this->getTitle());
$table = parent::getHtmlOutput($view);
$this->applyHtml... | 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 static function makeFakeForm($value)
{
$form = new \Gems_Form();
$form->removeDecorator('HtmlTag');
$element = new \Zend_Form_Element_Text('gto_id_token');
$element->class = 'token_copy';
$element->setDecorators(array('ViewHelper', array('HtmlTag', 'Div')));
... | Creates a fake form so that it is (slightly) easier to
copy and paste a token.
@param string $value Gems token value
@return \Gems_Form | entailment |
public function execute($patchLevel = null, $ignoreCompleted = true, $ignoreExecuted = false)
{
$batch = $this->getBatch();
$batch->addMessage(sprintf($this->translate->_('Adding patchlevel %d'), $patchLevel));
$this->patcher->uploadPatches($patchLevel);
$this->patcher->loadPatchBat... | Should handle execution of the task, taking as much (optional) parameters as needed
The parameters should be optional and failing to provide them should be handled by
the task
@param int $patchLevel Only execute patches for this patchlevel
@param boolean $ignoreCompleted Set to yes to skip patches that where already ... | entailment |
protected function addFormElements(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model)
{
$bridge->addHtml('to', 'label', $this->_('To'));
$bridge->addExhibitor('track', array('label' => $this->_('Track')));
$bridge->addExhibitor('round', array('label' =>... | Adds elements from the model to the bridge that creates the form.
Overrule this function to add different elements to the browse table, without
having to recode the core table building code.
@param \MUtil_Model_Bridge_FormBridgeInterface $bridge
@param \MUtil_Model_ModelAbstract $model | entailment |
public function onBootstrap(MvcEvent $e)
{
$manager = Container::getDefaultManager();
if (!$manager->sessionExists()) {
return;
}
$app = $e->getApplication();
/** @var \Zend\EventManager\SharedEventManagerInterface $sharedEvm */
$sharedEvm = $app->getEven... | Bootstrap Handle FlashMessenger session show. | entailment |
private function duplicateFlashMessengerSessionData(Container $container) : void
{
$flashToolbarContainer = new Container('SanSessionToolbarFlashMessenger');
foreach ($container->getArrayCopy() as $key => $row) {
foreach ($row->toArray() as $keyArray => $rowArray) {
if ($... | Used to duplicate flashMessenger data as it shown and gone. | entailment |
public function flashMessengerHandler(EventInterface $e) : void
{
/** @var \Zend\Mvc\Controller\AbstractActionController $controller */
$controller = $e->getTarget();
if (!$controller->getPluginManager()->has('flashMessenger')) {
return;
}
$flash = $controller->p... | Handle FlashMessenger data to be able to be seen in both "app" and toolbar parts. | entailment |
public function processTokenData(\Gems_Tracker_Token $token)
{
if ($token->getReceptionCode()->isSuccess() && $token->isCompleted()) {
$respTrack = $token->getRespondentTrack();
$fields = $respTrack->getCodeFields();
$answers = $token->getRawAnswers();
$n... | Process the data and return the answers that should be changed.
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 addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
{
if ($model->has('row_class')) {
$bridge->getTable()->tbody()->getFirst(true)->appendAttrib('class', $bridge->row_class);
}
if ($editMenuItem = $this->getE... | 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 _showTable($caption, $data, $nested = false)
{
$table = \MUtil_Html_TableElement::createArray($data, $caption, $nested);
$table->class = 'browser table';
$div = \MUtil_Html::create()->div(array('class' => 'table-container'));
$div[] = $table;
$this->html[] ... | Helper function to show a table
@param string $caption
@param array $data
@param boolean $nested | entailment |
public function createModel($detailed, $action)
{
$model = new \MUtil_Model_TableModel('gems__roles');
$model->set('grl_name', 'label', $this->_('Name'),
'size', 15,
'minlength', 4
);
$model->set('grl_description', 'label', $this->_('Descripti... | 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 editAction()
{
$model = $this->getModel();
$data = $model->loadFirst();
//If we try to edit master, add an error message and reroute
if (isset($data['grl_name']) && $data['grl_name']=='master') {
$this->addMessage($this->_('Editing `master` is not al... | Action for showing a edit item page with extra title | entailment |
public function formatLongLine(array $privileges)
{
$output = \MUtil_Html::create('div');
if (count($privileges)) {
$privileges = array_combine($privileges, $privileges);
foreach ($this->getUsedPrivileges() as $privilege => $description) {
if (isset($priv... | Output for browsing rols
@param array $privileges
@return array | entailment |
public function formatInherited(array $parents)
{
$privileges = array_keys($this->getInheritedPrivileges($parents));
return $this->formatPrivileges($privileges);
} | Output of not allowed for viewing rols
@param array $parent
@return \MUtil_Html_ListElement | entailment |
public function formatNotAllowed($data)
{
list($parents_string, $privileges_string) = explode("\t", $data, 2);
$parents = explode(',', $parents_string);
$privileges = explode(',', $privileges_string);
if (count($privileges) > 0 ) {
$privileges = array_combine($privileg... | Output of not allowed for viewing rols
@param strong $data parents tab privileges
@return \MUtil_Html_ListElement | entailment |
public function formatPrivileges(array $privileges)
{
if (count($privileges)) {
$output = \MUtil_Html_ListElement::ul();
$privileges = array_combine($privileges, $privileges);
$output->class = 'allowed';
foreach ($this->getUsedPrivileges() as $privilege ... | Output for viewing rols
@param array $privileges
@return \MUtil_Html_ListElement | entailment |
protected function getInheritedPrivileges(array $parents)
{
if (! $parents) {
return array();
}
$rolePrivileges = $this->acl->getRolePrivileges();
$inherited = array();
foreach ($parents as $parent) {
if (isset($rolePrivileges[$parent])) {
... | Get the privileges for thess parents
@param array $parents
@return array privilege => setting | entailment |
protected function getUsedPrivileges()
{
if (! $this->usedPrivileges) {
$privileges = $this->menu->getUsedPrivileges();
asort($privileges);
//don't allow to edit the pr.nologin and pr.islogin privilege
unset($privileges['pr.nologin']);
unset($priv... | Get the privileges a role can have.
@return array | entailment |
public function overviewAction()
{
$roles = array();
foreach ($this->acl->getRolePrivileges() as $role => $privileges) {
$roles[$role][$this->_('Role')] = $role;
$roles[$role][$this->_('Parents')] = $privileges[\MUtil_Acl::PARENTS] ? implode(', ', $privileges[\MUtil_Acl... | Action to shw overview of all privileges | entailment |
public function privilegeAction()
{
$privileges = array();
foreach ($this->acl->getPrivilegeRoles() as $privilege => $roles) {
$privileges[$privilege][$this->_('Privilege')] = $privilege;
$privileges[$privilege][$this->_('Allowed')] = $roles[\Zend_Acl::TYPE_ALLOW] ? implod... | Action to show all privileges | entailment |
public function handle($path = null)
{
$path = ltrim($path, '/');
$cleanPrefix = rtrim($this->urlPrefix, '/');
return sprintf('%s/%s', $cleanPrefix, $path);
} | Executes the plugin.
@param string null $path
@return mixed | entailment |
protected function addSynchronizationInformation()
{
$this->html->pInfo($this->_(
'Check source for new surveys, changes in survey status and survey deletion. Can also perform maintenance on some sources, e.g. by changing the number of attributes.'
));
$this->html->pI... | Displays a textual explanation what synchronization does on the page. | entailment |
public function attributesAction()
{
$sourceId = $this->getSourceId();
$where = $this->db->quoteInto('gsu_id_source = ?', $sourceId);
$batch = $this->loader->getTracker()->refreshTokenAttributes('attributeCheck' . $sourceId, $where);
$title = sprintf($this->_('Refreshing token a... | Check token attributes for a single source | entailment |
public function attributesAllAction()
{
$batch = $this->loader->getTracker()->refreshTokenAttributes('attributeCheckAll');
$title = $this->_('Refreshing token attributes for all sources.');
$this->_helper->batchRunner($batch, $title, $this->accesslog);
$this->html->pInfo($this->_(... | Check all token attributes for all sources | entailment |
public function checkAction()
{
$sourceId = $this->getSourceId();
$where = $this->db->quoteInto('gto_id_survey IN (SELECT gsu_id_survey FROM gems__surveys WHERE gsu_id_source = ?)', $sourceId);
$batch = $this->loader->getTracker()->recalculateTokens('sourceCheck' . $sourceId, $this->curr... | Check all the tokens for a single source | entailment |
public function createModel($detailed, $action)
{
$tracker = $this->loader->getTracker();
$model = new \MUtil_Model_TableModel('gems__sources');
$model->set('gso_source_name', 'label', $this->_('Name'),
'description', $this->_('E.g. the name of the project - for single sou... | 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 |
private function getSourceById($sourceId = null)
{
if (null === $sourceId) {
$sourceId = $this->getSourceId();
}
return $this->loader->getTracker()->getSource($sourceId);
} | Load a source object
@param int $sourceId
@return \Gems_Tracker_Source_SourceInterface | entailment |
public function pingAction()
{
$source = $this->getSourceById();
try {
if ($source->checkSourceActive($this->currentUser->getUserId())) {
$this->addMessage($this->_('This installation is active.'), 'success');
} else {
$this->addMessage($this-... | Action to check whether the source is active | entailment |
public function synchronizeAction()
{
$sourceId = $this->getSourceId();
$batch = $this->loader->getTracker()->synchronizeSources($sourceId, $this->currentUser->getUserId());
$title = sprintf($this->_('Synchronize the %s source.'),
$this->db->fetchOne("SELECT gso_source_... | Synchronize survey status for the surveys in a source | entailment |
public function synchronizeAllAction()
{
$batch = $this->loader->getTracker()->synchronizeSources(null, $this->currentUser->getUserId());
$batch->minimalStepDurationMs = 3000;
$title = $this->_('Synchronize all sources.');
$this->_helper->batchRunner($batch, $title, $this->accesslog... | Synchronize survey status for the surveys in all sources | entailment |
public function answerAction()
{
// Set menu OFF
$this->menu->setVisible(false);
$token = $this->getToken();
$snippets = $token->getAnswerSnippetNames();
if ($snippets) {
$this->setTitle(sprintf($this->_('Token answers: %s'), strtoupper($token->getTokenId()))... | Pops the answers to a survey in a separate window | entailment |
public function answerExportAction()
{
if ($this->answerExportSnippets) {
$params = $this->_processParameters($this->answerExportParameters + $this->defaultTokenParameters);
$this->addSnippets($this->answerExportSnippets, $params);
}
} | Export a single token | entailment |
public function checkAllTracksAction()
{
$respondent = $this->getRespondent();
$where = $this->db->quoteInto('gr2t_id_user = ?', $respondent->getId());
$batch = $this->loader->getTracker()->checkTrackRounds(
'trackCheckRoundsResp_' . $respondent->getId(),
... | Action for checking all assigned rounds for this respondent using a batch | entailment |
public function checkTokenAnswersAction()
{
$token = $this->getToken();
$where = $this->db->quoteInto('gto_id_token = ?', $token->getTokenId());
$batch = $this->loader->getTracker()->recalculateTokens(
'answersCheckToken__' . $token->getTokenId(),
... | Check the tokens for a single token | entailment |
public function checkTrackAction()
{
$respondent = $this->getRespondent();
$respTrackId = $this->getRespondentTrackId();
$trackEngine = $this->getTrackEngine();
$where = $this->db->quoteInto('gr2t_id_respondent_track = ?', $respTrackId);
$batch = $this->loader->getTrac... | Action for checking all assigned rounds for a single respondent track using a batch | entailment |
public function createAction()
{
if (! $this->isMultiTracks()) {
// Fix for double pressing of create button
$request = $this->getRequest();
$model = $this->getModel();
$model->setFilter(array()) // First clear existing filter
->applyReq... | Action for showing a create new item page
Uses separate createSnippets instead of createEditSnipppets | entailment |
protected function createModel($detailed, $action)
{
$apply = true;
$model = $this->loader->getTracker()->getRespondentTrackModel();
if ($detailed) {
$engine = $this->getTrackEngine();
if ($engine) {
switch ($action) {
case 'export... | 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 deleteTrackAction()
{
if ($this->deleteTrackSnippets) {
$params = $this->_processParameters($this->deleteTrackParameters + $this->deleteParameters);
$this->addSnippets($this->deleteTrackSnippets, $params);
}
} | Delete a track | entailment |
public function editAction()
{
$this->editParameters = $this->editParameters + $this->defaultTokenParameters;
$this->createEditSnippets = $this->getToken()->getEditSnippetNames();
parent::editAction();
} | Edit single token | entailment |
public function editTrackAction()
{
if ($this->editTrackSnippets) {
$params = $this->_processParameters($this->editTrackParameters + $this->createEditParameters);
$this->addSnippets($this->editTrackSnippets, $params);
}
} | Edit the respondent track data | entailment |
public function emailAction()
{
if ($this->emailSnippets) {
$params = $this->_processParameters($this->emailParameters + $this->defaultTokenParameters);
$this->addSnippets($this->emailSnippets, $params);
}
} | Email the user | entailment |
public function exportTrackAction()
{
if ($this->exportTrackSnippets) {
$params = $this->_processParameters($this->exportTrackParameters);
$this->addSnippets($this->exportTrackSnippets, $params);
}
} | Export a single track | entailment |
protected function getCorrectTokenTitle()
{
$token = $this->getToken();
return sprintf(
$this->_('Correct answers for survey %s, round %s'),
$token->getSurveyName(),
$token->getRoundDescription()
);
} | Get the title for correcting a token
@return string | entailment |
protected function getCreateTrackTitle()
{
$respondent = $this->getRespondent();
return sprintf(
$this->_('Adding the %s track to respondent %s: %s'),
$this->getTrackEngine()->getTrackName(),
$respondent->getPatientNumber(),
$responden... | Get the title for creating a track
@return string | entailment |
protected function getTrackTitle()
{
$respondent = $this->getRespondent();
$respTrack = $this->getRespondentTrack();
if ($respTrack) {
$trackEngine = $respTrack->getTrackEngine();
if ($this->currentUser->areAllFieldsMaskedWhole('grs_first_name', 'grs_surname_prefi... | Get the title describing the track
@return string | entailment |
protected function getTokenTitle()
{
$token = $this->getToken();
$respondent = $token->getRespondent();
// Set params
return sprintf(
$this->_('Token %s in round "%s" in track "%s" for respondent nr %s: %s'),
$token->getTokenId(),
... | Get the title describing the token
@return string | entailment |
protected function getEmailTokenTitle()
{
$token = $this->getToken();
$respondent = $token->getRespondent();
// Set params
return sprintf(
$this->_('Send mail to %s respondent nr %s for token %s'),
$token->getEmail(), // When using relat... | Get the title for editing a track
@return string | entailment |
public function getIndexTitle()
{
$respondent = $this->getRespondent();
return sprintf(
$this->_('Tracks assigned to %s: %s'),
$respondent->getPatientNumber(),
$respondent->getFullName()
);
} | Helper function to get the title for the index action.
@return $string | entailment |
protected function getInsertInTrackTitle()
{
$respondent = $this->getRespondent();
return sprintf(
$this->_('Inserting a survey in a track for respondent %s: %s'),
$respondent->getPatientNumber(),
$respondent->getFullName()
);
} | Get the title for creating a track
@return string | entailment |
public function getRespondentTrack()
{
static $respTrack;
if ($respTrack instanceof \Gems_Tracker_RespondentTrack) {
return $respTrack;
}
$respTrackId = $this->_getParam(\Gems_Model::RESPONDENT_TRACK);
$tracker = $this->loader->getTracker();
if ($re... | Retrieve the respondent track
(So we don't need to repeat that for every snippet.)
@return \Gems_Tracker_RespondentTrack | entailment |
public function getSurveyId()
{
$sid = $this->_getParam(\Gems_Model::SURVEY_ID);
if ($sid) {
return $sid;
}
if ($this->getTokenId()) {
return $this->getToken()->getSurveyId();
}
} | Retrieve the survey ID
@return int | entailment |
public function getToken()
{
static $token;
if ($token instanceof \Gems_Tracker_Token) {
return $token;
}
$token = null;
$tokenId = $this->getTokenId();
if ($tokenId) {
$token = $this->loader->getTracker()->getToken($tokenId);
}
... | Retrieve the token
@return \Gems_Tracker_Token | entailment |
public function getTrackEngine()
{
static $engine;
if ($engine instanceof \Gems_Tracker_Engine_TrackEngineInterface) {
return $engine;
}
try {
$respTrack = $this->getRespondentTrack();
if ($respTrack instanceof \Gems_Tracker_RespondentTrack) {
... | Retrieve the track engine
@return \Gems_Tracker_Engine_TrackEngineInterface | entailment |
protected function getViewTrackTitle()
{
$trackEngine = $this->getTrackEngine();
if ($this->isMultiTracks()) {
$respondent = $this->getRespondent();
// Set params
return sprintf(
$this->_('%s track assignments for respondent nr %s: %s'),
... | Get the title for viewing track usage
@return string | entailment |
public function init()
{
parent::init();
$request = $this->getRequest();
if (in_array($request->getActionName(), $this->tokenReturnActions)) {
// Tell the system where to return to after a survey has been taken
$this->currentUser->setSurveyReturn($request);
... | Initialize translate and html objects
Called from {@link __construct()} as final step of object instantiation.
@return void | entailment |
public function insertAction()
{
if ($this->insertSnippets) {
$params = $this->_processParameters($this->insertParameters);
$this->addSnippets($this->insertSnippets, $params);
}
} | Insert a single survey into a track | entailment |
public function questionsAction()
{
if (!$this->getTokenId()) {
$params = $this->_processParameters($this->questionsParameters);
} else {
$params = $this->_processParameters($this->questionsParameters + $this->defaultTokenParameters);
}
if ($this->questionsSni... | Shows the questions in a survey | entailment |
public function recalcAllFieldsAction()
{
$respondent = $this->getRespondent();
$where = $this->db->quoteInto('gr2t_id_user = ?', $respondent->getId());
$batch = $this->loader->getTracker()->recalcTrackFields(
'trackRecalcFieldsResp_' . $respondent->getId(),
... | Action for checking all assigned rounds using a batch | entailment |
public function recalcFieldsAction()
{
$respondent = $this->getRespondent();
$respTrackId = $this->getRespondentTrackId();
$trackEngine = $this->getTrackEngine();
$where = $this->db->quoteInto('gr2t_id_respondent_track = ?', $respTrackId);
$batch = $this->loader->getTr... | Action for checking all assigned rounds for a single track using a batch | entailment |
public function showAction()
{
$this->showParameters = $this->showParameters + $this->defaultTokenParameters;
$this->showSnippets = $this->getToken()->getShowSnippetNames();
parent::showAction();
} | Show a single token, mind you: it can be a SingleSurveyTrack | entailment |
public function showTrackAction()
{
if ($this->showTrackSnippets) {
$params = $this->_processParameters($this->showTrackParameters);
$this->addSnippets($this->showTrackSnippets, $params);
}
} | Show information on a single track assigned to a respondent | entailment |
public function undeleteAction()
{
$this->deleteParameters = $this->deleteParameters + $this->defaultTokenParameters;
$this->deleteSnippets = $this->getToken()->getDeleteSnippetNames();
parent::deleteAction();
} | Delete a single token | entailment |
public function undeleteTrackAction()
{
if ($this->deleteTrackSnippets) {
$params = $this->_processParameters($this->deleteTrackParameters + $this->deleteParameters);
$this->addSnippets($this->deleteTrackSnippets, $params);
}
} | Undelete a track | entailment |
public function viewAction()
{
if ($this->viewSnippets) {
$params = $this->_processParameters($this->viewParameters);
$this->addSnippets($this->viewSnippets, $params);
}
} | Show information on a single track type assigned to a respondent | entailment |
public function viewSurveyAction()
{
$params = $this->_processParameters($this->viewSurveyParameters);
$this->addSnippets($this->viewSurveySnippets, $params);
} | Used in AddTracksSnippet to show a preview for an insertable survey | entailment |
protected function getResetPasswordMailFields()
{
if ($this->user->getUserId()) {
$result = $this->user->getResetPasswordMailFields();
} else {
$result['reset_key'] = '';
$result['reset_url'] = '';
}
return $result;
} | Return the mailfields for a password reset template
@return array | entailment |
public function setCreateAccountTemplate()
{
$templateId = $this->organization->getCreateAccountTemplate();
if ($templateId) {
$this->setTemplate($this->organization->getCreateAccountTemplate());
return true;
} elseif ($this->project->getEmailCreateAccount()) {
... | Set the create account Mail template from the organization or the project
@return boolean success | entailment |
public function setResetPasswordTemplate()
{
$templateId = $this->organization->getResetPasswordTemplate();
if ($templateId) {
$this->setTemplate($this->organization->getResetPasswordTemplate());
return true;
} elseif ($this->project->getEmailResetPassword()) {
... | Set the reset password Mail template from the organization or the project
@return boolean success | entailment |
public function getTab()
{
if (!$this->_db)
return 'No adapter';
foreach ($this->_db as $adapter) {
$profiler = $adapter->getProfiler();
$adapterInfo[] = $profiler->getTotalNumQueries() . ' in '
. round($profiler->getTotalElapsedSecs()*... | Gets menu tab for the Debugbar
@return string | entailment |
public function getPanel()
{
if (!$this->_db)
return '';
$html = '<h4>Database queries';
// @TODO: This is always on?
if (Zend_Db_Table_Abstract::getDefaultMetadataCache()) {
$html .= ' – Metadata cache ENABLED';
} else {
$html .= ' – Met... | Gets content panel for the Debugbar
@return string | entailment |
protected function _getObjectsAllCached($cacheId, $object, $sql, $binds = null, $tags = array())
{
$output = array();
$rows = $this->_getSelectAllCached($cacheId, $sql, $binds, $tags);
if ($rows) {
$this->source->applySource($object);
foreach ($rows as $row) {
... | Utility function for loading a complete query from cache into objects
@param string $cacheId The class is prepended to this id
@param object $object The object to put the data in
@param mixed $sql string or \Zend_Db_Select
@param array $binds sql paramters
@param mixed $tags atring or array of strings
@return array | entailment |
protected function _getSelectAllCached($cacheId, $sql, $binds = array(), $tags = array(), $natSort = false)
{
$cacheId = strtr(get_class($this) . '_a_' . $cacheId, '\\/', '__');
$result = $this->cache->load($cacheId);
if ($result) {
return $result;
}
try {
... | Utility function for loading a complete query from cache
@param string $cacheId The class is prepended to this id
@param mixed $sql string or \Zend_Db_Select
@param array $binds sql paramters
@param mixed $tags atring or array of strings
@param boolean $natSort Perform a natsort over the output
@return array | entailment |
protected function _getSelectPairsCached($cacheId, $sql, $binds = array(), $tags = array(), $sort = null)
{
$cacheId = strtr(get_class($this) . '_p_' . $cacheId, '\\/', '__');
$result = $this->cache->load($cacheId);
if ($result) {
return $result;
}
try {
... | Utility function for loading a query paired from cache
@param string $cacheId The class is prepended to this id
@param mixed $sql string or \Zend_Db_Select
@param array $binds sql paramters
@param mixed $tags atring or array of strings
@param string Optional function to sort on, only known functions will do
@return ar... | entailment |
protected function _getSelectPairsProcessedCached($cacheId, $sql, $function, $binds = array(), $tags = array(), $sort = null)
{
$cacheId = get_class($this) . '_' . $cacheId;
$result = false; //$this->cache->load($cacheId);
if ($result) {
return $result;
}
try {... | Utility function for loading a query from cache
@param string $cacheId The class is prepended to this id
@param mixed $sql string or \Zend_Db_Select
@param callable $function The function called with each row to form the result
@param array $binds sql paramters
@param mixed $tags string or array of strings
@param stri... | entailment |
protected function _getSelectProcessedCached($cacheId, $sql, $function, $keyField, $tags = array(), $sort = null)
{
$cacheId = get_class($this) . '_' . $cacheId;
$result = false; //$this->cache->load($cacheId);
if ($result) {
return $result;
}
$result = array()... | Utility function for loading a query from cache
@param string $cacheId The class is prepended to this id
@param mixed $sql string or \Zend_Db_Select
@param callable $function The function called with each row to form the result
@param string $keyField The field containing the key for each row
@param mixed $tags string... | entailment |
protected function _sortResult(array &$result, $sort = 'asort')
{
// Sorting
switch ($sort) {
case 'asort':
asort($result);
break;
case 'ksort':
ksort($result);
break;
case 'natsort':
... | Sort the array using the specified sort function
@param array $result
@param strng $sort | entailment |
public function formatNumber($value, $precision = 2)
{
if (null !== $value) {
return \Zend_Locale_Format::toNumber($value, array('precision' => $precision, 'locale' => $this->locale));
}
} | /*
public function formatDateTime($dateTimeValue, $showRecentTime = false)
{
if ($dateTimeValue) {
$locale = $this->locale;
$dateTime = strtotime($dateTimeValue);
$days = floor($dateTime / 86400) - floor(time() / 86400) + ($showRecentTime ? 0 : 1); // 86400 = 24*60*60
if ($descr = \Zend_Locale_Data::getContent($local... | entailment |
public function applyDetailSettings()
{
parent::applyDetailSettings();
$this->setIfExists('grs_surname_prefix', 'description', $this->_('de, van der, \'t, etc...'));
$this->setIfExists('grs_partner_surname_prefix', 'description', $this->_('de, van der, \'t, etc...'));
return $this;... | Set those settings needed for the detailed display
@return \Gems_Model_RespondentNlModel | entailment |
public function applyEditSettings($create = false)
{
parent::applyEditSettings($create);
$translator = $this->getTranslateAdapter();
if ($this->hashSsn !== parent::SSN_HIDE) {
self::setDutchSsn($this, $translator);
}
$this->setIfExists('grs_iso_lang', 'default'... | Set those values needed for editing
@param boolean $create True when creating
@return \Gems_Model_RespondentModel | entailment |
public static function setDutchSsn(\MUtil_Model_ModelAbstract $model, \Zend_Translate_Adapter $translator, $fieldName = 'grs_ssn')
{
$bsn = new \MUtil_Validate_Dutch_Burgerservicenummer();
$model->set($fieldName,
'size', 10,
'maxlength', 12,
'filter',... | Set the field values for a dutch social security number
@param \MUtil_Model_ModelAbstract $model
@param \Zend_Translate_Adapter $translator
@param string $fieldName | entailment |
public static function setDutchZipcode(\MUtil_Model_ModelAbstract $model, \Zend_Translate_Adapter $translator, $fieldName = 'grs_zipcode')
{
$model->set($fieldName,
'size', 7,
'description', $translator->_('E.g.: 0000 AA'),
'filter', new \Gems_Filter_DutchZipc... | Set the field values for a dutch zipcode
@param \MUtil_Model_ModelAbstract $model
@param \Zend_Translate_Adapter $translator
@param string $fieldName | entailment |
protected function getAutoSearchElements(array $data)
{
$elements = parent::getAutoSearchElements($data);
$elements[] = new \Zend_Form_Element_Hidden(\MUtil_Model::REQUEST_ID);
$elements[] = $this->_createSelectElement('gtf_field_type', $this->model, $this->_('(all types)'));
$eleme... | 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 |
public function filterAnswers(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model, array $currentNames)
{
$currentNames = array_combine($currentNames, $currentNames);
$newOrder = array();
$values = array_filter($this->token->getRawAnswers(), 'is_numeric');
... | 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 |
public function getVersion()
{
$code = $this->runShell('tika --version', $stdout);
// Parse output
if (!$code && preg_match('/Apache Tika (?<version>[\.\d]+)/', $stdout, $matches)) {
return $matches['version'];
}
return 0;
} | Get the version of tika installed, or 0 if not installed
@return mixed float | int The version of tika | entailment |
protected function runShell($command, &$stdout = '', &$stderr = '', $input = '')
{
$descriptorSpecs = [
0 => ["pipe", "r"],
1 => ["pipe", "w"],
2 => ["pipe", "w"]
];
// Invoke command
$pipes = [];
$proc = proc_open($command, $descriptorSpec... | Runs an arbitrary and safely escaped shell command
@param string $command Full command including arguments
@param string &$stdout Standand output
@param string &$stderr Standard error
@param string $input Content to pass via standard input
@return int Exit code. 0 is success | entailment |
private function _getImportantDecorator($element)
{
$class = get_class($element);
if (strpos($class, 'JQuery')) {
$dec = $element->getDecorator('UiWidgetElement');
}
if (strpos($class, 'File')) {
$dec = $element->getDecorator('File');
}
if (!... | Get a ViewHelper or ZendX decorator to add in front of the decorator chain
@param \Zend_Form_Element $element
@return null|\Zend_Form_Decorator_Abstract | entailment |
public function addDisplayGroup(array $elements, $name, $options = null)
{
//Add the group as usual, but skip decorator loading as we don't need that
return parent::addDisplayGroup($elements, $name, (array) $options + array('disableLoadDefaultDecorators' => true));
} | Add a display group to the subform
This allows to render multiple fields in one table cell. Provide a description to set the label for
the group. When the special option showLabels is set to true, inside the tabel cell all fields will
still show their own label.
Example:
<code>
$this->addDisplayGroup(array('firstname... | entailment |
public function fixDecorators()
{
//Needed for alternating rows
$this->_alternate = new \MUtil_Lazy_Alternate(array('odd', 'even'));
foreach ($this as $name => $element) {
if ($element instanceof \MUtil_Form_Element_Html) {
$this->_fixDecoratorHtml($element);
... | Fix the decorators so we get the table layout we want. Normally this is called
only once when rendering the form. | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.