function action() { $category = new Category(); $kdgs = new Kdgs(); $album = new Album(); $story_url = new StoryUrl(); $category_list = $category->get_list("`res_name`='kdgs' and `s_id`='0'"); foreach ($category_list as $k => $v) { $page = 1; while (true) { $album_list = $kdgs->get_children_category_album_list($v['s_p_id'], $page); if (!$album_list) { break; } foreach ($album_list as $k2 => $v2) { $exists = $album->check_exists("`link_url` = '{$v2['url']}'"); if ($exists) { continue; } $album_id = $album->insert(array('title' => $v2['title'], 'min_age' => $v2['min_age'], 'max_age' => $v2['max_age'], 'intro' => '', 's_cover' => $v2['cover'], 'link_url' => $v2['url'], 'add_time' => date('Y-m-d H:i:s'))); $story_url->insert(array('res_name' => 'album', 'res_id' => $album_id, 'field_name' => 'cover', 'source_url' => $v2['cover'], 'source_file_name' => ltrim(strrchr($v2['cover'], '/'), '/'), 'add_time' => date('Y-m-d H:i:s'))); } $page++; } } }
function get_filters_names($conn) { $filter = array(); //Reputation Activities $filter['act'] = Reputation::get_reputation_activities($conn); //Product types $product_types = Product_type::get_list($conn); $filter['ptype'][0] = _('ANY'); foreach ($product_types as $ptype) { $filter['ptype'][$ptype->get_id()] = $ptype->get_name(); } //Subcategories $subcategories = Subcategory::get_list($conn); $filter['subcat'][0] = _('ANY'); foreach ($subcategories as $subc) { $filter['subcat'][$subc->get_id()] = $subc->get_name(); } //Categories $categories = Category::get_list($conn); $filter['cat'][0] = _('ANY'); foreach ($categories as $cat) { $filter['cat'][$cat->get_id()] = $cat->get_name(); } return $filter; }
function action() { // 子类 $category = new Category(); $kdgs = new Kdgs(); $story_url = new StoryUrl(); $current_time = date('Y-m-d H:i:s'); $parent_category_list = $kdgs->get_parent_category($this->home_url); foreach ($parent_category_list as $k => $v) { $exists = $category->check_exists("`res_name`='kdgs' and `s_id`='{$v['s_id']}'"); if ($exists) { continue; } else { $category_id = $category->insert(array('res_name' => 'kdgs', 'parent_id' => 0, 'title' => $v['title'], 's_id' => $v['s_id'], 's_p_id' => 0, 'from_url' => $this->home_url, 'link_url' => $v['link_url'], 's_cover' => $v['cover'], 'add_time' => date('Y-m-d H:i:s'))); $story_url->insert(array('res_name' => 'category', 'res_id' => $category_id, 'field_name' => 'cover', 'source_url' => $v['cover'], 'source_file_name' => ltrim(strrchr($v['cover'], '/'), '/'), 'add_time' => date('Y-m-d H:i:s'))); echo $category_id; echo "<br />"; } } // 子类 $category_list = $category->get_list("`res_name`='kdgs' and `s_p_id`=0"); foreach ($category_list as $k => $v) { $children_category_list = $kdgs->get_children_category_list($v['link_url']); foreach ($children_category_list as $k2 => $v2) { $exists = $category->check_exists("`res_name`='kdgs' and `s_id`='0' and `s_p_id`='{$v2['s_p_id']}'"); if ($exists) { continue; } else { $category_id = $category->insert(array('res_name' => 'kdgs', 'parent_id' => $v['id'], 'title' => $v2['title'], 's_id' => 0, 's_p_id' => $v2['s_p_id'], 'from_url' => $v['link_url'], 'link_url' => $v2['link_url'], 's_cover' => $v2['cover'], 'add_time' => date('Y-m-d H:i:s'))); $story_url->insert(array('res_name' => 'category', 'res_id' => $category_id, 'field_name' => 'cover', 'source_url' => $v2['cover'], 'source_file_name' => ltrim(strrchr($v2['cover'], '/'), '/'), 'add_time' => date('Y-m-d H:i:s'))); echo "children:" . $category_id; echo "<br />"; } } } }
} echo json_encode($data); exit; } $db = new ossim_db(); $conn = $db->connect(); $plugin_id = REQUEST('plugin_id'); $name = REQUEST('ds_name'); $sid = REQUEST('sid'); $reliability = REQUEST('reliability'); $priority = REQUEST('priority'); $category = REQUEST('category'); $subcategory = REQUEST('subcategory'); $validation_errors = validate_form_fields('POST', $validate); $data['status'] = 'OK'; $list_categories = Category::get_list($conn); if ($priority < 0 || $priority > 5) { $validation_errors['priority'] = _('Priority must be between 0 and 5'); } if ($reliability < 0 || $reliability > 10) { $validation_errors['reliability'] = _('Reliability must be between 0 and 10'); } $data['data'] = $validation_errors; if (POST('ajax_validation_all') == TRUE) { if (is_array($validation_errors) && !empty($validation_errors)) { $data['status'] = 'error'; echo json_encode($data); } else { $data['status'] = 'OK'; echo json_encode($data); }
Session::logcheck("configuration-menu", "ConfigurationPlugins"); $plugin_id = GET('plugin_id'); $category_id = GET('category_id'); $subcategory_id = GET('subcategory_id'); ossim_valid($plugin_id, OSS_ALPHA, 'illegal:' . _("Plugin ID")); ossim_valid($category_id, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Category ID")); ossim_valid($subcategory_id, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("SubCategory ID")); if (ossim_error()) { die(ossim_error()); } $db = new ossim_db(); $conn = $db->connect(); // translate category id $category_name = ''; if ($category_id != "") { if ($category_list = Category::get_list($conn, "WHERE id = '{$category_id}'")) { $category_name = $category_list[0]->get_name(); } } //Subcategory $subcategory_name = ''; if ($subcategory_id != "") { if ($subcategory_list = Subcategory::get_list($conn, "WHERE id = '{$subcategory_id}'")) { $subcategory_name = $subcategory_list[0]->get_name(); } } $category_filter = $subcategory_name != "" ? "{$category_name} - {$subcategory_name}" : $category_name; $dt_url = "getpluginsid.php?plugin_id={$plugin_id}"; if ($category_id != "") { $dt_url .= "&category_id={$category_id}"; }
function taxonomy_select($conn) { $product_types = Product_type::get_list($conn); $select = "<div class='select_div_first' >"; $select .= "<div style='float:left;'>" . _('Product Type') . ": </div>"; $select .= "<div style='float:right;'><select id='ptypeselect' style='width:210px;text-align:left;'>"; $select .= "<option title='" . _('Any') . "' value='0' >" . _('Any') . "</option>"; if (is_array($product_types)) { foreach ($product_types as $ptype) { $ptype_name = strlen($ptype->get_name()) > 36 ? substr($ptype->get_name(), 0, 39) . "..." : $ptype->get_name(); $select .= "<option title='" . $ptype->get_name() . "' value='" . $ptype->get_id() . "' >" . $ptype_name . "</option>"; } } $select .= "</select></div></div><br>"; $select .= "<div class='select_div'>"; $select .= "<div style='float:left;'>" . _('Category') . ": </div>"; $select .= "<div style='float:right;'><select id='catselect' style='width:210px;text-align:left;' onchange='change_type(\"subcategory\", \$(this).val())'>"; $select .= "<option title='" . _('Any') . "' value='0' >" . _('Any') . "</option>"; $cat_list = Category::get_list($conn); if (is_array($product_types)) { foreach ($cat_list as $cat) { $cat_name = strlen($cat->get_name()) > 36 ? substr($cat->get_name(), 0, 39) . "..." : $cat->get_name(); $select .= "<option title='" . $cat->get_name() . "' value='" . $cat->get_id() . "' >" . $cat_name . "</option>"; } } $select .= "</select></div></div><br>"; $select .= "<div class='select_div'>"; $select .= "<div style='float:left;'>" . _('Subategory') . ": </div>"; $select .= "<div style='float:right;'><select id='subcatselect' style='width:210px;text-align:left;' >"; $select .= "<option title='" . _('Any') . "' value='0' >" . _('Any') . "</option>"; $select .= "</select></div></div><br>"; return $select; }