public static function GetByID($id)
 {
     if (!is_numeric($id)) {
         return null;
     }
     $tenant = Tenant::GetCurrent();
     $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "TenantEnumerations WHERE enum_ID = " . $id . " AND enum_TenantID = " . $tenant->ID;
     $result = $MySQL->query($query);
     if ($result === false) {
         return null;
     }
     $count = $result->num_rows;
     if ($count == 0) {
         return null;
     }
     $values = $result->fetch_assoc();
     return TenantEnumeration::GetByAssoc($values);
 }
示例#2
0
 /**
  * Creates an enumeration on this Tenant
  * @deprecated Please create a SingleInstance or MultipleInstance property instead.
  * @param unknown $name
  * @param string $description
  * @param string $choices
  * @return \PhoenixSNS\Objects\TenantEnumeration
  */
 public function CreateEnumeration($name, $description = null, $choices = null)
 {
     global $MySQL;
     if ($choices == null) {
         $choices = array();
     }
     $item = new TenantEnumeration($name, $description, $choices);
     $item->Tenant = $this;
     $item->Choices = $choices;
     $item->Update();
     return $item;
 }
 /**
  * Creates a new TenantObjectProperty object based on the given values from the database.
  * @param array $values
  * @return \PhoenixSNS\Objects\TenantObjectProperty based on the values of the fields in the given associative array
  */
 public static function GetByAssoc($values)
 {
     $item = new TenantObjectProperty();
     $item->ID = $values["property_ID"];
     $item->Tenant = Tenant::GetByID($values["property_TenantID"]);
     $item->ParentObject = TenantObject::GetByID($values["property_ObjectID"]);
     $item->Name = $values["property_Name"];
     $item->Description = $values["property_Description"];
     $item->DataType = DataType::GetByID($values["property_DataTypeID"]);
     $item->DefaultValue = $values["property_DefaultValue"];
     $item->Required = $values["property_IsRequired"] == 1;
     $item->Enumeration = TenantEnumeration::GetByID($values["property_EnumerationID"]);
     $item->RequireChoiceFromEnumeration = $values["property_RequireChoiceFromEnumeration"] == 1;
     return $item;
 }