forked from extern/egroupware
updated my graphics class
This commit is contained in:
parent
758dbaeaa6
commit
ad3eecef15
@ -95,37 +95,57 @@
|
||||
{
|
||||
}
|
||||
|
||||
function get_list()
|
||||
{
|
||||
global $phpgw;
|
||||
|
||||
// get a ldap connection handle
|
||||
$ds = $phpgw->common->ldapConnect();
|
||||
function get_list($_type='both')
|
||||
{
|
||||
global $phpgw;
|
||||
|
||||
// search the dn for the given uid
|
||||
$sri = ldap_search($ds, $phpgw_info["server"]["ldap_context"], "uidnumber=*");
|
||||
$allValues = ldap_get_entries($ds, $sri);
|
||||
|
||||
for ($i=0; $i<$allValues["count"]; $i++)
|
||||
{
|
||||
$ds = $phpgw->common->ldapConnect();
|
||||
|
||||
$this->db->query("select * from phpgw_accounts where account_id='" . $allValues[$i]["uidnumber"][0] . "'",__LINE__,__FILE__);
|
||||
$this->db->next_record();
|
||||
|
||||
$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")
|
||||
);
|
||||
|
||||
#print "data".$allValues[$i]["uid"][0]."<br>";
|
||||
switch($_type)
|
||||
{
|
||||
case 'accounts':
|
||||
$whereclause = "where account_type = 'u'";
|
||||
break;
|
||||
case 'groups':
|
||||
$whereclause = "where account_type = 'g'";
|
||||
break;
|
||||
default:
|
||||
$whereclause = "";
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -198,7 +218,7 @@
|
||||
$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')";
|
||||
$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('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__);
|
||||
|
@ -59,22 +59,36 @@
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
function get_list()
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
$sql = "select * from phpgw_accounts";
|
||||
$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 get_list($_type='both')
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
|
||||
switch($_type)
|
||||
{
|
||||
case 'accounts':
|
||||
$whereclause = "where account_type = 'u'";
|
||||
break;
|
||||
case 'groups':
|
||||
$whereclause = "where account_type = 'g'";
|
||||
break;
|
||||
default:
|
||||
$whereclause = "";
|
||||
}
|
||||
|
||||
$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)
|
||||
{
|
||||
@ -141,7 +155,7 @@
|
||||
$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')";
|
||||
$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('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__);
|
||||
|
@ -28,7 +28,7 @@ class graphics
|
||||
// put a valid font here
|
||||
var $font="/opt/future-project/src/management-server/ttf/arial.ttf";
|
||||
|
||||
function createButton($_text, $_fontsize=11)
|
||||
function createImage($_text, $_fontsize=11)
|
||||
{
|
||||
// create filename
|
||||
$filename="button_".md5($_text).".png";
|
||||
@ -55,4 +55,17 @@ class graphics
|
||||
|
||||
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…
Reference in New Issue
Block a user