当前位置: 首页>>代码示例>>PHP>>正文


PHP Category::Save方法代码示例

本文整理汇总了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();
 }
开发者ID:benvanstaveren,项目名称:movabletype,代码行数:7,代码来源:class.mt_folder.php

示例2: cate

function cate()
{
    for ($i = 0; $i < 1000; $i++) {
        $cate = new Category();
        $cate->Name = getRandStr(mt_rand(2, 4));
        $cate->Save();
    }
}
开发者ID:chonghua,项目名称:zblogphp,代码行数:8,代码来源:createdata.php

示例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)) {
开发者ID:proxymoron,项目名称:tracmor,代码行数:67,代码来源:asset_import.php

示例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;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:33,代码来源:LegacysoapController.php

示例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;
                     }
开发者ID:brustj,项目名称:tracmor,代码行数:67,代码来源:category_import.php

示例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>&nbsp;&nbsp;<span class="cp-vrs"><a href="{#ZC_BLOG_HOST#}zb_system/cmd.php?act=misc&amp;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();
//.........这里部分代码省略.........
开发者ID:ijustyce,项目名称:zblogphp,代码行数:101,代码来源:index.php

示例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';
开发者ID:NewRoute,项目名称:paypal,代码行数:31,代码来源:index.php

示例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();
 }
开发者ID:brustj,项目名称:tracmor,代码行数:28,代码来源:category_list.php

示例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');
开发者ID:nickdenardis,项目名称:formspring-extender,代码行数:31,代码来源:category-edit.php

示例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();
开发者ID:peterbarraud,项目名称:testadmin,代码行数:31,代码来源:pbrest.php


注:本文中的Category::Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。