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


PHP category::save方法代码示例

本文整理汇总了PHP中category::save方法的典型用法代码示例。如果您正苦于以下问题:PHP category::save方法的具体用法?PHP category::save怎么用?PHP category::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在category的用法示例。


在下文中一共展示了category::save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $cat = new category();
     $cat->category = \Input::get('categoryname');
     $cat->save();
     return \Redirect::route('catesite')->with('alert', 'Category created successfully!');
 }
开发者ID:devasanibharath,项目名称:Laravel-Complete-blog,代码行数:12,代码来源:CategoryController.php

示例2: category

$error_level = 0;
switch ($_POST['action']) {
    case 'save_data':
        // When action==save_data: verify entered data and save if OK / set errorlevel when NOK
        //
        // Check for data format and required fields
        // change action when not everything is filled-in
        if ($_POST['categories_name'] == '') {
            $_POST['action'] = 'enter_data';
            $error_level = 1;
            // No categories_name
        } else {
            // OK, entry can be saved
            $administration_category = new category($_POST['categories_id']);
            $administration_category->fill($_POST['categories_name']);
            $administration_category->save();
            // Clear all values except mPath
            foreach ($_POST as $key => $value) {
                if ($key != 'mPath') {
                    unset($_POST[$key]);
                }
            }
        }
        break;
    case 'delete_entry':
        // Check for dependencies
        $administration_category = new category($_POST['categories_id']);
        if ($administration_category->has_dependencies()) {
            $error_level = 2;
            // Related role(s) exist
            $_POST['action'] = '';
开发者ID:BackupTheBerlios,项目名称:bitts-svn,代码行数:31,代码来源:administration_categories.php

示例3: category

  function write_file_category($file, $data, $param) {
    $file=explode(":", $file);
    $cat=new category($file[0]);

    $cat_lang=$cat->tags->get("lang");
    if(!$cat_lang)
      $cat_lang="en";
    $suffix="";
    if($cat_lang!=$this->lang)
      $suffix=":{$this->lang}";

    foreach($data as $path=>$str) {
      $str=implode(";", $str);
      $path=explode(":", $path);

      if(sizeof($path)==2) {
	$cat->tags->set("{$path[1]}{$suffix}", $str);
      }
      elseif(sizeof($path)==3) {
	if($cat->rules[$path[1]])
	  $cat->rules[$path[1]]->tags->set("{$path[2]}{$suffix}", $str);
      }
    }

    $cat->save($param);
  }
开发者ID:plepe,项目名称:OpenStreetBrowser,代码行数:26,代码来源:code.php

示例4: setEntryOnCategory

 private function setEntryOnCategory(category $category, $entry = null)
 {
     $category->incrementEntriesCount($this->getEntryId());
     $category->incrementDirectEntriesCount($this->getEntryId());
     //if was pending - decrease pending entries count!
     if ($this->getColumnsOldValue(categoryEntryPeer::STATUS) == CategoryEntryStatus::PENDING) {
         $category->decrementPendingEntriesCount();
     }
     $category->save();
     //only categories with no context are saved on entry - this is only for Backward compatible
     if ($entry && !categoryEntryPeer::getSkipSave() && (trim($category->getPrivacyContexts()) == '' || $category->getPrivacyContexts() == null)) {
         $categories = array();
         if (trim($entry->getCategories()) != '') {
             $categories = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getCategories());
         }
         $categories[] = $category->getFullName();
         $categoriesIds = array();
         if (trim($entry->getCategoriesIds()) != '') {
             $categoriesIds = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getCategoriesIds());
         }
         $categoriesIds[] = $category->getId();
         $entry->parentSetCategories(implode(entry::ENTRY_CATEGORY_SEPARATOR, $categories));
         $entry->parentSetCategoriesIds(implode(entry::ENTRY_CATEGORY_SEPARATOR, $categoriesIds));
         $entry->justSave();
     }
     return $entry;
 }
开发者ID:panigh,项目名称:server,代码行数:27,代码来源:categoryEntry.php

示例5: createByPartnerAndFullName

 /**
  * Initialize new category using patnerId and fullName, this will also create the needed categories for the fullName
  *
  * @param $partnerId
  * @param $fullName
  * @return category
  */
 public static function createByPartnerAndFullName($partnerId, $fullName)
 {
     $fullNameArray = explode(categoryPeer::CATEGORY_SEPARATOR, $fullName);
     $fullNameTemp = "";
     $parentId = 0;
     foreach ($fullNameArray as $name) {
         if ($fullNameTemp === "") {
             $fullNameTemp .= $name;
         } else {
             $fullNameTemp .= categoryPeer::CATEGORY_SEPARATOR . $name;
         }
         $category = categoryPeer::getByFullNameExactMatch($fullNameTemp);
         if (!$category) {
             $category = new category();
             $category->setPartnerId($partnerId);
             $category->setParentId($parentId);
             $category->setName($name);
             $category->save();
         }
         $parentId = $category->getId();
     }
     return $category;
 }
开发者ID:dozernz,项目名称:server,代码行数:30,代码来源:category.php

示例6: doSave

 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->acategory !== null) {
             if ($this->acategory->isModified() || $this->acategory->isNew()) {
                 $affectedRows += $this->acategory->save($con);
             }
             $this->setcategory($this->acategory);
         }
         if ($this->akuser !== null) {
             if ($this->akuser->isModified() || $this->akuser->isNew()) {
                 $affectedRows += $this->akuser->save($con);
             }
             $this->setkuser($this->akuser);
         }
         if ($this->isNew()) {
             $this->modifiedColumns[] = categoryKuserPeer::ID;
         }
         // If this object has been modified, then save it to the database.
         $this->objectSaved = false;
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = categoryKuserPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setId($pk);
                 //[IMV] update autoincrement primary key
                 $this->setNew(false);
                 $this->objectSaved = true;
             } else {
                 $affectedObjects = categoryKuserPeer::doUpdate($this, $con);
                 if ($affectedObjects) {
                     $this->objectSaved = true;
                 }
                 $affectedRows += $affectedObjects;
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:DBezemer,项目名称:server,代码行数:63,代码来源:BasecategoryKuser.php

示例7: setEntryOnCategory

 private function setEntryOnCategory(category $category, $entry = null)
 {
     if (is_null($this->entryCategoriesAddedIds)) {
         $categoriesEntries = categoryEntryPeer::retrieveActiveByEntryId($this->getEntryId());
         $categoriesIds = array();
         foreach ($categoriesEntries as $categroyEntry) {
             //cannot get directly the full ids - since it might not be updated.
             if ($categroyEntry->getCategoryId() != $this->getCategoryId()) {
                 $categoriesIds[] = $categroyEntry->getCategoryId();
             }
         }
         $categoriesAdded = categoryPeer::retrieveByPKs($categoriesIds);
         $entryCategoriesAddedIds = array();
         foreach ($categoriesAdded as $categoryAdded) {
             $fullIds = explode(categoryPeer::CATEGORY_SEPARATOR, $categoryAdded->getFullIds());
             $entryCategoriesAddedIds = array_merge($entryCategoriesAddedIds, $fullIds);
         }
         $this->entryCategoriesAddedIds = $entryCategoriesAddedIds;
     }
     $category->incrementEntriesCount(1, $this->entryCategoriesAddedIds);
     $category->incrementDirectEntriesCount();
     //if was pending - decrease pending entries count!
     if ($this->getColumnsOldValue(categoryEntryPeer::STATUS) == CategoryEntryStatus::PENDING) {
         $category->decrementPendingEntriesCount();
     }
     $category->save();
     //only categories with no context are saved on entry - this is only for Backward compatible
     if ($entry && !categoryEntryPeer::getSkipSave() && (trim($category->getPrivacyContexts()) == '' || $category->getPrivacyContexts() == null)) {
         $categories = array();
         if (trim($entry->getCategories()) != '') {
             $categories = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getCategories());
         }
         $categories[] = $category->getFullName();
         $categoriesIds = array();
         if (trim($entry->getCategoriesIds()) != '') {
             $categoriesIds = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getCategoriesIds());
         }
         $categoriesIds[] = $category->getId();
         $entry->parentSetCategories(implode(entry::ENTRY_CATEGORY_SEPARATOR, $categories));
         $entry->parentSetCategoriesIds(implode(entry::ENTRY_CATEGORY_SEPARATOR, $categoriesIds));
         $entry->justSave();
     }
     return $entry;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:44,代码来源:categoryEntry.php


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