forked from extern/egroupware
added global cats
This commit is contained in:
parent
37cdf6faf1
commit
5c4dbe12cc
@ -48,7 +48,7 @@
|
|||||||
$t->set_var('hidden_vars','<input type="hidden" name="cat_id" value="' . $cat_id . '">');
|
$t->set_var('hidden_vars','<input type="hidden" name="cat_id" value="' . $cat_id . '">');
|
||||||
$t->set_var('lang_select_parent',lang('Select parent category'));
|
$t->set_var('lang_select_parent',lang('Select parent category'));
|
||||||
|
|
||||||
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent));
|
$t->set_var('category_list',$c->formated_list('select','False','all',$cat_parent));
|
||||||
$t->set_var('lang_name',lang('Category name'));
|
$t->set_var('lang_name',lang('Category name'));
|
||||||
$t->set_var('lang_descr',lang('Category description'));
|
$t->set_var('lang_descr',lang('Category description'));
|
||||||
$t->set_var('cat_name',$cat_name);
|
$t->set_var('cat_name',$cat_name);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**************************************************************************\
|
/**************************************************************************\
|
||||||
* phpGroupWare - Admin *
|
* phpGroupWare - Admin - Global categories *
|
||||||
* http://www.phpgroupware.org *
|
* http://www.phpgroupware.org *
|
||||||
* Written by Bettina Gille [ceb@phpgroupware.org] *
|
* Written by Bettina Gille [ceb@phpgroupware.org] *
|
||||||
* ----------------------------------------------- *
|
* ----------------------------------------------- *
|
||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
$c = CreateObject('phpgwapi.categories');
|
$c = CreateObject('phpgwapi.categories');
|
||||||
$c->categories($phpgw_info['user']['account_id'],'phpgw');
|
$c->categories($phpgw_info['user']['account_id'],'phpgw');
|
||||||
$categories = $c->return_array($type,$start,$limit,$query,$sort,$order);
|
$categories = $c->return_array('False','all',$start,$limit,$query,$sort,$order);
|
||||||
|
|
||||||
//--------------------------------- nextmatch --------------------------------------------
|
//--------------------------------- nextmatch --------------------------------------------
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
|
|
||||||
$t->set_var('cat_name',$phpgw->strip_html($cats[0]['name']));
|
$t->set_var('cat_name',$phpgw->strip_html($cats[0]['name']));
|
||||||
$t->set_var('cat_description',$phpgw->strip_html($cats[0]['description']));
|
$t->set_var('cat_description',$phpgw->strip_html($cats[0]['description']));
|
||||||
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent));
|
$t->set_var('category_list',$c->formated_list('select','False','all',$cat_parent));
|
||||||
|
|
||||||
$t->set_var('edithandle','');
|
$t->set_var('edithandle','');
|
||||||
$t->set_var('addhandle','');
|
$t->set_var('addhandle','');
|
||||||
|
@ -82,12 +82,17 @@
|
|||||||
@param $order order by
|
@param $order order by
|
||||||
@result $cats array
|
@result $cats array
|
||||||
*/
|
*/
|
||||||
function return_array($type = 'all',$start,$limit,$query = '',$sort = '',$order = '')
|
function return_array($public = 'False',$type = 'all',$start,$limit,$query = '',$sort = '',$order = '')
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
$this->db2 = $this->db;
|
$this->db2 = $this->db;
|
||||||
|
|
||||||
|
if ($public == 'True')
|
||||||
|
{
|
||||||
|
$public_cats = " OR cat_appname='phpgw' ";
|
||||||
|
}
|
||||||
|
|
||||||
$filter = $this->filter($type);
|
$filter = $this->filter($type);
|
||||||
if (!$sort)
|
if (!$sort)
|
||||||
{
|
{
|
||||||
@ -105,13 +110,13 @@
|
|||||||
|
|
||||||
if ($query)
|
if ($query)
|
||||||
{
|
{
|
||||||
$sql = "select * from phpgw_categories where cat_appname='" . $this->app_name . "' and "
|
$sql = "select * from phpgw_categories where cat_appname='" . $this->app_name . "' $public_cats and "
|
||||||
. "(cat_name like '%$query%' or cat_description like '%$query%') $filter $ordermethod";
|
. "(cat_name like '%$query%' or cat_description like '%$query%') $filter $ordermethod";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = "select * from phpgw_categories where cat_appname='" . $this->app_name . "'"
|
$sql = "select * from phpgw_categories where cat_appname='" . $this->app_name . "'"
|
||||||
. "$filter $ordermethod";
|
. "$public_cats $filter $ordermethod";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db2->query($sql,__LINE__,__FILE__);
|
$this->db2->query($sql,__LINE__,__FILE__);
|
||||||
@ -123,6 +128,7 @@
|
|||||||
{
|
{
|
||||||
$cats[$i]['id'] = $this->db->f('cat_id');
|
$cats[$i]['id'] = $this->db->f('cat_id');
|
||||||
$cats[$i]['owner'] = $this->db->f('cat_owner');
|
$cats[$i]['owner'] = $this->db->f('cat_owner');
|
||||||
|
$cats[$i]['app_name'] = $this->db->f('cat_appname');
|
||||||
$cats[$i]['parent'] = $this->db->f('cat_parent');
|
$cats[$i]['parent'] = $this->db->f('cat_parent');
|
||||||
$cats[$i]['name'] = $this->db->f('cat_name');
|
$cats[$i]['name'] = $this->db->f('cat_name');
|
||||||
$cats[$i]['description'] = $this->db->f('cat_description');
|
$cats[$i]['description'] = $this->db->f('cat_description');
|
||||||
@ -175,7 +181,7 @@
|
|||||||
$this->app_name = $app_name;
|
$this->app_name = $app_name;
|
||||||
$this->db = $phpgw->db;
|
$this->db = $phpgw->db;
|
||||||
$this->total_records = $this->db->num_rows();
|
$this->total_records = $this->db->num_rows();
|
||||||
$this->cats = $this->return_array($type,$start,$limit,$query,$sort,$order);
|
$this->cats = $this->return_array($public,$type,$start,$limit,$query,$sort,$order);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return into a select box, list or other formats
|
// Return into a select box, list or other formats
|
||||||
@ -187,15 +193,20 @@
|
|||||||
@param $selected ?
|
@param $selected ?
|
||||||
@result $s array - populated with categories
|
@result $s array - populated with categories
|
||||||
*/
|
*/
|
||||||
function formated_list($format,$type,$selected = "")
|
function formated_list($format,$public = 'False',$type,$selected = "")
|
||||||
{
|
{
|
||||||
global $phpgw;
|
global $phpgw;
|
||||||
$filter = $this->filter($type);
|
$filter = $this->filter($type);
|
||||||
|
|
||||||
|
if ($public == 'True')
|
||||||
|
{
|
||||||
|
$public_cats = " OR cat_appname='phpgw' ";
|
||||||
|
}
|
||||||
|
|
||||||
if ($format == 'select')
|
if ($format == 'select')
|
||||||
{
|
{
|
||||||
$this->db->query("select * from phpgw_categories where cat_appname='" . $this->app_name
|
$this->db->query("select * from phpgw_categories where cat_appname='" . $this->app_name
|
||||||
. "' $filter",__LINE__,__FILE__);
|
. "' $public_cats $filter",__LINE__,__FILE__);
|
||||||
while ($this->db->next_record())
|
while ($this->db->next_record())
|
||||||
{
|
{
|
||||||
$s .= '<option value="' . $this->db->f('cat_id') . '"';
|
$s .= '<option value="' . $this->db->f('cat_id') . '"';
|
||||||
|
Loading…
Reference in New Issue
Block a user