mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-11 00:18:25 +01:00
preps for editgroup/newgroup and calendar
This commit is contained in:
parent
c4d3423bde
commit
b1cf1322a6
@ -64,7 +64,7 @@
|
|||||||
global $phpgw;
|
global $phpgw;
|
||||||
global $phpgw_info;
|
global $phpgw_info;
|
||||||
$owner = $owner==$phpgw_info["user"]["account_id"]?0:$owner;
|
$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) {
|
if (!$groups) {
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
|
@ -73,12 +73,12 @@
|
|||||||
|
|
||||||
$phpgw->template->set_var("bg_text",$phpgw_info["theme"]["bg_text"]);
|
$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);
|
$m = mktime(2,0,0,$thismonth,1,$thisyear);
|
||||||
$phpgw->template->set_var("month_identifier",lang(strftime("%B",$m)) . " " . $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("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();
|
flush();
|
||||||
$phpgw->template->set_var("large_month",$phpgw->calendar->display_large_month($thismonth,$thisyear,True,$owner));
|
$phpgw->template->set_var("large_month",$phpgw->calendar->display_large_month($thismonth,$thisyear,True,$owner));
|
||||||
if (!$friendly) {
|
if (!$friendly) {
|
||||||
|
@ -138,16 +138,17 @@
|
|||||||
{
|
{
|
||||||
global $phpgw_info, $phpgw;
|
global $phpgw_info, $phpgw;
|
||||||
|
|
||||||
$db2 = $phpgw->db;
|
|
||||||
if (gettype($id) == "string") { $id = $this->username2userid($id); }
|
if (gettype($id) == "string") { $id = $this->username2userid($id); }
|
||||||
$groups = Array();
|
$groups = Array();
|
||||||
$group_memberhips = $phpgw->acl->get_location_list_for_id("phpgw_group", 1, "u", $id);
|
$group_memberships = $phpgw->acl->get_location_list_for_id("phpgw_group", 1, "u", intval($id));
|
||||||
reset ($groups);
|
if ($group_memberships) {
|
||||||
$num = count($group_memberhips);
|
for ($idx=0; $idx<count($group_memberships); $idx++){
|
||||||
for ($idx=0; $idx<$num; ++$idx){
|
$groups[intval($group_memberships[$idx])] = 1;
|
||||||
$groups[$group_memberhips[$idx]] = 0;
|
|
||||||
}
|
}
|
||||||
return $groups;
|
return $groups;
|
||||||
|
} else {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function read_group_names($lid = "")
|
function read_group_names($lid = "")
|
||||||
@ -161,6 +162,7 @@
|
|||||||
|
|
||||||
$db = $phpgw->db;
|
$db = $phpgw->db;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
reset($groups);
|
||||||
while ($groups && $group = each($groups)) {
|
while ($groups && $group = each($groups)) {
|
||||||
$db->query("select group_name from groups where group_id=".$group[0],__LINE__,__FILE__);
|
$db->query("select group_name from groups where group_id=".$group[0],__LINE__,__FILE__);
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
@ -170,7 +172,6 @@
|
|||||||
}
|
}
|
||||||
if (! $lid)
|
if (! $lid)
|
||||||
$this->group_names = $group_names;
|
$this->group_names = $group_names;
|
||||||
|
|
||||||
return $group_names;
|
return $group_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,14 +75,11 @@
|
|||||||
if(!$owner) {
|
if(!$owner) {
|
||||||
$owner = $phpgw_info["user"]["account_id"];
|
$owner = $phpgw_info["user"]["account_id"];
|
||||||
}
|
}
|
||||||
$db = $phpgw->db;
|
$groups = $this->read_groups($owner);
|
||||||
$db->query("SELECT account_lid FROM accounts WHERE account_id=".$owner,__LINE__,__FILE__);
|
|
||||||
$db->next_record();
|
|
||||||
$groups = $this->read_groups($db->f("account_lid"));
|
|
||||||
if (gettype($groups) == "array") {
|
if (gettype($groups) == "array") {
|
||||||
// echo "\n\n\n\n\ntest: " . count($groups) . "\n\n\n\n\n\n";
|
// echo "\n\n\n\n\ntest: " . count($groups) . "\n\n\n\n\n\n";
|
||||||
while ($group = each($groups)) {
|
while ($group = each($groups)) {
|
||||||
$s .= " or $table like '%," . $group[0] . ",%'";
|
$s .= " or $table like '%," . $group[1] . ",%'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $s;
|
return $s;
|
||||||
|
@ -97,13 +97,15 @@
|
|||||||
|
|
||||||
if (gettype($id) == "string") { $id = $this->username2userid($id); }
|
if (gettype($id) == "string") { $id = $this->username2userid($id); }
|
||||||
$groups = Array();
|
$groups = Array();
|
||||||
$group_memberhips = $phpgw->acl->get_location_list_for_id("phpgw_group", 1, "u", $id);
|
$group_memberships = $phpgw->acl->get_location_list_for_id("phpgw_group", 1, "u", intval($id));
|
||||||
reset ($groups);
|
if ($group_memberships) {
|
||||||
$num = count($group_memberhips);
|
for ($idx=0; $idx<$count($group_memberships); $idx++){
|
||||||
for ($idx=0; $idx<$num; ++$idx){
|
$groups[$group_memberships[$idx]] = 1;
|
||||||
$groups[$group_memberhips[$idx]] = 0;
|
|
||||||
}
|
}
|
||||||
return $groups;
|
return $groups;
|
||||||
|
} else {
|
||||||
|
return False;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function read_group_names($lid = "")
|
function read_group_names($lid = "")
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
// Group piece
|
// Group piece
|
||||||
$sql .= " or (acl_account_type='g' and acl_account in (0"; // group 0 covers all users
|
$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){
|
if (is_array($memberships) && count($memberships) > 0){
|
||||||
for ($idx = 0; $idx < count($memberships); ++$idx){
|
for ($idx = 0; $idx < count($memberships); ++$idx){
|
||||||
$sql .= ",".$memberships[$idx][0];
|
$sql .= ",".$memberships[$idx][0];
|
||||||
@ -162,7 +162,7 @@
|
|||||||
|
|
||||||
// Group piece
|
// Group piece
|
||||||
$sql .= " or (acl_account_type='g' and acl_account in (0"; // group 0 covers all users
|
$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){
|
if (is_array($memberships) && count($memberships) > 0){
|
||||||
for ($idx = 0; $idx < count($memberships); ++$idx){
|
for ($idx = 0; $idx < count($memberships); ++$idx){
|
||||||
$sql .= ",".$memberships[$idx][0];
|
$sql .= ",".$memberships[$idx][0];
|
||||||
@ -195,12 +195,11 @@
|
|||||||
$rights = 0;
|
$rights = 0;
|
||||||
if ($this->db->num_rows() == 0 ){ return False; }
|
if ($this->db->num_rows() == 0 ){ return False; }
|
||||||
while ($this->db->next_record()) {
|
while ($this->db->next_record()) {
|
||||||
if ($this->db->f("acl_rights") == 0){ return False; }
|
if ($this->db->f("acl_rights")) {
|
||||||
$rights |= $this->db->f("acl_rights");
|
$rights |= $this->db->f("acl_rights");
|
||||||
if (!!($rights & $required) == True){
|
if (!!($rights & $required) == True){
|
||||||
$locations[] = $this->db->f("acl_location");
|
$locations[] = $this->db->f("acl_location");
|
||||||
}else{
|
}
|
||||||
return False;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $locations;
|
return $locations;
|
||||||
|
Loading…
Reference in New Issue
Block a user