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


PHP createCategory函数代码示例

本文整理汇总了PHP中createCategory函数的典型用法代码示例。如果您正苦于以下问题:PHP createCategory函数的具体用法?PHP createCategory怎么用?PHP createCategory使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: generate_image

     $image = new \Thelia\Model\BrandImage();
     $image->setBrandId($brandId);
     generate_image($image, 'brand', $brandId);
     $document = new \Thelia\Model\BrandDocument();
     $document->setBrandId($brandId);
     generate_document($document, 'brand', $brandId);
 }
 echo "Creating categories and products\n";
 //categories and products
 $productIdList = array();
 $virtualProductList = array();
 $categoryIdList = array();
 for ($i = 1; $i < $numberCategories; $i++) {
     $category = createCategory($faker, 0, $i, $categoryIdList, $contentIdList);
     for ($j = 1; $j < rand(0, $numberCategories); $j++) {
         $subcategory = createCategory($faker, $category->getId(), $j, $categoryIdList, $contentIdList);
         for ($k = 0; $k < rand(0, $numberProducts); $k++) {
             createProduct($faker, $subcategory, $k, $template, $brandIdList, $productIdList, $virtualProductList);
         }
     }
     for ($k = 1; $k < rand(1, $numberProducts); $k++) {
         createProduct($faker, $category, $k, $template, $brandIdList, $productIdList, $virtualProductList);
     }
 }
 foreach ($productIdList as $productId) {
     //add random accessories - or not
     $alreadyPicked = array();
     for ($i = 1; $i < rand(0, 4); $i++) {
         $accessory = new Thelia\Model\Accessory();
         do {
             $pick = array_rand($productIdList, 1);
开发者ID:hadesain,项目名称:thelia,代码行数:31,代码来源:faker.php

示例2: getCategory

function getCategory($name)
{
    if (empty($name)) {
        $name = "Default";
    }
    $tmp = split("!", $name);
    $maingroup = 0;
    $found = true;
    $i = 0;
    do {
        $sql = "select D.*,C.parent_id from categories C left join categories_description D on C.categories_id=D.categories_id ";
        $sql .= "where categories_name like '" . $tmp[$i] . "' and C.parent_id={$maingroup}";
        $rs = getAll("shop", $sql, "getCategory");
        if ($rs[0]["categories_id"]) {
            $maingroup = $rs[0]["categories_id"];
            echo $maingroup . ":" . $rs[0]["categories_name"] . " ";
            $i++;
        } else {
            $found = false;
        }
    } while ($rs and $found and $i < count($tmp));
    for (; $i < count($tmp); $i++) {
        $maingroup = createCategory($tmp[$i], $maingroup);
    }
    return $maingroup;
}
开发者ID:jquade,项目名称:lxoffice-erp,代码行数:26,代码来源:shopimport_csv.php

示例3: getCategory

function getCategory($name, $Lang, $Languages)
{
    if (empty($name)) {
        $name = "Default";
    }
    $tmp = split("!", $name);
    $maingroup = 0;
    $found = true;
    $i = 0;
    do {
        $sql = "select D.*,C.parent_id from " . PREFIX . "categories C left join " . PREFIX . "categories_description D on C.categories_id=D.categories_id ";
        $sql .= "where (categories_name = '" . $tmp[$i] . "' or categories_meta_title ='" . $tmp[$i] . "') and ";
        $sql .= "C.parent_id={$maingroup} and language_id={$Lang}";
        $rs = getAll("shop", $sql, "getCategory");
        if ($rs) {
            $maingroup = $rs[0]["categories_id"];
            $i++;
        } else {
            $found = false;
        }
    } while ($rs and $found and $i < count($tmp));
    for (; $i < count($tmp); $i++) {
        $maingroup = createCategory($tmp[$i], $maingroup, $Lang, $Languages);
    }
    return $maingroup;
}
开发者ID:jquade,项目名称:lxoffice-erp,代码行数:26,代码来源:shopimport_db.php

示例4: _makeCategories

 private function _makeCategories()
 {
     require_once SUBSDIR . '/Categories.subs.php';
     while ($this->counters['categories']['current'] < $this->counters['categories']['max'] && $this->blockSize--) {
         $catOptions = array('move_after' => 0, 'cat_name' => 'Category Number ' . ++$this->counters['categories']['current'], 'is_collapsible' => 1);
         createCategory($catOptions);
     }
     $this->_pause();
 }
开发者ID:ahrasis,项目名称:tools,代码行数:9,代码来源:populate.php

示例5: makeCategories

 private function makeCategories()
 {
     global $sourcedir;
     require_once $sourcedir . '/Subs-Categories.php';
     while ($this->counters['categories']['current'] < $this->counters['categories']['max'] && $this->blockSize--) {
         $catOptions = array('move_after' => 0, 'cat_name' => 'Category Number ' . ++$this->counters['categories']['current'], 'is_collapsible' => 1);
         createCategory($catOptions);
     }
     $this->pause();
 }
开发者ID:rhodefey,项目名称:tools,代码行数:10,代码来源:Populate.php

示例6: array

             break;
         }
     }
 case 'createcategory':
     if ($isallowed && $mode == 'createcategory') {
         $smarty->assign('languages', $lang->listLanguages());
         $grouplist = $rights->getAllGroups();
         $smarty->assign('groups', $grouplist);
         if (isset($_POST['create']) && trim($_POST['name']) != '') {
             $assigned_groups = array();
             foreach ($grouplist as $group) {
                 if (@$_POST['group_' . $group['groupid']] == '1') {
                     $assigned_groups[] = $group['groupid'];
                 }
             }
             createCategory($_POST['name'], $categoryid, $assigned_groups, $_POST['language']);
         } else {
             $breadcrumbs->addElement($lang->get('createcategory'), makeURL($mod, array('mode' => 'createcategory')));
             $smarty->assign('path', $template_dir . "/createcategory.tpl");
             break;
         }
     }
 default:
     if (isVisible($categoryid)) {
         $showcategories = true;
         if ($downloadid > 0) {
             $dl = getDownload($downloadid);
             if (isset($_POST['download'])) {
                 increaseDownloadCounter($downloadid);
                 $dl['counter']++;
                 $addr = trim($config->get('media', 'mail-notification-address'));
开发者ID:tech-nik89,项目名称:lpm4,代码行数:31,代码来源:media.mod.php

示例7: getData

function getData($code, $connection)
{
    if (!isTokenUser()) {
        $code = 4;
    }
    switch ($code) {
        //////////////////////CASE -1/////////////////////////////////////
        //Si entra aqui es porque ningun dato de S_POST coincide con una acción valida. Ya que el $dataCode por defecto es -1
        case -1:
            $response = array("error" => 1030, "description" => "Error no se ejecuto ninguna acción, verifica los parametros de entrada.");
            break;
            //////////////////////CASE 0/////////////////////////////////////
            //Obtenemos las opciones a mostrar de un pregunta y las devolvemos en un array en formato json
        //////////////////////CASE 0/////////////////////////////////////
        //Obtenemos las opciones a mostrar de un pregunta y las devolvemos en un array en formato json
        case 0:
            if ($connection) {
                $id_pregunta = $_POST["id_pregunta"];
                $dataOptions = $connection->query("SELECT * FROM " . TABLE_PREFIX . TABLE_OPCIONES . " where id_pregunta = " . $id_pregunta);
                $data;
                /*
                 * obtenemos los datos de la base de datos en un array asociativo.
                 */
                while ($fila = $dataOptions->fetch_assoc()) {
                    $data[] = $fila;
                }
                //dado que los valores de la base de datos vienen en codificacion utf-8, hay que transformar aquellas columnas con campos de texto.
                $dataResponse = codificationArray($data, "m_option");
                //para la variable m_option de la tabla n_opciones se codifica en utf-8
                $response = $dataResponse;
            } else {
                $response = array("error" => 1020, "description" => "Error conexión no establecida");
            }
            break;
            //////////////////////CASE 1/////////////////////////////////////
            //Devolvemos la pregunta dado una paginacion ( con un LIMIT en la select filtramos la paginación)			.
        //////////////////////CASE 1/////////////////////////////////////
        //Devolvemos la pregunta dado una paginacion ( con un LIMIT en la select filtramos la paginación)			.
        case 1:
            if (!isTokenTest()) {
                createTokenTest(getTokenUser());
            } else {
                if (isTokenTest() && isset($_POST["isFirstSelectedTest"]) && $_POST["isFirstSelectedTest"] == "true") {
                    //$response = array("error" => 1200, "Error token desincronizado");
                    $response = array("error" => 1200, "desError" => "Test desincronizado", "page" => getPage(), "category" => getCategory(), "token_test" => getTokenTest(), "token_user" => getTokenUser());
                    break;
                }
            }
            //sincronizamos el avanze de paginas
            if (!isPage()) {
                createPage(intval($_POST["pagination"]));
            } else {
                if (isset($_SESSION["is_page_refresh"]) && $_SESSION["is_page_refresh"] && getPage() < intval($_POST["pagination"])) {
                    createPage(intval(getPage()) + 1);
                } else {
                    if (isset($_SESSION["is_page_refresh"]) && $_SESSION["is_page_refresh"]) {
                        createPage(intval(getPage()));
                    } else {
                        createPage(intval(getPage()) + 1);
                    }
                }
            }
            if (!isCategory()) {
                //si no esta sincroniada la categoria se sincroniza
                createCategory(intval($_POST["id"]));
            }
            if ($connection) {
                $pagination = getPage();
                //numero de pagina.
                $id = $_POST["id"];
                //id categoria: 1- ingles, 2- aleman...
                $result = $connection->query("SELECT * FROM " . TABLE_PREFIX . TABLE_PREGUNTAS . " where id_title = " . $id . " LIMIT " . $pagination . ",1");
                $countLengthData = $connection->query("SELECT count(id) as count FROM " . TABLE_PREFIX . TABLE_PREGUNTAS . " where id_title = " . $id);
                $data = array();
                while ($fila = $result->fetch_assoc()) {
                    $data[] = $fila;
                }
                $dataResponse = codificationArray($data, "question");
                //para la variable question de la tabla n_preguntas se codifica en utf-8
                $dataLength = $countLengthData->fetch_assoc();
                $dataResponse[1] = $dataLength;
                //numero de preguntas para la categoria actual
                if (!isCountQuestion()) {
                    createCountQuestion($dataLength);
                }
                $dataResponse[2] = getTokenTest();
                $dataResponse[3] = getTokenUser();
                $response = $dataResponse;
            } else {
                $response = array("error" => 1020, "description" => "Error conexión no establecida");
            }
            break;
            //////////////////////CASE 2/////////////////////////////////////
            // Actualizamos el progresso del cliente.
        //////////////////////CASE 2/////////////////////////////////////
        // Actualizamos el progresso del cliente.
        case 2:
            if (isPage()) {
                $canContinue = false;
                if (isset($_POST["pageUpdate"]) && $_POST["pageUpdate"]) {
//.........这里部分代码省略.........
开发者ID:balvarob,项目名称:test,代码行数:101,代码来源:ajaxTest.php

示例8: while

while (($line = fgetcsv($file)) !== FALSE) {
    $count++;
    //$line is an array of the csv elements
    if (!empty($line[0]) && !empty($line[1])) {
        $data['general']['path'] = $line[0];
        $data['general']['name'] = $line[1];
        $data['general']['meta_title'] = "";
        $data['general']['meta_description'] = "";
        $data['general']['is_active'] = "";
        $data['general']['url_key'] = "";
        $data['general']['display_mode'] = "PRODUCTS";
        $data['general']['is_anchor'] = 0;
        $data['category']['parent'] = $line[0];
        // 3 top level
        $storeId = 0;
        createCategory($data, $storeId);
        sleep(0.5);
        unset($data);
    }
}
function createCategory($data, $storeId)
{
    echo "Starting {$data['general']['name']} [{$data['category']['parent']}] ...";
    $category = Mage::getModel('catalog/category');
    $category->setStoreId($storeId);
    # Fix must be applied to run script
    #http://www.magentocommerce.com/boards/appserv/main.php/viewreply/157328/
    if (is_array($data)) {
        $category->addData($data['general']);
        if (!$category->getId()) {
            $parentId = $data['category']['parent'];
开发者ID:ngagestudios,项目名称:magento.vehiclefits.com,代码行数:31,代码来源:Elite_tasks_categories.php

示例9: loadCategories

     loadCategories($node);
     break;
 case "create_category":
     $parent = '';
     $name = '';
     $description = '';
     if (isset($_REQUEST['parent'])) {
         $parent = $_REQUEST['parent'];
     }
     if (isset($_REQUEST['name'])) {
         $name = $_REQUEST['name'];
     }
     if (isset($_REQUEST['description'])) {
         $description = $_REQUEST['description'];
     }
     createCategory($name, $parent, $description);
     break;
 case "update_category":
     $id = '';
     $name = '';
     $description = '';
     $type = '';
     // rename,move,merge
     $target = '';
     //only for move and merge
     if (isset($_REQUEST['id'])) {
         $id = $_REQUEST['id'];
     }
     if (isset($_REQUEST['name'])) {
         $name = $_REQUEST['name'];
     }
开发者ID:nicholasdickey,项目名称:react-qwiket,代码行数:31,代码来源:api.php

示例10: createCategory

    <div id="page-wrapper">

        <div class="container-fluid">

            <!-- Page Heading -->
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">
                        Admin Panel
                        <small>Author</small>
                    </h1>

                    <div class="col-xs-6">

                        <?php 
createCategory();
?>

                        <form action="" method="post">
                            <div class="form-group">
                                <label for="category_input">Add Category</label>
                                <input type="text" class="form-control" name="category_input">
                            </div>
                            <div class="form-group">
                                <input type="submit" class="btn btn-primary" name="submit" value="Add Category">
                            </div>
                        </form>

                        <?php 
if (isset($_GET['edit'])) {
    include 'views/update_gategories.php';
开发者ID:ITTalents-Almonds,项目名称:layout,代码行数:31,代码来源:admin_categories.php

示例11: createField

function createField($name, $details)
{
    switch ($details->{'type'}) {
        case 'text':
            createFieldText($name, $details);
            break;
        case 'checkbox':
            createFieldCheckBox($name, $details);
            break;
        case 'hidden':
            createFieldHidden($name, $details);
            break;
        case 'category':
            createCategory($name, $details);
            break;
    }
}
开发者ID:Team-Quantum,项目名称:QuantumCMS,代码行数:17,代码来源:install.php

示例12: session_start

session_start();
is_login(DOCROOT . "admin/login/");
//checking whether admin logged in or not.
if ($_POST) {
    $categoryname = htmlentities($_POST['categoryname'], ENT_QUOTES);
    $category_url = htmlentities($_POST['permalink'], ENT_QUOTES);
    //$category_img = htmlentities($_POST['imglink'], ENT_QUOTES);
    $queryString = "select * from coupons_category where category_name = '{$categoryname}' ";
    $resultSet = mysql_query($queryString);
    if (mysql_num_rows($resultSet) > 0) {
        set_response_mes(-1, $admin_language['categoryexist']);
        $redirect_url = DOCROOT . 'add/category/';
        url_redirect($redirect_url);
    } else {
        createCategory($categoryname, $category_url, $category_img);
        set_response_mes(1, $admin_language['categoryadded']);
        $redirect_url = DOCROOT . 'add/category/';
        url_redirect($redirect_url);
    }
}
?>

<script type="text/javascript">
/* validation */
$(document).ready(function(){ $("#form_createcategory").validate();});
</script>

<script type="text/javascript">
$(document).ready(function(){ 
$(".toggleul_4").slideToggle(); 
开发者ID:AdoSalkic,项目名称:personal,代码行数:30,代码来源:addcategory.php

示例13: switch

    switch ($action) {
        case 'getAllCategoriesDT':
            echo getAllCategoriesDT();
            break;
        case 'deleteCategory':
            $id = $_POST['id'];
            echo deleteCategory($id);
            break;
        case 'editCategory':
            $id = $_POST['id'];
            $category = $_POST['category'];
            echo editCategory($id, $category);
            break;
        case 'createCategory':
            $category = $_POST['category'];
            echo createCategory($category);
            break;
    }
}
function getAllCategoriesDT()
{
    global $bdd, $_TABLES;
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $content = '<thead>';
        $content .= '<tr>';
        $content .= '<th>Id</th>';
        $content .= '<th>Category</th>';
        $content .= '<th>Action</th>';
        $content .= '</tr>';
        $content .= '</thead>';
        $content .= '<tbody>';
开发者ID:xXNoceboXx,项目名称:WUS,代码行数:31,代码来源:category.controller.php

示例14: syncCreateCategory

function syncCreateCategory($usermail, $password, $name, $parentid = 0)
{
    global $db;
    $tbl_cat = MYSQL_TABLE_PREFIX . 'media_categories';
    $assigned_groups = getAssignedGroups($usermail, $password);
    if ($assigned_groups == false) {
        return false;
    }
    $parentid = (int) $parentid;
    $parent = $db->selectOneRow($tbl_cat, "*", "`categoryid`=" . $parentid);
    if ($parent == null && $parentid > 0) {
        return false;
    }
    if ($db->selectOneRow($tbl_cat, "*", "`name`='" . secureMySQL($name) . "'") != null) {
        return false;
    }
    createCategory($name, $parentid);
    return true;
}
开发者ID:tech-nik89,项目名称:lpm4,代码行数:19,代码来源:media.function.php

示例15: createCategory

<?php

if (isset($_GET['detail']) && $_GET['detail'] == 'createMain') {
    if (isset($_POST['category_name']) && !empty($_POST['category_name'])) {
        $msg = createCategory($_POST['category_name'], $db, $_POST['subcategory_name']);
        if ($msg) {
            $responseMain[] = 'Kategorie erfolgreich angelegt';
        } else {
            $responseMain[] = 'Kategorie konnte nicht angelegt werden!';
        }
    } elseif (empty($_POST['category_name'])) {
        $responseMain[] = 'Kategoriename!';
    }
}
if (isset($_GET['detail']) && $_GET['detail'] == 'createSub') {
    if (isset($_POST['subcategory_name'], $_POST['parent_category']) && !empty($_POST['subcategory_name']) && !empty($_POST['parent_category'])) {
        $msg = createSubcategory($_POST['subcategory_name'], $_POST['parent_category'], $db);
        if ($msg) {
            $responseSub[] = 'Unterkategorie erfolgreich angelegt';
        } else {
            $responseSub[] = 'Unterkategorie konnte nicht angelegt werden!';
        }
    } elseif (empty($_POST['subcategory_name'])) {
        $responseSub[] = 'Unterkategoriename!';
    }
}
if (isset($_GET['detail']) && $_GET['detail'] == 'edit') {
    $msg = updateCategories($_POST, $db);
    if ($msg) {
        header('Location: /dashboard/categories');
    } else {
开发者ID:bassels,项目名称:moebel-mafia,代码行数:31,代码来源:categoriesController.php


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