Пример #1
0
	        <br />
			<?php 
    if (!empty($categories)) {
        ?>
				<select name="cat_parent_id" id="category_parent"><?php 
        if ($parent_id) {
            $current_cat_id = $parent_id;
            $exclude = false;
            /* don't exclude the children */
        } else {
            $current_cat_id = $cat_id;
            $exclude = true;
            /* exclude the children */
        }
        echo '<option value="0">&nbsp;&nbsp;&nbsp; ' . _AT('cats_all') . ' &nbsp;&nbsp;&nbsp;</option>';
        select_link_categories($categories, 0, $current_cat_id, FALSE);
        ?>
				</select>
			<?php 
    }
    ?>
		</div>

		<div class="row">
			<label for="search"><?php 
    echo _AT('search');
    ?>
 (<?php 
    echo _AT('title') . ', ' . _AT('description');
    ?>
)</label><br />
Пример #2
0
			<select name="cat_parent_id" id="category_parent">
			<?php 
    if ($pcat_id) {
        $current_cat_id = $pcat_id;
        $exclude = false;
        /* don't exclude the children */
    } else {
        $current_cat_id = $cat_id;
        $exclude = true;
        /* exclude the children */
    }
    $auth = manage_links();
    if ($auth == LINK_CAT_AUTH_ALL) {
        echo '<option value="0"></option>';
    }
    select_link_categories($categories, 0, $current_cat_id, $exclude, 0, TRUE);
    ?>
			</select>
		<?php 
} else {
    echo _AT('cats_no_categories');
}
?>
	</div>

	<div class="row buttons">
		<input type="submit" name="submit" value="<?php 
echo _AT('save');
?>
" accesskey="s" />
		<input type="submit" name="cancel" value="<?php 
Пример #3
0
function select_link_categories($categories, $cat_id, $current_cat_id, $exclude, $depth = 0, $owner = FALSE)
{
    if ($cat_id == 0 && is_array($categories[0])) {
        foreach ($categories[0] as $child_cat_id) {
            select_link_categories($categories, $child_cat_id, $current_cat_id, $depth, 0, $owner);
        }
    } else {
        $row = queryDB('SELECT name, owner_type, owner_id FROM %slinks_categories WHERE cat_id=%d', array(TABLE_PREFIX, $cat_id), true);
        if ($exclude && $cat_id == $current_cat_id) {
            return;
        }
        if ($owner) {
            echo '<option value="' . $cat_id . '-' . $row['owner_type'] . '-' . $row['owner_id'] . '"';
        } else {
            echo '<option value="' . $cat_id . '"';
        }
        if ($exclude && is_array($categories[$cat_id]['children']) && in_array($current_cat_id, $categories[$cat_id]['children'])) {
            echo ' selected="selected"';
        } else {
            if (!$exclude && $cat_id == $current_cat_id) {
                echo ' selected="selected"';
            }
        }
        echo '>';
        echo str_repeat("&nbsp;", $depth * 4);
        echo $categories[$cat_id]['cat_name'] . '</option>';
        if (is_array($categories[$cat_id]['children'])) {
            foreach ($categories[$cat_id]['children'] as $child_cat_id) {
                select_link_categories($categories, $child_cat_id, $current_cat_id, $exclude, $depth + 1, $owner);
            }
        }
    }
}
Пример #4
0
echo $_POST['title'];
?>
"/>
	</div>

	<div class="row">
		<span class="required" title="<?php 
echo _AT('required_field');
?>
">*</span><label for="cat"><?php 
echo _AT('category');
?>
</label><br />
		<select name="cat" id="cat">
			<?php 
select_link_categories($categories, 0, $_POST['cat'], FALSE);
?>
		</select>
	</div>
	
	<div class="row">
		<span class="required" title="<?php 
echo _AT('required_field');
?>
">*</span><label for="url"><?php 
echo _AT('url');
?>
</label><br />
		<input type="text" name="url" size="40" id="url" value="<?php 
echo $_POST['url'];
?>
Пример #5
0
function select_link_categories($categories, $cat_id, $current_cat_id, $exclude, $depth=0, $owner=FALSE) {
	global $db; 

	if ($cat_id == 0 && is_array($categories[0])) {
		foreach($categories[0] as $child_cat_id) {
			select_link_categories($categories, $child_cat_id, $current_cat_id, $depth, 0, $owner);
		}
	} else {
		$sql = "SELECT name, owner_type, owner_id FROM ".TABLE_PREFIX."links_categories WHERE cat_id=$cat_id";
		$result = mysql_query($sql, $db);
		$row = mysql_fetch_assoc($result);


		if ($exclude && ($cat_id == $current_cat_id)) {
			return;
		}

		if ($owner) {
			echo '<option value="'.$cat_id.'-'.$row['owner_type'].'-'.$row['owner_id'].'"';
		} else  {
			echo '<option value="'.$cat_id.'"';
		}
	
		if ($exclude && is_array($categories[$cat_id]['children']) && in_array($current_cat_id, $categories[$cat_id]['children'])) {
			echo ' selected="selected"';
		} else if (!$exclude && ($cat_id == $current_cat_id)) {
			echo ' selected="selected"';
		}
		echo '>';
		echo str_repeat("&nbsp;", $depth*4);
		echo $categories[$cat_id]['cat_name'].'</option>';

		if (is_array($categories[$cat_id]['children'])) {
			foreach($categories[$cat_id]['children'] as $child_cat_id) {
				select_link_categories($categories, $child_cat_id, $current_cat_id, $exclude, $depth+1, $owner);
			}
		}
	}
}