本文整理汇总了PHP中getCategories函数的典型用法代码示例。如果您正苦于以下问题:PHP getCategories函数的具体用法?PHP getCategories怎么用?PHP getCategories使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCategories函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCategories
function getCategories($u)
{
global $baseurl, $f;
$path = "";
$d = new simple_html_dom();
$d->load(scraperwiki::scrape($u));
echo "Loaded URL: " . $u . "\n";
if ($d->find('div[id=ctl00_cphContent_gsaCatFacetContainer]')) {
$breadcrumb = $d->find('div[id=breadcrumb]', 0);
//foreach($breadcrumb as $b) {
//echo "Breadcrumb = " . $b;}
if (!is_null($breadcrumb)) {
foreach ($breadcrumb->children() as $crumb) {
$path .= trim($crumb->innertext) . "/";
}
$path .= trim(strrchr($breadcrumb->innertext, ">"), "> ");
}
foreach ($d->find('div[id=ctl00_cphContent_gsaCatFacetContainer]', 0)->find('div[class=S2refinementsContainer]', 0)->children() as $div) {
$name = trim(strstr($div->children(0)->innertext, "(", true));
$url = $baseurl . $div->children(0)->href;
$data = array("Name" => $name, "Path" => $path, "URL" => $url);
echo $path . "/" . $name . "\n";
if ($local) {
fputcsv($f, array($name, $path, $url));
} else {
scraperwiki::save_sqlite(array("URL"), $data);
}
getCategories($url);
}
}
}
示例2: categoryHandler
function categoryHandler()
{
$arr = getCategories();
for ($ctr = 0; $ctr < count($arr); $ctr++) {
echo '<option>' . $arr[$ctr] . '</option>';
}
}
示例3: getCategories
function getCategories($parentId = null, &$items = array(), $showDisabled = true)
{
$groups = new \cf\ChildGroups($parentId, $showDisabled);
foreach ($groups as $g) {
$item = array('' => array('id' => $g->id(), 'code' => $g->code()));
getCategories($g->id(), $item, $showDisabled);
$items[$g->name()] = $item;
}
return $items;
}
示例4: createCategoryButtons
function createCategoryButtons()
{
$arrCat = getCategories();
$btn = "<div class='btn-group' role='group'>\n <button type='button' class='btn btn-default btnCat' id='All'>All</button>\n </div>";
$head = "<div class='btn-group' role='group'>";
$class = 'btn btn-default btnCat';
for ($ctr = 0; $ctr < count($arrCat); $ctr++) {
$btn = $btn . $head . "<button type='button' class='" . $class . "' id='" . $arrCat[$ctr] . "'>" . $arrCat[$ctr] . "</button></div>";
}
echo $btn;
}
示例5: getExpandedProfile
function getExpandedProfile(User $user, array $features, $include_empty = true)
{
//outline
//display basic biographical information
//get all MetaData categories applicable to this user.
//get the value sets for each type
//display substitute row in empty sets/hide category if specified
var_dump($features);
$types = getTypes_User($user);
$categories = getCategories($types);
$str = getBiographicalSketch($user, $features);
//if categories are not included in $features, assume they are to be included
return $str;
}
示例6: returnAllMenuInfo
public function returnAllMenuInfo($slug)
{
$results = \MenuItem::where('menu_item_slug', '=', $slug)->get(array('menu_item_description', 'menu_item_picture_uri', 'menu_item_name', 'menu_item_slug', 'menu_item_id', 'menu_item_category_fk', 'menu_item_short', 'menu_item_price'));
foreach ($results as $result) {
$menu_item_description = $result->menu_item_description;
$menu_item_name = $result->menu_item_name;
$menu_item_picture_uri = $result->menu_item_picture_uri;
$menu_item_id = $result->menu_item_id;
$slug = $result->menu_item_slug;
$menu_item_category_fk = $result->menu_item_category_fk;
$menu_item_short = $result->menu_item_short;
$menu_item_price = $result->menu_item_price;
}
function getCategories()
{
$category = array();
$categories = \MenuCategory::get();
foreach ($categories as $cat) {
$cat_name = $cat->menu_category_name;
$cat_id = $cat->menu_category_id;
$category[$cat_id] = $cat_name;
}
return $category;
}
function getDefault($menu_item_category_fk)
{
$results = \MenuCategory::where('menu_category_id', '=', $menu_item_category_fk)->get(array('menu_category_id'));
foreach ($results as $result) {
$category = $result->menu_category_id;
}
return $category;
}
$categories = getCategories();
$default = "";
if (isset($menu_item_category_fk)) {
$default = getDefault($menu_item_category_fk);
}
if (\Auth::check()) {
if (!isset($menu_item_description)) {
return \Redirect::to('admin');
}
return \View::make('menu-items.edit')->withMenuItemDescription($menu_item_description)->withMenuItemPictureUri($menu_item_picture_uri)->withMenuItemName($menu_item_name)->withMenuItemShort($menu_item_short)->withSlug($slug)->withCategories($categories)->withDefault($default)->withMenuItemPrice($menu_item_price);
}
return \Redirect::to('admin');
}
示例7: getDepartmentWithCourses
function getDepartmentWithCourses($collegeId)
{
//initialise array variables
$data = [];
$courses = [];
$ids = [];
//fetch departments
$departments = getDepartments($collegeId);
//append departments to data array
//$data['departments'] = $departments;
//get the ids of each department
foreach ($departments as $key => $value) {
//$ids[] = $value['id'];
$data[$key]['department'] = $value;
$data[$key]['courses'] = getCategories($value['id']);
}
return $data;
}
示例8: optimizeCategories
function optimizeCategories($root)
{
$nodes = getCategories($root);
if (sizeof($nodes) < MAX_LENGTH) {
return;
}
$node = null;
$destNode = null;
for ($i = sizeof($nodes) - 1; $i >= MAX_LENGTH; $i--) {
$node = $nodes[$i];
$destNode = getDestNode($root);
moveNode($destNode, $node);
}
// Îáðàáîòàòü ïîäêàòåãîðèè
$nodes = getCategories($root);
for ($i = 0; $i < sizeof($nodes); $i++) {
optimizeCategories($nodes[$i]);
}
}
示例9: getBlogContentForCoverPage
function getBlogContentForCoverPage()
{
global $blogid, $blog, $service, $stats, $skinSetting;
global $pd_category, $pd_categoryXhtml, $pd_archive, $pd_calendar, $pd_tags, $pd_notices, $pd_recentEntry;
global $pd_recentComment, $pd_recentTrackback, $pd_link, $pd_authorList;
$categories = getCategories($blogid);
$totalPosts = getEntriesTotalCount($blogid);
$pd_category = getCategoriesView($totalPosts, $categories, isset($category) ? $category : true);
$pd_categoryXhtml = getCategoriesView($totalPosts, $categories, isset($category) ? $category : true, true);
$pd_archive = getArchives($blogid);
$pd_calendar = getCalendarView(getCalendar($blogid, true));
$pd_tags = getRandomTags($blogid);
$pd_notices = getNotices($blogid);
$pd_recentEntry = getRecentEntries($blogid);
$pd_recentComment = getRecentComments($blogid);
$pd_recentTrackback = getRecentTrackbacks($blogid);
$pd_link = getLinks($blogid);
$pd_authorList = User::getUserNamesOfBlog($blogid);
}
示例10: showVoteInput
function showVoteInput($q)
{
$info = explode(".", $q);
$district = $info[0];
$machine = $info[1];
echo "<center><h1 class='title'>Enter Election Results for District: <span class='big'>{$district}</span>, Machine: <span class='big'>{$machine}</span></h1></center>";
echo "<form action = './saveInputs.php' method ='post'>";
//get categories
$categoriesResult = getCategories();
$count = 0;
$categoryCount = 0;
echo "<table><tr><td class='category'>";
while ($category = mysql_fetch_array($categoriesResult)) {
//get candidates
$id = $category['category_id'];
//echo " ID = {$id} ";
$candidates = getCandidates($id);
echo "<h1> {$category['category_name']}</h1><table>";
while ($candidate = mysql_fetch_array($candidates)) {
$info = "{$district},{$machine},{$candidate['candidate_id']},";
//echo $info;
$hidden = "candidateID" . $count++;
echo "<tr><td width = 25px></td><td>{$candidate['candidate_name']}</td><td>";
echo "<input type ='number' id='{$candidate['candidate_id']}' name='{$candidate['candidate_id']}' value = ";
echo "'";
echo getElectionResults($district, $machine, $candidate['candidate_id']);
echo "'";
//$functionStr = "ajaxGetInfo({$info}, this.value)"; // . $info . ")";
echo " oninput='ajaxGetInfo(this.value, this.name)' min=0></td></tr>";
echo "<input type=hidden name = {$hidden} METHOD='POST' value='{$candidate['candidate_id']}'>";
// echo "<input type=hidden name = 'candidateID' METHOD='POST' value='{$candidate['candidate_id']}'>";
}
echo "</table>";
echo "<input type=hidden id = 'district' value='{$district}'>";
echo "<input type=hidden id = 'machine' value='{$machine}'>";
if ($categoryCount % 3 == 2) {
echo "</td><td style='padding-left:45px'>";
}
$categoryCount++;
}
echo "</td></tr></table>";
}
示例11: getCategories
function getCategories($parentId = null, &$items = array())
{
$q = null;
\cf\createStaticQuery($q, "\n\t\tSELECT id, name, url, tree_id, list_id\n\t\tFROM cf_admin_categories\n\t\tWHERE parent_id=:parent OR (parent_id IS NULL AND :parent IS NULL)\n\t\tORDER BY sort_order\n\t");
$q->setParam('parent', $parentId);
$q->execute();
while ($q->fetch()) {
$item = array('id' => $q->at('id'), 'name' => $q->at('name'), 'url' => $q->at('url') ? $q->at('url') . '&mid=' . $q->at('id') : (canRead($q->at('list_id')) ? 'list.php?vid=' . $q->at('list_id') . '&mid=' . $q->at('id') : ''), 'children' => array());
getCategories($q->at('id'), $item['children']);
if ($q->at('tree_id') && canRead($q->at('tree_id'))) {
getTree($q->at('tree_id'), null, $item['children'], $q->at('list_id') && canRead($q->at('list_id')) ? $q->at('list_id') : false, $q->at('id'));
}
if (count($item['children']) || $item['url']) {
if (!$item['url']) {
$item['url'] = 'category.php?id=' . $q->at('id') . '&mid=' . $q->at('id');
}
$items[] = $item;
}
}
$q->close();
return $items;
}
示例12: getChallenge
function getChallenge()
{
$challenge = array();
if ($categories = getCategories()) {
// Shuffle the categories.
shuffle($categories);
// retrieve the top four.
$categories = array_slice($categories, 0, 4);
// grab the images from the first.
shuffle($categories[0]['images']);
// use the first image.
$challenge['image'] = $categories[0]['images'][0];
// Build the answer.
$challenge['answer'] = array('id' => md5($challenge['image']['id'] . $categories[0]['id']), 'role' => $categories[0]['role'], 'title' => $categories[0]['title'], 'source' => $challenge['image']['source'], 'correct' => getResponse('correct'), 'incorrect' => getResponse('incorrect'));
// Build the options.
shuffle($categories);
foreach ($categories as $category) {
$challenge['options'][] = array('id' => $category['id'], 'title' => $category['title']['name'] . ($category['year'] ? ' (' . $category['year'] . ')' : ''));
}
}
return (object) $challenge;
}
示例13: showMenu
public function showMenu()
{
function getMenuItem()
{
$items = \MenuItem::get();
foreach ($items as $item) {
$item_price[] = $item->menu_item_price;
$item_desc[] = $item->menu_item_short;
$item_name[] = $item->menu_item_name;
$item_fk[] = $item->menu_item_category_fk;
}
if (!isset($item)) {
$items = null;
return $items;
}
$items = array($item_name, $item_desc, $item_fk, $item_price);
return $items;
}
function getCategories()
{
$categories = \MenuCategory::get();
foreach ($categories as $cat) {
$cat_name[] = $cat->menu_category_name;
$cat_id[] = $cat->menu_category_id;
$category = array($cat_id, $cat_name);
}
return $category;
}
$items = getMenuItem();
if ($items === null) {
return \Redirect::to('admin');
}
$category = getCategories();
list($name, $desc, $fk, $price) = $items;
list($cat_id, $cat) = $category;
return \View::make('menu-items.menu')->withName($name)->withDesc($desc)->withFk($fk)->withPrice($price)->withCatId($cat_id)->withCatName($cat);
}
示例14: buildMenu
function buildMenu(User $user)
{
$username = $user->getID();
$categories = getCategories();
$db = DBConnection::getConnection();
if (count($categories) == 0) {
throw new Exception("There are no available categories for you");
} else {
foreach ($categories as $catName) {
$id = str_replace(" ", "", $catName) . "_btn";
echo "<p class='category' id='{$id}' onclick='showPanel(this)'>" . $catName . "</p>";
$query = "SELECT ID, NAME, ALERT FROM SCRIPTS WHERE CATEGORY = '{$catName}' AND ID IN (SELECT ID_SCRIPT FROM AUTHORIZATIONS WHERE ID_USER='{$username}')";
try {
$res = $db->query($query);
$namePanel = str_replace(" ", "", $catName) . "_Panel";
if ($res->rowCount() <= 0) {
echo "<ul class=\"scripts\" id=\"{$namePanel}\">";
echo "<p class='error'>No Available Scripts in this category</p>";
echo "</ul>";
} else {
echo "<ul class=\"scripts\" id=\"{$namePanel}\">";
while ($info = $res->fetch(PDO::FETCH_ASSOC)) {
$scriptName = $info["NAME"];
$scriptId = $info["ID"];
$scriptAlert = $info["ALERT"];
$row = "<li id=\"{$scriptId}\" about=\"{$scriptAlert}\" onclick=\"execCmd(this)\">{$scriptName}</li>";
echo $row;
}
echo "</ul>";
}
} catch (Exception $e) {
throw new Exception("Impossible to Execute Query that retrieve scripts for category " . $catName . ": " . $e->getMessage());
}
}
}
}
示例15: function
removeItselfById('category-move-button');
trashSelect = document.createElement("SELECT");
trashSelect.id = "category";
trashSelect.name = "category";
trashSelect.onchange = function() { document.getElementById('trash-form').page.value=1; document.getElementById('trash-form').submit(); return false; };
trashOption = document.createElement("OPTION");
trashOption.innerHTML = "<?php
echo _t('전체');
?>
";
trashOption.value = "0";
trashSelect.appendChild(trashOption);
<?php
foreach (getCategories($blogid) as $category) {
?>
trashOption = document.createElement("OPTION");
trashOption.innerHTML = "<?php
echo htmlspecialchars($category['name']);
?>
";
trashOption.value = "<?php
echo $category['id'];
?>
";
<?php
if ($category['id'] == $categoryId) {
?>
trashOption.setAttribute("selected", "selected");