mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-25 20:31:31 +02:00
updated my graphics class
This commit is contained in:
parent
758dbaeaa6
commit
ad3eecef15
@ -95,37 +95,57 @@
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_list()
|
function get_list($_type='both')
|
||||||
{
|
{
|
||||||
global $phpgw;
|
global $phpgw;
|
||||||
|
|
||||||
// get a ldap connection handle
|
|
||||||
$ds = $phpgw->common->ldapConnect();
|
|
||||||
|
|
||||||
// search the dn for the given uid
|
$ds = $phpgw->common->ldapConnect();
|
||||||
$sri = ldap_search($ds, $phpgw_info["server"]["ldap_context"], "uidnumber=*");
|
|
||||||
$allValues = ldap_get_entries($ds, $sri);
|
|
||||||
|
|
||||||
for ($i=0; $i<$allValues["count"]; $i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->db->query("select * from phpgw_accounts where account_id='" . $allValues[$i]["uidnumber"][0] . "'",__LINE__,__FILE__);
|
switch($_type)
|
||||||
$this->db->next_record();
|
{
|
||||||
|
case 'accounts':
|
||||||
$accounts[] = Array(
|
$whereclause = "where account_type = 'u'";
|
||||||
"account_id" => $allValues[$i]["uidnumber"][0],
|
break;
|
||||||
"account_lid" => $allValues[$i]["uid"][0],
|
case 'groups':
|
||||||
"account_type" => $this->db->f("account_type"),
|
$whereclause = "where account_type = 'g'";
|
||||||
"account_firstname" => $allValues[$i]["givenname"][0],
|
break;
|
||||||
"account_lastname" => $allValues[$i]["sn"][0],
|
default:
|
||||||
"account_status" => $this->db->f("account_status")
|
$whereclause = "";
|
||||||
);
|
|
||||||
|
|
||||||
#print "data".$allValues[$i]["uid"][0]."<br>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $accounts;
|
$sql = "select * from phpgw_accounts $whereclause";
|
||||||
}
|
$this->db->query($sql,__LINE__,__FILE__);
|
||||||
|
while ($this->db->next_record()) {
|
||||||
|
// get user information from ldap only, if it's a user, not a group
|
||||||
|
if ($this->db->f("account_type") == 'u')
|
||||||
|
{
|
||||||
|
$sri = ldap_search($ds, $phpgw_info["server"]["ldap_context"], "uidnumber=".$this->db->f("account_id"));
|
||||||
|
$allValues = ldap_get_entries($ds, $sri);
|
||||||
|
$accounts[] = Array(
|
||||||
|
"account_id" => $allValues[$i]["uidnumber"][0],
|
||||||
|
"account_lid" => $allValues[$i]["uid"][0],
|
||||||
|
"account_type" => $this->db->f("account_type"),
|
||||||
|
"account_firstname" => $allValues[$i]["givenname"][0],
|
||||||
|
"account_lastname" => $allValues[$i]["sn"][0],
|
||||||
|
"account_status" => $this->db->f("account_status")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$accounts[] = Array(
|
||||||
|
"account_id" => $this->db->f("account_id"),
|
||||||
|
"account_lid" => $this->db->f("account_lid"),
|
||||||
|
"account_type" => $this->db->f("account_type"),
|
||||||
|
"account_firstname" => $this->db->f("account_firstname"),
|
||||||
|
"account_lastname" => $this->db->f("account_lastname"),
|
||||||
|
"account_status" => $this->db->f("account_status")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $accounts;
|
||||||
|
}
|
||||||
|
|
||||||
function name2id($account_name)
|
function name2id($account_name)
|
||||||
{
|
{
|
||||||
@ -198,7 +218,7 @@
|
|||||||
$sql .= "(account_id, account_lid, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status, account_type)";
|
$sql .= "(account_id, account_lid, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status, account_type)";
|
||||||
$sql .= "values (".$accountid.", '".$accountname."', '".md5($passwd)."', '".$accountname."', 'AutoCreated', ".time().", 'A','u')";
|
$sql .= "values (".$accountid.", '".$accountname."', '".md5($passwd)."', '".$accountname."', 'AutoCreated', ".time().", 'A','u')";
|
||||||
$this->db->query($sql);
|
$this->db->query($sql);
|
||||||
$this->db->query("insert into phpgw_preferences (preference_owner, preference_value) values ('".$accountid."', '$defaultprefs')");
|
$this->db->query("insert into preferences (preference_owner, preference_value) values ('".$accountid."', '$defaultprefs')");
|
||||||
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)values('preferences', 'changepassword', ".$accountid.", 'u', 0)",__LINE__,__FILE__);
|
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)values('preferences', 'changepassword', ".$accountid.", 'u', 0)",__LINE__,__FILE__);
|
||||||
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '1', ".$accountid.", 'u', 1)",__LINE__,__FILE__);
|
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('phpgw_group', '1', ".$accountid.", 'u', 1)",__LINE__,__FILE__);
|
||||||
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', ".$accountid.", 'u', 1)",__LINE__,__FILE__);
|
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights) values('addressbook', 'run', ".$accountid.", 'u', 1)",__LINE__,__FILE__);
|
||||||
|
@ -59,22 +59,36 @@
|
|||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_list()
|
function get_list($_type='both')
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
global $phpgw, $phpgw_info;
|
||||||
$sql = "select * from phpgw_accounts";
|
|
||||||
$this->db->query($sql,__LINE__,__FILE__);
|
switch($_type)
|
||||||
while ($this->db->next_record()) {
|
{
|
||||||
$accounts[] = Array("account_id" => $this->db->f("account_id"),
|
case 'accounts':
|
||||||
"account_lid" => $this->db->f("account_lid"),
|
$whereclause = "where account_type = 'u'";
|
||||||
"account_type" => $this->db->f("account_type"),
|
break;
|
||||||
"account_firstname" => $this->db->f("account_firstname"),
|
case 'groups':
|
||||||
"account_lastname" => $this->db->f("account_lastname"),
|
$whereclause = "where account_type = 'g'";
|
||||||
"account_status" => $this->db->f("account_status")
|
break;
|
||||||
);
|
default:
|
||||||
}
|
$whereclause = "";
|
||||||
return $accounts;
|
}
|
||||||
}
|
|
||||||
|
$sql = "select * from phpgw_accounts $whereclause";
|
||||||
|
$this->db->query($sql,__LINE__,__FILE__);
|
||||||
|
while ($this->db->next_record()) {
|
||||||
|
$accounts[] = Array(
|
||||||
|
"account_id" => $this->db->f("account_id"),
|
||||||
|
"account_lid" => $this->db->f("account_lid"),
|
||||||
|
"account_type" => $this->db->f("account_type"),
|
||||||
|
"account_firstname" => $this->db->f("account_firstname"),
|
||||||
|
"account_lastname" => $this->db->f("account_lastname"),
|
||||||
|
"account_status" => $this->db->f("account_status")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $accounts;
|
||||||
|
}
|
||||||
|
|
||||||
function name2id($account_name)
|
function name2id($account_name)
|
||||||
{
|
{
|
||||||
@ -141,7 +155,7 @@
|
|||||||
$sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
|
$sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
|
||||||
$sql .= "values (".$accountid.", '".$accountname."','u', '".md5($passwd)."', '".$accountname."', 'AutoCreated', ".time().", 'A')";
|
$sql .= "values (".$accountid.", '".$accountname."','u', '".md5($passwd)."', '".$accountname."', 'AutoCreated', ".time().", 'A')";
|
||||||
$this->db->query($sql);
|
$this->db->query($sql);
|
||||||
$this->db->query("insert into phpgw_preferences (preference_owner, preference_value) values ('".$accountid."', '$default_prefs')");
|
$this->db->query("insert into preferences (preference_owner, preference_value) values ('".$accountid."', '$default_prefs')");
|
||||||
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 'u', 0)",__LINE__,__FILE__);
|
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 'u', 0)",__LINE__,__FILE__);
|
||||||
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('phpgw_group', '1', ".$accountid.", 'u', 1)",__LINE__,__FILE__);
|
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('phpgw_group', '1', ".$accountid.", 'u', 1)",__LINE__,__FILE__);
|
||||||
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('addressbook', 'run', ".$accountid.", 'u', 1)",__LINE__,__FILE__);
|
$this->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('addressbook', 'run', ".$accountid.", 'u', 1)",__LINE__,__FILE__);
|
||||||
|
@ -28,7 +28,7 @@ class graphics
|
|||||||
// put a valid font here
|
// put a valid font here
|
||||||
var $font="/opt/future-project/src/management-server/ttf/arial.ttf";
|
var $font="/opt/future-project/src/management-server/ttf/arial.ttf";
|
||||||
|
|
||||||
function createButton($_text, $_fontsize=11)
|
function createImage($_text, $_fontsize=11)
|
||||||
{
|
{
|
||||||
// create filename
|
// create filename
|
||||||
$filename="button_".md5($_text).".png";
|
$filename="button_".md5($_text).".png";
|
||||||
@ -55,4 +55,17 @@ class graphics
|
|||||||
|
|
||||||
return $filename;
|
return $filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createInputButton($_text, $_name, $_mode='graphic')
|
||||||
|
{
|
||||||
|
if ($_mode == 'graphic' && extension_loaded("gd"))
|
||||||
|
{
|
||||||
|
return '<input type="image" src="/phpgroupware/phpgwapi/templates/default/images/'.$this->createImage($_text).'" border="0" name="'.$_name.'">';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return '<input type="submit" value="'.$_text.'" name="'.$_name.'">';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user