本文整理汇总了PHP中Manufacturer::Save方法的典型用法代码示例。如果您正苦于以下问题:PHP Manufacturer::Save方法的具体用法?PHP Manufacturer::Save怎么用?PHP Manufacturer::Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manufacturer
的用法示例。
在下文中一共展示了Manufacturer::Save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: btnNext_Click
//.........这里部分代码省略.........
$this->btnImportMore->Display = false;
$this->btnImportMore->AddAction(new QClickEvent(), new QServerAction('btnImportMore_Click'));
$this->btnImportMore->AddAction(new QEnterKeyEvent(), new QServerAction('btnImportMore_Click'));
$this->btnImportMore->AddAction(new QEnterKeyEvent(), new QTerminateAction());
// Return to Assets button
$this->btnReturnTo = new QButton($this);
$this->btnReturnTo->Text = "Return to Manufacturers";
$this->btnReturnTo->Display = false;
$this->btnReturnTo->AddAction(new QClickEvent(), new QServerAction('btnReturnTo_Click'));
$this->btnReturnTo->AddAction(new QEnterKeyEvent(), new QServerAction('btnReturnTo_Click'));
$this->btnReturnTo->AddAction(new QEnterKeyEvent(), new QTerminateAction());
} else {
$this->btnNext->Warning = "You must select all required fields.";
$blnError = true;
}
} else {
// Step 3 complete
set_time_limit(0);
$file_skipped = fopen($strFilePath = sprintf('%s/%s_manufacturer_skipped.csv', __TRACMOR_TMP__, $_SESSION['intUserAccountId']), "a");
if (!$this->blnImportEnd) {
if ($this->intImportStep == 2) {
$strManufacturerArray = array();
$this->objNewManufacturerArray = array();
// Load all manufacturers
foreach (Manufacturer::LoadAll() as $objManufacturer) {
$strManufacturerArray[] = stripslashes($objManufacturer->ShortDescription);
}
$txtDefaultValue = trim($this->txtMapDefaultValueArray[$this->intManufacturerKey]->Text);
// Add Default Value
if ($txtDefaultValue && !$this->in_array_nocase($txtDefaultValue, $strManufacturerArray)) {
$strManufacturerArray[] = $txtDefaultValue;
$objNewManufacturer = new Manufacturer();
$objNewManufacturer->ShortDescription = addslashes($txtDefaultValue);
$objNewManufacturer->Save();
$this->objNewManufacturerArray[$objNewManufacturer->ManufacturerId] = $objNewManufacturer->ShortDescription;
}
$this->btnNext->Warning = "Manufacturers have been imported. Please wait...";
}
for ($j = $this->intCurrentFile; $j < count($this->strFilePathArray); $j++) {
$this->FileCsvData->load($this->strFilePathArray[$j]);
if (!$j) {
//$this->FileCsvData->appendRow($this->FileCsvData->getHeaders());
}
// Manufacturer Import
if ($this->intImportStep == 2) {
$arrItemCustomField = array();
foreach ($this->arrTracmorField as $key => $value) {
if (substr($value, 0, 13) == 'manufacturer_') {
$intItemCustomFieldKeyArray[substr($value, 13)] = $key;
if (array_key_exists(substr($value, 13), $this->arrItemCustomField)) {
$arrItemCustomField[substr($value, 13)] = $this->arrItemCustomField[substr($value, 13)];
}
}
}
$strManufacturerValuesArray = array();
$strUpdatedManufacturerValuesArray = array();
$strItemCFVArray = array();
$strUpdatedItemCFVArray = array();
$strNewManufacturerArray = array();
$intManufacturerArray = array();
$this->arrOldItemArray = array();
$this->objUpdatedItemArray = array();
$objManufacturerArray = array();
foreach (Manufacturer::LoadAllWithCustomFieldsHelper() as $objManufacturer) {
$objManufacturerArray[strtolower($objManufacturer->ShortDescription)] = $objManufacturer;
}
示例2: btnNext_Click
//.........这里部分代码省略.........
if (!$blnError && $blnAssetCode && $blnAssetModelCode && $blnAssetModelShortDescription && $blnLocation && $blnCategory && $blnManufacturer) {
$this->btnNext->Warning = "";
// Setup keys for main required fields
foreach ($this->arrTracmorField as $key => $value) {
if ($value == 'location') {
$this->intLocationKey = $key;
} elseif ($value == 'category') {
$this->intCategoryKey = $key;
} elseif ($value == 'manufacturer') {
$this->intManufacturerKey = $key;
} elseif ($value == 'created by') {
$this->intCreatedByKey = $key;
} elseif ($value == 'created date') {
$this->intCreatedDateKey = $key;
} elseif ($value == 'modified by') {
$this->intModifiedByKey = $key;
} elseif ($value == 'modified date') {
$this->intModifiedDateKey = $key;
}
}
$strLocationArray = array();
$strNewLocationArray = array();
// Load all locations
foreach (Location::LoadAll() as $objLocation) {
$strLocationArray[] = stripslashes($objLocation->ShortDescription);
}
$txtDefaultValue = trim($this->txtMapDefaultValueArray[$this->intLocationKey]->Text);
// Add default value in database if it is not exist
if ($txtDefaultValue && !$this->in_array_nocase($txtDefaultValue, $strLocationArray)) {
$strLocationArray[] = $txtDefaultValue;
$objNewLocation = new Location();
$objNewLocation->ShortDescription = addslashes($txtDefaultValue);
$objNewLocation->EnabledFlag = 1;
$objNewLocation->Save();
$this->objNewLocationArray[$objNewLocation->LocationId] = $objNewLocation->ShortDescription;
}
$this->objNewLocationArray = array();
$this->objNewCategoryArray = array();
$this->objNewManufacturerArray = array();
$this->objNewAssetModelArray = array();
$this->strModelValuesArray = array();
$this->blnImportEnd = false;
$j = 1;
$strLocationValuesArray = array();
// Add all unique locations in database
foreach ($this->strFilePathArray as $strFilePath) {
$this->FileCsvData->load($strFilePath);
if ($j != 1) {
//$this->FileCsvData->appendRow($this->FileCsvData->getHeaders());
}
// Location Import
for ($i = 0; $i < $this->FileCsvData->countRows(); $i++) {
$strRowArray = $this->FileCsvData->getRow($i);
if (trim($strRowArray[$this->intLocationKey]) && !$this->in_array_nocase(trim($strRowArray[$this->intLocationKey]), $strLocationArray)) {
$strLocationArray[] = trim($strRowArray[$this->intLocationKey]);
/*$objNewLocation = new Location();
$objNewLocation->ShortDescription = addslashes(trim($strRowArray[$this->intLocationKey]));
$objNewLocation->Save();*/
$strLocationValuesArray[] = sprintf("('%s', '%s', NOW())", addslashes(trim($strRowArray[$this->intLocationKey])), $_SESSION['intUserAccountId']);
$strNewLocation[] = addslashes(trim($strRowArray[$this->intLocationKey]));
//$this->objNewLocationArray[$objNewLocation->LocationId] = $objNewLocation->ShortDescription;
}
}
$j++;
}
if (count($strLocationValuesArray)) {
示例3: btnQuickAdd_Click
protected function btnQuickAdd_Click($strFormId, $strControlId, $strParameter)
{
$blnError = false;
$this->btnQuickAdd->Warning = '';
if (strlen(trim($this->txtQuickAdd->Text)) == 0) {
$blnError = true;
$this->btnQuickAdd->Warning = 'You must enter a Manufacturer name';
}
// Check for dupes
$objManufacturerDuplicate = Manufacturer::QuerySingle(QQ::Equal(QQN::Manufacturer()->ShortDescription, $this->txtQuickAdd->Text));
if ($objManufacturerDuplicate) {
$blnError = true;
$this->btnQuickAdd->Warning = 'This Manufacturer Name is already in use. Please try another.';
}
if (!$blnError) {
$objManufacturer = new Manufacturer();
$objManufacturer->ShortDescription = $this->txtQuickAdd->Text;
$objManufacturer->CreatedBy = QApplication::$objUserAccount->UserAccountId;
$objManufacturer->CreationDate = QDateTime::Now();
$objManufacturer->Save();
$this->dtgManufacturer->Refresh();
$this->txtQuickAdd->Text = '';
}
$this->txtQuickAdd->Focus();
$this->txtQuickAdd->Select();
}