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


PHP category::update方法代码示例

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


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

示例1: find_default_ctrAction

 public function find_default_ctrAction($die = true)
 {
     $stat = new stat();
     $category = new category();
     $categories = $category->select($count);
     $datetime = date("Y-m-d H:i:s", time() - 60 * 60 * 24);
     foreach ($categories as $category) {
         $gifts = $category->get_gifts(array('filter' => array('not_default_ctr' => true)));
         $gifts_ids = array();
         $min_ctr = Zend_Registry::get('config')->ctr->norma;
         $default_ctr = 0;
         // Определим минимальный по палате ctr
         if (is_array($gifts) && count($gifts) > 0) {
             foreach ($gifts as $gift) {
                 if (!empty($gift->id)) {
                     $gifts_ids[] = $gift->id;
                     if ($gift->ctr > 1 && $gift->ctr < $min_ctr) {
                         $min_ctr = $gift->ctr;
                     }
                 }
             }
         }
         $views = $stat->get_total_views_by_category($datetime, $category->get('id'));
         $default_ctr = $views > 0 ? $stat->get_total_clicks_by_category($datetime, $category->get('id')) * Zend_Registry::get('config')->ctr->norma / $views : 0;
         if ($default_ctr < $min_ctr) {
             $default_ctr = $min_ctr;
         }
         echo $category->get('category') . ', default CTR: ' . $default_ctr . ', min CTR: ' . $min_ctr . '<br>';
         $category->update(array('default_ctr' => (int) $default_ctr, 'min_ctr' => (int) $min_ctr));
         sleep(1);
     }
     if ($die) {
         die;
     }
 }
开发者ID:evnazarchuk,项目名称:code_examples,代码行数:35,代码来源:controller_maintenance.php

示例2: category

        ?>
</button>
			</div>
		</form>
        
<?php 
    } else {
        if (isset($_POST['published'])) {
            $_POST['published'] = true;
        } else {
            $_POST['published'] = false;
        }
        $category = new category();
        $category->setId(intval($_GET['i']));
        $category->setContent($_POST['title_1'], $_POST['description_1'], $_POST['title_2'], $_POST['description_2'], $_POST['title_3'], $_POST['description_3'], $_POST['title_4'], $_POST['description_4'], $_POST['title_5'], $_POST['description_5'], $_POST['title_6'], $_POST['description_6'], $_POST['code']);
        $category->setUserId($account["name"]);
        $category->setDateUpdate();
        $category->setPublished($_POST['published']);
        $category->setCategoryType($_POST['category_type']);
        if ($category->update()) {
            print 'sucess';
        } else {
            print 'failure';
        }
    }
} else {
    print 'error';
}
?>
</div>
开发者ID:DaniJCV,项目名称:BO2-BOxygen,代码行数:30,代码来源:category_edit.php

示例3: switch

 */
if (!empty($_POST)) {
    include_once 'pear-database-category.php';
    switch (@$_POST['action']) {
        case 'add':
            if (!empty($_POST['catDesc']) and !empty($_POST['catName'])) {
                $result = category::add(array('name' => $_POST['catName'], 'desc' => $_POST['catDesc'], 'parent' => !empty($_POST['cat_parent']) ? (int) $_POST['cat_parent'] : null));
                $_SESSION['category_manager']['error_msg'] = PEAR::isError($result) ? 'Failed to insert category: ' . $result->message : 'Category added';
            } else {
                $_SESSION['category_manager']['error_msg'] = 'Please enter a name and description!';
            }
            localRedirect('/admin/category-manager.php');
            break;
        case 'update':
            if (!empty($_POST['catDesc']) and !empty($_POST['catName'])) {
                $result = category::update((int) $_POST['cat_parent'], $_POST['catName'], $_POST['catDesc']);
                $_SESSION['category_manager']['error_msg'] = PEAR::isError($result) ? 'Failed to insert category: ' . $result->message : 'Category updated';
            } else {
                $_SESSION['category_manager']['error_msg'] = 'Please enter a name and description!';
            }
            localRedirect('/admin/category-manager.php');
            break;
        case 'delete':
            if (!empty($_POST['cat_parent'])) {
                $result = category::delete($_POST['cat_parent']);
                $_SESSION['category_manager']['error_msg'] = PEAR::isError($result) ? 'Failed to delete category: ' . $result->message : 'Category deleted';
            } else {
                $_SESSION['category_manager']['error_msg'] = 'Please select a category';
            }
            localRedirect('/admin/category-manager.php');
            break;
开发者ID:stof,项目名称:pearweb,代码行数:31,代码来源:category-manager.php

示例4: category

         $_SESSION['errors'] = $errors;
     }
     if ($category->category_is_exist($_GET['name'])) {
         $errors[] = "the category is already exist";
         $_SESSION['errors'] = $errors;
     }
     if (empty(trim($_GET['desc']))) {
         $errors[] = "the desc is empty";
         $_SESSION['errors'] = $errors;
     }
     if (!empty($errors)) {
         $errors[] = $_GET["id"];
     } else {
         $category->category_name = $_GET['name'];
         $category->category_desc = $_GET['desc'];
         $category->update();
     }
     $data = $category->getallcategory();
     $response1 = [];
     $response1[] = $data;
     $response1[] = $errors;
     $jsondata = json_encode($response1);
     echo $jsondata;
     // $jsondata = json_encode($data);
     // echo $jsondata;
 }
 if ($_GET['value'] == 'Edit') {
     $category = new category($_GET['id']);
     $jsondata = json_encode($category);
     echo $jsondata;
 }
开发者ID:sherif700,项目名称:ourWork,代码行数:31,代码来源:category_server.php

示例5: dmsg

     dmsg('更新成功', "?mid={$mid}&file={$file}");
     break;
 case 'delete':
     if ($catid) {
         $catids = $catid;
     }
     $catids or msg();
     $do->delete($catids);
     $NUM > 200 ? $do->cache() : $do->repair();
     dmsg('删除成功', $forward);
     break;
 case 'update':
     if (!$category || !is_array($category)) {
         msg();
     }
     $do->update($category);
     foreach ($category as $catid => $v) {
         $CATEGORY[$catid] = $db->get_one("SELECT * FROM {$table} WHERE catid={$catid}");
         update_category($CATEGORY[$catid]);
     }
     $NUM > 200 ? $do->cache() : $do->repair();
     dmsg('更新成功', $forward);
     break;
 case 'letters':
     $update = false;
     foreach ($CATEGORY as $k => $v) {
         if (strlen($v['letter']) != 1) {
             $letter = $do->get_letter($v['catname'], false);
             if ($letter) {
                 $update = true;
                 $letter = substr($letter, 0, 1);
开发者ID:hcd2008,项目名称:destoon,代码行数:31,代码来源:category.inc.php

示例6: split_authority

 public function split_authority($id_authority)
 {
     $query = "select * from authorities_sources where num_authority = " . $id_authority . " and authority_type= '" . $this->notice->type . "' and num_origin_authority = " . $this->num_origin;
     $result = mysql_query($query);
     if (mysql_num_rows($result)) {
         $infos = mysql_fetch_object($result);
     }
     $data = addslashes_array($this->notice->specifics_data);
     switch ($this->notice->type) {
         case "author":
             $authority = new auteur(0);
             break;
         case "uniform_title":
             $authority = new titre_uniforme(0);
             break;
         case "collection":
             $authority = new collection(0);
             break;
         case "subcollection":
             $authority = new subcollection(0);
             break;
         case "category":
             //si on split une catégorie, on le fait dans la même branche...
             $query = "select num_parent from noeuds where id_noeud = " . $id_authority;
             $result = mysql_query($query);
             if (mysql_num_rows($result)) {
                 $num_parent = mysql_result($result, 0, 0);
             } else {
                 $num_parent = $this->get_parent_category();
             }
             $authority = new category(0);
             break;
         default:
             //	on fait rien...
             break;
     }
     if ($authority && !$authority->import_denied) {
         if ($this->notice->type == "category") {
             $result = $authority->update($data, $this->id_thesaurus, $num_parent, $this->notice->common_data['lang']);
         } else {
             $result = $authority->update($data, true);
         }
         if ($result) {
             $this->splitted = true;
             $this->authority_id = $authority->id;
             if ($infos->id_authority_source) {
                 $query = "update authorities_sources set \n\t\t\t\t\t\tnum_authority_source = " . $this->authority_id . ",\n\t\t\t\t\t\tauthority_favorite = 1,\n\t\t\t\t\t\tupdate_date = now() \n\t\t\t\t\twhere id_authority_source = " . $infos->id_authority_source;
                 mysql_query($query);
                 //on doit aussi gérer la séparation dans les notices
                 $query = "select * from notices_authorities_sources where num_authority_source = " . $infos->id_authority_source;
                 $result = mysql_query($query);
                 if (mysql_num_rows($result)) {
                     while ($row = mysql_fetch_object($result)) {
                         switch ($this->notice->type) {
                             case "author":
                                 $query = "update responsability set responsability_author = " . $this->authority_id . " where responsability_author = " . $info->num_authority . " and responsability_notice = " . $row->num_notice;
                                 break;
                             case "uniform_title":
                                 $query = "update notices_titres_uniformes set ntu_num_tu = " . $this->authority_id . " where ntu_num_tu = " . $info->num_authority . " and ntu_num_notice = " . $row->num_notice;
                                 break;
                             case "collection":
                                 $query = "update notices set coll_id = " . $this->authority_id . ", subcoll_id = 0 where notice_id = " . $row->num_notice;
                                 break;
                             case "subcollection":
                                 $query = "update notices set subcoll_id = " . $this->authority_id . " where notice_id = " . $row->num_notice;
                                 break;
                             case "category":
                                 $query = "update notices_categories set num_noeud = " . $this->authority_id . " where notcateg_notice = " . $row->num_notice;
                                 break;
                             default:
                                 $query = "";
                         }
                         if ($query != "") {
                             mysql_query($query);
                         }
                     }
                     return true;
                 }
             } else {
                 $query = "insert into authorities_sources set \n\t\t\t\t\t\tnum_authority = " . $this->authority_id . ",\n\t\t\t\t\t\tauthority_number = '" . $this->notice->common_data['authority_number'] . "',\t\n\t\t\t\t\t\tauthority_type = '" . $this->notice->type . "',\n\t\t\t\t\t\tnum_origin_authority = " . $this->num_origin . ",\n\t\t\t\t\t\tauthority_favorite = 1,\n\t\t\t\t\t\timport_date = now(),\n\t\t\t\t\t\tupdate_date = now()";
                 return mysql_query($query);
             }
         }
     }
     return false;
 }
开发者ID:bouchra012,项目名称:PMB,代码行数:86,代码来源:authority_import.class.php

示例7: update_category

 private function update_category($data)
 {
     if ($this->user['SiteRank'] >= 4) {
         if (isset($data['cat'])) {
             $category = category::get($data['cat']);
             if ($category != null && $data['name'] != '' && $data['name'] != ' ') {
                 $result = category::update($data);
                 //Build event details to log
                 // $logEventID = '132';
                 // $logDetails = 'Forum post id:'.$post_id.' in thread id:'.$thread.' for category id:'.$category.' deleted!';
                 // $logEventAuthor = $this->user['Username'];
                 //Write to admin log.
                 // $this->eventLog($logEventID, $logDetails, $logEventAuthor);
                 json::resp(array('success' => true));
             } else {
                 self::errorJSON('Error updating category!');
             }
         }
     }
 }
开发者ID:TheDoxMedia,项目名称:pgs,代码行数:20,代码来源:forum.worker.php

示例8: exit

if (!defined("EXPONENT")) {
    exit("");
}
$cat = null;
if (isset($_POST['id'])) {
    $cat = $db->selectObject("category", "id=" . intval($_POST['id']));
}
if ($cat) {
    $loc = unserialize($cat->location_data);
} else {
    $loc->mod = $_POST['orig_module'];
    // Only need to update the module.
    $cat->rank = $db->max('category', 'rank', 'location_data', "location_data='" . serialize($loc) . "'");
    if ($cat->rank === null) {
        $cat->rank = 0;
    } else {
        $cat->rank++;
    }
}
if (exponent_permissions_check('manage_categories', $loc)) {
    $cat = category::update($_POST, $cat);
    $cat->location_data = serialize($loc);
    if (isset($cat->id)) {
        $db->updateObject($cat, "category");
    } else {
        $db->insertObject($cat, "category");
    }
    exponent_flow_redirect();
} else {
    echo SITE_403_HTML;
}
开发者ID:BackupTheBerlios,项目名称:exponentva-svn,代码行数:31,代码来源:save.php

示例9: category

<?php

include 'categoryclass.php';
$categ = new category();
if (isset($_POST['save'])) {
    if (!empty(trim($_POST['catname']))) {
        $cat_id = $_POST['cat_id'];
        $categ->name = $_POST['catname'];
        $categ->update($cat_id);
        header("location:addcategory.php");
    } else {
        header("location:addcategory.php");
    }
}
开发者ID:zeinamagdy,项目名称:E-Commerce-Web-Application-,代码行数:14,代码来源:updatecat.php


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