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


PHP Tracker_FormElementFactory::getFormElementById方法代码示例

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


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

示例1: process

 public function process(Tracker_IDisplayTrackerLayout $layout, Codendi_Request $request, PFUser $current_user)
 {
     $workflow = $this->workflow_factory->getWorkflowByTrackerId($this->tracker->id);
     $this->processEnabled($workflow, $request->get('is_used'));
     $k = 0;
     $field = $this->form_element_factory->getFormElementById($workflow->field_id);
     $field_values = $field->getBind()->getAllValues();
     $currMatrix = array();
     $field_value_from = null;
     //Add an initial state transition
     foreach ($field_values as $field_value_id_to => $field_value_to) {
         //$field_value_from=;
         $transition = '_' . $field_value_id_to;
         if ($request->existAndNonEmpty($transition)) {
             $currMatrix[] = array('', $field_value_id_to);
             $k += $this->addTransition($workflow, $transition, $field_value_from, $field_value_to);
         }
     }
     //Add a transition
     foreach ($field_values as $field_value_id_from => $field_value_from) {
         foreach ($field_values as $field_value_id_to => $field_value_to) {
             $transition = $field_value_id_from . '_' . $field_value_id_to;
             if ($request->existAndNonEmpty($transition)) {
                 $currMatrix[] = array($field_value_id_from, $field_value_id_to);
                 $k += $this->addTransition($workflow, $transition, $field_value_from, $field_value_to);
             }
         }
     }
     //Delete a transition
     $transitions_in_db = $workflow->getTransitions();
     $nb_transitions_in_db = count($transitions_in_db);
     for ($i = 0; $i < $nb_transitions_in_db; $i++) {
         $field_value_from = $transitions_in_db[$i]->getFieldValueFrom();
         $field_value_to = $transitions_in_db[$i]->getFieldValueTo();
         //Treatment of the initial state
         if ($field_value_from == null) {
             $value_to_search = array('', $field_value_to->getId());
             //$field_value_from->getId()='';
         } else {
             $value_to_search = array($field_value_from->getId(), $field_value_to->getId());
         }
         if (!in_array($value_to_search, $currMatrix)) {
             $this->workflow_factory->deleteTransition($workflow->workflow_id, $field_value_from, $field_value_to);
             $k++;
         }
     }
     if ($k > 0) {
         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('workflow_admin', 'updated'));
     }
     $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => Workflow::FUNC_ADMIN_TRANSITIONS)));
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:51,代码来源:CreateMatrix.class.php

示例2: createFormElement

 public function createFormElement(Tracker $tracker, array $formElement_data, User $user)
 {
     $formElement = $this->factory->getFormElementById($formElement_data['field_id']);
     if (!$formElement) {
         $exception_message = $GLOBALS['Language']->getText('plugin_tracker_formelement_exception', 'wrong_field_id', $formElement_data['field_id']);
         throw new Exception($exception_message);
     }
     $field = $this->getRootOriginalField($formElement);
     $this->assertFieldCanBeCopied($field, $user);
     $data = $this->populateFormElementDataForASharedField($field);
     $type = $data['type'];
     $id = $this->factory->createFormElement($tracker, $type, $data);
     $this->boundValuesFactory->duplicateByReference($field->getId(), $id);
     return $id;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:15,代码来源:Tracker_SharedFormElementFactory.class.php

示例3: populate

 /**
  *
  * @param Tracker_Rule_Date $date_rule
  * @param int $tracker_id
  * @param int $source_field_id
  * @param int $target_field_id
  * @param string $comparator
  * @return \Tracker_Rule_Date
  */
 private function populate(Tracker_Rule_Date $date_rule, $tracker_id, $source_field_id, $target_field_id, $comparator, $id = null)
 {
     $source_field = $this->element_factory->getFormElementById($source_field_id);
     $target_field = $this->element_factory->getFormElementById($target_field_id);
     $date_rule->setTrackerId($tracker_id)->setSourceFieldId($source_field_id)->setSourceField($source_field)->setTargetFieldId($target_field_id)->setTargetField($target_field)->setTrackerId($tracker_id)->setComparator($comparator);
     if ($date_rule !== null) {
         $date_rule->setId($id);
     }
     return $date_rule;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:19,代码来源:Factory.class.php

示例4: getById

 /**
  *
  * @param type $id
  *
  * @return Tracker_FileInfo
  */
 public function getById($id)
 {
     $row = $this->dao->searchById($id)->getRow();
     if (!$row) {
         return;
     }
     $field_id = $this->dao->searchFieldIdByFileInfoId($id);
     if (!$field_id) {
         return;
     }
     $field = $this->formelement_factory->getFormElementById($field_id);
     if (!$field) {
         return;
     }
     if (!$field->isUsed()) {
         return;
     }
     return new Tracker_FileInfo($row['id'], $field, $row['submitted_by'], $row['description'], $row['filename'], $row['filesize'], $row['filetype']);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:25,代码来源:FileInfoFactory.class.php

示例5: displayTransitionsMatrix

 protected function displayTransitionsMatrix($workflow, $layout, $request, $current_user)
 {
     $workflow = $this->workflow_factory->getWorkflowByTrackerId($this->tracker->id);
     $field = $this->form_element_factory->getFormElementById($workflow->field_id);
     if ($workflow->hasTransitions()) {
         $transitions = $workflow->getTransitions($workflow->workflow_id);
         $field->displayTransitionsMatrix($transitions);
     } else {
         $field->displayTransitionsMatrix();
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:11,代码来源:DefineWorkflow.class.php

示例6: getCriteria

 public function getCriteria()
 {
     $rank = 0;
     $tracker_id = $this->getTracker()->getId();
     foreach ($this->rest_criteria as $field_identifier => $criterion) {
         $formelement = $this->formelement_factory->getFormElementById($field_identifier);
         if (!$formelement) {
             $formelement = $this->formelement_factory->getFormElementByName($tracker_id, $field_identifier);
         }
         if ($formelement && $formelement->userCanRead($this->current_user)) {
             $this->addCriterionToFormElement($formelement, $criterion, $rank);
             $rank++;
         }
     }
     return $this->criteria;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:16,代码来源:Tracker_Report_REST.class.php

示例7: getFieldFromRow

 /**
  * Retrieves the field from the given PostAction database row.
  *
  * @param array $row
  *
  * @return Tracker_FormElement_Field
  */
 private function getFieldFromRow($row)
 {
     return $this->element_factory->getFormElementById((int) $row['field_id']);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:11,代码来源:Transition_PostAction_FieldFactory.class.php

示例8: exportToXml

 /**
  * 
  * @param SimpleXMLElement $root
  * @param array $xmlMapping
  * @param Tracker_FormElementFactory $form_element_factory
  * @param int $tracker_id
  */
 public function exportToXml(SimpleXMLElement $root, $xmlMapping, $form_element_factory, $tracker_id)
 {
     $rules = $this->searchByTrackerId($tracker_id);
     $list_rules = $root->addChild('list_rules');
     foreach ($rules as $rule) {
         $source_field = $form_element_factory->getFormElementById($rule->getSourceFieldId());
         $target_field = $form_element_factory->getFormElementById($rule->getTargetFieldId());
         $bf = new Tracker_FormElement_Field_List_BindFactory();
         //TODO: handle sb/msb bind to users and remove condition
         if ($bf->getType($source_field->getBind()) == 'static' && $bf->getType($target_field->getBind()) == 'static') {
             $child = $list_rules->addChild('rule');
             $child->addChild('source_field')->addAttribute('REF', array_search($rule->source_field, $xmlMapping));
             $child->addChild('target_field')->addAttribute('REF', array_search($rule->target_field, $xmlMapping));
             if ($rule->source_value == Tracker_FormElement_Field_List_Bind_StaticValue_None::VALUE_ID) {
                 $child->addChild('source_value')->addAttribute('is_none', '1');
             } else {
                 $child->addChild('source_value')->addAttribute('REF', array_search($rule->source_value, $xmlMapping['values']));
             }
             if ($rule->target_value == Tracker_FormElement_Field_List_Bind_StaticValue_None::VALUE_ID) {
                 $child->addChild('target_value')->addAttribute('is_none', '1');
             } else {
                 $child->addChild('target_value')->addAttribute('REF', array_search($rule->target_value, $xmlMapping['values']));
             }
         }
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:33,代码来源:Factory.class.php

示例9: displayChooseSourceAndTarget

 function displayChooseSourceAndTarget($engine, $request, $current_user, $source_field_id)
 {
     $hp = Codendi_HTMLPurifier::instance();
     $this->tracker->displayAdminItemHeader($engine, 'dependencies');
     echo '<p>' . $GLOBALS['Language']->getText('plugin_tracker_field_dependencies', 'inline_help') . '</p>';
     echo '<form action="' . TRACKER_BASE_URL . '/?" method="GET">';
     echo '<input type="hidden" name="tracker" value="' . (int) $this->tracker->id . '" />';
     echo '<input type="hidden" name="func" value="admin-dependencies" />';
     //source
     $source_field = $this->form_element_factory->getFormElementById($source_field_id);
     if (!$source_field) {
         echo '<select name="source_field" onchange="this.form.submit()">';
         echo '<option value="0">' . $GLOBALS['Language']->getText('plugin_tracker_field_dependencies', 'choose_source_field') . '</option>';
         $sources = $this->getAllSourceFields(null);
         foreach ($sources as $id => $field) {
             echo '<option value="' . $id . '">';
             echo $hp->purify($field->getLabel(), CODENDI_PURIFIER_CONVERT_HTML);
             echo '</option>';
         }
         echo '</select>';
     } else {
         echo '<input type="hidden" name="source_field" value="' . $source_field_id . '" />';
         echo $source_field->getLabel();
     }
     echo ' &rarr; ';
     //target
     $disabled = '';
     if (!$source_field) {
         $disabled = 'disabled="disabled" readonly="readonly"';
     }
     echo '<select name="target_field" ' . $disabled . '>';
     echo '<option value="0">' . $GLOBALS['Language']->getText('plugin_tracker_field_dependencies', 'choose_target_field') . '</option>';
     if ($source_field) {
         $sources = $this->getAllTargetFields($source_field_id);
         foreach ($sources as $id => $field) {
             echo '<option value="' . $id . '">';
             echo $hp->purify($field->getLabel(), CODENDI_PURIFIER_CONVERT_HTML);
             echo '</option>';
         }
     }
     echo '</select>';
     echo ' <input type="submit" name="choose_source" value="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '" />';
     echo '</form>';
     //Shortcut
     $sources_targets = $this->getRuleFactory()->getInvolvedFieldsByTrackerId($this->tracker->id);
     if (count($sources_targets)) {
         $dependencies = array();
         foreach ($sources_targets as $row) {
             if ($source = $this->form_element_factory->getFormElementById($row['source_field_id'])) {
                 if ($target = $this->form_element_factory->getFormElementById($row['target_field_id'])) {
                     $d = '<a href="' . TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => 'admin-dependencies', 'source_field' => $row['source_field_id'], 'target_field' => $row['target_field_id'])) . '">';
                     $d .= $source->getLabel() . ' &rarr; ' . $target->getLabel();
                     $d .= '</a>';
                     $dependencies[] = $d;
                 }
             }
         }
         if ($dependencies) {
             echo '<p>' . $GLOBALS['Language']->getText('plugin_tracker_field_dependencies', 'choose_existing_dependency') . '</p>';
             echo '<ul><li>' . implode('</li><li>', $dependencies) . '</li></ul>';
         }
         echo '</ul>';
     }
     $this->tracker->displayFooter($engine);
 }
开发者ID:bamboolsu,项目名称:tuleap,代码行数:65,代码来源:Tracker_RulesManager.class.php


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