當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。