本文整理汇总了PHP中AttributeValue类的典型用法代码示例。如果您正苦于以下问题:PHP AttributeValue类的具体用法?PHP AttributeValue怎么用?PHP AttributeValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AttributeValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: safeUp
public function safeUp()
{
$this->createTable('{{store_product_attribute_value}}', ['id' => 'pk', 'product_id' => 'INTEGER NOT NULL', 'attribute_id' => 'INTEGER NOT NULL', 'number_value' => 'REAL', 'string_value' => 'VARCHAR(250)', 'text_value' => 'TEXT', 'option_value' => 'INTEGER', 'create_time' => 'DATETIME'], $this->getOptions());
//fk
$this->addForeignKey('{{fk_product_attribute_product}}', '{{store_product_attribute_value}}', 'product_id', '{{store_product}}', 'id', 'CASCADE');
$this->addForeignKey('{{fk_product_attribute_attribute}}', '{{store_product_attribute_value}}', 'attribute_id', '{{store_attribute}}', 'id', 'CASCADE');
$this->addForeignKey('{{fk_product_attribute_option}}', '{{store_product_attribute_value}}', 'option_value', '{{store_attribute_option}}', 'id', 'CASCADE');
//ix
$this->createIndex('{{ix_product_attribute_number_value}}', '{{store_product_attribute_value}}', 'number_value');
$this->createIndex('{{ix_product_attribute_string_value}}', '{{store_product_attribute_value}}', 'string_value');
//перенести аттрибуты
$attributes = Yii::app()->getDb()->createCommand('SELECT * FROM {{store_product_attribute_eav}}')->queryAll();
$modelsAttr = [];
foreach ($attributes as $attribute) {
$product = Product::model()->findByPk($attribute['product_id']);
if (null === $product) {
continue;
}
if (!isset($modelsAttr[$attribute['attribute']])) {
$model = Attribute::model()->find('name = :name', [':name' => $attribute['attribute']]);
if (null === $model) {
continue;
}
$modelsAttr[$attribute['attribute']] = $model;
}
$value = new AttributeValue();
$value->store($modelsAttr[$attribute['attribute']]->id, $attribute['value'], $product);
}
$this->dropTable('{{store_product_attribute_eav}}');
}
开发者ID:alextravin,项目名称:yupe,代码行数:30,代码来源:m150907_084604_new_attributes.php
示例2: getByID
public static function getByID($avID) {
$av = new AttributeValue();
$av->load($avID);
if ($av->getAttributeValueID() == $avID) {
return $av;
}
}
开发者ID:notzen,项目名称:concrete5,代码行数:7,代码来源:value.php
示例3: RenderValue
public function RenderValue(AttributeValue $objValue)
{
switch ($objValue->Attribute->AttributeDataTypeId) {
case AttributeDataType::Text:
return QApplication::HtmlEntities($objValue->TextValue);
case AttributeDataType::Checkbox:
return $objValue->BooleanValue ? 'Yes' : 'No';
case AttributeDataType::Date:
return $objValue->DateValue->ToString('MMMM D, YYYY');
case AttributeDataType::DateTime:
return $objValue->DatetimeValue->ToString('MMMM D, YYYY') . ' at ' . $objValue->DatetimeValue->ToString('h:mmz');
case AttributeDataType::ImmutableSingleDropdown:
case AttributeDataType::MutableSingleDropdown:
return $objValue->SingleAttributeOption != null ? QApplication::HtmlEntities($objValue->SingleAttributeOption->Name) : ' ';
case AttributeDataType::ImmutableMultipleDropdown:
case AttributeDataType::MutableMultipleDropdown:
$strArray = array();
foreach ($objValue->GetAttributeOptionAsMultipleArray(QQ::OrderBy(QQN::AttributeOption()->Name)) as $objOption) {
$strArray[] = '• ' . QApplication::HtmlEntities($objOption->Name);
}
return implode('<br/>', $strArray);
default:
throw new Exception('Unhandled Attribute Data Type');
}
}
开发者ID:alcf,项目名称:chms,代码行数:25,代码来源:Vicp_Attributes.class.php
示例4: testConstructorAndGetters
public function testConstructorAndGetters()
{
$helper = new \Magento\TestFramework\Helper\ObjectManager($this);
$attributeBuilder = $helper->getObject('\\Magento\\Framework\\Service\\Data\\Eav\\AttributeValueBuilder')->setAttributeCode(self::ATTRIBUTE_CODE)->setValue(self::VALUE);
$attribute = new AttributeValue($attributeBuilder);
$this->assertSame(self::ATTRIBUTE_CODE, $attribute->getAttributeCode());
$this->assertSame(self::VALUE, $attribute->getValue());
}
开发者ID:Atlis,项目名称:docker-magento2,代码行数:8,代码来源:AttributeValueTest.php
示例5: __construct
public function __construct(Product $product, Attribute $attribute, AttributeValue $attributeValue)
{
$this->setId();
$this->setCreated();
$this->product = $product;
$this->attribute = $attribute;
$this->attributeValue = $attributeValue;
$product->addProductAttribute($this);
$attribute->addProductAttribute($this);
$attributeValue->addProductAttribute($this);
}
开发者ID:inklabs,项目名称:kommerce-core,代码行数:11,代码来源:ProductAttribute.php
示例6: __construct
public function __construct($pa_value_array = null)
{
parent::__construct($pa_value_array);
if (!DateRangeAttributeValue::$o_tep) {
DateRangeAttributeValue::$o_tep = new TimeExpressionParser();
}
}
开发者ID:samrahman,项目名称:providence,代码行数:7,代码来源:DateRangeAttributeValue.php
示例7: CreateGroupParticipations
function CreateGroupParticipations(mysqli $objAcsDatabase, Group $objGroup, GroupRole $objRole, $intAcsGroupId, $intAcsReserveId)
{
print "Adding for Group: " . $objGroup->Name . "\r\n ";
if ($intAcsReserveId) {
$objResult = $objAcsDatabase->query(sprintf('select * from awgrrost where groupid=%s AND reserveid1=%s', $intAcsGroupId, $intAcsReserveId));
} else {
$objResult = $objAcsDatabase->query(sprintf('select * from awgrrost where groupid=%s', $intAcsGroupId));
}
while ($objRow = $objResult->fetch_array()) {
$objAttributeValueArray = AttributeValue::QueryArray(QQ::AndCondition(QQ::Equal(QQN::AttributeValue()->AttributeId, 2), QQ::Equal(QQN::AttributeValue()->TextValue, $objRow['indvid'])));
if (count($objAttributeValueArray) != 1) {
printf("Issue with awgrrost.pkid of %s - IndvId %s for Group %s - AVCount of %s\r\n", $objRow['pkid'], $objRow['indvid'], $objGroup->Name, count($objAttributeValueArray));
} else {
$objPerson = $objAttributeValueArray[0]->Person;
$dttStartDate = new QDateTime($objRow['dateadded']);
if ($objRow['dateremoved']) {
$dttEndDate = new QDateTime($objRow['dateremoved']);
} else {
$dttEndDate = null;
}
$objGroup->AddPerson($objPerson, $objRole->Id, $dttStartDate, $dttEndDate);
print "*";
}
}
print "\r\n Done.\r\n\r\n";
}
开发者ID:alcf,项目名称:chms,代码行数:26,代码来源:acs-wsm-import.cli.php
示例8: getTeacherAttributeValue
public static function getTeacherAttributeValue($teacher, $attribute){
$result = '';
switch($attribute){
case '1': //capacity
$result = AttributeValue::model()->findByAttributes(array('teacher'=>$teacher, 'attribute'=>$attribute))->value;
break;
case '2': //trainer's students
$result = TeacherHelper::getTrainerStudents($teacher);
break;
case '3': //consultant_modules
$result = TeacherHelper::getConsultantModules($teacher);
break;
case '4':// leader's projects
$result = TeacherHelper::getLeaderProjects($teacher);
break;
case '6'://leader's modules
$result = TeacherHelper::getLeaderModules($teacher);
break;
case '7'://author's modules
$result = TeacherHelper::getLeaderModules($teacher);
break;
case '8'://leader's capacity
$result = AttributeValue::model()->findByAttributes(array('teacher'=>$teacher, 'attribute'=>$attribute))->value;
break;
default:
$result = AttributeValue::model()->findByAttributes(array('teacher'=>$teacher, 'attribute'=>$attribute))->value;
}
return $result;
}
开发者ID:nico13051995,项目名称:IntITA,代码行数:29,代码来源:TeacherHelper.php
示例9: add
public function add($aChild, $sName = null, $bTakeover = true)
{
if ($aChild instanceof Macro) {
$aAttrVal = new AttributeValue(null, '', $aChild->position(), $aChild->line());
$aAttrVal->setEndPosition($aChild->endPosition());
$aAttrVal->add($aChild);
$this->attributes()->add($aAttrVal);
$aAttrVal->setParent($this);
$aChild->setParent($this);
}
}
开发者ID:JeCat,项目名称:framework,代码行数:11,代码来源:Tag.php
示例10: buildDBAttr
private static function buildDBAttr($dbAttr, $pdo)
{
$attr = Attribute::__build($dbAttr['ID'], $dbAttr['NAME'], null);
$valstmt = $pdo->prepare("SELECT * FROM ATTRIBUTEVALUE WHERE " . "ATTRIBUTE_ID = :id ORDER BY VALUE");
$valstmt->execute(array(':id' => $dbAttr['ID']));
while ($dbVal = $valstmt->fetch()) {
$val = AttributeValue::__build($dbVal['ID'], $dbVal['VALUE']);
$attr->addValue($val);
}
return $attr;
}
开发者ID:booko,项目名称:pasteque-server,代码行数:11,代码来源:AttributesService.php
示例11: actionDeleteFile
public function actionDeleteFile()
{
if (!Yii::app()->getRequest()->getIsPostRequest()) {
throw new CHttpException();
}
$product = (int) Yii::app()->getRequest()->getPost('product');
$attribute = (int) Yii::app()->getRequest()->getPost('attribute');
$model = AttributeValue::model()->find('product_id = :product AND attribute_id = :attribute', [':product' => $product, ':attribute' => $attribute]);
if (null === $model || null === $model->getFilePath()) {
Yii::app()->ajax->success();
}
$model->delete();
Yii::app()->ajax->success();
}
开发者ID:yupe,项目名称:yupe,代码行数:14,代码来源:AttributeBackendController.php
示例12: DeleteAllAttributeValues
/**
* Deletes all associated AttributeValues
* @return void
*/
public function DeleteAllAttributeValues()
{
if (is_null($this->intId)) {
throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAttributeValue on this unsaved Person.');
}
// Get the Database Object for this Class
$objDatabase = Person::GetDatabase();
// Journaling
if ($objDatabase->JournalingDatabase) {
foreach (AttributeValue::LoadArrayByPersonId($this->intId) as $objAttributeValue) {
$objAttributeValue->Journal('DELETE');
}
}
// Perform the SQL Query
$objDatabase->NonQuery('
DELETE FROM
`attribute_value`
WHERE
`person_id` = ' . $objDatabase->SqlVariable($this->intId) . '
');
}
开发者ID:alcf,项目名称:chms,代码行数:25,代码来源:PersonGen.class.php
示例13: MetaDataBinder
/**
* Main utility method to aid with data binding. It is used by the default BindAllRows() databinder but
* could and should be used by any custom databind methods that would be used for instances of this
* MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause.
*
* If a paginator is set on this DataBinder, it will use it. If not, then no pagination will be used.
* It will also perform any sorting (if applicable).
*
* @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
* @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query
* @return void
*/
public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
{
// Setup input parameters to default values if none passed in
if (!$objCondition) {
$objCondition = QQ::All();
}
$objClauses = $objOptionalClauses ? $objOptionalClauses : array();
// We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
if ($this->Paginator) {
$this->TotalItemCount = AttributeValue::QueryCount($objCondition, $objClauses);
}
// If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
// the OrderByClause to the $objClauses array
if ($objClause = $this->OrderByClause) {
array_push($objClauses, $objClause);
}
// Add the LimitClause information, as well
if ($objClause = $this->LimitClause) {
array_push($objClauses, $objClause);
}
// Set the DataSource to be a Query result from AttributeValue, given the clauses above
$this->DataSource = AttributeValue::QueryArray($objCondition, $objClauses);
}
开发者ID:alcf,项目名称:chms,代码行数:35,代码来源:AttributeValueDataGridGen.class.php
示例14: SetupPanel
protected function SetupPanel()
{
$this->objAttributeValue = AttributeValue::LoadByAttributeIdPersonId($this->strUrlHashArgument, $this->objPerson->Id);
if (!$this->objAttributeValue) {
$this->objAttributeValue = new AttributeValue();
$this->objAttributeValue->AttributeId = $this->strUrlHashArgument;
$this->objAttributeValue->Person = $this->objPerson;
} else {
$this->btnDelete = new QLinkButton($this);
$this->btnDelete->Text = 'Delete';
$this->btnDelete->CssClass = 'delete';
$this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to DELETE this attribute?'));
$this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
$this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction());
}
switch ($this->objAttributeValue->Attribute->AttributeDataTypeId) {
case AttributeDataType::Checkbox:
$this->chkValue = new QRadioButtonList($this);
$this->chkValue->Name = $this->objAttributeValue->Attribute->Name;
$this->chkValue->Required = true;
$this->chkValue->AddItem('Yes', true, $this->objAttributeValue->BooleanValue === true);
$this->chkValue->AddItem('No', false, $this->objAttributeValue->BooleanValue === false);
break;
case AttributeDataType::Date:
case AttributeDataType::DateTime:
$this->dtxValue = new QDateTimeTextBox($this);
$this->dtxValue->Name = $this->objAttributeValue->Attribute->Name;
$this->dtxValue->Required = true;
if ($this->objAttributeValue->Attribute->AttributeDataTypeId == AttributeDataType::Date) {
$this->dtxValue->Text = $this->objAttributeValue->DateValue ? $this->objAttributeValue->DateValue->ToString() : null;
} else {
$this->dtxValue->Text = $this->objAttributeValue->DatetimeValue ? $this->objAttributeValue->DatetimeValue->ToString() : null;
}
$this->calValue = new QCalendar($this, $this->dtxValue);
$this->dtxValue->RemoveAllActions(QClickEvent::EventName);
break;
case AttributeDataType::Text:
$this->txtValue = new QTextBox($this);
$this->txtValue->Name = $this->objAttributeValue->Attribute->Name;
$this->txtValue->Required = true;
$this->txtValue->TextMode = QTextMode::MultiLine;
$this->txtValue->Text = trim($this->objAttributeValue->TextValue);
$this->txtValue->FontNames = QFontFamily::Arial;
$this->txtValue->FontSize = '11px';
$this->txtValue->Width = '400px';
$this->txtValue->Height = '200px';
break;
case AttributeDataType::ImmutableSingleDropdown:
$this->lstValue = new QListBox($this);
$this->lstValue->Name = $this->objAttributeValue->Attribute->Name;
$this->lstValue->Required = true;
if (!$this->objAttributeValue->SingleAttributeOptionId) {
$this->lstValue->AddItem('- Select One -');
}
foreach ($this->objAttributeValue->Attribute->GetAttributeOptionArray(QQ::OrderBy(QQN::AttributeOption()->Name)) as $objOption) {
$this->lstValue->AddItem($objOption->Name, $objOption->Id, $objOption->Id == $this->objAttributeValue->SingleAttributeOptionId);
}
break;
case AttributeDataType::ImmutableMultipleDropdown:
$this->lstValue = new QListBox($this);
$this->lstValue->Name = $this->objAttributeValue->Attribute->Name;
$this->lstValue->Required = true;
$this->lstValue->SelectionMode = QSelectionMode::Multiple;
$this->lstValue->Width = '200px';
$this->lstValue->Height = '200px';
$intSelectedIdArray = array();
if ($this->objAttributeValue->Id) {
foreach ($this->objAttributeValue->GetAttributeOptionAsMultipleArray() as $objOption) {
$intSelectedIdArray[$objOption->Id] = $objOption->Id;
}
}
foreach ($this->objAttributeValue->Attribute->GetAttributeOptionArray(QQ::OrderBy(QQN::AttributeOption()->Name)) as $objOption) {
$this->lstValue->AddItem($objOption->Name, $objOption->Id, array_key_exists($objOption->Id, $intSelectedIdArray));
}
break;
case AttributeDataType::MutableSingleDropdown:
$this->lstValue = new QListBox($this);
$this->lstValue->Name = $this->objAttributeValue->Attribute->Name;
$this->lstValue->Required = true;
if (!$this->objAttributeValue->SingleAttributeOptionId) {
$this->lstValue->AddItem('- Select One -');
}
foreach ($this->objAttributeValue->Attribute->GetAttributeOptionArray(QQ::OrderBy(QQN::AttributeOption()->Name)) as $objOption) {
$this->lstValue->AddItem($objOption->Name, $objOption->Id, $objOption->Id == $this->objAttributeValue->SingleAttributeOptionId);
}
$this->lstValue->AddItem('- Other... -', -1);
$this->txtAddItem = new QTextBox($this);
$this->txtAddItem->Name = 'Add a Value';
$this->txtAddItem->Visible = false;
$this->lstValue->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'lstValue_Change'));
$this->txtAddItem->AddAction(new QEnterKeyEvent(), new QTerminateAction());
break;
case AttributeDataType::MutableMultipleDropdown:
$this->lstValue = new QListBox($this);
$this->lstValue->Name = $this->objAttributeValue->Attribute->Name;
$this->lstValue->Required = true;
$this->lstValue->SelectionMode = QSelectionMode::Multiple;
$this->lstValue->Width = '200px';
$this->lstValue->Height = '200px';
$intSelectedIdArray = array();
//.........这里部分代码省略.........
开发者ID:alcf,项目名称:chms,代码行数:101,代码来源:Vicp_Attributes_Edit.class.php
示例15: uploadAttributesFiles
/**
* @param $model
*/
protected function uploadAttributesFiles($model)
{
if (!empty($_FILES['Attribute']['name'])) {
foreach ($_FILES['Attribute']['name'] as $key => $file) {
$value = AttributeValue::model()->find('product_id = :product AND attribute_id = :attribute', [':product' => $model->id, ':attribute' => $key]);
$value = $value ?: new AttributeValue();
$value->setAttributes(['product_id' => $model->id, 'attribute_id' => $key]);
$value->addFileInstanceName('Attribute[' . $key . '][name]');
if (false === $value->save()) {
Yii::app()->getUser()->setFlash(\yupe\widgets\YFlashMessages::ERROR_MESSAGE, Yii::t('StoreModule.store', 'Error uploading some files...'));
}
}
}
}
开发者ID:syrexby,项目名称:domovoishop.by,代码行数:17,代码来源:ProductBackendController.php
示例16: Create
/**
* Static Helper Method to Create using PK arguments
* You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
* If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
* static helper methods. Finally, specify a CreateType to define whether or not we are only allowed to
* edit, or if we are also allowed to create a new one, etc.
*
* @param mixed $objParentObject QForm or QPanel which will be using this AttributeValueMetaControl
* @param integer $intId primary key value
* @param QMetaControlCreateType $intCreateType rules governing AttributeValue object creation - defaults to CreateOrEdit
* @return AttributeValueMetaControl
*/
public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
{
// Attempt to Load from PK Arguments
if (strlen($intId)) {
$objAttributeValue = AttributeValue::Load($intId);
// AttributeValue was found -- return it!
if ($objAttributeValue) {
return new AttributeValueMetaControl($objParentObject, $objAttributeValue);
} else {
if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
throw new QCallerException('Could not find a AttributeValue object with PK arguments: ' . $intId);
}
}
// If EditOnly is specified, throw an exception
} else {
if ($intCreateType == QMetaControlCreateType::EditOnly) {
throw new QCallerException('No PK arguments specified');
}
}
// If we are here, then we need to create a new record
return new AttributeValueMetaControl($objParentObject, new AttributeValue());
}
开发者ID:alcf,项目名称:chms,代码行数:34,代码来源:AttributeValueMetaControlGen.class.php
示例17: btnUnsubscribe_Click
protected function btnUnsubscribe_Click()
{
$objCommunicationListEntry = CommunicationListEntry::LoadByEmail($this->txtEmail->Text);
$objEmailArray = Email::LoadArrayByAddress($this->txtEmail->Text);
foreach ($objEmailArray as $objEmail) {
$objPerson = Person::LoadByPrimaryEmailId($objEmail->Id);
if ($objPerson != null) {
$strUnsubscribedList = '';
$success = false;
foreach ($this->chkBtnListArray as $objItem) {
if ($objItem->Checked) {
$this->objList = CommunicationList::LoadByToken($objItem->Name);
if ($this->objList) {
$bFound = false;
if ($this->objList->IsPersonAssociated($objPerson)) {
$this->objList->UnassociatePerson($objPerson);
// If church newletter is the one being unsubscribed, document reason.
if ($this->lstTerminationReason->SelectedValue == -1) {
$objAttributeOption = new AttributeOption();
$objAttributeOption->AttributeId = $this->objAttributeValue->AttributeId;
$objAttributeOption->Name = trim($this->txtOther->Text);
$objAttributeOption->Save();
$objAttributeValue = AttributeValue::LoadByAttributeIdPersonId($this->objAttribute->Id, $objPerson->Id);
if ($objAttributeValue) {
$objAttributeValue->SingleAttributeOption = $objAttributeOption;
$objAttributeValue->Save();
} else {
$objAttributeValue = new AttributeValue();
$objAttributeValue->AttributeId = $this->objAttribute->Id;
$objAttributeValue->PersonId = $objPerson->Id;
$objAttributeValue->SingleAttributeOption = $objAttributeOption;
$objAttributeValue->Save();
$objPerson->AssociateAttributeValue($objAttributeValue);
}
} else {
$objAttributeValue = AttributeValue::LoadByAttributeIdPersonId($this->objAttribute->Id, $objPerson->Id);
if ($objAttributeValue) {
$objAttributeValue->SingleAttributeOptionId = $this->lstTerminationReason->SelectedValue;
$objAttributeValue->Save();
} else {
$objAttributeValue = new AttributeValue();
$objAttributeValue->AttributeId = $this->objAttribute->Id;
$objAttributeValue->PersonId = $objPerson->Id;
$objAttributeValue->SingleAttributeOptionId = $this->lstTerminationReason->SelectedValue;
$objAttributeValue->Save();
$objPerson->AssociateAttributeValue($objAttributeValue);
}
}
$strUnsubscribedList .= $objItem->Text . ',';
$success = true;
$bFound = true;
}
if (!$bFound) {
$this->lblMessage->Text = '(Person Entry) You cannot Unsubscribe because you are not subscribed to the ' . $objItem->Text . ' Mailing List.';
$this->lblMessage->Visible = true;
}
}
}
}
if ($success) {
$strUnsubscribedList = substr($strUnsubscribedList, 0, strlen($strUnsubscribedList) - 1);
QApplication::Redirect('/unsubscribe/success.php/' . urlencode($strUnsubscribedList) . '/' . $objPerson->Id);
}
}
}
if ($objCommunicationListEntry) {
$strUnsubscribedList = '';
$success = false;
$bChecked = false;
foreach ($this->chkBtnListArray as $objItem) {
if ($objItem->Checked) {
$this->objList = CommunicationList::LoadByToken($objItem->Name);
if ($this->objList) {
$bFound = false;
if ($objCommunicationListEntry != null) {
if ($this->objList->IsCommunicationListEntryAssociated($objCommunicationListEntry)) {
$this->objList->UnassociateCommunicationListEntry($objCommunicationListEntry);
$strUnsubscribedList .= $objItem->Text . ',';
$success = true;
$bFound = true;
}
}
if (!$bFound) {
$this->lblMessage->Text = '(CommunicationsEntry) You cannot Unsubscribe because you are not subscribed to the ' . $objItem->Text . ' Mailing List.';
$this->lblMessage->Visible = true;
}
}
}
}
if ($success) {
$strUnsubscribedList = substr($strUnsubscribedList, 0, strlen($strUnsubscribedList) - 1);
QApplication::Redirect('/unsubscribe/success.php/' . urlencode($strUnsubscribedList));
}
}
$bChecked = false;
foreach ($this->chkBtnListArray as $objItem) {
if ($objItem->Checked) {
$bChecked = true;
break;
}
//.........这里部分代码省略.........
开发者ID:alcf,项目名称:chms,代码行数:101,代码来源:index.php
示例18: array
<?php
$intPersonIdByIndvId = array();
foreach (AttributeValue::LoadArrayByAttributeId(2) as $objAttributeValue) {
$intPersonIdByIndvId[$objAttributeValue->TextValue] = $objAttributeValue->PersonId;
}
$objMySqli = new mysqli('localhost', 'root', '', 'alcf_acs');
$objResult = $objMySqli->query('SELECT * FROM awperelt');
$intCount = $objResult->num_rows;
while (QDataGen::DisplayWhileTask('Importing Family Relationships', $intCount) && ($objRow = $objResult->fetch_array())) {
if ($objRow['indvid'] != $objRow['reltindvid']) {
$intRelationshipTypeId = null;
switch (strtolower($objRow['relationship'])) {
case 'mother':
case 'father':
$intRelationshipTypeId = RelationshipType::Parental;
break;
case 'son':
case 'daughter':
$intRelationshipTypeId = RelationshipType::Child;
break;
case 'brother':
case 'sister':
$intRelationshipTypeId = RelationshipType::Sibling;
break;
case 'grandmother':
case 'grandfather':
$intRelationshipTypeId = RelationshipType::Grandparent;
break;
case 'grandchild':
case 'grandson':
开发者ID:alcf,项目名称:chms,代码行数:31,代码来源:acs-relationships.cli.php
示例19: MergeWith
/**
* Merges two records together.
* @param Person $objPersonMergeWith
* @param boolean $blnUseThisDetails boolean on whether to use this person's Person object details, or if false, use the PersonMergeWith's
*/
public function MergeWith(Person $objPersonMergeWith, $blnUseThisDetails)
{
QLog::Log(sprintf('Merging %s (ID %s) with %s (ID %s) - %s', $this->Name, $this->Id, $objPersonMergeWith->Name, $objPersonMergeWith->Id, $blnUseThisDetails ? 'left' : 'right'));
Person::GetDatabase()->TransactionBegin();
// Household Participation Records
if ($this->HouseholdAsHead && $objPersonMergeWith->HouseholdAsHead) {
$this->HouseholdAsHead->MergeHousehold($objPersonMergeWith->HouseholdAsHead, $this);
} else {
if ($this->HouseholdAsHead) {
// Go through each MergeWith HouseholdParticipation -- Throw if it's another household, Delete if it's this Household-as-Head
foreach ($objPersonMergeWith->GetHouseholdParticipationArray() as $objHouseholdParticipation) {
if ($objHouseholdParticipation->HouseholdId != $this->HouseholdAsHead->Id) {
throw new QCallerException('Cannot merge this head of household with a person record that exists in other households');
} else {
$objHouseholdParticipation->Delete();
}
}
} else {
if ($objHousehold = $objPersonMergeWith->HouseholdAsHead) {
// Go through each of this's HouseholdParticipation -- Throw if it's another household, Delete if it's MergeWith's Household-as-Head
foreach ($this->GetHouseholdParticipationArray() as $objHouseholdParticipation) {
if ($objHouseholdParticipation->HouseholdId != $objPersonMergeWith->HouseholdAsHead->Id) {
throw new QCallerException('Cannot merge MergeWith head of household with this person record which exists in other households');
} else {
$objHouseholdParticipation->Delete();
}
}
$objHousehold->HeadPerson = $this;
$objHousehold->Save();
$objParticipation = HouseholdParticipation::LoadByPersonIdHouseholdId($objPersonMergeWith->Id, $objHousehold->Id);
$objParticipation->PersonId = $this->Id;
$objParticipation->Save();
} else {
// Otherwise: members of multiple households! but head of none
foreach ($objPersonMergeWith->GetHouseholdParticipationArray() as $objHouseholdParticipation) {
if (HouseholdParticipation::LoadByPersonIdHouseholdId($this->Id, $objHouseholdParticipation->HouseholdId)) {
$objHouseholdParticipation->Delete();
} else {
$objHouseholdParticipation->PersonId = $this->Id;
$objHouseholdParticipation->Save();
}
}
}
}
}
if (!$blnUseThisDetails) {
$this->FirstName = $objPersonMergeWith->FirstName;
$this->MiddleName = $objPersonMergeWith->MiddleName;
$this->LastName = $objPersonMergeWith->LastName;
$this->MailingLabel = $objPersonMergeWith->MailingLabel;
$this->PriorLastNames = $objPersonMergeWith->PriorLastNames;
$this->Nickname = $objPersonMergeWith->Nickname;
$this->Title = $objPersonMergeWith->Title;
$this->Suffix = $objPersonMergeWith->Suffix;
$this->Gender = $objPersonMergeWith->Gender;
$this->DateOfBirth = $objPersonMergeWith->DateOfBirth;
$this->DobYearApproximateFlag = $objPersonMergeWith->DobYearApproximateFlag;
$this->DobGuessedFlag = $objPersonMergeWith->DobGuessedFlag;
$this->Age = $objPersonMergeWith->Age;
$this->DeceasedFlag = $objPersonMergeWith->DeceasedFlag;
$this->DateDeceased = $objPersonMergeWith->DateDeceased;
}
// Attributes
foreach ($objPersonMergeWith->GetAttributeValueArray() as $objAttributeValue) {
// Check for double-defined attributes
if ($objDoubleDefinedAttribute = AttributeValue::LoadByAttributeIdPersonId($objAttributeValue->AttributeId, $this->Id)) {
if ($blnUseThisDetails) {
$objAttributeValue->Delete();
} else {
$objDoubleDefinedAttribute->Delete();
$objAttributeValue->PersonId = $this->Id;
$objAttributeValue->Save();
}
// Nothing double-defined -- just move it over!
} else {
$objAttributeValue->PersonId = $this->Id;
$objAttributeValue->Save();
}
}
// Comments
foreach ($objPersonMergeWith->GetCommentArray() as $objComment) {
$objComment->PersonId = $this->Id;
$objComment->Save();
}
// Memberships
foreach ($objPersonMergeWith->GetMembershipArray() as $objMembership) {
$objMembership->PersonId = $this->Id;
$objMembership->Save();
}
// Communication Lists
foreach ($objPersonMergeWith->GetCommunicationListArray() as $objCommList) {
$objPersonMergeWith->UnassociateCommunicationList($objCommList);
if (!$this->IsCommunicationListAssociated($objCommList)) {
$this->AssociateCommunicationList($objCommList);
}
//.........这里部分代码省略.........
开发者ID:alcf,项目名称:chms,代码行数:101,代码来源:Person.class.php
示例20: addAttributeValue
/**
* Adds a generic attribute record (with this type) to the AttributeValues table
*/
public function addAttributeValue()
{
$db = Loader::db();
$u = new User();
$dh = Loader::helper('date');
$uID = $u->isRegistered() ? $u->getUserID() : 0;
$avDate = $dh->getLocalDateTime();
$v = array($this->atID, $this->akID, $uID, $avDate);
$db->Execute('insert into AttributeValues (atID, akID, uID, avDateAdded) values (?, ?, ?, ?)', $v);
$avID = $db->Insert_ID();
return AttributeValue::getByID($avID);
}
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:15,代码来源:key.php
注:本文中的AttributeValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论