コード例 #1
0
 /**
  *  fetchData - re-fetch the data for this ArtifactFieldSet from the database.
  *
  *  @return boolean	success.
  */
 function fetchData()
 {
     global $Language;
     $sql = "SELECT * \n                FROM artifact_field_set \n                WHERE artifact_field_set_id=" . db_ei($this->getID()) . "";
     $res = db_query($sql);
     if (!$res || db_numrows($res) < 1) {
         $this->setError('ArtifactFieldSet: ' . $Language->getText('tracker_common_fieldset', 'invalid_at'));
         return false;
     }
     // set the attributes of this fieldset
     $this->setFromArray($res);
     // attach the fields of this fieldset
     $art_field_fact = new ArtifactFieldFactory($ArtifactType);
     $this->ArtifactFields = $art_field_fact->getFieldsContainedInFieldSet($this->getID());
     db_free_result($res);
     return true;
 }
コード例 #2
0
 /**
  *  Retrieve the fieldsets associated with an artifact type
  *
  *  @param int $group_artifact_id the artifact type id
  *	@return	boolean	success
  */
 function fetchData($group_artifact_id)
 {
     $sql = "SELECT * \n                FROM artifact_field_set \n                WHERE group_artifact_id=" . db_ei($group_artifact_id) . " \n                ORDER BY rank";
     //echo $sql;
     $res = db_query($sql);
     $this->ArtifactFieldSets = array();
     while ($fieldset_array = db_fetch_array($res)) {
         // create a new ArtifactFieldSet (empty)
         $fieldset = new ArtifactFieldSet();
         // set the datas
         $fieldset->setFromArray($fieldset_array);
         // set the fields contained inside the FieldSet
         $art_field_fact = new ArtifactFieldFactory($this->ArtifactType);
         $fields = $art_field_fact->getFieldsContainedInFieldSet($fieldset_array['field_set_id']);
         $fieldset->setArtifactFields($fields);
         $this->ArtifactFieldSets[] = $fieldset;
     }
     reset($this->ArtifactFieldSets);
 }