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


PHP Tracker_FormElement_Field类代码示例

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


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

示例1: getFieldData

 /**
  * Extract Field data from XML input
  *
  * @param Tracker_FormElement_Field $field
  * @param SimpleXMLElement $field_change
  *
  * @return mixed
  */
 public function getFieldData(Tracker_FormElement_Field $field, SimpleXMLElement $field_change)
 {
     $values = $field_change->value;
     $files_infos = array();
     if ($this->isFieldChangeEmpty($values)) {
         $this->logger->warn('Skipped attachment field ' . $field->getLabel() . ': field value is empty.');
         return $files_infos;
     }
     foreach ($values as $value) {
         try {
             $attributes = $value->attributes();
             $file_id = (string) $attributes['ref'];
             $file = $this->files_importer->getFileXML($file_id);
             if (!$this->files_importer->fileIsAlreadyImported($file_id)) {
                 $files_infos[] = $this->getFileInfoForAttachment($file);
                 $this->files_importer->markAsImported($file_id);
             }
         } catch (Tracker_Artifact_XMLImport_Exception_FileNotFoundException $exception) {
             $this->logger->warn('Skipped attachment field ' . $field->getLabel() . ': ' . $exception->getMessage());
         }
     }
     if ($this->itCannotImportAnyFiles($values, $files_infos)) {
         throw new Tracker_Artifact_XMLImport_Exception_NoValidAttachementsException();
     }
     return $files_infos;
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:34,代码来源:XMLImportFieldStrategyAttachment.class.php

示例2: getFieldChangeId

 private function getFieldChangeId(Tracker_FormElement_Field $field, $value)
 {
     if (isset($value['format']) && (string) $value['format'] === self::FORMAT_ID) {
         return (string) $value;
     }
     return $field->getFieldData((string) $value);
 }
开发者ID:amanikamail,项目名称:tuleap,代码行数:7,代码来源:XMLImportFieldStrategyOpenList.class.php

示例3: getFieldChangeId

 private function getFieldChangeId(Tracker_FormElement_Field $field, $value)
 {
     if (isset($value['format']) && (string) $value['format'] === self::FORMAT_ID) {
         return $this->xml_fields_mapping->getNewOpenValueId((string) $value);
     }
     return $field->getFieldData((string) $value);
 }
开发者ID:pkdevbox,项目名称:tuleap,代码行数:7,代码来源:XMLImportFieldStrategyOpenList.class.php

示例4: getFieldData

 /**
  * Extract Field data from XML input
  *
  * @param Tracker_FormElement_Field $field
  * @param SimpleXMLElement $field_change
  *
  * @return mixed
  */
 public function getFieldData(Tracker_FormElement_Field $field, SimpleXMLElement $field_change)
 {
     $timestamp = strtotime((string) $field_change->value);
     if ($timestamp > 0) {
         return $field->formatDate(strtotime($field_change->value));
     }
     return '';
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:16,代码来源:XMLImportFieldStrategyDate.class.php

示例5: getValue

 /**
  * Return the value of a field in the current changeset
  *
  * @param Tracker_FormElement_Field $field The field
  *
  * @return Tracker_Artifact_ChangesetValue, or null if not found
  */
 public function getValue(Tracker_FormElement_Field $field)
 {
     $values = $this->getValues();
     if (isset($values[$field->getId()])) {
         return $values[$field->getId()];
     }
     return null;
 }
开发者ID:ndjido,项目名称:tuleap,代码行数:15,代码来源:Tracker_Artifact_Changeset.class.php

示例6: getFullRESTValue

 public function getFullRESTValue(Tracker_FormElement_Field $field)
 {
     $class_user_representation = '\\Tuleap\\Project\\REST\\UserGroupRepresentation';
     $ugroup_representation = new $class_user_representation();
     $ugroup_manager = new UGroupManager();
     $project = $field->getTracker()->getProject();
     $ugroup_representation->build($project->getID(), $ugroup_manager->getById($this->getUgroupId()));
     return $ugroup_representation;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:9,代码来源:Tracker_FormElement_Field_List_Bind_UgroupsValue.class.php

示例7: getStaticListDataValue

 private function getStaticListDataValue(Tracker_FormElement_Field $field, $value)
 {
     if (isset($value['format']) && (string) $value['format'] === self::FORMAT_ID) {
         return $this->xml_fields_mapping->getNewValueId((int) $value);
     }
     $result = $this->static_value_dao->searchValueByLabel($field->getId(), (string) $value);
     $row = $result->getRow();
     return (int) $row['id'];
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:9,代码来源:XMLImportFieldStrategyList.class.php

示例8: getMappings

 /**
  * @return array of Cardwall_OnTop_Config_ValueMapping
  */
 public function getMappings(Tracker $tracker, Tracker $mapping_tracker, Tracker_FormElement_Field $mapping_field)
 {
     // Why does we return a collection indexed on value_id in the case of freestyle mappings, and a collection
     // indexed on column_id in the case of status mappings @see getStatusMappings?????????
     // Shouldn't we let TrackerMapping do the indexing so that code in TrackerMapping might exploit that?
     $mappings = $this->getMappingFieldValuesIndexedByTracker($tracker);
     if (isset($mappings[$mapping_tracker->getId()][$mapping_field->getId()])) {
         return $mappings[$mapping_tracker->getId()][$mapping_field->getId()];
     }
     return array();
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:14,代码来源:ValueMappingFactory.class.php

示例9: getLastChangesetWithFieldValue

 /**
  * @return \Tracker_Artifact_Changeset|null
  */
 public function getLastChangesetWithFieldValue(Tracker_Artifact $artifact, Tracker_FormElement_Field $field)
 {
     $dar = $this->dao->searchLastChangesetAndValueForArtifactField($artifact->getId(), $field->getId());
     if ($dar) {
         $row = $dar->getRow();
         $changeset = $this->getChangesetFromRow($artifact, $row);
         $value = $field->getChangesetValue($changeset, $row['value_id'], $row['has_changed']);
         $changeset->setFieldValue($field, $value);
         return $changeset;
     }
     return null;
 }
开发者ID:ansarbek,项目名称:tuleap,代码行数:15,代码来源:Tracker_Artifact_ChangesetFactory.class.php

示例10: getFieldData

 /**
  * Extract Field data from XML input
  *
  * @param Tracker_FormElement_Field $field
  * @param SimpleXMLElement $field_change
  *
  * @return mixed
  */
 public function getFieldData(Tracker_FormElement_Field $field, SimpleXMLElement $field_change)
 {
     $data = array('use_artifact_permissions' => (int) $field_change['use_perm'], 'u_groups' => array());
     foreach ($field_change->ugroup as $ugroup_xml) {
         if (isset($ugroup_xml['ugroup_id'])) {
             $data['u_groups'][] = (int) $ugroup_xml['ugroup_id'];
         } elseif (isset($ugroup_xml['ugroup_name'])) {
             $ugroup_manager = new UGroupManager();
             $ugroup = $ugroup_manager->getUGroupByName($field->getTracker()->getProject(), (string) $ugroup_xml['ugroup_name']);
             $data['u_groups'][] = $ugroup->getId();
         }
     }
     return $data;
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:22,代码来源:XMLImportFieldStrategyPermissionsOnArtifact.class.php

示例11: getBind

 /**
  * Build a binder associated to a list field.
  * @param Tracker_FormElement_Field $field
  * @param string $type ('ug', 'submit', 'Static')
  */
 public function getBind($field, $type)
 {
     $default_value = array();
     $dao = new Tracker_FormElement_Field_List_Bind_DefaultvalueDao();
     foreach ($dao->searchByFieldId($field->id) as $row) {
         $default_value[$row['value_id']] = true;
     }
     $decorators = array();
     $dao = new Tracker_FormElement_Field_List_BindDecoratorDao();
     foreach ($dao->searchByFieldId($field->id) as $row) {
         $decorators[$row['value_id']] = new Tracker_FormElement_Field_List_BindDecorator($row['field_id'], $row['value_id'], $row['red'], $row['green'], $row['blue']);
     }
     $bind = new Tracker_FormElement_Field_List_Bind_Null($field);
     switch ($type) {
         case self::STATIK:
             $dao = new Tracker_FormElement_Field_List_Bind_StaticDao();
             if ($row = $dao->searchByFieldId($field->id)->getRow()) {
                 $values = array();
                 $dao = new Tracker_FormElement_Field_List_Bind_Static_ValueDao();
                 foreach ($dao->searchByFieldId($field->id, $row['is_rank_alpha']) as $row_value) {
                     $values[$row_value['id']] = $this->getStaticValueInstance($row_value['id'], $row_value['label'], $row_value['description'], $row_value['rank'], $row_value['is_hidden']);
                 }
                 $bind = new Tracker_FormElement_Field_List_Bind_Static($field, $row['is_rank_alpha'], $values, $default_value, $decorators);
             }
             break;
         case self::USERS:
             $dao = new Tracker_FormElement_Field_List_Bind_UsersDao();
             if ($row = $dao->searchByFieldId($field->id)->getRow()) {
                 $bind = new Tracker_FormElement_Field_List_Bind_Users($field, $row['value_function'], $default_value, $decorators);
             }
             break;
         case self::UGROUPS:
             $values = array();
             foreach ($this->getUgroupsValueDao()->searchByFieldId($field->id) as $row_value) {
                 $values[$row_value['id']] = $this->getUgroupsValueInstance($row_value['id'], $field->getTracker()->getProject(), $row_value['ugroup_id'], $row_value['is_hidden']);
             }
             $bind = new Tracker_FormElement_Field_List_Bind_Ugroups($field, array_filter($values), $default_value, $decorators, $this->ugroup_manager, $this->getUgroupsValueDao());
             break;
         default:
             trigger_error('Unknown bind "' . $type . '"', E_USER_WARNING);
             break;
     }
     return $bind;
 }
开发者ID:ndjido,项目名称:tuleap,代码行数:49,代码来源:Tracker_FormElement_Field_List_BindFactory.class.php

示例12: isFieldUsedInPostActions

 /**
  * @see Transition_PostActionSubFactory::isFieldUsedInPostActions()
  */
 public function isFieldUsedInPostActions(Tracker_FormElement_Field $field)
 {
     foreach (array_keys($this->post_actions_classes) as $shortname) {
         if ($this->getDao($shortname)->countByFieldId($field->getId()) > 0) {
             return true;
         }
     }
     return false;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:12,代码来源:Transition_PostAction_FieldFactory.class.php

示例13: canFieldBeExportedToCSV

 private function canFieldBeExportedToCSV(Tracker_FormElement_Field $field)
 {
     return $field->isUsed() && $field->userCanRead() && (!is_a($field, 'Tracker_FormElement_Field_ArtifactId') || is_a($field, 'Tracker_FormElement_Field_PerTrackerArtifactId'));
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:4,代码来源:Tracker_Report_Renderer_Table.class.php

示例14: getFieldId

 /**
  * The Id of the (text) field used for initial_effort semantic
  *
  * @return int The Id of the (numeric) field used for initial_effort semantic, or 0 if no field
  */
 public function getFieldId()
 {
     if ($this->initial_effort_field) {
         return $this->initial_effort_field->getId();
     } else {
         return 0;
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:13,代码来源:Semantic_InitialEffort.class.php

示例15: itCreatesFieldChangeNodeInChangesetNode

 public function itCreatesFieldChangeNodeInChangesetNode()
 {
     $this->exporter->export($this->artifact_xml, $this->changeset_xml, mock('Tracker_Artifact'), $this->changeset_value);
     $field_change = $this->changeset_xml->field_change;
     $this->assertEqual((string) $field_change['type'], 'int');
     $this->assertEqual((string) $field_change['field_name'], $this->field->getName());
     $this->assertEqual($field_change->value, 123);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:8,代码来源:ChangesetValueIntegerXMLExporterTest.php


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