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


PHP Tracker_FormElementFactory类代码示例

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


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

示例1: buildProperties

 /**
  * build pie chart properties
  *
  * @param Pie_Engine $engine object
  */
 function buildProperties($engine)
 {
     parent::buildProperties($engine);
     $engine->data = array();
     $engine->legend = null;
     $result = array();
     $ff = Tracker_FormElementFactory::instance();
     $af = $ff->getFormElementById($this->chart->getField_base());
     if ($af && $af->userCanRead()) {
         $select = " SELECT count(a.id) AS nb, " . $af->getQuerySelect();
         $from = " FROM tracker_artifact AS a INNER JOIN tracker_changeset AS c ON (c.artifact_id = a.id) " . $af->getQueryFrom();
         $where = " WHERE a.id IN (" . $this->artifacts['id'] . ") \n                          AND c.id IN (" . $this->artifacts['last_changeset_id'] . ") ";
         $sql = $select . $from . $where . ' GROUP BY ' . $af->getQueryGroupBy();
         $res = db_query($sql);
         while ($data = db_fetch_array($res)) {
             if ($data[$af->name] !== null) {
                 $engine->data[] = $data['nb'];
                 $engine->legend[] = $af->fetchRawValue($data[$af->name]);
             } else {
                 $engine->data[] = $data['nb'];
                 $engine->legend[] = $GLOBALS['Language']->getText('global', 'none');
             }
         }
     }
     return $result;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:31,代码来源:GraphOnTrackersV5_Chart_PieDataBuilder.class.php

示例2: getFullRESTRepresentation

 protected function getFullRESTRepresentation($value)
 {
     $classname_with_namespace = 'Tuleap\\Tracker\\REST\\Artifact\\ArtifactFieldValueFullRepresentation';
     $artifact_field_value_full_representation = new $classname_with_namespace();
     $artifact_field_value_full_representation->build($this->field->getId(), Tracker_FormElementFactory::instance()->getType($this->field), $this->field->getLabel(), $value);
     return $artifact_field_value_full_representation;
 }
开发者ID:amanikamail,项目名称:tuleap,代码行数:7,代码来源:Tracker_Artifact_ChangesetValue_String.class.php

示例3: getFullRESTValue

 public function getFullRESTValue(PFUser $user, Tracker_Artifact_Changeset $changeset)
 {
     $classname_with_namespace = 'Tuleap\\Tracker\\REST\\Artifact\\ArtifactFieldValueFullRepresentation';
     $artifact_field_value_full_representation = new $classname_with_namespace();
     $artifact_field_value_full_representation->build($this->getId(), Tracker_FormElementFactory::instance()->getType($this), $this->getLabel(), (int) $changeset->getArtifact()->getPerTrackerArtifactId());
     return $artifact_field_value_full_representation;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:Tracker_FormElement_Field_PerTrackerArtifactIdclass.php

示例4: __construct

 public function __construct(AgileDashboard_Kanban $kanban, PFUser $user, $user_is_kanban_admin, $language, $project_id)
 {
     $user_preferences = new AgileDashboard_KanbanUserPreferences();
     $kanban_representation_builder = new Tuleap\AgileDashboard\REST\v1\Kanban\KanbanRepresentationBuilder($user_preferences, new AgileDashboard_KanbanColumnFactory(new AgileDashboard_KanbanColumnDao(), $user_preferences), TrackerFactory::instance(), Tracker_FormElementFactory::instance());
     $this->kanban_representation = json_encode($kanban_representation_builder->build($kanban, $user));
     $this->user_is_kanban_admin = (int) $user_is_kanban_admin;
     $this->language = $language;
     $this->project_id = $project_id;
 }
开发者ID:uniteddiversity,项目名称:tuleap,代码行数:9,代码来源:KanbanPresenter.class.php

示例5: process

 public function process(Tracker_Artifact $artifact, array $fields_data)
 {
     $tracker_data = array();
     //only when a previous changeset exists
     if (!$artifact->getLastChangeset() instanceof Tracker_Artifact_Changeset_Null) {
         foreach ($artifact->getLastChangeset()->getValues() as $key => $field) {
             if ($field instanceof Tracker_Artifact_ChangesetValue_Date || $field instanceof Tracker_Artifact_ChangesetValue_List) {
                 $tracker_data[$key] = $field->getValue();
             }
         }
     }
     //replace where appropriate with submitted values
     foreach ($fields_data as $key => $value) {
         $tracker_data[$key] = $value;
     }
     //addlastUpdateDate and submitted on if available
     foreach ($this->formelement_factory->getAllFormElementsForTracker($artifact->getTracker()) as $field) {
         if ($field instanceof Tracker_FormElement_Field_LastUpdateDate) {
             $tracker_data[$field->getId()] = date("Y-m-d");
         }
         if ($field instanceof Tracker_FormElement_Field_SubmittedOn) {
             $tracker_data[$field->getId()] = $artifact->getSubmittedOn();
         }
         if ($field instanceof Tracker_FormElement_Field_Date && !array_key_exists($field->getId(), $tracker_data)) {
             //user doesn't have access to field
             $tracker_data[$field->getId()] = $field->getValue($field->getId());
         }
     }
     return $tracker_data;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:30,代码来源:ChangesetDataInitializator.class.php

示例6: getIndexedFields

 private function getIndexedFields(Tracker $tracker)
 {
     $indexed_fields = array();
     foreach ($this->formelement_factory->getUsedFields($tracker) as $field) {
         $indexed_fields[$field->getId()] = $field;
     }
     return $indexed_fields;
 }
开发者ID:pdaniel-frk,项目名称:tuleap,代码行数:8,代码来源:ArtifactValidator.class.php

示例7: trackerHasOnlyTitleRequired

 private function trackerHasOnlyTitleRequired(Tracker $tracker, Tracker_Semantic_Title $semantic_title)
 {
     $used_fields = $this->form_element_factory->getUsedFields($tracker);
     foreach ($used_fields as $used_field) {
         if ($used_field->isRequired() && $used_field->getId() != $semantic_title->getFieldId()) {
             return false;
         }
     }
     return true;
 }
开发者ID:ndjido,项目名称:tuleap,代码行数:10,代码来源:KanbanAddInPlaceChecker.php

示例8: saveArtifactAfterNewChangeset

 /**
  * Should we move this method outside of changeset creation
  * so that we can remove the dependency on artifact factory
  * and enforce SRP ?
  */
 protected function saveArtifactAfterNewChangeset(Tracker_Artifact $artifact, array $fields_data, PFUser $submitter, Tracker_Artifact_Changeset $new_changeset, Tracker_Artifact_Changeset $previous_changeset = null)
 {
     if ($this->artifact_factory->save($artifact)) {
         $used_fields = $this->formelement_factory->getUsedFields($artifact->getTracker());
         foreach ($used_fields as $field) {
             $field->postSaveNewChangeset($artifact, $submitter, $new_changeset, $previous_changeset);
         }
         $artifact->getWorkflow()->after($fields_data, $new_changeset, $previous_changeset);
         return true;
     }
     return false;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:17,代码来源:ChangesetCreatorBase.class.php

示例9: validate

 /**
  * Validate the fields contained in $fields_data, and update $fields_data for invalid data
  * $fields_data is an array of [field_id] => field_data
  *
  * @param array $fields_data The field data
  *
  * @return boolean true if all fields are valid, false otherwise. This function update $field_data (set values to null if not valid)
  */
 public function validate(Tracker_Artifact $artifact, $fields_data)
 {
     $is_valid = true;
     $used_fields = $this->formelement_factory->getUsedFields($artifact->getTracker());
     foreach ($used_fields as $field) {
         $submitted_value = $this->getSubmittedValue($field, $fields_data);
         if ($this->canValidateField($artifact, $field)) {
             $is_valid = $this->validateField($artifact, $field, $submitted_value) && $is_valid;
         }
     }
     return $is_valid;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:20,代码来源:FieldsValidator.class.php

示例10: getSharedFieldsCriteria

 /**
  * Build a Report criteria based on submitted values.
  * 
  * If used cannot access requested value (eg. forged URL) the Query is modified
  * to remove the offending query.
  * 
  * @return array of \Tracker_Report_Criteria 
  */
 public function getSharedFieldsCriteria(User $user, Project $project, Tracker_Report $report, Tracker_CrossSearch_Query $cross_search_query)
 {
     $fields = $this->form_element_factory->getSharedFieldsReadableBy($user, $project);
     $criteria = array();
     $allowed_field_ids = array();
     foreach ($fields as $field) {
         $allowed_field_ids[$field->getId()] = true;
         $field->setCriteriaValue($this->getSelectedValues($field, $cross_search_query->getSharedFields()));
         $criteria[] = $this->buildCriteria($report, $field);
     }
     $cross_search_query->purgeSharedFieldNotInList($allowed_field_ids);
     return $criteria;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:21,代码来源:CriteriaBuilder.class.php

示例11: update

 public function update(Tracker $tracker, SimpleXMLElement $artifact_xml, array $submitted_values, PFUser $user, $submitted_on)
 {
     $artifact_xml->changeset->submitted_on = date('c', $submitted_on);
     $artifact_xml->changeset->submitted_by = $user->getId();
     foreach ($artifact_xml->changeset->field_change as $field_change) {
         $field_name = (string) $field_change['field_name'];
         $field = $this->formelement_factory->getUsedFieldByNameForUser($tracker->getId(), $field_name, $user);
         if ($field && isset($submitted_values[$field->getId()])) {
             $submitted_value = $submitted_values[$field->getId()];
             $this->visitor->update($field_change, $field, $submitted_value);
         }
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:13,代码来源:ChangesetXMLUpdater.class.php

示例12: 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

示例13: exportAttachmentsInArchive

 public function exportAttachmentsInArchive(Tracker_Artifact $artifact, ZipArchive $archive)
 {
     $file_fields = $this->form_element_factory->getUsedFileFields($artifact->getTracker());
     $last_changeset = $artifact->getLastChangeset();
     if (!$last_changeset) {
         return;
     }
     foreach ($file_fields as $field) {
         $value = $last_changeset->getValue($field);
         if ($value) {
             $this->addFilesIntoArchive($value, $archive);
         }
     }
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:14,代码来源:ArtifactAttachmentExporter.php

示例14: getCriteria

 public function getCriteria()
 {
     $rank = 0;
     foreach ($this->soap_criteria as $key => $value) {
         $is_advanced = false;
         if ($formelement = $this->formelement_factory->getFormElementByName($this->getTracker()->getId(), $value->field_name)) {
             if ($formelement->userCanRead($this->current_user)) {
                 $criteria = new Tracker_Report_Criteria(0, $this, $formelement, $rank, $is_advanced);
                 $formelement->setCriteriaValueFromSOAP($criteria, $value->value);
                 $this->criteria[$formelement->getId()] = $criteria;
                 $rank++;
             }
         }
     }
     return $this->criteria;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:16,代码来源:Tracker_Report_SOAP.class.php

示例15: getFieldsData

 /**
  * @return array
  */
 public function getFieldsData(SimpleXMLElement $xml_field_change)
 {
     $data = array();
     if (!$xml_field_change->field_change) {
         return $data;
     }
     foreach ($xml_field_change->field_change as $field_change) {
         $field = $this->formelement_factory->getUsedFieldByName($this->tracker->getId(), (string) $field_change['field_name']);
         if ($field) {
             $this->appendValidValue($data, $field, $field_change);
         } else {
             $this->logger->debug("Skipped unknown/unused field " . (string) $field_change['field_name']);
         }
     }
     return $data;
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:19,代码来源:ArtifactFieldsDataBuilder.class.php


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