当前位置: 首页>>代码示例>>PHP>>正文


PHP Gems_Loader::getTracker方法代码示例

本文整理汇总了PHP中Gems_Loader::getTracker方法的典型用法代码示例。如果您正苦于以下问题:PHP Gems_Loader::getTracker方法的具体用法?PHP Gems_Loader::getTracker怎么用?PHP Gems_Loader::getTracker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gems_Loader的用法示例。


在下文中一共展示了Gems_Loader::getTracker方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * 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
  */
 public function execute($lineNr = null, $fieldData = null)
 {
     $batch = $this->getBatch();
     $import = $batch->getVariable('import');
     if (isset($fieldData['gtf_id_order']) && $fieldData['gtf_id_order']) {
         $import['fieldOrder'][$fieldData['gtf_id_order']] = false;
         if ($batch->hasVariable('trackEngine') && isset($fieldData['gtf_field_type']) && $fieldData['gtf_field_type']) {
             $trackEngine = $batch->getVariable('trackEngine');
             if ($trackEngine instanceof \Gems_Tracker_Engine_TrackEngineInterface) {
                 $fieldDef = $trackEngine->getFieldsDefinition();
                 $field = $fieldDef->getFieldByOrder($fieldData['gtf_id_order']);
                 if ($field instanceof FieldInterface) {
                     if ($field->getFieldType() != $fieldData['gtf_field_type']) {
                         $batch->addToCounter('import_errors');
                         $batch->addMessage(sprintf($this->_('Conflicting field types "%s" and "%s" for field orders %d specified on line %d.'), $field->getFieldType(), $fieldData['gtf_field_type'], $fieldData['gtf_id_order'], $lineNr));
                     }
                 }
             }
         }
     } else {
         $batch->addToCounter('import_errors');
         $batch->addMessage(sprintf($this->_('No gtf_id_order specified for field at line %d.'), $lineNr));
     }
     if (isset($fieldData['gtf_field_type']) && $fieldData['gtf_field_type']) {
         $model = $this->loader->getTracker()->createTrackClass('Model\\FieldMaintenanceModel');
         $fields = $model->getFieldTypes();
         if (!isset($fields[$fieldData['gtf_field_type']])) {
             $batch->addToCounter('import_errors');
             $batch->addMessage(sprintf($this->_('Unknown field type "%s" specified on line %d.'), $fieldData['gtf_field_type'], $lineNr));
         }
     } else {
         $batch->addToCounter('import_errors');
         $batch->addMessage(sprintf($this->_('No field type specified on line %d.'), $lineNr));
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:43,代码来源:CheckTrackFieldImportTask.php

示例2: execute

 /**
  * 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
  */
 public function execute($formData = null)
 {
     $batch = $this->getBatch();
     $import = $batch->getVariable('import');
     $tracker = $this->loader->getTracker();
     $model = $tracker->getTrackModel();
     $model->applyFormatting(true, true);
     $trackData = $import['trackData'];
     $trackData['gtr_track_name'] = $formData['gtr_track_name'];
     $trackData['gtr_organizations'] = $formData['gtr_organizations'];
     if ($batch->hasVariable('trackEngine')) {
         $trackEngine = $batch->getVariable('trackEngine');
         if ($trackEngine instanceof \Gems_Tracker_Engine_TrackEngineInterface) {
             $trackData['gtr_id_track'] = $trackEngine->getTrackId();
         }
     }
     // \MUtil_Echo::track($trackData);
     if ($trackData['gtr_date_start'] && !$trackData['gtr_date_start'] instanceof \Zend_Date) {
         $trackData['gtr_date_start'] = new \MUtil_Date($trackData['gtr_date_start'], 'yyyy-MM-dd');
     }
     $output = $model->save($trackData);
     $import['trackId'] = $output['gtr_id_track'];
     $import['trackData']['gtr_id_track'] = $output['gtr_id_track'];
     $batch->addMessage($this->_('Merged track data'));
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:33,代码来源:MergeTrackImportTask.php

示例3: execute

 /**
  * 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
  */
 public function execute($lineNr = null, $roundData = null)
 {
     $batch = $this->getBatch();
     $import = $batch->getVariable('import');
     if (!(isset($import['trackId']) && $import['trackId'])) {
         // Do nothing
         return;
     }
     // Only save when export code is known and set
     if (!isset($roundData['survey_export_code'], $import['surveyCodes'][$roundData['survey_export_code']])) {
         // Do nothing, no survey export code or no known export code
         return;
     }
     if (!$import['surveyCodes'][$roundData['survey_export_code']]) {
         // Export code not set to skip import of round
         return;
     }
     $fieldCodes = $import['fieldCodes'];
     $roundOrders = isset($import['roundOrders']) ? $import['roundOrders'] : array();
     $tracker = $this->loader->getTracker();
     $trackEngine = $tracker->getTrackEngine($import['trackId']);
     $model = $trackEngine->getRoundModel(true, 'create');
     $roundData['gro_id_track'] = $import['trackId'];
     $roundData['gro_id_survey'] = $import['surveyCodes'][$roundData['survey_export_code']];
     if (isset($roundData['valid_after']) && $roundData['valid_after']) {
         if (isset($roundOrders[$roundData['valid_after']]) && $roundOrders[$roundData['valid_after']]) {
             $roundData['gro_valid_after_id'] = $roundOrders[$roundData['valid_after']];
         } else {
             $batch->addTask('Tracker\\Import\\UpdateRoundValidTask', $lineNr, $roundData['gro_id_order'], $roundData['valid_after'], 'gro_valid_after_id');
         }
     }
     if (isset($roundData['gro_valid_after_source'], $fieldData['gro_valid_after_field'])) {
         switch ($roundData['gro_valid_after_source']) {
             case self::APPOINTMENT_TABLE:
             case self::RESPONDENT_TRACK_TABLE:
                 if (isset($fieldCodes[$fieldData['gro_valid_after_field']])) {
                     $fieldData['gro_valid_after_field'] = $fieldCodes[$fieldData['gro_valid_after_field']];
                 }
         }
     }
     if (isset($roundData['valid_for']) && $roundData['valid_for']) {
         if (isset($roundOrders[$roundData['valid_for']]) && $roundOrders[$roundData['valid_for']]) {
             $roundData['gro_valid_for_id'] = $roundOrders[$roundData['valid_for']];
         } else {
             $batch->addTask('Tracker\\Import\\UpdateRoundValidTask', $lineNr, $roundData['gro_id_order'], $roundData['valid_for'], 'gro_valid_for_id');
         }
     }
     if (isset($roundData['gro_valid_for_source'], $fieldData['gro_valid_for_field'])) {
         switch ($roundData['gro_valid_for_source']) {
             case self::APPOINTMENT_TABLE:
             case self::RESPONDENT_TRACK_TABLE:
                 if (isset($fieldCodes[$fieldData['gro_valid_for_field']])) {
                     $fieldData['gro_valid_for_field'] = $fieldCodes[$fieldData['gro_valid_for_field']];
                 }
         }
     }
     $roundData = $model->save($roundData);
     $import['rounds'][$lineNr]['gro_id_round'] = $roundData['gro_id_round'];
     $import['roundOrders'][$roundData['gro_id_order']] = $roundData['gro_id_round'];
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:66,代码来源:CreateTrackRoundImportTask.php

示例4: execute

 /**
  * 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
  */
 public function execute($tokenData = null, $userId = null)
 {
     $batch = $this->getBatch();
     $tracker = $this->loader->getTracker();
     $batch->addToCounter('checkedTokens');
     $token = $tracker->getToken($tokenData);
     $wasAnswered = $token->isCompleted();
     if ($result = $token->checkTokenCompletion($userId)) {
         if ($result & \Gems_Tracker_Token::COMPLETION_DATACHANGE) {
             $i = $batch->addToCounter('resultDataChanges');
             $batch->setMessage('resultDataChanges', sprintf($this->_('Results and timing changed for %d tokens.'), $i));
             if ($wasAnswered) {
                 $action = 'token.data-changed';
                 $message = sprintf($this->_("Token '%s' data has changed."), $token->getTokenId());
             } else {
                 $action = 'token.answered';
                 $message = sprintf($this->_("Token '%s' was answered."), $token->getTokenId());
             }
             if (!$this->request instanceof \Zend_Controller_Request_Abstract) {
                 $this->request = \Zend_Controller_Front::getInstance()->getRequest();
             }
             $this->accesslog->logEntry($this->request, $action, true, $message, $token->getArrayCopy(), $token->getRespondentId());
         }
         if ($result & \Gems_Tracker_Token::COMPLETION_EVENTCHANGE) {
             $i = $batch->addToCounter('surveyCompletionChanges');
             $batch->setMessage('surveyCompletionChanges', sprintf($this->_('Answers changed by survey completion event for %d tokens.'), $i));
         }
     }
     if ($token->isCompleted()) {
         $batch->setTask('Tracker_ProcessTokenCompletion', 'tokproc-' . $token->getTokenId(), $tokenData, $userId);
     }
     $batch->setMessage('checkedTokens', sprintf($this->_('Checked %d tokens.'), $batch->getCounter('checkedTokens')));
     // Free memory
     $tracker->removeToken($token);
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:41,代码来源:CheckTokenCompletion.php

示例5: getFieldsTranslations

 /**
  * Get information on the field translations
  *
  * @return array of fields sourceName => targetName
  * @throws \MUtil_Model_ModelException
  */
 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->_('Token'), 'import_descr', $this->loader->getTracker()->getTokenLibrary()->getFormat(), 'required', true, 'order', 2);
     return array('token' => 'gto_id_token') + parent::getFieldsTranslations();
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:14,代码来源:TokenAnswerTranslator.php

示例6: execute

 /**
  * 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
  */
 public function execute($respTrackData = null, $userId = null)
 {
     $batch = $this->getBatch();
     $tracker = $this->loader->getTracker();
     $respTrack = $tracker->getRespondentTrack($respTrackData);
     $engine = $respTrack->getTrackEngine();
     $engine->checkRoundsFor($respTrack, $userId, $batch);
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:14,代码来源:CheckTrackRounds.php

示例7: execute

 /**
  * 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
  */
 public function execute($surveyId = null, $questionId = null, $order = null)
 {
     $batch = $this->getBatch();
     $survey = $this->loader->getTracker()->getSurvey($surveyId);
     // Now save the questions
     $answerModel = $survey->getAnswerModel('en');
     $questionModel = new \MUtil_Model_TableModel('gems__survey_questions');
     \Gems_Model::setChangeFieldsByPrefix($questionModel, 'gsq');
     $label = $answerModel->get($questionId, 'label');
     /*
             if ($label instanceof \MUtil_Html_HtmlInterface) {
                 $label = $label->render($this->view);
             }
             // */
     $question['gsq_id_survey'] = $surveyId;
     $question['gsq_name'] = $questionId;
     $question['gsq_name_parent'] = $answerModel->get($questionId, 'parent_question');
     $question['gsq_order'] = $order;
     $question['gsq_type'] = $answerModel->getWithDefault($questionId, 'type', \MUtil_Model::TYPE_STRING);
     $question['gsq_class'] = $answerModel->get($questionId, 'thClass');
     $question['gsq_group'] = $answerModel->get($questionId, 'group');
     $question['gsq_label'] = $label;
     $question['gsq_description'] = $answerModel->get($questionId, 'description');
     // \MUtil_Echo::track($question);
     try {
         $questionModel->save($question);
     } catch (\Exception $e) {
         $batch->addMessage(sprintf($this->_('Save failed for survey %s, question %s: %s'), $survey->getName(), $questionId, $e->getMessage()));
     }
     $batch->addToCounter('checkedQuestions');
     if ($questionModel->getChanged()) {
         $batch->addToCounter('changedQuestions');
     }
     $batch->setMessage('questionschanged', sprintf($this->_('%d of %d questions changed.'), $batch->getCounter('changedQuestions'), $batch->getCounter('checkedQuestions')));
     $options = $answerModel->get($questionId, 'multiOptions');
     if ($options) {
         $optionModel = new \MUtil_Model_TableModel('gems__survey_question_options');
         \Gems_Model::setChangeFieldsByPrefix($optionModel, 'gsqo');
         $option['gsqo_id_survey'] = $surveyId;
         $option['gsqo_name'] = $questionId;
         $i = 0;
         // \MUtil_Echo::track($options);
         foreach ($options as $key => $label) {
             $option['gsqo_order'] = $i;
             $option['gsqo_key'] = $key;
             $option['gsqo_label'] = $label;
             try {
                 $optionModel->save($option);
             } catch (\Exception $e) {
                 $batch->addMessage(sprintf($this->_('Save failed for survey %s, question %s, option "%s" => "%s": %s'), $survey->getName(), $questionId, $key, $label, $e->getMessage()));
             }
             $i++;
         }
         $batch->addToCounter('checkedOptions', count($options));
         $batch->addToCounter('changedOptions', $optionModel->getChanged());
         $batch->setMessage('optionschanged', sprintf($this->_('%d of %d options changed.'), $batch->getCounter('changedOptions'), $batch->getCounter('checkedOptions')));
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:64,代码来源:RefreshQuestion.php

示例8: getHtmlOutput

 /**
  * 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
  */
 public function getHtmlOutput(\Zend_View_Abstract $view)
 {
     $messages = false;
     if ($this->wasAnswered) {
         $this->currentToken = $this->token->getNextUnansweredToken();
     } else {
         $validator = $this->loader->getTracker()->getTokenValidator();
         if ($validator->isValid($this->token->getTokenId())) {
             $this->currentToken = $this->token;
         } else {
             $messages = $validator->getMessages();
             $this->currentToken = $this->token->getNextUnansweredToken();
         }
     }
     if ($this->currentToken instanceof \Gems_Tracker_Token) {
         $href = $this->getTokenHref($this->currentToken);
         $url = $href->render($this->view);
         // Redirect at once
         header('Location: ' . $url);
         exit;
     }
     // After the header() so that the patient does not see the messages after answering surveys
     if ($messages) {
         $this->addMessage($messages);
     }
     $org = $this->token->getOrganization();
     $html = $this->getHtmlSequence();
     $html->h3($this->_('Token'));
     $html->pInfo(sprintf($this->_('Thank you %s,'), $this->token->getRespondentName()));
     if ($welcome = $org->getWelcome()) {
         $html->pInfo()->raw(\MUtil_Markup::render($this->_($welcome), 'Bbcode', 'Html'));
     }
     $p = $html->pInfo()->spaced();
     if ($this->wasAnswered) {
         $p->append($this->_('Thanks for answering our questions.'));
     } elseif (!$this->isValid) {
         if ($this->token->isExpired()) {
             $this->addMessage($this->_('This survey has expired. You can no longer answer it.'));
         } else {
             $this->addMessage($this->_('This survey is no longer valid.'));
         }
     }
     $p->append($this->_('We have no further questions for you at the moment.'));
     $p->append($this->_('We appreciate your cooperation very much.'));
     if ($sig = $org->getSignature()) {
         $html->pInfo()->raw(\MUtil_Markup::render($this->_($sig), 'Bbcode', 'Html'));
     }
     /*
             $html->br();
     
             $href = array($this->request->getActionKey() => 'index', \MUtil_Model::REQUEST_ID => null);
             $buttonDiv = $html->buttonDiv(array('class' => 'centerAlign'));
             $buttonDiv->actionLink($href, $this->_('OK'));
             // */
     return $html;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:64,代码来源:RedirectUntilGoodbyeSnippet.php

示例9: execute

 /**
  * 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
  */
 public function execute($sourceId = null, $command = null)
 {
     $batch = $this->getBatch();
     $params = array_slice(func_get_args(), 2);
     $source = $this->loader->getTracker()->getSource($sourceId);
     if ($messages = call_user_func_array(array($source, $command), $params)) {
         foreach ($messages as $message) {
             $batch->addMessage($command . ': ' . $message);
         }
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:17,代码来源:SourceCommand.php

示例10: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->db = \Zend_Db::factory('pdo_sqlite', array('dbname' => ':memory:'));
     \Zend_Registry::set('db', $this->db);
     $settings = new \Zend_Config_Ini(GEMS_ROOT_DIR . '/configs/application.example.ini', APPLICATION_ENV);
     $sa = $settings->toArray();
     $this->loader = new \Gems_Loader(\Zend_Registry::getInstance(), $sa['loaderDirs']);
     \Zend_Registry::set('loader', $this->loader);
     $this->tracker = $this->loader->getTracker();
     \Zend_Registry::set('tracker', $this->tracker);
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:15,代码来源:TestAbstract.php

示例11: execute

 /**
  * 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
  */
 public function execute($sourceId = null, $userId = null)
 {
     $batch = $this->getBatch();
     $source = $this->loader->getTracker()->getSource($sourceId);
     if (is_null($userId)) {
         $userId = $this->loader->getCurrentUser()->getUserId();
     }
     $surveyCount = $batch->addToCounter('sourceSyncSources');
     $batch->setMessage('sourceSyncSources', sprintf($this->plural('Check %s source', 'Check %s sources', $surveyCount), $surveyCount));
     $source->synchronizeSurveyBatch($batch, $userId);
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:17,代码来源:SourceSyncSurveys.php

示例12: execute

 /**
  * 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
  */
 public function execute()
 {
     $batch = $this->getBatch();
     $import = $batch->getVariable('import');
     if (!(isset($import['trackId']) && $import['trackId'])) {
         // Do nothing
         return;
     }
     $tracker = $this->loader->getTracker();
     $trackEngine = $tracker->getTrackEngine($import['trackId']);
     $trackEngine->updateRoundCount($this->currentUser->getUserLoginId());
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:18,代码来源:FinishTrackImport.php

示例13: createModel

 /**
  * Creates the model
  *
  * @return \MUtil_Model_ModelAbstract
  */
 protected function createModel()
 {
     if ($this->model instanceof \Gems_Tracker_Model_StandardTokenModel) {
         $model = $this->model;
     } else {
         $model = $this->loader->getTracker()->getTokenModel();
     }
     $model->addColumn('CASE WHEN gto_completion_time IS NULL THEN gto_valid_from ELSE gto_completion_time END', 'calc_used_date', 'gto_valid_from');
     $model->addColumn('CASE WHEN gto_completion_time IS NULL THEN gto_valid_from ELSE NULL END', 'calc_valid_from', 'gto_valid_from');
     $model->addColumn('CASE WHEN gto_completion_time IS NULL AND grc_success = 1 AND gto_valid_from <= CURRENT_TIMESTAMP AND gto_completion_time IS NULL AND (gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP) THEN gto_id_token ELSE NULL END', 'calc_id_token', 'gto_id_token');
     $model->addColumn('CASE WHEN gto_completion_time IS NULL AND grc_success = 1 AND gto_valid_from <= CURRENT_TIMESTAMP AND gto_completion_time IS NULL AND gto_valid_until < CURRENT_TIMESTAMP THEN 1 ELSE 0 END', 'was_missed');
     return $model;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:18,代码来源:TokenModelSnippetAbstract.php

示例14: execute

 /**
  * 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
  */
 public function execute($respTrackData = null, $userId = null)
 {
     $batch = $this->getBatch();
     $tracker = $this->loader->getTracker();
     $respTrack = $tracker->getRespondentTrack($respTrackData);
     $i = $batch->addToCounter('checkedRespondentTracks');
     if ($result = $respTrack->checkTrackTokens($userId)) {
         $a = $batch->addToCounter('tokenDateCauses');
         $b = $batch->addToCounter('tokenDateChanges', $result);
         $batch->setMessage('tokenDateChanges', sprintf($this->_('%2$d token date changes in %1$d tracks.'), $a, $b));
     }
     $batch->setMessage('checkedRespondentTracks', sprintf($this->_('Checked %d tracks.'), $i));
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:19,代码来源:CheckTrackTokens.php

示例15: processChangedRespondent

 /**
  * Process the respondent and return true when data has changed.
  *
  * The event has to handle the actual storage of the changes.
  *
  * @param \Gems_Tracker_Respondent $respondent
  * @param int $userId The current user
  * @return boolean True when something changed
  */
 public function processChangedRespondent(\Gems_Tracker_Respondent $respondent)
 {
     $changes = 0;
     $tracker = $this->loader->getTracker();
     $respTracks = $tracker->getRespondentTracks($respondent->getId(), $respondent->getOrganizationId());
     $userId = $this->currentUser->getUserId();
     foreach ($respTracks as $respondentTrack) {
         if ($respondentTrack instanceof \Gems_Tracker_RespondentTrack) {
             $changes += $respondentTrack->checkTrackTokens($userId);
         }
     }
     // \MUtil_Echo::track('Hi there! ' . $changes);
     return (bool) $changes;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:23,代码来源:RecalculateTracks.php


注:本文中的Gems_Loader::getTracker方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。