Example #1
0
function isAlsoDefault2($cat)
{
    if ($cat == getCategoryById(getDefaultCategory())) {
        return 'selected="selected"';
    }
    return '';
}
Example #2
0
File: main.php Project: VSG24/ccms
        echo '<input type="hidden" class="canvas_posts" id="' . $i . '" value="' . $cat_names[$i] . '">';
    }
}
?>

    <script>

        var cat_names_string = [];


        var num_loops = 50;//document.getElementById('num_of_loops').value; // important stuff - this is the maximum of cats to be shown

        <?php 
for ($i = 0; $i <= $num_loops_php; $i++) {
    if (isset($cat_names[$i])) {
        echo 'cat_names_string.push(\'' . getCategoryById($i) . '\');';
    }
}
?>

        var i = 1;
        var canvas;

        var cat_ids = [];
        var cat_names = [];

        while(i<=num_loops)
        {
            if(canvas = document.getElementById(i.toString()))
            {
                if(cat_names.indexOf(parseInt(i, 10)) == -1)
Example #3
0
function getTypeList($parm)
{
    //if(empty($parm['type_id'])) return;
    $Osql = "sort_order DESC";
    //查询条件
    $Lsql = "{$parm['limit']}";
    $pc = getCategoryCountByParentId($parm['type_id']);
    if ($pc > 0) {
        $map['is_hiden'] = 0;
        $map['parent_id'] = $parm['type_id'];
        $data = getCategoryByCondition($map, $Osql, $Lsql);
    } elseif (!isset($parm['notself'])) {
        $map['is_hiden'] = 0;
        $mycat = getCategoryById($parm['type_id']);
        $map['parent_id'] = $mycat['parent_id'];
        $data = getCategoryByCondition($map, $Osql, $Lsql);
    }
    //链接处理
    $typefix = get_type_leve_nid($parm['type_id']);
    $typeu = $typefix[0];
    $suffix = C("URL_HTML_SUFFIX");
    foreach ($data as $key => $v) {
        if ($v['type_set'] == 2) {
            if (empty($v['type_url'])) {
                $data[$key]['turl'] = "javascript:alert('请在后台添加此栏目链接');";
            } else {
                $data[$key]['turl'] = $v['type_url'];
            }
        } elseif ($parm['type_id'] == 0 || $v['parent_id'] == 0 && count($typefix) == 1) {
            $data[$key]['turl'] = MU("Home/{$v['type_nid']}/index", "typelist", array("suffix" => $suffix));
        } else {
            $data[$key]['turl'] = MU("Home/{$typeu}/{$v['type_nid']}", "typelist", array("suffix" => $suffix));
        }
    }
    $row = array();
    $row = $data;
    return $row;
}
Example #4
0
function getPostShareByCategory($id_or_name = false)
{
    $conn = MySQL::open_conn();
    $query = "SELECT cat_id FROM c_posts_cats";
    $res = $conn->query($query);
    dbQueryCheck($res, $conn);
    $query2 = "SELECT MAX(ID) AS 'maxid', MIN(ID) AS 'minid' FROM c_categories";
    $res2 = $conn->query($query2);
    $row2 = $res2->fetch_assoc();
    $maxid = $row2['maxid'];
    $minid = $row2['minid'];
    $cats = [];
    while ($row = $res->fetch_assoc()) {
        for ($i = $minid; $i <= $maxid; $i++) {
            if ($i == $row['cat_id']) {
                $cats[$i]++;
                break;
            }
        }
    }
    if ($id_or_name == false) {
        return $cats;
    } else {
        foreach ($cats as $i => $v) {
            $n = getCategoryById($i);
            $cat_names[$n] = $v;
        }
        return $cat_names;
    }
}
<?php

include_once "chart.php";
$cid = $_GET['chartId'];
echo getCategoryById($cid);
Example #6
0
<?php

if (!isset($logged)) {
    header('Location:login.html');
}
if (!hasPermission($logged, 'access', 'category_form')) {
    header('Location:permission.html');
}
if (isset($_GET['category_id'])) {
    $category_id = $_GET['category_id'];
}
if (isset($category_id) && $_SERVER['REQUEST_METHOD'] != 'POST') {
    $category_info = getCategoryById($category_id);
}
if (isset($_POST['name'])) {
    $name = $_POST['name'];
} elseif (!empty($category_info)) {
    $name = $category_info['category_name'];
} else {
    $name = '';
}
//$categories = getCategoriesList(0);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $action = $_POST['action'];
    $name = $_POST['name'];
    $category_id = $_POST['category_id'];
    $error = array();
    if (strlen($name) < 3 || strlen($name) > 32) {
        $error['name'] = $lang['error_category_name'];
    }
    if (empty($error)) {
Example #7
0
include_once 'sidebar.php';
?>

        <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 col-md-offset-1 col-lg-offset-1 div_white_left">
            <article class="post">
                <a href="<?php 
echo $posts->getPostPermLink($row['ID'], $row['post_type'], $row['link_title']);
?>
"><h3 style="font-weight: bold;"><?php 
echo strip_tags($row['post_title']);
?>
</h3></a>&nbsp;&nbsp;<span style="color: #808080;"><i style="vertical-align: middle;" class="mdi mdi-calendar"></i>&nbsp;<?php 
echo englishConvertDate($row['post_date']);
?>
&nbsp;<i style="vertical-align: middle;" class="mdi mdi-file"></i>&nbsp;<?php 
echo getCategoryById(getPostCategories($row['ID'])[0]);
?>
</span>
                <p><?php 
echo $row['post_excerpt'];
?>
</p>
                <p><?php 
echo $row['post_content'];
?>
</p>
                <?php 
if (Users::getUsernameBySeassion() !== false && Users::isAdmin(Users::getUsernameBySeassion())) {
    ?>
                <div align="right"><a href="<?php 
    echo $posts->getPostEditLink($row['ID']);
Example #8
0
<?php

$item = getItem($id)[0];
?>
<div class="products">
    <div class="cl">&nbsp;</div>
    <ul>

<?php 
echo '<li>';
$catName = getCategoryById($item['id_category'])[0]['name'];
$link = '?type=3&id=' . $item['id'];
echo '<a href="' . $link . '"><img src="' . $item['photo'] . '" alt="" /></a>
                <div class="product-info">
                    <h3>' . $catName . '</h3>
                    <div class="product-desc">
                        <h4>' . $item['name'] . '</h4>
                        <strong class="price">' . $item['price'] . ' руб.</strong>
                    </div>
                </div>';
echo '</li>';
echo $item['description'];
?>

</ul>
<div class="cl">&nbsp;</div>
    <?php 
echo '<a class="search-submit" style="width: 150px; text-align: center" href="?type=4&id=' . trim($id) . '" >Добавить в корзину</a>';
?>
</div>
Example #9
0
</th>
                </tr>
                <?php 
while ($row = $res->fetch_assoc()) {
    if (isset($row['post_author'])) {
        $username = Users::getUserById($row['post_author']);
    }
    if ($row['post_status'] == 'Initialized') {
        $status = _e('initialized', '', '', true);
        $statcolor = "style='text-align: center; color: red;'";
    } else {
        $status = _e('published', '', '', true);
        $statcolor = "style='text-align: center;'";
    }
    $first_cat = getPostCategories($row['ID'])[0];
    echo "<tr><td style='text-align: center; vertical-align: middle;'>" . $row['ID'] . "</td><td style='text-align: center; vertical-align: middle;'><a href='?switch=users&sub=edit_user&id=" . $row['post_author'] . "'>" . $username['username'] . "</a></td><td>" . $row['post_title'] . "</td><td style='text-align: center; vertical-align: middle;'><a href='?switch=categories&sub=edit_category&id=" . $first_cat . "'>" . getCategoryById($first_cat) . "</a></td><td " . $statcolor . ">" . $status . "<br>" . "<span style='text-align: center;'><a onclick=\"return confirm('Are you sure?');\" href='?switch=manage_posts&sub=delete_post&id=" . $row['ID'] . "'>" . _e('delete', '', '', true) . "</a></span>" . "<br>" . "<span style='text-align: center;'><a href='?switch=new_post&sub=edit_post&id=" . $row['ID'] . "'>" . _e('edit', '', '', true) . "</a></span></td><td style='text-align: center; vertical-align: middle;'>" . addZerosToShow(LBDP($row['post_date'])) . "</td></tr>";
}
$res->free();
?>
                </table>
                <?php 
$home = "?switch=users&sub=edit_user";
?>
                <!--<script>
                    function gotoEdit(ref)
                    {
                        var id = ref.id;
                        window.location.assign("<?php 
echo $home;
?>
&id=" + id);
Example #10
0
 /**
  * Updates the access_url_rel_course_category table with a given list
  * @author Julio Montoya
  * @param array course category list
  * @param int access_url_id
  **/
 public static function updateUrlRelCourseCategory($list, $urlId)
 {
     $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY);
     $sql = "SELECT course_category_id FROM {$table} WHERE access_url_id = " . intval($urlId);
     $result = Database::query($sql);
     $existingItems = array();
     while ($row = Database::fetch_array($result)) {
         $existingItems[] = $row['course_category_id'];
     }
     // Adding
     foreach ($list as $id) {
         UrlManager::addCourseCategoryToUrl($id, $urlId);
         $categoryInfo = getCategoryById($id);
         $children = getChildren($categoryInfo['code']);
         if (!empty($children)) {
             foreach ($children as $category) {
                 UrlManager::addCourseCategoryToUrl($category['id'], $urlId);
             }
         }
     }
     // Deleting old items
     foreach ($existingItems as $id) {
         if (!in_array($id, $list)) {
             UrlManager::deleteUrlRelCourseCategory($id, $urlId);
             $categoryInfo = getCategoryById($id);
             $children = getChildren($categoryInfo['code']);
             if (!empty($children)) {
                 foreach ($children as $category) {
                     UrlManager::deleteUrlRelCourseCategory($category['id'], $urlId);
                 }
             }
         }
     }
 }
Example #11
0
include $function;
include $header;
include $footer;
include $list;
?>
<script src="../javascript/index.js" type="text/javascript"></script>
</head>
<body>
	<?php 
echo getBatikHeader();
?>
	
	<div class="main-body">
	<?php 
if (isset($_GET['id'])) {
    $category = getCategoryById($_GET['id']);
    if (!is_null($category)) {
        ?>
				<h2 class="main-title"><?php 
        echo $category->categoryname;
        ?>
</h2>
				<hr/>
				<?php 
        $productlist = getProductByCategory($_GET['id']);
        echo print_product_list($productlist, "Daftar Barang", "product-category-list");
    } else {
        echo printProductNotFound();
    }
} else {
    echo printProductNotFound();
Example #12
0
<?php

require_once "ApiLibrary.php";
//Checks if this is running from a request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'GET') {
    //This checks to see if anything was passed into the parameter userName
    if (!isset($_GET['catId'])) {
        //handle error
    } else {
        $_catId = $_GET['catId'];
        echo getCategoryById($_catId);
    }
}
Example #13
0
						</p>
					<?php 
} else {
    ?>
						<p class="breadcrumb"><?php 
    echo getLocById($locationId)["fr_name"];
    ?>
 > <?php 
    echo getSectionById($sectionId)["fr_name"];
    ?>
 
							<?php 
    if ($categoryId !== 'all-categories') {
        ?>
								> <?php 
        echo getCategoryById($categoryId)["fr_name"];
        ?>
							<?php 
    }
    ?>
						</p>
					<?php 
}
?>
 

					<div class="listing-container">
						<div class="featured-listings cf">

							<?php 
foreach ($paidListings as $listing) {
Example #14
0
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>View Categories</title>
    </head>
    <body><center>
        <?php 
/* Connect to DB and include functions */
include_once '../../functions/dbconnect.php';
include_once '../../functions/category-functions.php';
require_once '../../includes/session-start.req-inc.php';
require_once '../../includes/access-required.html.php';
$db = dbconnect();
$category_id = filter_input(INPUT_GET, 'category_id');
$results = getCategoryById();
?>

         <table class="table-hover" border="2">
            <thead>
                <tr>
                    <th>category_id</th>
                    <th>category</th>
                   
                </tr>
            </thead>
        <?php 
foreach ($results as $row) {
    ?>
            <tr>
               <?php 
Example #15
0
/** 
 * @author Amedeo Leo
 */
function getCategoriesOfIdea($idIdea)
{
    $returnValues = array();
    $conn = getConn();
    $sql = "SELECT * FROM hasCategory WHERE idIdea = '{$idIdea}'";
    $result = mysqli_query($conn, $sql);
    if (mysqli_num_rows($result) > 0) {
        while ($row = mysqli_fetch_assoc($result)) {
            $category = getCategoryById($row['idCategory']);
            $returnValues[] = $category[0]['name'];
        }
        mysqli_close($conn);
        return $returnValues;
    } else {
        mysqli_close($conn);
        return NULL;
    }
}