function category_tree($tree) { if (!is_array($tree)) { return ''; } $output = '<ul>'; foreach ($tree as $node) { $output .= '<li>'; $output .= $node['item']->strnama_dealer; $output .= category_tree($node['child']); $output .= '</li>'; } return $output . '</ul>'; }
?> ><?php _e("Select a category"); ?> </option> <?php $pt_opts = array(); $pt_opts['link'] = "{empty}{title}"; $pt_opts['list_tag'] = " "; $pt_opts['list_item_tag'] = "option"; $pt_opts['active_ids'] = $category_id; $pt_opts['active_code_tag'] = ' selected="selected" '; $pt_opts['rel_type'] = 'content'; $pt_opts['rel_id'] = $posts_parent_page; category_tree($pt_opts); ?> </option> </select> </div> <?php } ?>
if (!isset($leaves)) { $leaves = ":1:"; } if (isset($addid)) { $leaves .= ":{$addid}:"; } if (isset($delid)) { $leaves = str_replace(":{$delid}:", "", $leaves); } if ($action == "db_set") { // DB SET $query = "UPDATE tblsolutions SET category_id='{$cate_id}' WHERE solutions_id='{$solu_id}'"; $db->query($query); } /*------------------------------------------------------- BOX tbllicense */ $bx->box_begin(); $bx->box_title($t->translate("Select Category of Solution")); $bx->box_body_begin(); /*----------------------------------------------------------- whole Tree */ category_tree(0, 0, $cate_id); /*-----------------------------------------------------------------------*/ $bx->box_body_end(); $bx->box_end(); /*-----------------------------------------------------------------------*/ echo "<p align='center'><b>[<a href='" . $sess->url("newsolutions.php") . $sess->add_query(array("solu_id" => $solu_id)) . "'>" . $t->translate("Back to your solution") . "</a>]</b>"; ?> <!-- end content --> <?php require "footer.inc"; @page_close();
$params ['include_first'] = true; $params ['ul_class_name'] = 'category_tree'; /*$actve_ids = ($params ['actve_ids']) ? $params ['actve_ids'] : false; $active_code = ($params ['active_code']) ? $params ['active_code'] : false; $remove_ids = ($params ['remove_ids']) ? $params ['remove_ids'] : false; $removed_ids_code = ($params ['removed_ids_code']) ? $params ['removed_ids_code'] : false; $ul_class_name = ($params ['ul_class_name']) ? $params ['ul_class_name'] : false; $include_first = ($params ['include_first']) ? $params ['include_first'] : false; $content_type = ($params ['content_type']) ? $params ['content_type'] : false; $add_ids = ($params ['add_ids']) ? $params ['add_ids'] : false; $orderby = ($params ['orderby']) ? $params ['orderby'] : false;*/ category_tree( $params ) ; ?> <? if($params['update_field']): ?> <script type="text/javascript"> $(document).ready(function () { //$("<? print $params['update_field'] ?>").click(function(){alert(this.value)}) /*var Catval = ""; $("#<? print $rand_id ?> span.active").each(function(){ if(Catval==""){ Catval = Catval + $(this).attr("category_id") } else{ Catval = Catval + "," + $(this).attr("category_id") }
<h2> <? if($params['title'] != false): ?> <? print $params['title']; ?> <? else : ?> <? print $config['params']['title']['default']; ?> <? endif; ?> </h2> <? //p($params); ?> <? category_tree($params) ?>
function addEvents() { global $o, $c, $m, $a, $y, $w, $id, $table_prefix, $page_title, $calendar_title, $supergroup, $supercategory, $lang; $title = $_REQUEST["title"]; $venue = $_REQUEST["venue"]; $contact = $_REQUEST["contact"]; $category = $_REQUEST["category"]; $group = $_REQUEST["group"]; $date = $_REQUEST["date"]; $start = $_REQUEST["start"]; $end = $_REQUEST["end"]; $description = $_REQUEST["description"]; while (list($k, $v) = each($start)) { $dstart = eregi_replace("([0-9]{1,2}:[0-9]{2}):[0-9]{2}([ ]?[a|p]m)", "\\1\\2", $v); $dend = eregi_replace("([0-9]{1,2}:[0-9]{2}):[0-9]{2}([ ]?[a|p]m)", "\\1\\2", $end[$k]); $dc = ""; $sc = ""; $ec = ""; if (!ereg("([0-9]{1,2})[\\/-]+([0-9]{1,2})[\\/-]+([0-9]{4})", $date[$k])) { $dc = " class=\"error\""; } if (!eregi("([0-9]{1,2}):([0-9]{2})[ ]?([a|p]m)", $dstart)) { $sc = " class=\"error\""; } if ($dend && !eregi("([0-9]{1,2}):([0-9]{2})[ ]?([a|p]m)", $dend)) { $ec = " class=\"error\""; } if ($dc | $sc | $ec) { $verify .= "There are date/time errors in your listings. "; } if (!$supercategory) { $q = "select * from " . $table_prefix . "users_to_categories where category_id = " . $category[$k] . " and user_id = " . $_SESSION["user_id"]; $qu = mysql_query($q); if (mysql_num_rows($qu) < 2) { $verify = $lang["no_permision_post_events"]; } } if (!$supergroup) { $q = "select * from " . $table_prefix . "users_to_groups where group_id = " . $group[$k] . " and user_id = " . $_SESSION["user_id"]; $qu = mysql_query($q); if (mysql_num_rows($qu) < 2) { $verify = $lang["no_permision_post_events"]; } } // verify categories } reset($start); if ($verify) { include "includes/header.php"; ?> <form action="<?php echo $PHP_SELF; ?> " method="post"> <?php include "includes/hidden_fields.php"; ?> <h3><?php echo $lang["verify_event_listings_title"]; ?> </h3> <p><?php echo $lang["errors_in_listings"]; ?> <?php echo $verify; ?> </p> <table> <tr><th><?php echo $lang["title"]; ?> </th><th><?php echo $lang["venue"]; ?> </th><th><?php echo $lang["contact_sponsor"]; ?> </th><th><?php echo $lang["category"]; ?> </th><th><?php echo $lang["group"]; ?> </th><th><?php echo $lang["date"]; ?> </th><th><?php echo $lang["start_time"]; ?> </th><th<?php echo $lang["end_time"]; ?> </th><th><?php echo $lang["description"]; ?> </th></tr> <?php while (list($k, $v) = each($start)) { $dstart = eregi_replace("([0-9]{1,2}:[0-9]{2}):[0-9]{2}([ ]?[a|p]m)", "\\1\\2", $v); $dend = eregi_replace("([0-9]{1,2}:[0-9]{2}):[0-9]{2}([ ]?[a|p]m)", "\\1\\2", $end[$k]); $dc = ""; $sc = ""; $ec = ""; if (!ereg("([0-9]{1,2})[\\/-]+([0-9]{1,2})[\\/-]+([0-9]{4})", $date[$k])) { $dc = " class=\"error\""; } if (!eregi("([0-9]{1,2}):([0-9]{2})[ ]?([a|p]m)", $dstart)) { $sc = " class=\"error\""; } if ($dend && !eregi("([0-9]{1,2}):([0-9]{2})[ ]?([a|p]m)", $dend)) { $ec = " class=\"error\""; } echo "<tr>\n"; echo "<td><input type=\"text\" size=\"20\" id=\"title[]\" name=\"title[]\" value=\"" . $title[$k] . "\"></td>\n"; echo "<td><select name=\"venue[]\" id=\"venue[]\" size=\"1\"><option value=\"1\">" . $lang["in_main_description"] . "</option>\n"; select_place($venue[$k]); echo "</select></td>\n"; echo "<td><select name=\"contact[]\" id=\"contact[]\" size=\"1\"><option value=\"1\">" . $lang["none"] . "</option>\n"; select_place($contact[$k]); echo "</select></td>\n"; echo "<td><select name=\"category[]\" id=\"category[]\" size=\"1\">\n"; $scategory = $category[$k]; category_tree(0); echo "</select></td>\n"; echo "<td><select name=\"category[]\" id=\"category[]\" size=\"1\">\n"; $sgroup = $group[$k]; group_tree(0); echo "</select></td>\n"; echo "<td><input type=\"text\"" . $dc . " id=\"date[]\" size=\"10\" name=\"date[]\" value=\"" . $date[$k] . "\"></td>\n"; echo "<td><input type=\"text\"" . $sc . " id=\"start[]\" size=\"8\" name=\"start[]\" value=\"" . $dstart . "\"></td>\n"; echo "<td><input type=\"text\"" . $ec . " id=\"end[]\" size=\"8\" name=\"end[]\" value=\"" . $dend . "\"></td>\n"; echo "<td><textarea cols=\"30\" rows=\"1\" name=\"description[]\">" . $description[$k] . "</textarea></td>\n"; echo "</tr>\n"; } echo "</table>\n"; echo "<INPUT TYPE=\"submit\" NAME=\"mode\" VALUE=\"" . $lang["add_events"] . "\"></form>"; } else { while (list($k, $v) = each($start)) { $dstart = eregi_replace("([0-9]{1,2}:[0-9]{2}):[0-9]{2}([ ]?[a|p]m)", "\\1\\2", $v); $dend = eregi_replace("([0-9]{1,2}:[0-9]{2}):[0-9]{2}([ ]?[a|p]m)", "\\1\\2", $end[$k]); $title[$k] = addslashes(strip_tags($title[$k])); $descriptioni[$k] = addslashes($description[$k]); $q = "INSERT into " . $table_prefix . "events (title, venue_id, contact_id, description, category_id, user_id, group_id) values ('" . $title[$k] . "', " . $venue[$k] . ", " . $contact[$k] . ", '" . $description[$k] . "', " . $category[$k] . ", " . $_SESSION["user_id"] . ", " . $group[$k] . ")"; $query = mysql_query($q); $event_id = mysql_insert_id(); if (!$query) { $msg .= "Database Error : " . $q; } else { if (!ereg("([0-9]{1,2})[\\/-]+([0-9]{1,2})[\\/-]+([0-9]{4})", $date[$k], $d_date)) { $msg .= "Bad Date:" . $date[$k]; } else { if (!eregi("([0-9]{1,2}):([0-9]{2})[ ]?([a|p]m)", $dstart, $start_time)) { $msg .= "Bad Start Time:" . $dstart; } else { if ($dend && !eregi("([0-9]{1,2}):([0-9]{2})[ ]?([a|p]m)", $dend, $end_time)) { $msg .= "Bad End Time:" . $dend; } else { if (strlen($d_date[1]) == 1) { $d_date[1] = "0" . $d_date[1]; } if (strlen($d_date[2]) == 1) { $d_date[2] = "0" . $d_date[2]; } if (eregi("pm", $start_time[3]) && $start_time[1] < 12) { $start_time[1] = $start_time[1] + 12; } if (eregi("pm", $end_time[3]) && $end_time[1] < 12) { $end_time[1] = $end_time[1] + 12; } if (strlen($start_time[1]) == 1) { $start_time[1] = "0" . $start_time[1]; } if (strlen($end_time[1]) == 1) { $end_time[1] = "0" . $end_time[1]; } $start_date = $d_date[3] . "-" . $d_date[1] . "-" . $d_date[2] . " " . $start_time[1] . ":" . $start_time[2]; if ($dend) { $end_date = $d_date[3] . "-" . $d_date[1] . "-" . $d_date[2] . " " . $end_time[1] . ":" . $end_time[2]; if ($end_time[1] . $end_time[2] > $start_time[1] . $start_time[2]) { $q = "INSERT into " . $table_prefix . "dates (event_id, date, end_date) values (" . $event_id . ", '" . $start_date . "', '" . $end_date . "')"; } else { $q = "INSERT into " . $table_prefix . "dates (event_id, date) values (" . $event_id . ", '" . $start_date . "')"; } } else { $q = "INSERT into " . $table_prefix . "dates (event_id, date) values (" . $event_id . ", '" . $start_date . "')"; } $query = mysql_query($q); if (!$query) { $msg .= "Database Error : " . $q; } } } } } } if (!$msg) { $msg = $lang["events_added"]; } header("Location: upload_events.php?msg=" . $msg . "&" . $common_get); } }
function category_tree($category_id) { global $table_prefix, $indent, $supercategory, $scategory; $q = "SELECT category_id, name from " . $table_prefix . "categories where sub_of = " . $category_id . " order by name"; $query = mysql_query($q); if (!$query) { echo "Database Error : " . $q; } else { while ($row = mysql_fetch_row($query)) { $mod = 0; if (!$supercategory) { $q = "select moderate from " . $table_prefix . "users_to_categories where category_id = " . $row[0] . " and user_id = " . $_SESSION["user_id"]; $qu = mysql_query($q); if (mysql_num_rows($qu) > 0) { $mod = mysql_result($qu, 0, 0); } } else { $mod = 3; } if ($mod > 0) { echo "<option value=\"" . $row[0] . "\""; if ($mod < 2) { echo " disabled"; } if ($scategory == $row[0]) { echo " SELECTED"; } echo ">" . $indent . $row[1] . "</option>\n"; } $indent .= "__"; category_tree($row[0]); $indent = substr($indent, 2); } } }
_e("Select category to edit"); ?> </h2> <div class="mw-ui-category-selector mw-ui-manage-list" id="mw-ui-category-selector-manage" style="visibility: visible;display: block"> <?php $field_name = "categories"; $selected = 0; $tree = array(); $tree['ul_class'] = 'pages_tree cat_tree_live_edit'; $tree['li_class'] = 'sub-nav'; $tree['rel_type'] = 'content'; if (isset($params['page-id']) and $params['page-id'] != false) { $tree['rel_id'] = intval($params['page-id']); } $tree['link'] = "<a href='javascript:mw.quick_cat_edit({id})'><span class='mw-icon-category'></span> {title}</a>"; category_tree($tree); ?> </div> <script type="text/javascript"> mw.live_edit_load_cats_list = function () { mw.load_module('categories/manage', '#mw_add_cat_live_edit', function () { }); } mw.quick_cat_edit = function (id) { mw.tools.loading(mwd.body) mw.$("#mw_edit_category_admin_holder").attr("data-category-id", id); mw.$(".mw-module-category-manager").hide(); mw.$("#mw-live-edit-cats-tab").removeClass('active');
if (isset($params['data-include_categories']) and isset($params['parent'])) { $params['include_categories'] = intval($params['parent']); } else { $o = get_option('include_categories', $params['id']); if ($o != false and $o == 'y') { $include_categories = $params['include_categories'] = true; } } $o = get_option('maxdepth', $params['id']); if ($o != false and intval($o) > 0) { $params['maxdepth'] = $o; } if (is_admin() == false) { $params['is_active'] = 1; } $params['return_data'] = true; $pages_tree = category_tree($params); if ($pages_tree != '') { ?> <div class="pages-nav"> <div class="well" style="padding: 0;"> <?php print $pages_tree; ?> </div> </div> <?php } ?>