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


PHP Category::getName方法代码示例

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


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

示例1: array

 /**
  * Delete category
  *
  * @param void
  * @return null
  */
 function delete_category()
 {
     if ($this->active_category->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if ($this->request->isSubmitted()) {
         $delete = $this->active_category->delete();
         if ($delete && !is_error($delete)) {
             if ($this->request->getFormat() == FORMAT_HTML) {
                 flash_success('Category :category_name has been deleted', array('category_name' => $this->active_category->getName()));
                 $this->redirectToUrl($this->smarty->get_template_vars('categories_url'));
             } else {
                 $this->serveData($this->active_category, 'category');
             }
             // if
         } else {
             if ($this->request->getFormat() == FORMAT_HTML) {
                 flash_error('Failed to delete :category_name', array('category_name' => $this->active_category->getName()));
                 $this->redirectToUrl($this->smarty->get_template_vars('categories_url'));
             } else {
                 $this->serveData($delete);
             }
             // if
         }
         // if
     } else {
         $this->httpError(HTTP_ERR_BAD_REQUEST);
     }
     // if
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:37,代码来源:ProjectController.class.php

示例2: Category

 function test_getName()
 {
     $name = "Work stuff";
     $test_Category = new Category($name);
     $result = $test_Category->getName();
     $this->assertEquals($name, $result);
 }
开发者ID:bdspen,项目名称:todo_database,代码行数:7,代码来源:CategoryTest.php

示例3: index

 public function index()
 {
     $type = Param::get('type', self::TYPE_THREAD);
     $query = trim_collapse(Param::get('query'));
     $page = Param::get('page', 1);
     $pagination = new SimplePagination($page, self::RESULTS_PERPAGE);
     if (!$query) {
         redirect(APP_URL);
     }
     $results = new stdClass();
     switch ($type) {
         case self::TYPE_THREAD:
             $results = Thread::search($query, $pagination->start_index - 1, $pagination->count + 1);
             // Get other info for each thread
             foreach ($results->result as $thread) {
                 $thread->creator = User::getByID($thread->user_id);
                 $thread->category = Category::getName($thread->category_id);
                 $thread->replies_count = Comment::countAll($thread->id);
             }
             break;
         case self::TYPE_COMMENT:
             $results = Comment::search($query, $pagination->start_index - 1, $pagination->count + 1);
             break;
         case self::TYPE_USER:
             $results = User::search($query, $pagination->start_index - 1, $pagination->count + 1);
             break;
         default:
             throw new PageNotFoundException();
             break;
     }
     $pagination->checkLastPage($results->result);
     $pages = ceil($results->total_result / self::RESULTS_PERPAGE);
     $title = "Search: '{$query}'";
     $this->set(get_defined_vars());
 }
开发者ID:rdaitan,项目名称:dc-board,代码行数:35,代码来源:search_controller.php

示例4: getAllCategoriesFromDatabase

 public static function getAllCategoriesFromDatabase($dbConn)
 {
     $categoryIds = readFromDatabase::readEntireColumnFromTable($dbConn, array(self::ID_COLUMN_NAME), self::TABLE_NAME);
     $categories = array();
     foreach ($categoryIds as $categoryId) {
         $category = new Category($dbConn, $categoryId[self::ID_COLUMN_NAME]);
         $categories[$category->getId()] = $category->getName();
     }
     return $categories;
 }
开发者ID:radioCKUT,项目名称:digital-logsheets,代码行数:10,代码来源:manageCategoryEntries.php

示例5: modify

 protected function modify(Category $category)
 {
     $q = $this->dao->prepare('UPDATE ' . $this->table() . ' SET NAME = :name, DESCRIPTION = :description, PARENT_CATEGORY_ID = :parentCategoryId, IS_ROOT = :isRoot WHERE ID = :id');
     $q->bindValue(':name', $category->getName());
     $q->bindValue(':description', $category->getDescription());
     $q->bindValue(':parentCategoryId', $category->getParentCategoryId());
     $q->bindValue(':isRoot', $category->getIsRoot());
     $q->bindValue(':id', $category->id(), PDO::PARAM_INT);
     $q->execute();
 }
开发者ID:Tipkin-Commons,项目名称:tipkin,代码行数:10,代码来源:CategoriesManager_PDO.class.php

示例6: Category

 function action_category()
 {
     if (isset($_GET['id']) && $_GET['id'] > 0) {
         $id = DB::esc(intval($_GET['id']));
         $category = new Category($id, $this->model);
         $this->view->setData(array("category" => $category));
         $this->view->setTitle($category->getName());
         $this->view->display('category_view.php');
     } else {
         $this->action_404();
     }
 }
开发者ID:tochytskyi,项目名称:adboard,代码行数:12,代码来源:controller_board.php

示例7: edit

 public function edit(User $currentUser, Category $category)
 {
     $id = intval($category->getId());
     $name = $this->database->quote($category->getName());
     $description = $this->database->quote($category->getDescription());
     $query = "UPDATE category SET name = '" . $name . "', description = '" . $description . "' WHERE id = " . $id;
     $result = $this->database->exec($query);
     if ($result) {
         return true;
     } else {
         throw new Exception("Catastrophe base de données.");
     }
 }
开发者ID:CreepingPanda,项目名称:FennecPlusUltra,代码行数:13,代码来源:CategoryManager.class.php

示例8: testUpdate

 function testUpdate()
 {
     //Arrange
     $name = "Work stuff";
     $id = 1;
     $test_category = new Category($name, $id);
     $test_category->save();
     $new_name = "Home stuff";
     //Act
     $test_category->update($new_name);
     //Assert
     $this->assertEquals("Home stuff", $test_category->getName());
 }
开发者ID:jtorrespdx,项目名称:to_do,代码行数:13,代码来源:CategoryTest.php

示例9: getItemsCollection

 /**
  * @param Category $category
  * @return WikiaMobileCategoryViewer
  */
 public function getItemsCollection(Category $category)
 {
     $this->wf->profileIn(__METHOD__);
     $cacheKey = $this->getItemsCollectionCacheKey($category->getName());
     $contents = $this->wg->memc->get($cacheKey);
     if (empty($contents)) {
         /**
          * @var $wikiaMobileCategoryViewer WikiaMobileCategoryViewer
          */
         $wikiaMobileCategoryViewer = F::build('WikiaMobileCategoryViewer', array($category));
         $contents = $wikiaMobileCategoryViewer->getContents();
         $this->wg->memc->set($cacheKey, $contents, self::CACHE_TTL_ITEMSCOLLECTION);
     }
     $this->wf->profileOut(__METHOD__);
     return $contents;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:20,代码来源:WikiaMobileCategoryModel.class.php

示例10: getCategoryArray

 protected function getCategoryArray($id_product)
 {
     /*
     $controlFraude = new TPProductoControlFraude($id_product);
             return $controlFraude->codigo_producto;
     */
     $controlFraude = new Product($id_product);
     $categories = $controlFraude->getDefaultCategory();
     $category_id = $categories[0];
     $category = new Category($category_id);
     $name = $category->getName();
     if (empty($name)) {
         return "default";
     }
     return $name;
 }
开发者ID:xchwarze,项目名称:Plugin-PrestaShop,代码行数:16,代码来源:ControlFraudeRetail.php

示例11: create

 public function create($name, $description, $img)
 {
     $category = new Category($this->db);
     $errors = array();
     try {
         $category->setName($name);
     } catch (Exception $e) {
         $errors[] = $e->getMessage();
     }
     try {
         $category->setDescription($description);
     } catch (Exception $e) {
         $errors[] = $e->getMessage();
     }
     try {
         $category->setImg($img);
     } catch (Exception $e) {
         $errors[] = $e->getMessage();
     }
     if (count($errors) == 0) {
         $name = $this->db->quote($category->getName());
         $description = $this->db->quote($category->getDescription());
         $img = $this->db->quote($category->getImg());
         $query = "INSERT INTO category (name, description, img) VALUES(" . $name . "," . $description . "," . $img . ")";
         $res = $this->db->exec($query);
         if ($res) {
             $id = $this->db->lastInsertId();
             if ($id) {
                 return $this->findById($id);
             } else {
                 $errors[] = "Category not found";
                 return $errors;
             }
         } else {
             $errors[] = "Internal server error";
             return $errors;
         }
     } else {
         return $errors;
     }
 }
开发者ID:berserkr1,项目名称:e-commerce,代码行数:41,代码来源:CategoryManager.class.php

示例12: findAllCategories

 static function findAllCategories()
 {
     $default_category = new Category('default');
     $categories = array();
     foreach (Project::findAllProjects() as $project) {
         if ($name = $project->getCategory()) {
             if (!isset($categories[$name])) {
                 $category = new Category($name);
                 $categories[$name] = $category;
             } else {
                 $category = $categories[$name];
             }
         } else {
             $categories[$default_category->getName()] = $default_category;
             $category = $default_category;
         }
         $category->addProject($project);
     }
     ksort($categories);
     return array_values($categories);
 }
开发者ID:r-kitaev,项目名称:limb-app-syncman,代码行数:21,代码来源:Category.class.php

示例13: index

 public function index()
 {
     $page = Param::get('page', 1);
     $filter = Param::get('filter');
     // pagination
     $pagination = new SimplePagination($page, self::THREADS_PERPAGE);
     $threads = Thread::getAll($pagination->start_index - 1, $pagination->count + 1, $filter);
     $pagination->checkLastPage($threads);
     $total = Thread::countAll($filter);
     $pages = ceil($total / self::THREADS_PERPAGE);
     // Get other info for each thread
     foreach ($threads as $thread) {
         $thread->creator = User::getByID($thread->user_id);
         $thread->category = Category::getName($thread->category_id);
         $thread->replies_count = Comment::countAll($thread->id);
     }
     // get other variables needed by the view
     $title = 'All Threads';
     $auth_user = User::getAuthenticated();
     $categories = Category::getAll();
     $trending = Thread::getTrending(self::TRENDING_LIMIT);
     $this->set(get_defined_vars());
 }
开发者ID:rdaitan,项目名称:dc-board,代码行数:23,代码来源:thread_controller.php

示例14: itemExportCategories

 protected function itemExportCategories($row, $product)
 {
     // Url in 1.5.2.0 wrong (thickbox_default)
     //Categories
     $category = new Category($product->id_category_default);
     $row['categories'] = $category->getName($this->id_lang);
     return $row;
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:8,代码来源:PSShopgatePlugin.php

示例15: select

$t->is(count($category), 0, 'findOne() called after select(array) returns an empty array if no record is found');

$category1 = new Category();
$category1->setName('cat1');
$category1->save();
$category2 = new Category();
$category2->setName('cat2');
$category2->save();

$finder = sfPropelFinder::from('Category')->
  select(array('Id','Name'), sfModelFinder::ASSOCIATIVE);
$category = $finder->findOne();
$t->isa_ok($category, 'array', 'The row returned by findOne() called after select(array) is an array');
$t->is_deeply(array_keys($category), array('Id', 'Name'), 'The row returned by findOne() called after select(array, sfModelFinder::ASSOCIATIVE) is an associative array where the keys are the requested column names');
$t->is($category['Id'], $category1->getId(), 'The row returned by findOne() called after select(array, sfModelFinder::ASSOCIATIVE) is an associative array where the values are the requested column values');
$t->is($category['Name'], $category1->getName(), 'The row returned by findOne() called after select(array, sfModelFinder::ASSOCIATIVE) is an associative array where the values are the requested column values');

$finder = sfPropelFinder::from('Category')->
  select(array('Id','Name'), sfModelFinder::SIMPLE);
$category = $finder->findOne();
$t->is_deeply(array_keys($category), array(0, 1), 'The row returned by findOne() called after select(array, sfModelFinder::SIMPLE) is an array with numeric keys');
$t->is($category[0], $category1->getId(), 'The row returned by findOne() called after select(array, sfModelFinder::SIMPLE) is an array where the values are the requested column values');
$t->is($category[1], $category1->getName(), 'The row returned by findOne() called after select(array, sfModelFinder::SIMPLE) is an array where the values are the requested column values');

/*********************************************/
/* sfPropelFinder::select() and withColumn() */
/*********************************************/

$t->diag('sfPropelFinder::select() and withColumn()');

ArticlePeer::doDeleteAll();
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:31,代码来源:sfPropelFinderSelectTest.php


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