• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP MUtil_Model_ModelAbstract类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中MUtil_Model_ModelAbstract的典型用法代码示例。如果您正苦于以下问题:PHP MUtil_Model_ModelAbstract类的具体用法?PHP MUtil_Model_ModelAbstract怎么用?PHP MUtil_Model_ModelAbstract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: filterAnswers

 /**
  * 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 chaining)
  * @return array Of the names of labels that should be shown
  */
 public function filterAnswers(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model, array $currentNames)
 {
     $repeater = $model->loadRepeatable();
     $table = $bridge->getTable();
     $table->setRepeater($repeater);
     // Filter unless option 'fullanswers' is true, can be set as get or post var.
     $requestFullAnswers = \Zend_Controller_Front::getInstance()->getRequest()->getParam('fullanswers', false);
     if (!$repeater->__start()) {
         return $currentNames;
     }
     $keys = array();
     if ($requestFullAnswers !== false) {
         // No filtering
         return $model->getItemsOrdered();
     } else {
         foreach ($model->getItemNames() as $name) {
             $start = substr(strtolower($name), 0, $this->IncludeLength);
             if (in_array($start, $this->IncludeStarts)) {
                 $keys[$name] = $name;
             }
         }
     }
     $answers = $this->token->getRawAnswers();
     // Prevent errors when no answers present
     if (!empty($answers)) {
         $results = array_intersect($currentNames, array_keys($keys), array_keys($answers));
     } else {
         $results = array_intersect($currentNames, array_keys($keys));
     }
     $results = $this->restoreHeaderPositions($model, $results);
     if ($results) {
         return $results;
     }
     return $this->getHeaders($model, $currentNames);
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:46,代码来源:CompactFullToggle.php


示例2: addBrowseTableColumns

 /**
  * 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
  */
 protected function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
 {
     $model->set('gto_id_token', 'formatFunction', 'strtoupper');
     $bridge->setDefaultRowClass(\MUtil_Html_TableElement::createAlternateRowClass('even', 'even', 'odd', 'odd'));
     $tr1 = $bridge->tr();
     $tr1->appendAttrib('class', $bridge->row_class);
     $tr1->appendAttrib('title', $bridge->gto_comment);
     $bridge->addColumn($this->createShowTokenButton($bridge), ' ')->rowspan = 2;
     // Space needed because TableElement does not look at rowspans
     $bridge->addSortable('gto_valid_from');
     $bridge->addSortable('gto_valid_until');
     $bridge->addSortable('gto_id_token');
     // $bridge->addSortable('gto_mail_sent_num', $this->_('Contact moments'))->rowspan = 2;
     $this->addRespondentCell($bridge, $model);
     $bridge->addMultiSort('ggp_name', array($this->createActionButtons($bridge)));
     $tr2 = $bridge->tr();
     $tr2->appendAttrib('class', $bridge->row_class);
     $tr2->appendAttrib('title', $bridge->gto_comment);
     $bridge->addSortable('gto_mail_sent_date');
     $bridge->addSortable('gto_completion_time');
     $bridge->addSortable('gto_mail_sent_num', $this->_('Contact moments'));
     if ($this->multiTracks) {
         $model->set('gr2t_track_info', 'tableDisplay', 'smallData');
         $model->set('gto_round_description', 'tableDisplay', 'smallData');
         $bridge->addMultiSort('gtr_track_name', 'gr2t_track_info', array($bridge->gtr_track_name->if(\MUtil_Html::raw(' » ')), ' '), 'gsu_survey_name', 'gto_round_description');
     } else {
         $bridge->addMultiSort('gto_round_description', \MUtil_Html::raw('; '), 'gsu_survey_name');
     }
     $bridge->addSortable('assigned_by');
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:40,代码来源:PlanTokenSnippet.php


示例3: replaceCreateView

 /**
  * Handles creating or replacing the view for this survey
  *
  * @param \Gems_Tracker_Survey       $viewName
  * @param \MUtil_Model_ModelAbstract $answerModel
  */
 protected function replaceCreateView(\Gems_Tracker_Survey $survey, \MUtil_Model_ModelAbstract $answerModel)
 {
     $viewName = $this->getViewName($survey);
     $responseDb = $this->project->getResponseDatabase();
     $fieldSql = '';
     foreach ($answerModel->getItemsOrdered() as $name) {
         if (true === $answerModel->get($name, 'survey_question') && !in_array($name, array('submitdate', 'startdate', 'datestamp')) && !$answerModel->is($name, 'type', \MUtil_Model::TYPE_NOVALUE)) {
             // Only real answers
             $fieldSql .= ',MAX(IF(gdr_answer_id = ' . $responseDb->quote($name) . ', gdr_response, NULL)) AS ' . $responseDb->quoteIdentifier($name);
         }
     }
     if ($fieldSql > '') {
         $dbConfig = $this->db->getConfig();
         $tokenTable = $this->db->quoteIdentifier($dbConfig['dbname'] . '.gems__tokens');
         $createViewSql = 'CREATE OR REPLACE VIEW ' . $responseDb->quoteIdentifier($viewName) . ' AS SELECT gdr_id_token';
         $createViewSql .= $fieldSql;
         $createViewSql .= "FROM gemsdata__responses join " . $tokenTable . " on (gto_id_token=gdr_id_token and gto_id_survey=" . $survey->getSurveyId() . ") GROUP BY gdr_id_token;";
         try {
             $responseDb->query($createViewSql)->execute();
         } catch (Exception $exc) {
             $responseConfig = $responseDb->getConfig();
             $dbUser = $this->db->quoteIdentifier($responseConfig['username']) . '@' . $this->db->quoteIdentifier($responseConfig['host']);
             $statement = "GRANT SELECT ON  " . $tokenTable . " TO " . $dbUser;
             $this->getBatch()->addMessage(sprintf($this->_("Creating view failed, try adding rights using the following statement: %s"), $statement));
         }
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:33,代码来源:AddRefreshQuestions.php


示例4: processFilterAndSort

 /**
  * Overrule to implement snippet specific filtering and sorting.
  *
  * @param \MUtil_Model_ModelAbstract $model
  */
 protected function processFilterAndSort(\MUtil_Model_ModelAbstract $model)
 {
     $filter[] = $this->db->quoteInto("gr2t_id_respondent_track IN (\n                    SELECT gr2t2a_id_respondent_track\n                    FROM gems__respondent2track2appointment\n                    WHERE gr2t2a_id_appointment = ?)", $this->request->getParam(\Gems_Model::APPOINTMENT_ID));
     // \MUtil_Model::$verbose = true;
     $model->setFilter($filter);
     $this->processSortOnly($model);
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:12,代码来源:TracksForAppointment.php


示例5: addFormElements

 /**
  * 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
  */
 protected function addFormElements(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model)
 {
     if (!$this->createData) {
         $bridge->addHidden('gtr_id_track');
     }
     $bridge->addText('gtr_track_name');
     // gtr_track_class
     if ($this->trackEngine) {
         $options = $model->get('gtr_track_class', 'multiOptions');
         $alternatives = $this->trackEngine->getConversionTargets($options);
         if (count($alternatives) > 1) {
             $options = $alternatives;
             $bridge->addHidden($this->_oldClassName);
             if (!isset($this->formData[$this->_oldClassName])) {
                 $this->formData[$this->_oldClassName] = $this->formData['gtr_track_class'];
             }
             $classEdit = true;
         } else {
             $classEdit = false;
         }
     } else {
         $tracker = $this->loader->getTracker();
         $options = $tracker->getTrackEngineList(true, true);
         $classEdit = true;
     }
     $model->set('gtr_track_class', 'multiOptions', $options, 'escape', false);
     if ($classEdit) {
         $bridge->addRadio('gtr_track_class');
     } else {
         $bridge->addExhibitor('gtr_track_class');
     }
     $bridge->addDate('gtr_date_start');
     $bridge->addDate('gtr_date_until');
     if (!$this->createData) {
         $bridge->addCheckbox('gtr_active');
     }
     if ($model->has('gtr_code')) {
         $bridge->addText('gtr_code');
     }
     if ($model->has('gtr_calculation_event', 'label')) {
         $bridge->add('gtr_calculation_event');
     }
     if ($model->has('gtr_completed_event', 'label')) {
         $bridge->add('gtr_completed_event');
     }
     if ($model->has('gtr_beforefieldupdate_event', 'label')) {
         $bridge->add('gtr_beforefieldupdate_event');
     }
     if ($model->has('gtr_fieldupdate_event', 'label')) {
         $bridge->add('gtr_fieldupdate_event');
     }
     $bridge->add('gtr_organizations');
     if (\MUtil_Bootstrap::enabled()) {
         $element = new \MUtil_Bootstrap_Form_Element_ToggleCheckboxes('toggleOrg', array('selector' => 'input[name^=gtr_organizations]'));
     } else {
         $element = new \Gems_JQuery_Form_Element_ToggleCheckboxes('toggleOrg', array('selector' => 'input[name^=gtr_organizations]'));
     }
     $element->setLabel($this->_('Toggle'));
     $bridge->addElement($element);
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:69,代码来源:EditTrackEngineSnippetGeneric.php


示例6: createModel

 /**
  * Creates the model
  *
  * @return \MUtil_Model_ModelAbstract
  */
 protected function createModel()
 {
     if (!$this->model instanceof LogModel) {
         $this->model = $this->loader->getModels()->createLogModel();
         $this->model->applyBrowseSettings();
     }
     return $this->model;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:13,代码来源:LogTableSnippet.php


示例7: _addIf

 private function _addIf(array $names, \MUtil_Model_Bridge_VerticalTableBridge $bridge, \MUtil_Model_ModelAbstract $model)
 {
     foreach ($names as $name) {
         if ($model->has($name, 'label')) {
             $bridge->addItem($name);
         }
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:8,代码来源:ShowRoundStepSnippet.php


示例8: addBrowseTableColumns

 /**
  * 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
  */
 protected function addBrowseTableColumns(\MUtil_Model_Bridge_TableBridge $bridge, \MUtil_Model_ModelAbstract $model)
 {
     $bridge->gr2t_id_respondent_track;
     // Data needed for edit button
     $bridge->gr2o_id_organization;
     // Data needed for edit button
     $HTML = \MUtil_Html::create();
     // Get the buttons
     $respMenu = $this->menu->findAllowedController('respondent', 'show');
     if ($respMenu) {
         $respondentButton = $respMenu->toActionLink($this->request, $bridge, $this->_('Show respondent'));
         $respondentButton->appendAttrib('class', 'rightFloat');
     } else {
         $respondentButton = null;
     }
     $trackMenu = $this->menu->findAllowedController('respondent', 'show-track');
     if ($trackMenu) {
         $trackButton = $trackMenu->toActionLink($this->request, $bridge, $this->_('Show track'));
         $trackButton->appendAttrib('class', 'rightFloat');
     } else {
         $trackButton = null;
     }
     // Row with dates and patient data
     $bridge->tr(array('onlyWhenChanged' => true, 'class' => 'even'));
     $bridge->addSortable('gr2o_patient_nr');
     $bridge->addSortable('respondent_name')->colspan = 2;
     if ($this->multiTracks) {
         $bridge->addSortable('grs_birthday');
         $bridge->addMultiSort('grs_city', array($respondentButton));
         $model->set('gr2t_track_info', 'tableDisplay', 'smallData');
         // Row with track info
         $bridge->tr(array('onlyWhenChanged' => true, 'class' => 'even'));
         $td = $bridge->addMultiSort('gtr_track_name', 'gr2t_track_info');
         $td->class = 'indentLeft';
         $td->colspan = 4;
         $td->renderWithoutContent = false;
         // Do not display this cell and thus this row if there is not content
         $td = $bridge->addMultiSort('progress', array($trackButton));
         $td->renderWithoutContent = false;
         // Do not display this cell and thus this row if there is not content
     } else {
         $bridge->addSortable('grs_birthday');
         $bridge->addMultiSort('progress', array($respondentButton));
     }
     $bridge->tr(array('class' => array('odd', $bridge->row_class), 'title' => $bridge->gto_comment));
     $bridge->addColumn($this->createShowTokenButton($bridge))->class = 'rightAlign';
     $bridge->addSortable('gto_valid_from');
     $bridge->addSortable('gto_valid_until');
     $model->set('gto_round_description', 'tableDisplay', 'smallData');
     $bridge->addMultiSort('gsu_survey_name', 'gto_round_description')->colspan = 2;
     $bridge->tr(array('class' => array('odd', $bridge->row_class), 'title' => $bridge->gto_comment));
     $bridge->addColumn();
     $bridge->addSortable('gto_mail_sent_date');
     $bridge->addSortable('gto_completion_time');
     $bridge->addSortable('gto_id_token');
     $bridge->addMultiSort('ggp_name', array($this->createActionButtons($bridge)));
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:67,代码来源:PlanRespondentSnippet.php


示例9: processFilterAndSort

 /**
  * Overrule to implement snippet specific filtering and sorting.
  *
  * @param \MUtil_Model_ModelAbstract $model
  */
 protected function processFilterAndSort(\MUtil_Model_ModelAbstract $model)
 {
     if ($this->request->getParam('log')) {
         $model->setFilter(array('gla_id'), $this->request->getParam('log'));
         parent::processSortOnly($model);
     } else {
         parent::processFilterAndSort($model);
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:14,代码来源:LogShowSnippet.php


示例10: addConfigFields

 /**
  * Appends the needed fields for this config to the $bridge
  *
  * @param \MUtil_Model_ModelAbstract $orgModel
  */
 public function addConfigFields(\MUtil_Model_ModelAbstract $orgModel)
 {
     $configModel = $this->getConfigModel(true);
     $order = $orgModel->getOrder('gor_user_class') + 1;
     foreach ($configModel->getItemNames() as $name) {
         $orgModel->set($name, 'order', $order++, 'tab', 'access');
         $orgModel->set($name, $configModel->get($name));
     }
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:14,代码来源:RadiusUserDefinition.php


示例11: addFormElements

 /**
  * 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
  */
 protected function addFormElements(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model)
 {
     $onOffFields = array('gr2t_track_info', 'gto_round_description', 'grc_description');
     foreach ($onOffFields as $field) {
         if (!(isset($this->formData[$field]) && $this->formData[$field])) {
             $model->set($field, 'elementClass', 'None');
         }
     }
     parent::addFormElements($bridge, $model);
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:19,代码来源:EditTrackTokenSnippet.php


示例12: addShowTableRows

 /**
 * Adds rows from the model to the bridge that creates the browse table.
 *
 * Overrule this function to add different columns to the browse table, without
 * having to recode the core table building code.
 *
 * @param \MUtil_Model_Bridge_VerticalTableBridge $bridge
 * @param \MUtil_Model_ModelAbstract $model
 * @return void
 * /
     protected function addShowTableRows(\MUtil_Model_Bridge_VerticalTableBridge $bridge, \MUtil_Model_ModelAbstract $model)
     {
    parent::addShowTableRows($bridge, $model);
     }
 
     /**
 * Creates the model
 *
 * @return \MUtil_Model_ModelAbstract
 */
 protected function createModel()
 {
     if (!$this->model instanceof \Gems_Model_AppointmentModel) {
         $this->model = $this->loader->getModels()->createAppointmentModel();
         $this->model->applyDetailSettings();
     }
     $this->model->set('gap_admission_time', 'formatFunction', array($this, 'displayDate'));
     $this->model->set('gap_discharge_time', 'formatFunction', array($this, 'displayDate'));
     return $this->model;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:30,代码来源:AppointmentShowSnippet.php


示例13: __construct

 /**
  * Construct the bridge while setting the model.
  *
  * Extra parameters can be added in subclasses, but the first parameter
  * must remain the model.
  *
  * @param \MUtil_Model_ModelAbstract $model
  * @param \Zend_Form $form Rquired
  */
 public function __construct(\MUtil_Model_ModelAbstract $model, \Zend_Form $form = null)
 {
     $this->model = $model;
     $this->form = $form;
     if (!$form instanceof \Zend_Form) {
         throw new \MUtil_Model_ModelException("No form specified while create a form bridge for model " . $model->getName());
     }
     if (!$form->getName()) {
         $form->setName($model->getName());
     }
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:20,代码来源:FormBridge.php


示例14: applySurveyListValidFor

 /**
  * Set the surveys to be listed as valid for choices for this item and the way they are displayed (if at all)
  *
  * @param \MUtil_Model_ModelAbstract $model The round model
  * @param array $itemData    The current items data
  * @param boolean True if the update changed values (usually by changed selection lists).
  */
 protected function applySurveyListValidFor(\MUtil_Model_ModelAbstract $model, array &$itemData)
 {
     if (!(isset($itemData['gro_id_round']) && $itemData['gro_id_round'])) {
         $itemData['gro_id_round'] = '';
     }
     // Fixed value
     $itemData['gro_valid_for_id'] = $itemData['gro_id_round'];
     // The options array
     $rounds[$itemData['gro_id_round']] = $this->_('This round');
     $model->set('gro_valid_for_id', 'multiOptions', $rounds, 'elementClass', 'Exhibitor');
     return false;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:19,代码来源:NextStepEngine.php


示例15: createModel

 /**
  * Creates the model
  *
  * @return \MUtil_Model_ModelAbstract
  */
 protected function createModel()
 {
     // Replace two checkboxes with on radio button control
     $this->model->set('ggp_staff_members', 'elementClass', 'Hidden');
     $this->model->setOnSave('ggp_staff_members', array($this, 'saveIsStaff'));
     $this->model->set('ggp_respondent_members', 'elementClass', 'Hidden');
     $this->model->setOnSave('ggp_respondent_members', array($this, 'saveIsRespondent'));
     $options = array('1' => $this->model->get('ggp_staff_members', 'label'), '2' => $this->model->get('ggp_respondent_members', 'label'));
     $this->model->set('staff_respondent', 'label', $this->_('Can be assigned to'), 'elementClass', 'Radio', 'multiOptions', $options, 'order', $this->model->getOrder('ggp_staff_members') + 1);
     $this->model->setOnLoad('staff_respondent', array($this, 'loadStaffRespondent'));
     return $this->model;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:17,代码来源:GroupFormSnippet.php


示例16: restoreHeaderPositions

 /**
  * Restores the header position of question before their corresponding question_sub
  *
  * When sub-questions with the same parent are shown continuous the parent is shown
  * once before them. When the sub-questions are displayed in seperate groups the
  * parent is shown once at their start.
  *
  * Stand alone headers without any corresponding value are removed. When they do have
  * a value of their own they are still shown, but their position may change according
  * to their sub-questions position. (NOTE: As in LimeSurvey their are no question
  * headers with values we leave it at this for the moment.)
  *
  * @param \MUtil_Model_ModelAbstract $model
  * @param array $currentNames The current names in use (allows chaining)
  * @return array Of the names of labels that should be shown
  */
 protected function restoreHeaderPositions(\MUtil_Model_ModelAbstract $model, array $currentNames)
 {
     $lastParent = null;
     $results = array();
     foreach ($currentNames as $name) {
         if ($model->is($name, 'type', \MUtil_Model::TYPE_NOVALUE)) {
             // Skip header types that contain no value
             continue;
         }
         if ($parent = $model->get($name, 'parent_question')) {
             // Check for change of parent
             if ($lastParent !== $parent) {
                 if (isset($results[$parent])) {
                     // Add another copy of the parent to the array
                     $results[] = $parent;
                 } else {
                     // Insert parent header on name if it was not shown before
                     $results[$parent] = $parent;
                 }
                 $lastParent = $parent;
             }
         } else {
             // Make sure a question (without parent) is picked up as parent too
             $lastParent = $name;
         }
         // If already set (as a $parent) this will not
         // redisplay the $parent as $result[$name] does
         // not change position
         $results[$name] = $name;
     }
     return $results;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:48,代码来源:SurveyAnswerFilterAbstract.php


示例17: processFilterAndSort

 /**
  * Overrule to implement snippet specific filtering and sorting.
  *
  * @param \MUtil_Model_ModelAbstract $model
  */
 protected function processFilterAndSort(\MUtil_Model_ModelAbstract $model)
 {
     $filter['gto_id_respondent'] = $this->respondent->getId();
     if (is_array($this->forOtherOrgs)) {
         $filter['gto_id_organization'] = $this->forOtherOrgs;
     } elseif (true !== $this->forOtherOrgs) {
         $filter['gto_id_organization'] = $this->respondent->getOrganizationId();
     }
     // Filter for valid track reception codes
     $filter[] = 'gr2t_reception_code IN (SELECT grc_id_reception_code FROM gems__reception_codes WHERE grc_success = 1)';
     $filter['grc_success'] = 1;
     // Active round
     // or
     // no round
     // or
     // token is success and completed
     $filter[] = 'gro_active = 1 OR gro_active IS NULL OR (grc_success=1 AND gto_completion_time IS NOT NULL)';
     $filter['gsu_active'] = 1;
     // NOTE! $this->model does not need to be the token model, but $model is a token model
     $tabFilter = $this->model->getMeta('tab_filter');
     if ($tabFilter) {
         $model->addFilter($tabFilter);
     }
     $model->addFilter($filter);
     // \MUtil_Echo::track($model->getFilter());
     $this->processSortOnly($model);
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:32,代码来源:RespondentTokenSnippet.php


示例18: createModel

 /**
  * Creates the model
  *
  * @return \MUtil_Model_ModelAbstract
  */
 protected function createModel()
 {
     if (!$this->model instanceof \Gems_Model_StaffModel) {
         $this->model = $this->loader->getModels()->getStaffModel(false);
         $this->model->applyOwnAccountEdit();
     }
     return $this->model;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:13,代码来源:OwnAccountEditSnippet.php


示例19: apply

 /**
  * Use this function for a default application of this type to the model
  *
  * @param \MUtil_Model_ModelAbstract $model
  * @param string $valueField The field containing the value to be encrypted
  * #param string $methodField the field storing the method of encryption
  * @return \Gems_Model_Type_EncryptedField (continuation pattern)
  */
 public function apply(\MUtil_Model_ModelAbstract $model, $valueField, $methodField)
 {
     $this->findValue[$methodField] = $valueField;
     $model->setSaveWhenNotNull($valueField);
     $model->setOnLoad($valueField, array($this, 'loadValue'));
     $model->setOnSave($valueField, array($this, 'saveValue'));
     // Only hidden to make sure onSave's are triggered
     $model->set($methodField, 'elementClass', 'hidden');
     $model->setOnLoad($methodField, 'default');
     // Yes you can set this to a constant
     $model->setSaveWhen($methodField, array($this, 'whenEncryption'));
     $model->setOnSave($methodField, array($this, 'saveEncryption'));
     if ($model instanceof \MUtil_Model_DatabaseModelAbstract) {
         $model->setOnTextFilter($valueField, false);
         $model->setOnTextFilter($methodField, false);
     }
     return $this;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:26,代码来源:EncryptedField.php


示例20: transformLoad

 /**
  * The transform function performs the actual transformation of the data and is called after
  * the loading of the data in the source model.
  *
  * @param \MUtil_Model_ModelAbstract $model The parent model
  * @param array $data Nested array
  * @param boolean $new True when loading a new item
  * @param boolean $isPostData With post data, unselected multiOptions values are not set so should be added
  * @return array Nested array containing (optionally) transformed data
  */
 public function transformLoad(\MUtil_Model_ModelAbstract $model, array $data, $new = false, $isPostData = false)
 {
     // get tokens
     $tokens = \MUtil_Ra::column('gto_id_token', $data);
     $answerRows = $this->source->getRawTokenAnswerRows(array('token' => $tokens), $this->survey->getSurveyId());
     $resultRows = array();
     $emptyRow = array_fill_keys($model->getItemNames(), null);
     foreach ($data as $row) {
         $tokenId = $row['gto_id_token'];
         if (isset($answerRows[$tokenId])) {
             $resultRows[$tokenId] = $row + $answerRows[$tokenId] + $emptyRow;
         } else {
             $resultRows[$tokenId] = $row + $emptyRow;
         }
     }
     //\MUtil_Echo::track($tokens);
     //\MUtil_Echo::track($resultRows);
     // No changes
     return $resultRows;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:30,代码来源:AddAnswersTransformer.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP MVCUtils类代码示例发布时间:2022-05-23
下一篇:
PHP MUtil_Html类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap