本文整理汇总了PHP中Category::Save方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::Save方法的具体用法?PHP Category::Save怎么用?PHP Category::Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category::Save方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Save
public function Save()
{
if (empty($this->category_class)) {
$this->class = 'folder';
}
parent::Save();
}
示例2: cate
function cate()
{
for ($i = 0; $i < 1000; $i++) {
$cate = new Category();
$cate->Name = getRandStr(mt_rand(2, 4));
$cate->Save();
}
}
示例3: 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)) {
示例4: parseCategoryString
/**
*
* @param $categname
* @param int $parentid
* @param int $intPosition
* @return bool|Category|int
*/
protected function parseCategoryString($categname, $parentid = 0, $intPosition = 0)
{
$categname = trim($categname);
if (empty($categname)) {
return $parentid;
}
$categs = Category::LoadArrayByName($categname);
$exist = false;
foreach ($categs as $categ) {
if ($categ->Parent == $parentid) {
$exist = $categ;
break;
}
}
if ($exist) {
return $exist;
}
$categ = new Category();
$categ->Name = $categname;
$categ->Parent = $parentid;
$categ->Created = new QDateTime(QDateTime::Now);
$categ->Position = $intPosition;
$categ->Save(true);
$categ->UpdateChildCount();
return $categ;
}
示例5: btnNext_Click
//.........这里部分代码省略.........
$this->btnImportMore->AddAction(new QEnterKeyEvent(), new QTerminateAction());
// Return to Assets button
$this->btnReturnTo = new QButton($this);
$this->btnReturnTo->Text = "Return to Categories";
$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_category_skipped.csv', __DOCROOT__ . __SUBDIRECTORY__ . __TRACMOR_TMP__, $_SESSION['intUserAccountId']), "a");
if (!$this->blnImportEnd) {
// Category
if ($this->intImportStep == 2) {
$strCategoryArray = array();
$this->objNewCategoryArray = array();
// Load all categories
foreach (Category::LoadAll() as $objCategory) {
$strCategoryArray[] = stripslashes($objCategory->ShortDescription);
}
// Add Default value
$txtDefaultValue = trim($this->txtMapDefaultValueArray[$this->intCategoryKey]->Text);
if ($txtDefaultValue && !$this->in_array_nocase($txtDefaultValue, $strCategoryArray)) {
$strCategoryArray[] = $txtDefaultValue;
$objNewCategory = new Category();
$objNewCategory->ShortDescription = addslashes($txtDefaultValue);
$objNewCategory->AssetFlag = true;
$objNewCategory->InventoryFlag = false;
$objNewCategory->Save();
$this->objNewCategoryArray[$objNewCategory->CategoryId] = $objNewCategory->ShortDescription;
}
$this->btnNext->Warning = "Categories 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());
}
// Category Import
if ($this->intImportStep == 2) {
$arrItemCustomField = array();
foreach ($this->arrTracmorField as $key => $value) {
if (substr($value, 0, 9) == 'category_') {
$intItemCustomFieldKeyArray[substr($value, 9)] = $key;
if (array_key_exists(substr($value, 9), $this->arrItemCustomField)) {
$arrItemCustomField[substr($value, 9)] = $this->arrItemCustomField[substr($value, 9)];
}
}
}
$strCategoryValuesArray = array();
$strUpdatedCategoryValuesArray = array();
$strItemCFVArray = array();
$strUpdatedItemCFVArray = array();
$strNewCategoryArray = array();
$intCategoryArray = array();
$this->arrOldItemArray = array();
$this->objUpdatedItemArray = array();
$objCategoryArray = array();
foreach (Category::LoadAllWithCustomFieldsHelper() as $objCategory) {
$objCategoryArray[strtolower($objCategory->ShortDescription)] = $objCategory;
}
示例6: InsertInfo
function InsertInfo()
{
global $zbp;
$zbp->guid = GetGuid();
$mem = new Member();
$guid = GetGuid();
$mem->Guid = $guid;
$mem->Level = 1;
$mem->Name = GetVars('username', 'POST');
$mem->Password = Member::GetPassWordByGuid(GetVars('password', 'POST'), $guid);
$mem->IP = GetGuestIP();
$mem->PostTime = time();
$mem->Save();
$cate = new Category();
$cate->Name = $zbp->lang['msg']['uncategory'];
$cate->Alias = 'uncategorized';
$cate->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['module_navbar'];
$t->FileName = "navbar";
$t->Source = "system";
$t->SidebarID = 0;
$t->Content = '<li id="nvabar-item-index"><a href="{#ZC_BLOG_HOST#}">' . $zbp->lang['zb_install']['index'] . '</a></li><li id="navbar-page-2"><a href="{#ZC_BLOG_HOST#}?id=2">' . $zbp->lang['zb_install']['guestbook'] . '</a></li>';
$t->HtmlID = "divNavBar";
$t->Type = "ul";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['calendar'];
$t->FileName = "calendar";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = "";
$t->HtmlID = "divCalendar";
$t->Type = "div";
$t->IsHideTitle = true;
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['control_panel'];
$t->FileName = "controlpanel";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = '<span class="cp-hello">' . $zbp->lang['zb_install']['wellcome'] . '</span><br/><span class="cp-login"><a href="{#ZC_BLOG_HOST#}zb_system/cmd.php?act=login">' . $zbp->lang['msg']['admin_login'] . '</a></span> <span class="cp-vrs"><a href="{#ZC_BLOG_HOST#}zb_system/cmd.php?act=misc&type=vrs">' . $zbp->lang['msg']['view_rights'] . '</a></span>';
$t->HtmlID = "divContorPanel";
$t->Type = "div";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['module_catalog'];
$t->FileName = "catalog";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = "";
$t->HtmlID = "divCatalog";
$t->Type = "ul";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['search'];
$t->FileName = "searchpanel";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = '<form name="search" method="post" action="{#ZC_BLOG_HOST#}zb_system/cmd.php?act=search"><input type="text" name="q" size="11" /> <input type="submit" value="' . $zbp->lang['msg']['search'] . '" /></form>';
$t->HtmlID = "divSearchPanel";
$t->Type = "div";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['module_comments'];
$t->FileName = "comments";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = "";
$t->HtmlID = "divComments";
$t->Type = "ul";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['module_archives'];
$t->FileName = "archives";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = "";
$t->HtmlID = "divArchives";
$t->Type = "ul";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['module_statistics'];
$t->FileName = "statistics";
$t->Source = "system";
$t->SidebarID = 0;
$t->Content = "";
$t->HtmlID = "divStatistics";
$t->Type = "ul";
$t->Save();
$t = new Module();
$t->Name = $zbp->lang['msg']['module_favorite'];
$t->FileName = "favorite";
$t->Source = "system";
$t->SidebarID = 1;
$t->Content = '<li><a href="http://bbs.zblogcn.com/" target="_blank">ZBlogger社区</a></li><li><a href="http://app.zblogcn.com/" target="_blank">Z-Blog应用中心</a></li><li><a href="http://weibo.com/zblogcn" target="_blank">Z-Blog新浪官微</a></li><li><a href="http://t.qq.com/zblogcn" target="_blank">Z-Blog腾讯官微</a></li>';
$t->HtmlID = "divFavorites";
$t->Type = "ul";
$t->Save();
$t = new Module();
//.........这里部分代码省略.........
示例7: Product
case 'delete_img':
$img_id = (int) $_REQUEST['img_id'];
Product::DeleteImage($img_id);
$view = 'editproduct';
break;
case 'saveproduct':
$P = new Product($_POST['id']);
if (!$P->Save($_POST)) {
$content .= PAYPAL_errMsg($P->PrintErrors());
$view = 'editproduct';
}
break;
case 'savecat':
USES_paypal_class_category();
$C = new Category($_POST['cat_id']);
if (!$C->Save($_POST)) {
$content .= PAYPAL_popupMsg($LANG_PP['invalid_form']);
$view = 'editcat';
} else {
$view = 'catlist';
}
break;
case 'saveopt':
USES_paypal_class_attribute();
$Attr = new Attribute($_POST['attr_id']);
if (!$Attr->Save($_POST)) {
$content .= PAYPAL_popupMsg($LANG_PP['invalid_form']);
}
if (isset($_POST['attr_id']) && !empty($_POST['attr_id'])) {
// Updating an existing option, return to the list
$view = 'attributes';
示例8: 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 Category name';
}
// Check for dupes
$objCategoryDuplicate = Category::QuerySingle(QQ::Equal(QQN::Category()->ShortDescription, $this->txtQuickAdd->Text));
if ($objCategoryDuplicate) {
$blnError = true;
$this->btnQuickAdd->Warning = 'This Category Name is already in use. Please try another.';
}
if (!$blnError) {
$objCategory = new Category();
$objCategory->ShortDescription = $this->txtQuickAdd->Text;
$objCategory->AssetFlag = '1';
$objCategory->InventoryFlag = '1';
$objCategory->CreatedBy = QApplication::$objUserAccount->UserAccountId;
$objCategory->CreationDate = QDateTime::Now();
$objCategory->Save();
$this->dtgCategory->Refresh();
$this->txtQuickAdd->Text = '';
}
$this->txtQuickAdd->Focus();
$this->txtQuickAdd->Select();
}
示例9: Category
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/../inc/application_top.php';
// Create the category class
$myCategory = new Category();
try {
// If they are saving the Information
if ($_POST['submit'] == 'save') {
// Get all the Form Data
$myCategory->SetValues($_POST);
$myCategory->SetValue('user_id', $myUser->GetPrimary());
// Save the Make
if ($myCategory->Save()) {
SetAlert('Category Successfully Saved.', 'success');
LogAction('Saved Category: ' . stripslashes($myCategory->GetValue('category')), 1);
header('location:' . PATH . 'categories');
die;
}
}
// If Deleting
if ($_POST['submit'] == 'delete') {
$myCategory->SetValues($_POST);
$name = stripslashes($myCategory->GetValue('category'));
// Remove from the DB
if (!$myCategory->Delete()) {
throw new SimplException('Error deleting from the database, please try again.');
}
// Everything went fine
SetAlert('Category Deleted Successfully', 'success');
LogAction('Deleted Category: ' . $name, 1);
header('location:' . PATH . 'categories');
示例10: array
$ret_val = array();
$user = new User($username, $password);
if ($user->IsValidUser) {
$ret_val['success'] = 1;
$ret_val['redirect'] = 'manageblog.php';
} else {
$ret_val['success'] = 0;
$ret_val['redirect'] = null;
}
echo json_encode($ret_val);
});
$app->get('/testserver/', function () {
$ret_val = array();
require_once 'category.php';
$category = new Category(4);
$category->Save();
$ret_val['success'] = 1;
echo json_encode($ret_val);
});
//TODO
$app->get('/getblogtypelist', function () {
require_once 'common/dbconnection.php';
$GLOBALS['mysqli'] = MySQLConnection::Open();
require_once 'posttype.php';
$retval = TypeFactory::GetTypes();
MySQLConnection::Close($GLOBALS['mysqli']);
echo json_encode($retval);
});
$app->get('/getcategorylist/', function () {
require_once 'common/dbconnection.php';
$GLOBALS['mysqli'] = MySQLConnection::Open();