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


PHP Category::getById方法代码示例

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


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

示例1: getParent

 /**
  * @return self|null
  */
 public function getParent()
 {
     if (!$this->parent && $this->parent_id) {
         $this->parent = Category::getById($this->parent_id);
     }
     return $this->parent;
 }
开发者ID:mrDumay,项目名称:demoshop,代码行数:10,代码来源:Category.php

示例2: getCategory

 /**
  * @return Category|null
  */
 public function getCategory()
 {
     if (!$this->category && $this->category_id) {
         $this->category = Category::getById($this->category_id);
     }
     return $this->category;
 }
开发者ID:mrDumay,项目名称:demoshop,代码行数:10,代码来源:Product.php

示例3: isCategoryInUseById

 public static function isCategoryInUseById($categoryId)
 {
     $categories = Category::getById($categoryId);
     $rows = ZurmoRedBean::getAll('SELECT * FROM customfieldvalue WHERE multiplevaluescustomfield_id IN (SELECT category_multiplevaluescustomfield_id FROM costbook) AND VALUE="' . $categories->name . '"');
     if (count($rows) > 0) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:RamaKavanan,项目名称:BaseVersion,代码行数:10,代码来源:Category.php

示例4: actionEdit

 public function actionEdit($id)
 {
     //get boject by id
     $category = Category::getById(intval($id));
     //Security check
     ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($category);
     //create view and render
     $editAndDetailsView = $this->makeEditAndDetailsView($this->attemptToSaveModelFromPost($category), 'Edit');
     $view = new CategoriesPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $editAndDetailsView));
     echo $view->render();
 }
开发者ID:RamaKavanan,项目名称:BaseVersion,代码行数:11,代码来源:DefaultController.php

示例5: viewArticle

function viewArticle()
{
    if (!isset($_GET["articleId"]) || !$_GET["articleId"]) {
        homepage();
        return;
    }
    $results = array();
    $results['article'] = Article::getById((int) $_GET["articleId"]);
    $results['category'] = Category::getById($results['article']->categoryId);
    $results['pageTitle'] = $results['article']->title . " | SystemBolaget";
    require TEMPLATE_PATH . "/viewArticle.php";
}
开发者ID:sabrinamiao,项目名称:Systembolaget,代码行数:12,代码来源:index.php

示例6: writeNZBforReleaseId

 function writeNZBforReleaseId($relid, $relguid, $name, $catId, $path, $echooutput = false)
 {
     $db = new DB();
     $binaries = array();
     $cat = new Category();
     $catrow = $cat->getById($catId);
     $site = new Sites();
     $fp = gzopen($path, "w");
     if ($fp) {
         gzwrite($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
         gzwrite($fp, "<!DOCTYPE nzb PUBLIC \"-//newzBin//DTD NZB 1.1//EN\" \"http://www.newzbin.com/DTD/nzb/nzb-1.1.dtd\">\n");
         gzwrite($fp, "<nzb xmlns=\"http://www.newzbin.com/DTD/2003/nzb\">\n\n");
         gzwrite($fp, "<head>\n");
         if ($catrow) {
             gzwrite($fp, " <meta type=\"category\">" . htmlspecialchars($catrow["title"], ENT_QUOTES, 'utf-8') . "</meta>\n");
         }
         if ($name != "") {
             gzwrite($fp, " <meta type=\"name\">" . htmlspecialchars($name, ENT_QUOTES, 'utf-8') . "</meta>\n");
         }
         gzwrite($fp, "</head>\n\n");
         $result = $db->queryDirect(sprintf("SELECT binaries.*, UNIX_TIMESTAMP(date) AS unixdate, groups.name as groupname FROM binaries inner join groups on binaries.groupID = groups.ID WHERE binaries.releaseID = %d ORDER BY binaries.name", $relid));
         while ($binrow = mysql_fetch_assoc($result)) {
             $groups = array();
             $groupsRaw = explode(' ', $binrow['xref']);
             foreach ($groupsRaw as $grp) {
                 if (preg_match('/^([a-z0-9\\.\\-_]+):(\\d+)?$/i', $grp, $match) && strtolower($grp) !== 'xref') {
                     $groups[] = $match[1];
                 }
             }
             if (count($groups) == 0) {
                 $groups[] = $binrow["groupname"];
             }
             gzwrite($fp, "<file poster=\"" . htmlspecialchars($binrow["fromname"], ENT_QUOTES, 'utf-8') . "\" date=\"" . $binrow["unixdate"] . "\" subject=\"" . htmlspecialchars($binrow["name"], ENT_QUOTES, 'utf-8') . " (1/" . $binrow["totalParts"] . ")\">\n");
             gzwrite($fp, " <groups>\n");
             foreach ($groups as $group) {
                 gzwrite($fp, "  <group>" . $group . "</group>\n");
             }
             gzwrite($fp, " </groups>\n");
             gzwrite($fp, " <segments>\n");
             $resparts = $db->queryDirect(sprintf("SELECT DISTINCT(messageID), size, partnumber FROM parts WHERE binaryID = %d ORDER BY partnumber", $binrow["ID"]));
             while ($partsrow = mysql_fetch_assoc($resparts)) {
                 gzwrite($fp, "  <segment bytes=\"" . $partsrow["size"] . "\" number=\"" . $partsrow["partnumber"] . "\">" . htmlspecialchars($partsrow["messageID"], ENT_QUOTES, 'utf-8') . "</segment>\n");
             }
             gzwrite($fp, " </segments>\n</file>\n");
         }
         gzwrite($fp, "<!-- generated by newznab " . $site->version() . " -->\n</nzb>");
         gzclose($fp);
     }
 }
开发者ID:nubzzz,项目名称:newznab,代码行数:49,代码来源:nzb.php

示例7: isset

}
$genre = isset($_REQUEST['genre']) && array_key_exists($_REQUEST['genre'], $tmpgnr) ? $_REQUEST['genre'] : '';
$page->smarty->assign('genres', $genres);
$page->smarty->assign('genre', $genre);
$browseby_link = '&amp;title=' . $title . '&amp;platform=' . $platform;
$page->smarty->assign('pagertotalitems', $browsecount);
$page->smarty->assign('pageroffset', $offset);
$page->smarty->assign('pageritemsperpage', ITEMS_PER_COVER_PAGE);
$page->smarty->assign('pagerquerybase', WWW_TOP . "/console?t=" . $category . $browseby_link . "&amp;ob=" . $orderby . "&amp;offset=");
$page->smarty->assign('pagerquerysuffix', "#results");
$pager = $page->smarty->fetch("pager.tpl");
$page->smarty->assign('pager', $pager);
if ($category == -1) {
    $page->smarty->assign("catname", "All");
} else {
    $cdata = $cat->getById($category);
    if ($cdata) {
        $page->smarty->assign('catname', $cdata["title"]);
    } else {
        $page->show404();
    }
}
foreach ($ordering as $ordertype) {
    $page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/console?t=" . $category . $browseby_link . "&amp;ob=" . $ordertype . "&amp;offset=0");
}
$page->smarty->assign('results', $consoles);
$page->meta_title = "Browse Console";
$page->meta_keywords = "browse,nzb,console,games,description,details";
$page->meta_description = "Browse for Games";
$page->content = $page->smarty->fetch('console.tpl');
$page->render();
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:31,代码来源:console.php

示例8: require_once

<? require_once("classes/Recipe.php"); ?>
<? require_once("classes/Category.php"); ?>
<? require_once("classes/Text.php"); ?>
<?
    $c = NULL;
    $cat = $_REQUEST['cat'];
    if (strlen($cat) == 0) {
        //$all = Recipe::getAll();
        $all = Recipe::getInCategory(NULL);
    } else {
        if ($cat == "null") {
            $all = Recipe::getInCategory(NULL);
        } else {
            $c = Category::getById($cat);
            $all = Recipe::getInCategory($c);
        }
    }

    include("header.php");
    if ($cat == "") {
        // Include only on the very front page
        include("welcome.php");
    }
    include("recipeNav.php");
    $rssUrl = $baseUrl."/rss.php?cat=".(strlen($cat) == 0 ? "null" : $cat);
?>

<? if ($c != NULL) { ?>
<h2><?php 
echo $c->getName();
?>
开发者ID:elecnix,项目名称:smellyfish,代码行数:31,代码来源:list.php

示例9: searchSimilar

 /**
  * Return a list of releases with a similar name to that provided.
  */
 public function searchSimilar($currentid, $name, $limit = 6, $excludedcats = array())
 {
     $name = $this->getSimilarName($name);
     $results = $this->search($name, array(-1), 0, $limit, '', -1, $excludedcats);
     if (!$results) {
         return $results;
     }
     //
     // Get the category for the parent of this release
     //
     $currRow = $this->getById($currentid);
     $cat = new Category();
     $catrow = $cat->getById($currRow["categoryID"]);
     $parentCat = $catrow["parentID"];
     $ret = array();
     foreach ($results as $res) {
         if ($res["ID"] != $currentid && $res["categoryParentID"] == $parentCat) {
             $ret[] = $res;
         }
     }
     return $ret;
 }
开发者ID:scriptzteam,项目名称:newzNZB-premium-indexer,代码行数:25,代码来源:releases.php

示例10: build

 function build($line) {
 
     $r = new Recipe();
     
     $r->id = $line['id'];
     $r->setTitle($line['title']);
     $r->setOrigin($line['origin']);
     $r->setSize($line['size']);
     $r->setIngredients($line['ingredients']);
     $r->setSteps($line['steps']);
     $r->dateAdded = $line['date_added_ts'];
     $r->hasPhoto = $line['has_photo'];
     $r->rating = $line['rating'];
     $r->authorId = $line['author_user_id'];
     
     $catId = $line['category_id'];
     if (strlen($catId) > 0) {
         $cat = Category::getById($catId);
         $r->setCategory($cat);
     }
     
     return $r;
 }
开发者ID:elecnix,项目名称:smellyfish,代码行数:23,代码来源:Recipe.php

示例11: include

<?
    $title = Text::getText("CategoryDeletion");
    $thisCat = Category::getById($_REQUEST['id']);
    $newCat = Category::getById($_REQUEST['newCat']);
    $action = $_REQUEST['action'];
    if ($thisCat == NULL) {
        $errMsg = Text::getText("CategoryNotFound");
        include("error.php");
        exit;
    } else {
        if ($action == "delete") {
            if (strlen($newCat) > 0) {
                if ($newCat == NULL || $newCat == "null") {
                    $newCategory = NULL;
                } else {
                    $newCategory = Category::getById($newCat);
                    if ($newCategory == NULL) {
                        $errMsg = Text::getText("CategoryNotFound");
                        include("error.php");
                        exit;
                    }
                }
                $recipesToMove = Recipe::getInCategory($thisCat);
                for ($i = 0; $i < count($recipesToMove); $i++) {
                    $r2m = $recipesToMove[$i];
                    $r2m->setCategory($newCategory);
                    $r2m->save();
                }
            }
            $thisCat->delete();
            header("Location: categoryList.php");
开发者ID:elecnix,项目名称:smellyfish,代码行数:31,代码来源:categoryDelete.php

示例12: deleteCategory

function deleteCategory()
{
    if (!($category = Category::getById((int) $_GET['categoryId']))) {
        header("Location: admin.php?action=listCategories&error=categoryNotFound");
        return;
    }
    $articles = Article::getList(1000000, $category->id);
    if ($articles['totalRows'] > 0) {
        header("Location: admin.php?action=listCategories&error=categoryContainsArticles");
        return;
    }
    $category->delete();
    header("Location: admin.php?action=listCategories&status=categoryDeleted");
}
开发者ID:sabrinamiao,项目名称:projectSystembolaget,代码行数:14,代码来源:admin.php

示例13: getItems

 /**
  * [POST]
  * return categories for corresponding cafe
  */
 public function getItems()
 {
     $id = $this->f3->get('PARAMS.id');
     $result = array('success' => false, 'info' => '', 'total' => 0, 'records' => array());
     try {
         // Only process to database if cafe id is valid
         if ($id > 0) {
             $items = new Item($this->db);
             $items = $items->getAllByCafeId($id);
             // prepare category object to avoid creating too many objects during loop
             $category = new Category($this->db);
             // change result indicatior to true
             $result[success] = true;
             $result[status] = "success";
             // populate records
             foreach ($items as $item) {
                 $result['records'][] = array('recid' => $item->itemId, 'itemName' => $item->itemName, 'description' => $item->description, 'price' => $item->price, 'isActive' => $item->isActive == 1 ? true : false, 'isVegetarian' => $item->isVegetarian == 1 ? true : false, 'isPopular' => $item->isPopular == 1 ? true : false, 'isSpecial' => $item->isSpecial == 1 ? true : false, 'category' => array('id' => $item->categoryId, 'text' => $category->getById($item->categoryId)[0]->categoryName));
             }
         }
         $result[success] = true;
     } catch (Exception $e) {
     }
     // Echo result and return immediately
     header('Content-Type: application/json');
     echo json_encode($result, JSON_NUMERIC_CHECK);
     exit;
 }
开发者ID:bigopon,项目名称:fg,代码行数:31,代码来源:AdminController.php

示例14: getFeedItemsQuery

		function getFeedItemsQuery($searchType, $searchKeyword, $searchExtraValue,$viewDelete = false,$owner = 0) {	
			global $db, $database, $config;

			$sQuery = '';

			if (($searchType=='tag' || $searchType=='tag+group_category') && !Validator::is_empty($searchKeyword)) {		
				$tagIds = array();
				$tags = explode(',',$searchKeyword);

				if($tagResult = $db->queryAll('SELECT id FROM '.$database['prefix'].'Tags WHERE name IN ('.Func::implode_string(',',$tags).')')) {
					foreach($tagResult as $tagItem) array_push($tagIds, $tagItem['id']);
				}

				if (empty($tagIds)) {
					return array(null,0);
				} else {
					if($searchType == 'tag') {
						$sQuery = ' LEFT JOIN '.$database['prefix'].'TagRelations r ON (r.item = i.id AND (r.type = "feed")) WHERE r.tag IN ('.implode(',',$tagIds).')';
					} else if($searchType == 'tag+group_category') {
						$sQuery = ' LEFT JOIN '.$database['prefix'].'TagRelations r ON (r.item = i.id AND (r.type = "feed" || r.type = "group_category")) WHERE r.tag IN ('.implode(',',$tagIds).')';
					}
				}

			} else if ($searchType=='blogURL' && !Validator::is_empty($searchKeyword)){		
				$searchKeyword = UTF8::bring($searchKeyword);
				$searchFeedId = $searchExtraValue;
				if(empty($searchFeedId)) {
					$searchFeedId = Feed::blogURL2Id('http://'.str_replace('http://', '', $searchKeyword));
				} 
				if(!empty($searchFeedId)) {
					$sQuery = ' WHERE i.feed = '.$searchFeedId;
				} else {
					$sQuery = ' WHERE 1=0 ';
				}
				
			} else if ($searchType=='user' && !Validator::is_empty($searchKeyword)){		
				$searchKeyword = UTF8::bring($searchKeyword);
				$searchFeedId = $searchExtraValue;
				if(empty($searchFeedId)) {

					if(is_numeric($searchKeyword)) {
						$user = User::getById($searchKeyword);
					} else {
						$user = User::getByloginId($searchKeyword);
					}		
					
					$searchFeedId = Feed::getIdListByOwner($user['id']);
				} 
				if(!empty($searchFeedId)) {
					$sQuery = ' WHERE i.feed IN ('.implode(",",$searchFeedId).')';
				} else {
					$sQuery = ' WHERE 1=0 ';
				}
			} else if ($searchType=='author' && !Validator::is_empty($searchKeyword)){		
				$searchKeyword = UTF8::bring($searchKeyword);
				if(!empty($searchKeyword)) {
					$sQuery = ' WHERE i.author = "' . $searchKeyword . '"';
				} else {
					$sQuery = ' WHERE 1=0 ';
				}
			} else if ($searchType=='title+description' && !Validator::is_empty($searchKeyword)){		
					$searchKeyword = UTF8::bring($searchKeyword);
					$keyword = $db->escape($searchKeyword);

					$sQuery =  ' WHERE i.description LIKE "%'.$keyword.'%"';				
			}  else if ($searchType=='title' && !Validator::is_empty($searchKeyword)){		
					$searchKeyword = UTF8::bring($searchKeyword);
					$keyword = $db->escape($searchKeyword);

					$sQuery =  ' WHERE i.title LIKE "%'.$keyword.'%"';				
			} else if ($searchType=='description' && !Validator::is_empty($searchKeyword)){		
					$searchKeyword = UTF8::bring($searchKeyword);
					$keyword = $db->escape($searchKeyword);

					$sQuery =  ' WHERE i.description LIKE "%'.$keyword.'%"';				
			} else if ($searchType=='focus'){		
					$sQuery =  ' WHERE i.focus = "'.$searchKeyword.'"';		
			} else if ($searchType=='group') {
				requireComponent('Bloglounge.Data.Groups');	
				
				if(!empty($searchExtraValue)) {
					$tagId = $db->pick('SELECT id FROM '.$database['prefix'].'Tags WHERE name="'.$db->escape(urldecode($searchExtraValue)).'"');
					if($tagId) {
						$tagId = $tagId[0];
						$sQuery = ' LEFT JOIN '.$database['prefix'].'TagRelations r ON (r.item = i.id AND r.type = "group_category") ';
					}
				}

				if(!is_numeric($searchKeyword)) {
					$group = Group::getByName($searchKeyword);
					$searchKeyword = $group['id'];
				}
				
				if($searchKeyword) {	
					$feedIds = Group::getFeedIdList($searchKeyword);
					$sQuery .= ' WHERE i.feed IN (' . implode(',',$feedIds) .')';

					if($tagId) {
						$sQuery .= ' AND r.tag="'.$tagId.'"';
					}
//.........这里部分代码省略.........
开发者ID:ncloud,项目名称:bloglounge,代码行数:101,代码来源:Bloglounge.Data.FeedItems.php

示例15: foreach

    }
    echo "true";
} else {
    if (isset($_POST['catIds']) && $_POST['catIds'] != "" && isset($_POST['menuId']) && $_POST['menuId'] != "" && isset($_POST['isCategory']) && $_POST['isCategory'] == "true") {
        // add pages to the menu
        $menuId = $database->escapeString($_POST['menuId']);
        $appearName = $database->escapeString($_POST['appearName']);
        $links->setMenuId($menuId);
        $links->setIsCustomLink(0);
        $links->setHttp("");
        $links->setPageId(0);
        $startPos = $links->numByMenu($database) + 1;
        foreach ($_POST['catIds'] as $id) {
            if ($appearName == "") {
                $category->setCategoryId($database->escapeString($id));
                $category->getById($database);
                $links->setAppearName($category->getCategory());
            } else {
                $links->setAppearName($appearName);
            }
            $links->setCategoryId($database->escapeString($id));
            $links->setPosition($startPos);
            $links->create($database);
            $startPos++;
        }
        echo "true";
    } else {
        if (isset($_POST['menuId']) && $_POST['menuId'] != "" && isset($_POST['isCategory']) && $_POST['isCategory'] == "false" && isset($_POST['isCustomLink']) && $_POST['isCustomLink'] == "true") {
            // add pages to the menu
            $menuId = $database->escapeString($_POST['menuId']);
            $appearName = $database->escapeString($_POST['appearName']);
开发者ID:jetmirhaxhisefa,项目名称:rezervime,代码行数:31,代码来源:addToMenu.php


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