preps for editgroup/newgroup and calendar

This commit is contained in:
skeeter 2001-01-31 05:51:52 +00:00
parent c4d3423bde
commit b1cf1322a6
6 changed files with 34 additions and 35 deletions

View File

@ -64,11 +64,11 @@
global $phpgw;
global $phpgw_info;
$owner = $owner==$phpgw_info["user"]["account_id"]?0:$owner;
$groups = substr($phpgw->accounts->sql_search("calendar_entry.cal_group",$owner),4);
$groups = substr($phpgw->accounts->sql_search("calendar_entry.cal_group",intval($owner)),4);
if (!$groups) {
return "";
return "";
} else {
return "(calendar_entry.cal_access='group' AND (". $groups .")) ";
return "(calendar_entry.cal_access='group' AND (". $groups .")) ";
}
}

View File

@ -73,12 +73,12 @@
$phpgw->template->set_var("bg_text",$phpgw_info["theme"]["bg_text"]);
$phpgw->template->set_var("small_calendar_prev",$phpgw->calendar->mini_calendar($thisday,$prev["month"],$prev["year"],"day.php"));
$phpgw->template->set_var("small_calendar_prev",$phpgw->calendar->mini_calendar(1,$prev["month"],$prev["year"],"day.php"));
$m = mktime(2,0,0,$thismonth,1,$thisyear);
$phpgw->template->set_var("month_identifier",lang(strftime("%B",$m)) . " " . $thisyear);
$phpgw->template->set_var("username",$phpgw->common->grab_owner_name($owner));
$phpgw->template->set_var("small_calendar_next",$phpgw->calendar->mini_calendar($thisday,$next["month"],$next["year"],"day.php"));
$phpgw->template->set_var("small_calendar_next",$phpgw->calendar->mini_calendar(1,$next["month"],$next["year"],"day.php"));
flush();
$phpgw->template->set_var("large_month",$phpgw->calendar->display_large_month($thismonth,$thisyear,True,$owner));
if (!$friendly) {

View File

@ -138,16 +138,17 @@
{
global $phpgw_info, $phpgw;
$db2 = $phpgw->db;
if (gettype($id) == "string") { $id = $this->username2userid($id); }
$groups = Array();
$group_memberhips = $phpgw->acl->get_location_list_for_id("phpgw_group", 1, "u", $id);
reset ($groups);
$num = count($group_memberhips);
for ($idx=0; $idx<$num; ++$idx){
$groups[$group_memberhips[$idx]] = 0;
$group_memberships = $phpgw->acl->get_location_list_for_id("phpgw_group", 1, "u", intval($id));
if ($group_memberships) {
for ($idx=0; $idx<count($group_memberships); $idx++){
$groups[intval($group_memberships[$idx])] = 1;
}
return $groups;
} else {
return False;
}
return $groups;
}
function read_group_names($lid = "")
@ -161,6 +162,7 @@
$db = $phpgw->db;
$i = 0;
reset($groups);
while ($groups && $group = each($groups)) {
$db->query("select group_name from groups where group_id=".$group[0],__LINE__,__FILE__);
$db->next_record();
@ -170,7 +172,6 @@
}
if (! $lid)
$this->group_names = $group_names;
return $group_names;
}

View File

@ -73,17 +73,14 @@
// Changed By: Skeeter 29 Nov 00
// This is to allow the user to search for other individuals group info....
if(!$owner) {
$owner = $phpgw_info["user"]["account_id"];
$owner = $phpgw_info["user"]["account_id"];
}
$db = $phpgw->db;
$db->query("SELECT account_lid FROM accounts WHERE account_id=".$owner,__LINE__,__FILE__);
$db->next_record();
$groups = $this->read_groups($db->f("account_lid"));
$groups = $this->read_groups($owner);
if (gettype($groups) == "array") {
// echo "\n\n\n\n\ntest: " . count($groups) . "\n\n\n\n\n\n";
while ($group = each($groups)) {
$s .= " or $table like '%," . $group[0] . ",%'";
}
$s .= " or $table like '%," . $group[1] . ",%'";
}
}
return $s;
}

View File

@ -97,13 +97,15 @@
if (gettype($id) == "string") { $id = $this->username2userid($id); }
$groups = Array();
$group_memberhips = $phpgw->acl->get_location_list_for_id("phpgw_group", 1, "u", $id);
reset ($groups);
$num = count($group_memberhips);
for ($idx=0; $idx<$num; ++$idx){
$groups[$group_memberhips[$idx]] = 0;
$group_memberships = $phpgw->acl->get_location_list_for_id("phpgw_group", 1, "u", intval($id));
if ($group_memberships) {
for ($idx=0; $idx<$count($group_memberships); $idx++){
$groups[$group_memberships[$idx]] = 1;
}
return $groups;
} else {
return False;
}
return $groups;
}
function read_group_names($lid = "")
@ -213,4 +215,4 @@
}
}
}//end of class
?>
?>

View File

@ -59,7 +59,7 @@
// Group piece
$sql .= " or (acl_account_type='g' and acl_account in (0"; // group 0 covers all users
$memberships = $phpgw->accounts->read_group_names();
$memberships = $phpgw->accounts->read_group_names($user_id);
if (is_array($memberships) && count($memberships) > 0){
for ($idx = 0; $idx < count($memberships); ++$idx){
$sql .= ",".$memberships[$idx][0];
@ -162,7 +162,7 @@
// Group piece
$sql .= " or (acl_account_type='g' and acl_account in (0"; // group 0 covers all users
$memberships = $phpgw->accounts->read_group_names();
$memberships = $phpgw->accounts->read_group_names($phpgw_info["user"]["account_id"]);
if (is_array($memberships) && count($memberships) > 0){
for ($idx = 0; $idx < count($memberships); ++$idx){
$sql .= ",".$memberships[$idx][0];
@ -195,12 +195,11 @@
$rights = 0;
if ($this->db->num_rows() == 0 ){ return False; }
while ($this->db->next_record()) {
if ($this->db->f("acl_rights") == 0){ return False; }
$rights |= $this->db->f("acl_rights");
if (!!($rights & $required) == True){
$locations[] = $this->db->f("acl_location");
}else{
return False;
if ($this->db->f("acl_rights")) {
$rights |= $this->db->f("acl_rights");
if (!!($rights & $required) == True){
$locations[] = $this->db->f("acl_location");
}
}
}
return $locations;