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


PHP Links::save_category方法代码示例

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


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

示例1: Links

            $error_array[] = "Please select a category";
        }
    } else {
        // adding new category.
        if (empty($_POST['category_name'])) {
            $error_array[] = "Please enter a category name";
        } else {
            if (!Validation::validate_alpha_numeric($_POST['category_name'], 1)) {
                $error_array[] = "Please enter a valid category name";
            } else {
                if (!empty($_POST['category_name'])) {
                    try {
                        $Links = new Links();
                        $param_array = array('user_id' => $_SESSION['user']['id'], 'category_name' => $_POST['category_name'], 'created' => time(), 'changed' => time());
                        $Links->set_params($param_array);
                        $Links->save_category();
                        $error_array[] = "Category added successfully";
                    } catch (PAException $e) {
                        $error_array[] = $e->message;
                    }
                }
            }
        }
    }
} else {
    if (!empty($_POST['btn_save_link'])) {
        if (empty($_POST['link_categories'])) {
            $error_array[] = "Please select a category";
        }
        if (empty($_POST['title'])) {
            $error_array[] = "Please enter a title for the link";
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:links_management.php

示例2: catch

             $Links->update_category();
             $json_string = '{ "errors" : "List has been updated successfully", "updated_category_id" : ' . $_POST['category_id'] . '}';
         } catch (PAException $e) {
             $json_string = '{ "is_error" : true, "errors" : "List with specified name already exists"}';
         }
         print $json_string;
     }
 } else {
     if (!empty($_POST) && $_POST['form_action'] == 'create_list') {
         $json_string = null;
         if (!empty($_POST['category_name'])) {
             $Links = new Links();
             $Links->user_id = $_SESSION['user']['id'];
             $Links->category_name = $_POST['category_name'];
             try {
                 $category_id = $Links->save_category();
                 $json_string = '{ "errors" : "List has saved successfully", "updated_category_id" : ' . $category_id . '}';
             } catch (PAException $e) {
                 $json_string = '{ "is_error" : true, "errors" : "List with specified name already exists"}';
             }
             print $json_string;
         }
         /**
         * Code for updating the selected links
         */
     } else {
         if (!empty($_POST) && $_POST['form_action'] == 'update_links') {
             $link_count = count($_POST['link_id_updated']);
             $Links = new Links();
             $updated_links_count = 0;
             $Links->user_id = $_SESSION['user']['id'];
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:31,代码来源:ajax_links.php

示例3: add_default_links

 public static function add_default_links($user_id)
 {
     require_once "api/CNNetworkLinks/CNNetworkLinks.php";
     require_once "api/CNLinks/CNLinks.php";
     $network_links = new NetworkLinks();
     $network_owner_id = PA::$network_info->type == MOTHER_NETWORK_TYPE ? SUPER_USER_ID : Network::get_network_owner(PA::$network_info->network_id);
     $condition = array('user_id' => $network_owner_id, 'is_active' => 1);
     $link_categories = $network_links->load_category($condition);
     // load category as set by network operator
     $Links = new Links();
     $error_array = array();
     //providing default links to the user, as set by network operator
     for ($counter = 0; $counter < count($link_categories); $counter++) {
         $param_array = array('category_name' => $link_categories[$counter]->category_name, 'user_id' => $user_id, 'created' => time(), 'changed' => time(), 'is_active' => ACTIVE);
         $Links->set_params($param_array);
         $category_id = $Links->save_category();
         // save network operator category as user's link category
         $network_lists = new NetworkLinks();
         $network_lists->user_id = $network_info->owner_id;
         $condition = array('category_id' => $link_categories[$counter]->category_id, 'is_active' => ACTIVE);
         $list_array = $network_lists->load_link($condition);
         // load list for network operator's category
         for ($i = 0; $i < count($list_array); $i++) {
             $param_array = array('title' => $list_array[$i]->title, 'url' => $list_array[$i]->url, 'category_id' => $category_id, 'created' => time(), 'changed' => time(), 'is_active' => ACTIVE);
             $Links->set_params($param_array);
             $Links->save_link();
             // save network operator list as user's list
         }
     }
 }
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:30,代码来源:CNUserRegistration.php


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