本文整理汇总了PHP中Attribute::LoadAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Attribute::LoadAll方法的具体用法?PHP Attribute::LoadAll怎么用?PHP Attribute::LoadAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attribute
的用法示例。
在下文中一共展示了Attribute::LoadAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Refresh
/**
* Refresh this MetaControl with Data from the local AttributeOption object.
* @param boolean $blnReload reload AttributeOption from the database
* @return void
*/
public function Refresh($blnReload = false)
{
if ($blnReload) {
$this->objAttributeOption->Reload();
}
if ($this->lblId) {
if ($this->blnEditMode) {
$this->lblId->Text = $this->objAttributeOption->Id;
}
}
if ($this->lstAttribute) {
$this->lstAttribute->RemoveAllItems();
if (!$this->blnEditMode) {
$this->lstAttribute->AddItem(QApplication::Translate('- Select One -'), null);
}
$objAttributeArray = Attribute::LoadAll();
if ($objAttributeArray) {
foreach ($objAttributeArray as $objAttribute) {
$objListItem = new QListItem($objAttribute->__toString(), $objAttribute->Id);
if ($this->objAttributeOption->Attribute && $this->objAttributeOption->Attribute->Id == $objAttribute->Id) {
$objListItem->Selected = true;
}
$this->lstAttribute->AddItem($objListItem);
}
}
}
if ($this->lblAttributeId) {
$this->lblAttributeId->Text = $this->objAttributeOption->Attribute ? $this->objAttributeOption->Attribute->__toString() : null;
}
if ($this->txtName) {
$this->txtName->Text = $this->objAttributeOption->Name;
}
if ($this->lblName) {
$this->lblName->Text = $this->objAttributeOption->Name;
}
if ($this->lstAttributeValuesAsMultiple) {
$this->lstAttributeValuesAsMultiple->RemoveAllItems();
$objAssociatedArray = $this->objAttributeOption->GetAttributeValueAsMultipleArray();
$objAttributeValueArray = AttributeValue::LoadAll();
if ($objAttributeValueArray) {
foreach ($objAttributeValueArray as $objAttributeValue) {
$objListItem = new QListItem($objAttributeValue->__toString(), $objAttributeValue->Id);
foreach ($objAssociatedArray as $objAssociated) {
if ($objAssociated->Id == $objAttributeValue->Id) {
$objListItem->Selected = true;
}
}
$this->lstAttributeValuesAsMultiple->AddItem($objListItem);
}
}
}
if ($this->lblAttributeValuesAsMultiple) {
$objAssociatedArray = $this->objAttributeOption->GetAttributeValueAsMultipleArray();
$strItems = array();
foreach ($objAssociatedArray as $objAssociated) {
$strItems[] = $objAssociated->__toString();
}
$this->lblAttributeValuesAsMultiple->Text = implode($strGlue, $strItems);
}
}
示例2: Refresh
/**
* Refresh this MetaControl with Data from the local AttributeValue object.
* @param boolean $blnReload reload AttributeValue from the database
* @return void
*/
public function Refresh($blnReload = false)
{
if ($blnReload) {
$this->objAttributeValue->Reload();
}
if ($this->lblId) {
if ($this->blnEditMode) {
$this->lblId->Text = $this->objAttributeValue->Id;
}
}
if ($this->lstAttribute) {
$this->lstAttribute->RemoveAllItems();
if (!$this->blnEditMode) {
$this->lstAttribute->AddItem(QApplication::Translate('- Select One -'), null);
}
$objAttributeArray = Attribute::LoadAll();
if ($objAttributeArray) {
foreach ($objAttributeArray as $objAttribute) {
$objListItem = new QListItem($objAttribute->__toString(), $objAttribute->Id);
if ($this->objAttributeValue->Attribute && $this->objAttributeValue->Attribute->Id == $objAttribute->Id) {
$objListItem->Selected = true;
}
$this->lstAttribute->AddItem($objListItem);
}
}
}
if ($this->lblAttributeId) {
$this->lblAttributeId->Text = $this->objAttributeValue->Attribute ? $this->objAttributeValue->Attribute->__toString() : null;
}
if ($this->lstPerson) {
$this->lstPerson->RemoveAllItems();
if (!$this->blnEditMode) {
$this->lstPerson->AddItem(QApplication::Translate('- Select One -'), null);
}
$objPersonArray = Person::LoadAll();
if ($objPersonArray) {
foreach ($objPersonArray as $objPerson) {
$objListItem = new QListItem($objPerson->__toString(), $objPerson->Id);
if ($this->objAttributeValue->Person && $this->objAttributeValue->Person->Id == $objPerson->Id) {
$objListItem->Selected = true;
}
$this->lstPerson->AddItem($objListItem);
}
}
}
if ($this->lblPersonId) {
$this->lblPersonId->Text = $this->objAttributeValue->Person ? $this->objAttributeValue->Person->__toString() : null;
}
if ($this->calDateValue) {
$this->calDateValue->DateTime = $this->objAttributeValue->DateValue;
}
if ($this->lblDateValue) {
$this->lblDateValue->Text = sprintf($this->objAttributeValue->DateValue) ? $this->objAttributeValue->__toString($this->strDateValueDateTimeFormat) : null;
}
if ($this->calDatetimeValue) {
$this->calDatetimeValue->DateTime = $this->objAttributeValue->DatetimeValue;
}
if ($this->lblDatetimeValue) {
$this->lblDatetimeValue->Text = sprintf($this->objAttributeValue->DatetimeValue) ? $this->objAttributeValue->__toString($this->strDatetimeValueDateTimeFormat) : null;
}
if ($this->txtTextValue) {
$this->txtTextValue->Text = $this->objAttributeValue->TextValue;
}
if ($this->lblTextValue) {
$this->lblTextValue->Text = $this->objAttributeValue->TextValue;
}
if ($this->chkBooleanValue) {
$this->chkBooleanValue->Checked = $this->objAttributeValue->BooleanValue;
}
if ($this->lblBooleanValue) {
$this->lblBooleanValue->Text = $this->objAttributeValue->BooleanValue ? QApplication::Translate('Yes') : QApplication::Translate('No');
}
if ($this->lstSingleAttributeOption) {
$this->lstSingleAttributeOption->RemoveAllItems();
$this->lstSingleAttributeOption->AddItem(QApplication::Translate('- Select One -'), null);
$objSingleAttributeOptionArray = AttributeOption::LoadAll();
if ($objSingleAttributeOptionArray) {
foreach ($objSingleAttributeOptionArray as $objSingleAttributeOption) {
$objListItem = new QListItem($objSingleAttributeOption->__toString(), $objSingleAttributeOption->Id);
if ($this->objAttributeValue->SingleAttributeOption && $this->objAttributeValue->SingleAttributeOption->Id == $objSingleAttributeOption->Id) {
$objListItem->Selected = true;
}
$this->lstSingleAttributeOption->AddItem($objListItem);
}
}
}
if ($this->lblSingleAttributeOptionId) {
$this->lblSingleAttributeOptionId->Text = $this->objAttributeValue->SingleAttributeOption ? $this->objAttributeValue->SingleAttributeOption->__toString() : null;
}
if ($this->lstAttributeOptionsAsMultiple) {
$this->lstAttributeOptionsAsMultiple->RemoveAllItems();
$objAssociatedArray = $this->objAttributeValue->GetAttributeOptionAsMultipleArray();
$objAttributeOptionArray = AttributeOption::LoadAll();
if ($objAttributeOptionArray) {
foreach ($objAttributeOptionArray as $objAttributeOption) {
//.........这里部分代码省略.........
示例3: GenerateAttributesForPerson
protected static function GenerateAttributesForPerson($objPerson)
{
foreach (Attribute::LoadAll() as $objAttribute) {
if (!rand(0, 3)) {
switch ($objAttribute->AttributeDataTypeId) {
case AttributeDataType::Text:
$mixData = QDataGen::GenerateTitle(5, 25);
break;
case AttributeDataType::Checkbox:
$mixData = rand(0, 1) ? true : false;
break;
case AttributeDataType::Date:
$mixData = QDataGen::GenerateDateTime(self::$LifeStartDate, QDateTime::Now());
break;
case AttributeDataType::ImmutableSingleDropdown:
case AttributeDataType::MutableSingleDropdown:
$mixData = QDataGen::GenerateFromArray($objAttribute->GetAttributeOptionArray());
break;
case AttributeDataType::ImmutableMultipleDropdown:
case AttributeDataType::MutableMultipleDropdown:
$mixData = array();
while (!count($mixData)) {
foreach ($objAttribute->GetAttributeOptionArray() as $objAttributeOption) {
if (rand(0, 1)) {
$mixData[] = $objAttributeOption;
}
}
}
break;
default:
throw new Exception('Unhandled Attribute Data Type');
}
$objPerson->SetAttribute($objAttribute, $mixData);
}
}
}
示例4: foreach
<?php
foreach (Attribute::LoadAll() as $objAttribute) {
$objNodes = QueryNode::QueryArray(QQ::AndCondition(QQ::Equal(QQN::QueryNode()->QueryNodeTypeId, QueryNodeType::AttributeNode), QQ::Equal(QQN::QueryNode()->NodeDetail, $objAttribute->Id)));
if (count($objNodes)) {
foreach ($objNodes as $objQueryNode) {
$objQueryNode->Name = $objAttribute->Name;
$objQueryNode->QcodoQueryNode = null;
$objQueryNode->QueryNodeTypeId = QueryNodeType::AttributeNode;
$objQueryNode->QueryDataTypeId = AttributeDataType::$QueryDataTypeArray[$objAttribute->AttributeDataTypeId];
$objQueryNode->NodeDetail = $objAttribute->Id;
$objQueryNode->Save();
}
} else {
$objQueryNode = new QueryNode();
$objQueryNode->Name = $objAttribute->Name;
$objQueryNode->QcodoQueryNode = null;
$objQueryNode->QueryNodeTypeId = QueryNodeType::AttributeNode;
$objQueryNode->QueryDataTypeId = AttributeDataType::$QueryDataTypeArray[$objAttribute->AttributeDataTypeId];
$objQueryNode->NodeDetail = $objAttribute->Id;
$objQueryNode->Save();
}
}
示例5: dtgAttributes_Bind
public function dtgAttributes_Bind()
{
$objExisting = array();
foreach ($this->objPerson->GetAttributeValueArray() as $objAttributeValue) {
$objExisting[$objAttributeValue->AttributeId] = true;
}
$objAttributeArray = array();
foreach (Attribute::LoadAll(QQ::OrderBy(QQN::Attribute()->Name)) as $objAttribute) {
if (!array_key_exists($objAttribute->Id, $objExisting)) {
$objAttributeArray[] = $objAttribute;
}
}
$this->iAttributeCount = count($objAttributeArray);
$this->dtgAttributes->DataSource = $objAttributeArray;
}